diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f6f822676e..e189aa291e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -613,8 +613,9 @@ if(PKG_USER-PLUMED) endif() if(PKG_USER-MOLFILE) + set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") add_library(molfile INTERFACE) - target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile) + target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) target_link_libraries(molfile INTERFACE ${CMAKE_DL_LIBS}) list(APPEND LAMMPS_LINK_LIBS molfile) endif() @@ -626,7 +627,6 @@ if(PKG_USER-NETCDF) add_definitions(-DLMP_HAS_NETCDF -DNC_64BIT_DATA=0x0020) endif() - if(PKG_USER-SMD) option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" OFF) if(DOWNLOAD_EIGEN3) @@ -670,6 +670,12 @@ if(PKG_USER-VTK) endif() if(PKG_KIM) + find_package(CURL) + if(CURL_FOUND) + include_directories(${CURL_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${CURL_LIBRARIES}) + add_definitions(-DLMP_KIM_CURL) + endif() option(DOWNLOAD_KIM "Download KIM-API v2 from OpenKIM instead of using an already installed one" OFF) if(DOWNLOAD_KIM) message(STATUS "KIM-API v2 download requested - we will build our own") @@ -1331,36 +1337,14 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HE ###################################### # Generate lmpgitversion.h ###################################### -set(temp "#ifndef LMP_GIT_VERSION_H\n#define LMP_GIT_VERSION_H\n") -set(temp_git_commit "(unknown)") -set(temp_git_branch "(unknown)") -set(temp_git_describe "(unknown)") -set(temp_git_info "false") -if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) - set(temp_git_info "true") - execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse HEAD - OUTPUT_VARIABLE temp_git_commit - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse --abbrev-ref HEAD - OUTPUT_VARIABLE temp_git_branch - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git describe --dirty=-modified - OUTPUT_VARIABLE temp_git_describe - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() - -set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_commit[] = \"${temp_git_commit}\";\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_branch[] = \"${temp_git_branch}\";\n") -set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_descriptor[] = \"${temp_git_describe}\";\n") -set(temp "${temp}#endif\n\n") - -message(STATUS "Generating lmpgitversion.h...") -file(WRITE "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${temp}" ) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h") +add_custom_target(gitversion COMMAND ${CMAKE_COMMAND} + -DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" + -DGIT_FOUND="${GIT_FOUND}" + -DLAMMPS_STYLE_HEADERS_DIR="${LAMMPS_STYLE_HEADERS_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/Modules/generate_lmpgitversion.cmake) +set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${LAMMPS_STYLE_HEADERS_DIR}/gitversion.h) +list(APPEND LAMMPS_DEPS gitversion) ########################################### # Actually add executable and lib to build diff --git a/cmake/Modules/generate_lmpgitversion.cmake b/cmake/Modules/generate_lmpgitversion.cmake new file mode 100644 index 0000000000..8aead88f5f --- /dev/null +++ b/cmake/Modules/generate_lmpgitversion.cmake @@ -0,0 +1,30 @@ +set(temp "#ifndef LMP_GIT_VERSION_H\n#define LMP_GIT_VERSION_H\n") +set(temp_git_commit "(unknown)") +set(temp_git_branch "(unknown)") +set(temp_git_describe "(unknown)") +set(temp_git_info "false") +if(GIT_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) + set(temp_git_info "true") + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse HEAD + OUTPUT_VARIABLE temp_git_commit + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE temp_git_branch + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_CURRENT_SOURCE_DIR}/../.git describe --dirty=-modified + OUTPUT_VARIABLE temp_git_describe + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n") +set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_commit[] = \"${temp_git_commit}\";\n") +set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_branch[] = \"${temp_git_branch}\";\n") +set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_descriptor[] = \"${temp_git_describe}\";\n") +set(temp "${temp}#endif\n\n") + +message(STATUS "Generating lmpgitversion.h...") +file(WRITE "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${temp}" ) +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h.tmp" "${LAMMPS_STYLE_HEADERS_DIR}/lmpgitversion.h") diff --git a/doc/src/Build_extras.txt b/doc/src/Build_extras.txt index cbbd9db2f3..65a05c267e 100644 --- a/doc/src/Build_extras.txt +++ b/doc/src/Build_extras.txt @@ -169,16 +169,18 @@ used to build the GPU library. KIM package :h4,link(kim) -To build with this package, the KIM library must be downloaded and -built on your system. It must include the KIM models that you want to -use with LAMMPS. +To build with this package, the KIM library with API v2 must be downloaded +and built on your system. It must include the KIM models that you want to +use with LAMMPS. If you want to use the "kim_query"_kim_query.html +command, you also need to have libcurl installed with the matching +development headers and the curl-config tool. Note that in LAMMPS lingo, a KIM model driver is a pair style (e.g. EAM or Tersoff). A KIM model is a pair style for a particular element or alloy and set of parameters, e.g. EAM for Cu with a -specific EAM potential file. Also note that installing the KIM API -library with all its models, may take around 30 min to build. Of -course you only need to do that once. +specific EAM potential file. Also note that downloading and installing +the KIM API library with all its models, may take a long time (10s of +minutes to hours) to build. Of course you only need to do that once. See the list of KIM model drivers here: https://openkim.org/browse/model-drivers/alphabetical @@ -893,7 +895,17 @@ USER-MOLFILE package :h4,link(user-molfile) [CMake build]: -No additional settings are needed besides "-D PKG_USER-MOLFILE=yes". +-D MOLFILE_INCLUDE_DIRS=path # (optional) path where VMD molfile plugin headers are installed +-D PKG_USER-MOLFILE=yes :pre + + +Using "-D PKG_USER-MOLFILE=yes" enables the package, and setting +"-D MOLFILE_INCLUDE DIRS" allows to provide a custom location for +the molfile plugin header files. These should match the ABI of the +plugin files used, and thus one typically sets them to include +folder of the local VMD installation in use. LAMMPS ships with a +couple of default header files that correspond to a popular VMD +version, usually the latest release. [Traditional make]: @@ -902,7 +914,11 @@ loading library libdl.a that is typically present on all systems. It is required for LAMMPS to link with this package. If the setting is not valid for your system, you will need to edit the Makefile.lammps file. See lib/molfile/README and lib/molfile/Makefile.lammps for -details. +details. It is also possible to configure a different folder with +the VMD molfile plugin header files. LAMMPS ships with a couple of +default headers, but these are not compatible with all VMD versions, +so it is often best to change this setting to the location of the +same include files of the local VMD installation in use. :line diff --git a/doc/src/Commands_all.txt b/doc/src/Commands_all.txt index 155b56ace8..66c348ee30 100644 --- a/doc/src/Commands_all.txt +++ b/doc/src/Commands_all.txt @@ -68,6 +68,7 @@ An alphabetic list of all general LAMMPS commands. "improper_style"_improper_style.html, "include"_include.html, "jump"_jump.html, +"kim_query"_kim_query.html, "kspace_modify"_kspace_modify.html, "kspace_style"_kspace_style.html, "label"_label.html, @@ -78,6 +79,7 @@ An alphabetic list of all general LAMMPS commands. "minimize"_minimize.html, "min_modify"_min_modify.html, "min_style"_min_style.html, +"min_style spin"_min_spin.html, "molecule"_molecule.html, "ndx2group"_group2ndx.html, "neb"_neb.html, diff --git a/doc/src/Packages_details.txt b/doc/src/Packages_details.txt index 3a362a23d0..0ab1b5e4fd 100644 --- a/doc/src/Packages_details.txt +++ b/doc/src/Packages_details.txt @@ -341,6 +341,8 @@ KIM package :link(PKG-KIM),h4 A "pair_style kim"_pair_kim.html command which is a wrapper on the Knowledge Base for Interatomic Models (KIM) repository of interatomic potentials, enabling any of them to be used in LAMMPS simulations. +Also a "kim_query"_kim_query.html command, which allows to query +the OpenKIM database for stored properties. To use this package you must have the KIM library available on your system. diff --git a/doc/src/commands_list.txt b/doc/src/commands_list.txt index 27e0906b5f..6f90d9c93a 100644 --- a/doc/src/commands_list.txt +++ b/doc/src/commands_list.txt @@ -53,6 +53,7 @@ Commands :h1 include info jump + kim_query kspace_modify kspace_style label @@ -61,6 +62,7 @@ Commands :h1 mass message min_modify + min_spin min_style minimize molecule diff --git a/doc/src/kim_query.txt b/doc/src/kim_query.txt new file mode 100644 index 0000000000..be46783d82 --- /dev/null +++ b/doc/src/kim_query.txt @@ -0,0 +1,45 @@ +"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Commands_all.html) + +:line + +kim_query command :h3 + +[Syntax:] + +kim_query variable query_function web_query_flags :pre + +variable = name of a (string style) variable where the result of the query is stored +query_function = name of the OpenKIM web API query function to be used +web_query_flags = a series of keyword=value pairs that represent the web query; supported keywords depend on query function :ul + +[Examples:] + +kim_query latconst get_test_result test=TE_156715955670 model=MO_800509458712 & + prop=structure-cubic-crystal-npt species=\["Al"\] keys=\["a"\] units=\["angstrom"\] :pre + +[Description:] + +The kim_query command allows to retrieve properties from the OpenKIM +through a web query. The result is stored in a string style +"variable"_variable.html, the name of which must be given as the first +argument of the kim_query command. The second required argument is the +name of the actual query function (e.g. {get_test_result}). All following +arguments are parameters handed over to the web query in the format +{keyword=value}. This list of supported keywords and the type of how +the value has to be encoded depends on the query function used. +For more details on this, please refer to the OpenKIM homepage. + +[Restrictions:] + +This command is part of the KIM package. It is only enabled if +LAMMPS was built with that package. Furthermore, its correct +functioning depends on compiling LAMMPS with libcurl support. +See the "Build package"_Build_package.html doc page for more info. + +[Related commands:] + +"pair_style kim"_pair_kim.html, "variable"_variable.html diff --git a/doc/src/lammps.book b/doc/src/lammps.book index 88625e0b73..eb8aa16968 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -167,6 +167,7 @@ if.html include.html info.html jump.html +kim_query.html label.html lattice.html log.html diff --git a/doc/src/min_modify.txt b/doc/src/min_modify.txt index 525d6716d8..d342e8bf01 100644 --- a/doc/src/min_modify.txt +++ b/doc/src/min_modify.txt @@ -13,14 +13,14 @@ min_modify command :h3 min_modify keyword values ... :pre one or more keyword/value pairs may be listed :ulb,l -keyword = {dmax} or {line} or {alpha_damp} or {discret_factor} +keyword = {dmax} or {line} or {alpha_damp} or {discrete_factor} {dmax} value = max max = maximum distance for line search to move (distance units) {line} value = {backtrack} or {quadratic} or {forcezero} backtrack,quadratic,forcezero = style of linesearch to use {alpha_damp} value = damping damping = fictitious Gilbert damping for spin minimization (adim) - {discret_factor} value = factor + {discrete_factor} value = factor factor = discretization factor for adaptive spin timestep (adim) :pre :ule @@ -69,16 +69,16 @@ difference of two large values (energy before and energy after) and that difference may be smaller than machine epsilon even if atoms could move in the gradient direction to reduce forces further. -Keywords {alpha_damp} and {discret_factor} only make sense when +Keywords {alpha_damp} and {discrete_factor} only make sense when a "min_spin"_min_spin.html command is declared. Keyword {alpha_damp} defines an analog of a magnetic Gilbert damping. It defines a relaxation rate toward an equilibrium for a given magnetic system. -Keyword {discret_factor} defines a discretization factor for the +Keyword {discrete_factor} defines a discretization factor for the adaptive timestep used in the {spin} minimization. See "min_spin"_min_spin.html for more information about those quantities. -Default values are alpha_damp = 1.0 and discret_factor = 10.0. +Default values are {alpha_damp} = 1.0 and {discrete_factor} = 10.0. [Restrictions:] none diff --git a/doc/src/min_spin.txt b/doc/src/min_spin.txt index 468cde0fec..890e324aca 100644 --- a/doc/src/min_spin.txt +++ b/doc/src/min_spin.txt @@ -3,7 +3,6 @@ :link(lws,http://lammps.sandia.gov) :link(ld,Manual.html) :link(lc,Commands_all.html) - :line min_style spin command :h3 @@ -14,8 +13,7 @@ min_style spin :pre [Examples:] -min_style spin -min_modify alpha_damp 1.0 discret_factor 10.0 :pre +min_style spin :pre [Description:] @@ -27,30 +25,34 @@ timestep, according to: :c,image(Eqs/min_spin_damping.jpg) -with lambda a damping coefficient (similar to a Gilbert damping) +with lambda a damping coefficient (similar to a Gilbert +damping). Lambda can be defined by setting the {alpha_damp} keyword with the "min_modify"_min_modify.html command. The minimization procedure solves this equation using an -adaptive timestep. The value of this timestep is conditionned +adaptive timestep. The value of this timestep is defined by the largest precession frequency that has to be solved in the system: :c,image(Eqs/min_spin_timestep.jpg) -with |omega|_{max} the norm of the largest precession frequency +with {|omega|_{max}} the norm of the largest precession frequency in the system (across all processes, and across all replicas if a spin/neb calculation is performed). -Kappa defines a discretization factor {discret_factor} for the +Kappa defines a discretization factor {discrete_factor} for the definition of this timestep. -{discret_factor} can be defined with the "min_modify"_min_modify.html +{discrete_factor} can be defined with the "min_modify"_min_modify.html command. NOTE: The {spin} style replaces the force tolerance by a torque tolerance. See "minimize"_minimize.html for more explanation. -[Restrictions:] none +[Restrictions:] + +This minimization procedure is only applied to spin degrees of +freedom for a frozen lattice configuration. [Related commands:] @@ -59,5 +61,5 @@ tolerance. See "minimize"_minimize.html for more explanation. [Default:] -The option defaults are alpha_damp = 1.0 and discret_factor = +The option defaults are {alpha_damp} = 1.0 and {discrete_factor} = 10.0. diff --git a/doc/src/pair_kim.txt b/doc/src/pair_kim.txt index c5d42403e3..a415ac606b 100644 --- a/doc/src/pair_kim.txt +++ b/doc/src/pair_kim.txt @@ -42,12 +42,9 @@ section of the "Packages details"_Packages_details.html doc page has instructions on how to do this with a simple make command, when building LAMMPS. -See the examples/kim dir for an input script that uses a KIM model (potential) -for Lennard-Jones. Note, for this example input script, the example models -shipped with with kim-api package must be installed. See the "Build -package"_Build_package.html section and the ./lib/kim/README for details -on how to build LAMMSPS with the kim-api and how to install the example models. - +See the examples/kim dir for an input script that uses a KIM model +(potential) for Lennard-Jones. + :line The argument {model} is the name of the KIM model for a specific diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 5366a31d5d..6eb158396f 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1382,6 +1382,7 @@ libAtoms libawpmd libch libcolvars +libcurl libdir libdl libfftw diff --git a/examples/SPIN/spinmin/in.spinmin.bfo b/examples/SPIN/spinmin/in.spinmin.bfo index 5b678c8a4d..5ebc9e0afe 100644 --- a/examples/SPIN/spinmin/in.spinmin.bfo +++ b/examples/SPIN/spinmin/in.spinmin.bfo @@ -30,8 +30,6 @@ neigh_modify every 10 check yes delay 20 #fix 1 all precession/spin zeeman 0.001 0.0 0.0 1.0 anisotropy 0.01 1.0 0.0 0.0 fix 1 all precession/spin anisotropy 0.0000033 0.0 0.0 1.0 fix_modify 1 energy yes -fix 2 all langevin/spin 0.0 0.1 21 -fix 3 all nve/spin lattice no timestep 0.0001 @@ -53,5 +51,5 @@ compute outsp all property/atom spx spy spz sp fmx fmy fmz dump 1 all custom 50 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3] c_outsp[4] c_outsp[5] c_outsp[6] c_outsp[7] min_style spin -min_modify alpha_damp 1.0 discret_factor 10.0 -minimize 0.0 0.0 10000 1000 +min_modify alpha_damp 1.0 discrete_factor 10.0 +minimize 1.0e-10 0.0 1000 100 diff --git a/examples/SPIN/spinmin/in.spinmin.iron b/examples/SPIN/spinmin/in.spinmin.iron index b87a811cc7..ebbd229b89 100644 --- a/examples/SPIN/spinmin/in.spinmin.iron +++ b/examples/SPIN/spinmin/in.spinmin.iron @@ -28,8 +28,6 @@ neigh_modify every 10 check yes delay 20 #fix 1 all precession/spin zeeman 0.001 0.0 0.0 1.0 anisotropy 0.01 1.0 0.0 0.0 fix 1 all precession/spin anisotropy 0.0001 0.0 0.0 1.0 fix_modify 1 energy yes -fix 2 all langevin/spin 0.0 0.1 21 -fix 3 all nve/spin lattice no timestep 0.0001 @@ -53,5 +51,5 @@ compute outsp all property/atom spx spy spz sp fmx fmy fmz dump 1 all custom 100 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3] c_outsp[4] c_outsp[5] c_outsp[6] c_outsp[7] min_style spin -min_modify alpha_damp 1.0 discret_factor 10.0 +min_modify alpha_damp 1.0 discrete_factor 10.0 minimize 1.0e-10 1.0e-10 100000 1000 diff --git a/examples/kim/in.query b/examples/kim/in.query new file mode 100644 index 0000000000..33272dc298 --- /dev/null +++ b/examples/kim/in.query @@ -0,0 +1,11 @@ + +# example for performing a query to the OpenKIM test database to retrieve +# a parameter to be used in the input. here it requests the aluminium +# lattice constant for a specific test used for a specific model and then +# assigns it to the variable 'latconst' + +units metal +info variables out log +kim_query latconst get_test_result test=TE_156715955670 species=["Al"] model=MO_800509458712 prop=structure-cubic-crystal-npt keys=["a"] units=["angstrom"] +info variables out log +lattice fcc ${latconst} diff --git a/examples/kim/log.22Mar2019.query.g++.1 b/examples/kim/log.22Mar2019.query.g++.1 new file mode 100644 index 0000000000..034bb13bba --- /dev/null +++ b/examples/kim/log.22Mar2019.query.g++.1 @@ -0,0 +1,34 @@ +LAMMPS (28 Feb 2019) + +# example for performing a query to the OpenKIM test database to retrieve +# a parameter to be used in the input. here it requests the aluminium +# lattice constant for a specific test used for a specific model and then +# assigns it to the variable 'latconst' + +units metal +info variables out log + +Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info +Printed on Fri Mar 22 20:00:56 2019 + + +Variable information: + +Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info + +kim_query latconst get_test_result test=TE_156715955670 species=["Al"] model=MO_800509458712 prop=structure-cubic-crystal-npt keys=["a"] units=["angstrom"] +info variables out log + +Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info +Printed on Fri Mar 22 20:00:57 2019 + + +Variable information: +Variable[ 0]: latconst , style = string , def = 4.03208274841 + +Info-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info + +lattice fcc ${latconst} +lattice fcc 4.03208274841 +Lattice spacing in x,y,z = 4.03208 4.03208 4.03208 +Total wall time: 0:00:00 diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index 6b4d0ab2a5..9397f3c6c5 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -237,7 +237,7 @@ int DeviceT::set_ocl_params(char *ocl_vendor) { " -DBLOCK_CELL_ID="+params[11]+ " -DMAX_BIO_SHARED_TYPES="+params[12]; } - _ocl_compile_string="-cl-fast-relaxed-math -cl-mad-enable "+std::string(OCL_INT_TYPE)+" "+ + _ocl_compile_string="-cl-std=CL1.2 -cl-fast-relaxed-math -cl-mad-enable "+std::string(OCL_INT_TYPE)+" "+ std::string(OCL_PRECISION_COMPILE)+" "+_ocl_vendor_string; #endif return 0; diff --git a/lib/kim/Makefile.lammps b/lib/kim/Makefile.lammps index 7c9fc7c5f7..492b9ddfc6 100644 --- a/lib/kim/Makefile.lammps +++ b/lib/kim/Makefile.lammps @@ -17,13 +17,18 @@ ifeq ($(strip $(shell pkg-config --version)),) $(error 'pkg-config' not found, but is required to configure the KIM API) endif - kim_PREFIX := $(shell cat ../../lib/kim/kim-prefix.txt 2> /dev/null) kim_PREFIX := $(if $(kim_PREFIX),$(kim_PREFIX)/lib/pkgconfig,) kim_PREFIX := $(if $(shell printf -- "$${PKG_CONFIG_PATH}"),$(kim_PREFIX):$(shell printf -- "$${PKG_CONFIG_PATH}"),$(kim_PREFIX)) +# there is no usable libcurl installation +ifeq ($(shell curl-config --version 2> /dev/null),) kim_SYSINC := $(shell export PKG_CONFIG_PATH="$(kim_PREFIX)"; pkg-config --cflags libkim-api-v2 2> /dev/null) kim_SYSLIB := $(shell export PKG_CONFIG_PATH="$(kim_PREFIX)"; pkg-config --libs libkim-api-v2 2> /dev/null) +else +kim_SYSINC := $(shell export PKG_CONFIG_PATH="$(kim_PREFIX)"; pkg-config --cflags libkim-api-v2 2> /dev/null) $(shell curl-config --cflags) -DLMP_KIM_CURL +kim_SYSLIB := $(shell export PKG_CONFIG_PATH="$(kim_PREFIX)"; pkg-config --libs libkim-api-v2 2> /dev/null) $(shell curl-config --libs) +endif ifeq ($(strip $(kim_SYSINC)),) $(error 'pkg-config' could not find an installed KIM API library.) diff --git a/lib/kim/README b/lib/kim/README index 0e51a30870..493758561d 100644 --- a/lib/kim/README +++ b/lib/kim/README @@ -13,6 +13,12 @@ do the same thing by typing "python Install.py" from within this directory, or you can do it manually by following the instructions below. +As of KIM API version 2, the KIM package also provides a LAMMPS command +to perform queries through the OpenKIM web API. This feature requires +that the CURL library (libcurl) development package and its configuration +query tool, curl-config, are installed. The provided Makefile.lammps +is set up to automatically detect this. + ----------------- Instructions: diff --git a/src/.gitignore b/src/.gitignore index d405cb209e..27f4f8a64c 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -26,6 +26,11 @@ /*_ssa.h /*_ssa.cpp +/kim_query.cpp +/kim_query.h +/pair_kim.cpp +/pair_kim.h + /kokkos.cpp /kokkos.h /kokkos_type.h @@ -818,8 +823,6 @@ /pair_hbond_dreiding_morse.h /pair_ilp_graphene_hbn.cpp /pair_ilp_graphene_hbn.h -/pair_kim.cpp -/pair_kim.h /pair_kolmogorov_crespi_full.cpp /pair_kolmogorov_crespi_full.h /pair_kolmogorov_crespi_z.cpp diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 857541957e..3d4ed3f183 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -94,8 +94,7 @@ void PairGayBerne::compute(int eflag, int vflag) double *iquat,*jquat; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 963ff985c4..4873b44dc4 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -77,8 +77,7 @@ void PairLineLJ::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index c477b1b8cf..b100a5f184 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -85,8 +85,7 @@ void PairRESquared::compute(int eflag, int vflag) RE2Vars wi,wj; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 142caf3764..cefd73f976 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -77,8 +77,7 @@ void PairTriLJ::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); AtomVecTri::Bonus *bonus = avec->bonus; double **x = atom->x; diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index 80b45beb4e..f2eb2aa520 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -77,8 +77,7 @@ void PairBodyNparticle::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index b6dcab29ae..69495ea57f 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -111,8 +111,7 @@ void PairBodyRoundedPolygon::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 1a4653ce53..60f6df3582 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -127,8 +127,7 @@ void PairBodyRoundedPolyhedron::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index 24f41bfd58..d550767e5e 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -78,8 +78,7 @@ void AngleClass2::compute(int eflag, int vflag) double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index af20313e0a..26c4e63a4d 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -56,8 +56,7 @@ void BondClass2::compute(int eflag, int vflag) double rsq,r,dr,dr2,dr3,dr4,de_bond; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index c6360dd846..c471b1f353 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -118,8 +118,7 @@ void DihedralClass2::compute(int eflag, int vflag) double fabcd[4][3]; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 77f594af9d..ccb81aebd9 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -90,8 +90,7 @@ void ImproperClass2::compute(int eflag, int vflag) double fabcd[4][3]; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (i = 0; i < 3; i++) for (j = 0; j < 4; j++) diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index e6546b1acc..f2eef55290 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -38,20 +38,20 @@ PairLJClass2::PairLJClass2(LAMMPS *lmp) : Pair(lmp) PairLJClass2::~PairLJClass2() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } } @@ -65,8 +65,7 @@ void PairLJClass2::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 49242ecb43..dafa83c8fd 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -39,23 +39,23 @@ PairLJClass2CoulCut::PairLJClass2CoulCut(LAMMPS *lmp) : Pair(lmp) PairLJClass2CoulCut::~PairLJClass2CoulCut() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(cut_coul); - memory->destroy(cut_coulsq); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(cut_coul); + memory->destroy(cut_coulsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } } @@ -70,8 +70,7 @@ void PairLJClass2CoulCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index bbea2ade6e..85fe0152e2 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -50,21 +50,21 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) PairLJClass2CoulLong::~PairLJClass2CoulLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } if (ftable) free_tables(); } @@ -82,8 +82,7 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index e532c06c86..aefa96b1fb 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -80,8 +80,7 @@ void PairBrownian::compute(int eflag, int vflag) double rsq,r,h_sep,radi; int *ilist,*jlist,*numneigh,**firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index c6d5def2fa..389ae084b7 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -66,8 +66,7 @@ void PairBrownianPoly::compute(int eflag, int vflag) double rsq,r,h_sep,beta0,beta1,radi,radj; int *ilist,*jlist,*numneigh,**firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index c16dbf41af..04c35a7c00 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -78,8 +78,7 @@ void PairColloid::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index de53d91818..4e629bd442 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -88,8 +88,7 @@ void PairLubricate::compute(int eflag, int vflag) double vxmu2f = force->vxmu2f; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 35fe33c84e..3ea3d4fe4a 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -116,8 +116,7 @@ void PairLubricateU::compute(int eflag, int vflag) int nghost = atom->nghost; int nall = nlocal + nghost; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // skip compute() if called from integrate::setup() // this is b/c do not want compute() to update velocities twice on a restart diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 90ac848d26..4fec95dcd8 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -78,8 +78,7 @@ void PairLubricateUPoly::compute(int eflag, int vflag) double **f = atom->f; double **torque = atom->torque; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // grow per-atom arrays if necessary // need to be atom->nmax in length diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index 5e52933364..ffbe7fce3c 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -72,8 +72,7 @@ void PairLubricatePoly::compute(int eflag, int vflag) double vxmu2f = force->vxmu2f; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/COLLOID/pair_yukawa_colloid.cpp b/src/COLLOID/pair_yukawa_colloid.cpp index d21bc43524..ab7d088508 100644 --- a/src/COLLOID/pair_yukawa_colloid.cpp +++ b/src/COLLOID/pair_yukawa_colloid.cpp @@ -46,8 +46,7 @@ void PairYukawaColloid::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_born_coul_dsf_cs.cpp b/src/CORESHELL/pair_born_coul_dsf_cs.cpp index 549c7c0348..f4d7447ade 100644 --- a/src/CORESHELL/pair_born_coul_dsf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_dsf_cs.cpp @@ -57,8 +57,7 @@ void PairBornCoulDSFCS::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index 76f6eb387d..a19f8c34a8 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -68,8 +68,7 @@ void PairBornCoulLongCS::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_born_coul_wolf_cs.cpp b/src/CORESHELL/pair_born_coul_wolf_cs.cpp index 84179ce50a..7b52c28664 100644 --- a/src/CORESHELL/pair_born_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_born_coul_wolf_cs.cpp @@ -53,8 +53,7 @@ void PairBornCoulWolfCS::compute(int eflag, int vflag) double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index ea072d44a1..8df91f39a3 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -68,8 +68,7 @@ void PairBuckCoulLongCS::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index b214653841..c8c8387d6d 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -69,8 +69,7 @@ void PairCoulLongCS::compute(int eflag, int vflag) double rsq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_coul_wolf_cs.cpp b/src/CORESHELL/pair_coul_wolf_cs.cpp index b50f14833e..36e037bfc8 100644 --- a/src/CORESHELL/pair_coul_wolf_cs.cpp +++ b/src/CORESHELL/pair_coul_wolf_cs.cpp @@ -53,8 +53,7 @@ void PairCoulWolfCS::compute(int eflag, int vflag) double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index 8caefc0e66..56c75f0f5d 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -74,8 +74,7 @@ void PairLJCutCoulLongCS::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -399,8 +398,7 @@ void PairLJCutCoulLongCS::compute_outer(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 6af9b45724..18b78c55e0 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -69,8 +69,7 @@ void PairLJCutDipoleCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 817a120e3d..0806d1ee73 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -90,8 +90,7 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 21fc035854..fbdc47a15b 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -405,8 +405,7 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) double evdwl,ecoul,fpair; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x, *x0 = x[0]; double **mu = atom->mu, *mu0 = mu[0], *imu, *jmu; diff --git a/src/GPU/pair_beck_gpu.cpp b/src/GPU/pair_beck_gpu.cpp index e65c53d194..9f76975ef1 100644 --- a/src/GPU/pair_beck_gpu.cpp +++ b/src/GPU/pair_beck_gpu.cpp @@ -84,8 +84,7 @@ PairBeckGPU::~PairBeckGPU() void PairBeckGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index 587c7b5215..291ad8ad1f 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -106,8 +106,7 @@ PairBornCoulLongCSGPU::~PairBornCoulLongCSGPU() void PairBornCoulLongCSGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index 1549ed79af..eb204691c7 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -101,8 +101,7 @@ PairBornCoulLongGPU::~PairBornCoulLongGPU() void PairBornCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp index bf23007bca..4877a442b5 100644 --- a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp @@ -94,8 +94,7 @@ PairBornCoulWolfCSGPU::~PairBornCoulWolfCSGPU() void PairBornCoulWolfCSGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_born_coul_wolf_gpu.cpp b/src/GPU/pair_born_coul_wolf_gpu.cpp index 06a2769e10..851174988b 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_gpu.cpp @@ -92,8 +92,7 @@ PairBornCoulWolfGPU::~PairBornCoulWolfGPU() void PairBornCoulWolfGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_born_gpu.cpp b/src/GPU/pair_born_gpu.cpp index 01e91a9c0b..253d2d7282 100644 --- a/src/GPU/pair_born_gpu.cpp +++ b/src/GPU/pair_born_gpu.cpp @@ -87,8 +87,7 @@ PairBornGPU::~PairBornGPU() void PairBornGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_buck_coul_cut_gpu.cpp b/src/GPU/pair_buck_coul_cut_gpu.cpp index ce71e9ac41..ed602f9cab 100644 --- a/src/GPU/pair_buck_coul_cut_gpu.cpp +++ b/src/GPU/pair_buck_coul_cut_gpu.cpp @@ -88,8 +88,7 @@ PairBuckCoulCutGPU::~PairBuckCoulCutGPU() void PairBuckCoulCutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index a2d14ea25f..d6b9e53282 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -97,8 +97,7 @@ PairBuckCoulLongGPU::~PairBuckCoulLongGPU() void PairBuckCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_buck_gpu.cpp b/src/GPU/pair_buck_gpu.cpp index e6479e46e8..8c85407e6e 100644 --- a/src/GPU/pair_buck_gpu.cpp +++ b/src/GPU/pair_buck_gpu.cpp @@ -85,8 +85,7 @@ PairBuckGPU::~PairBuckGPU() void PairBuckGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index 03e5aac5d5..0ee8708b5b 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -85,8 +85,7 @@ PairColloidGPU::~PairColloidGPU() void PairColloidGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_coul_cut_gpu.cpp b/src/GPU/pair_coul_cut_gpu.cpp index 436d26fb54..fb50c446b1 100644 --- a/src/GPU/pair_coul_cut_gpu.cpp +++ b/src/GPU/pair_coul_cut_gpu.cpp @@ -85,8 +85,7 @@ PairCoulCutGPU::~PairCoulCutGPU() void PairCoulCutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_coul_debye_gpu.cpp b/src/GPU/pair_coul_debye_gpu.cpp index c17e21f41f..ec771a9935 100644 --- a/src/GPU/pair_coul_debye_gpu.cpp +++ b/src/GPU/pair_coul_debye_gpu.cpp @@ -86,8 +86,7 @@ PairCoulDebyeGPU::~PairCoulDebyeGPU() void PairCoulDebyeGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_coul_dsf_gpu.cpp b/src/GPU/pair_coul_dsf_gpu.cpp index 15a15660dd..1753b8a91c 100644 --- a/src/GPU/pair_coul_dsf_gpu.cpp +++ b/src/GPU/pair_coul_dsf_gpu.cpp @@ -97,8 +97,7 @@ PairCoulDSFGPU::~PairCoulDSFGPU() void PairCoulDSFGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index be2a090786..6ca00d6361 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -99,8 +99,7 @@ PairCoulLongCSGPU::~PairCoulLongCSGPU() void PairCoulLongCSGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index 684b0049c0..f75d10b6dd 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -94,8 +94,7 @@ PairCoulLongGPU::~PairCoulLongGPU() void PairCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_dpd_gpu.cpp b/src/GPU/pair_dpd_gpu.cpp index 7d56b47fe5..b1e45fbecd 100644 --- a/src/GPU/pair_dpd_gpu.cpp +++ b/src/GPU/pair_dpd_gpu.cpp @@ -225,8 +225,7 @@ PairDPDGPU::~PairDPDGPU() void PairDPDGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_dpd_tstat_gpu.cpp b/src/GPU/pair_dpd_tstat_gpu.cpp index f093c03a2d..0693a27344 100644 --- a/src/GPU/pair_dpd_tstat_gpu.cpp +++ b/src/GPU/pair_dpd_tstat_gpu.cpp @@ -228,8 +228,7 @@ PairDPDTstatGPU::~PairDPDTstatGPU() void PairDPDTstatGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // adjust sigma if target T is changing diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index c472b91fc8..9b3412d3d1 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -94,8 +94,7 @@ double PairEAMAlloyGPU::memory_usage() void PairEAMAlloyGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // compute density on each atom on GPU diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 821bb1af1c..11ef28af3e 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -92,8 +92,7 @@ double PairEAMFSGPU::memory_usage() void PairEAMFSGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // compute density on each atom on GPU diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 515a349ad2..4788a72417 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -95,8 +95,7 @@ double PairEAMGPU::memory_usage() void PairEAMGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // compute density on each atom on GPU diff --git a/src/GPU/pair_gauss_gpu.cpp b/src/GPU/pair_gauss_gpu.cpp index 71fb55f4d0..c596a9d644 100644 --- a/src/GPU/pair_gauss_gpu.cpp +++ b/src/GPU/pair_gauss_gpu.cpp @@ -82,8 +82,7 @@ PairGaussGPU::~PairGaussGPU() void PairGaussGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 32b8b979cd..4ed2750e57 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -92,8 +92,7 @@ PairGayBerneGPU::~PairGayBerneGPU() void PairGayBerneGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 707d632d9a..5bc30c809d 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -82,8 +82,7 @@ PairLJ96CutGPU::~PairLJ96CutGPU() void PairLJ96CutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index ebc9f88943..134295c69f 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -99,8 +99,7 @@ PairLJCharmmCoulLongGPU::~PairLJCharmmCoulLongGPU() void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index 797680c032..fdffb06a8d 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -96,8 +96,7 @@ PairLJClass2CoulLongGPU::~PairLJClass2CoulLongGPU() void PairLJClass2CoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_class2_gpu.cpp b/src/GPU/pair_lj_class2_gpu.cpp index 8a9b2b31e8..bbb9168169 100644 --- a/src/GPU/pair_lj_class2_gpu.cpp +++ b/src/GPU/pair_lj_class2_gpu.cpp @@ -81,8 +81,7 @@ PairLJClass2GPU::~PairLJClass2GPU() void PairLJClass2GPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cubic_gpu.cpp b/src/GPU/pair_lj_cubic_gpu.cpp index 669eae4ee4..95eee6ae8f 100644 --- a/src/GPU/pair_lj_cubic_gpu.cpp +++ b/src/GPU/pair_lj_cubic_gpu.cpp @@ -86,8 +86,7 @@ PairLJCubicGPU::~PairLJCubicGPU() void PairLJCubicGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp index 99c7bb1c66..69fefbcdea 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp @@ -87,8 +87,7 @@ PairLJCutCoulCutGPU::~PairLJCutCoulCutGPU() void PairLJCutCoulCutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp index 450eca5c47..de86c58647 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp @@ -89,8 +89,7 @@ ljcd_gpu_clear(); void PairLJCutCoulDebyeGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp index abe7394a8c..87eac52749 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp @@ -98,8 +98,7 @@ PairLJCutCoulDSFGPU::~PairLJCutCoulDSFGPU() void PairLJCutCoulDSFGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 943d12b0fe..c854dab83d 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -99,8 +99,7 @@ PairLJCutCoulLongGPU::~PairLJCutCoulLongGPU() void PairLJCutCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index 46cf6f19bc..f87dc0ec91 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -88,8 +88,7 @@ PairLJCutCoulMSMGPU::~PairLJCutCoulMSMGPU() void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp index 1f4528cb88..d2c925d950 100644 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp @@ -89,8 +89,7 @@ PairLJCutDipoleCutGPU::~PairLJCutDipoleCutGPU() void PairLJCutDipoleCutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; @@ -199,8 +198,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla int *jlist; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp index b209fa0ee7..774ff2fae4 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp @@ -100,8 +100,7 @@ PairLJCutDipoleLongGPU::~PairLJCutDipoleLongGPU() void PairLJCutDipoleLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; @@ -228,8 +227,7 @@ void PairLJCutDipoleLongGPU::cpu_compute(int start, int inum, int eflag, int vfl int *jlist; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 9a6be3aab9..6dde9689f7 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -86,8 +86,7 @@ PairLJCutGPU::~PairLJCutGPU() void PairLJCutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index 4161155980..31f4fd651c 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -99,8 +99,7 @@ PairLJExpandCoulLongGPU::~PairLJExpandCoulLongGPU() void PairLJExpandCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_expand_gpu.cpp b/src/GPU/pair_lj_expand_gpu.cpp index 36378bf10e..a2e1cf54e3 100644 --- a/src/GPU/pair_lj_expand_gpu.cpp +++ b/src/GPU/pair_lj_expand_gpu.cpp @@ -85,8 +85,7 @@ PairLJExpandGPU::~PairLJExpandGPU() void PairLJExpandGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_gromacs_gpu.cpp b/src/GPU/pair_lj_gromacs_gpu.cpp index cc7010b295..e03f4b2e50 100644 --- a/src/GPU/pair_lj_gromacs_gpu.cpp +++ b/src/GPU/pair_lj_gromacs_gpu.cpp @@ -87,8 +87,7 @@ PairLJGromacsGPU::~PairLJGromacsGPU() void PairLJGromacsGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index 4dbd8874d6..f5029df5dc 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -102,8 +102,7 @@ PairLJSDKCoulLongGPU::~PairLJSDKCoulLongGPU() void PairLJSDKCoulLongGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_sdk_gpu.cpp b/src/GPU/pair_lj_sdk_gpu.cpp index 84d224a8c4..4797a34408 100644 --- a/src/GPU/pair_lj_sdk_gpu.cpp +++ b/src/GPU/pair_lj_sdk_gpu.cpp @@ -87,8 +87,7 @@ PairLJSDKGPU::~PairLJSDKGPU() void PairLJSDKGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp index a5ebb1dbc1..dd25a70eee 100644 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp @@ -88,8 +88,7 @@ PairLJSFDipoleSFGPU::~PairLJSFDipoleSFGPU() void PairLJSFDipoleSFGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; @@ -202,8 +201,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *jlist; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index e52577ee4c..838d28033f 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -83,8 +83,7 @@ PairMIECutGPU::~PairMIECutGPU() void PairMIECutGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_morse_gpu.cpp b/src/GPU/pair_morse_gpu.cpp index 7abf78ff30..1f94643e3a 100644 --- a/src/GPU/pair_morse_gpu.cpp +++ b/src/GPU/pair_morse_gpu.cpp @@ -81,8 +81,7 @@ PairMorseGPU::~PairMorseGPU() void PairMorseGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index b6fada0897..5e90f788bf 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -94,8 +94,7 @@ PairRESquaredGPU::~PairRESquaredGPU() void PairRESquaredGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_soft_gpu.cpp b/src/GPU/pair_soft_gpu.cpp index eed1bd5db3..42adb02553 100644 --- a/src/GPU/pair_soft_gpu.cpp +++ b/src/GPU/pair_soft_gpu.cpp @@ -86,8 +86,7 @@ PairSoftGPU::~PairSoftGPU() void PairSoftGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index 5368bee959..0cc858e57d 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -93,8 +93,7 @@ PairSWGPU::~PairSWGPU() void PairSWGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index d0185b85e8..a0b6562e5e 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -89,8 +89,7 @@ PairTableGPU::~PairTableGPU() void PairTableGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 535b56163e..cd0c5e6693 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -97,8 +97,7 @@ PairTersoffGPU::~PairTersoffGPU() void PairTersoffGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index f8b6c50db5..fd55ddc6e6 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -90,8 +90,7 @@ PairTersoffMODGPU::~PairTersoffMODGPU() void PairTersoffMODGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index b45503d759..d3828962e2 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -98,8 +98,7 @@ PairTersoffZBLGPU::~PairTersoffZBLGPU() void PairTersoffZBLGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index 688e3ef4dc..31422b0f4d 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -88,8 +88,7 @@ PairUFMGPU::~PairUFMGPU() void PairUFMGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index 84936f2c26..b496359b8a 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -94,8 +94,7 @@ PairVashishtaGPU::~PairVashishtaGPU() void PairVashishtaGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_yukawa_colloid_gpu.cpp b/src/GPU/pair_yukawa_colloid_gpu.cpp index 556dece7f8..3645f392a2 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.cpp +++ b/src/GPU/pair_yukawa_colloid_gpu.cpp @@ -84,8 +84,7 @@ PairYukawaColloidGPU::~PairYukawaColloidGPU() void PairYukawaColloidGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_yukawa_gpu.cpp b/src/GPU/pair_yukawa_gpu.cpp index 9d3ea6f5a7..90317fea34 100644 --- a/src/GPU/pair_yukawa_gpu.cpp +++ b/src/GPU/pair_yukawa_gpu.cpp @@ -83,8 +83,7 @@ PairYukawaGPU::~PairYukawaGPU() void PairYukawaGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pair_zbl_gpu.cpp b/src/GPU/pair_zbl_gpu.cpp index c9b8dd75a1..99471cbe90 100644 --- a/src/GPU/pair_zbl_gpu.cpp +++ b/src/GPU/pair_zbl_gpu.cpp @@ -86,8 +86,7 @@ PairZBLGPU::~PairZBLGPU() void PairZBLGPU::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int nall = atom->nlocal + atom->nghost; int inum, host_start; diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index 4b460b1280..1bb1a39703 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -199,9 +199,7 @@ void PPPMGPU::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // If need per-atom energies/virials, allocate per-atom arrays here // so that particle map on host can be done concurrently with GPU calculations diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index d1f3c7bbe1..728491c17a 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -55,8 +55,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) int *touch,**firsttouch; double *shear,*allshear,**firstshear; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int shearupdate = 1; if (update->setupflag) shearupdate = 0; diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 5244396ead..cfcc2743ba 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -51,8 +51,7 @@ void PairGranHooke::compute(int eflag, int vflag) double fn,fs,ft,fs1,fs2,fs3; int *ilist,*jlist,*numneigh,**firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // update rigid body info for owned & ghost atoms if using FixRigid masses // body[i] = which body atom I is in, -1 if none diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 83f75c221d..cec825316c 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -98,8 +98,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) int *touch,**firsttouch; double *shear,*allshear,**firstshear; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int shearupdate = 1; if (update->setupflag) shearupdate = 0; diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp new file mode 100644 index 0000000000..2e1f752dc1 --- /dev/null +++ b/src/KIM/kim_query.cpp @@ -0,0 +1,235 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + + +/* ---------------------------------------------------------------------- + Contributing authors: Axel Kohlmeyer (Temple U), + Ryan S. Elliott (UMN) +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, see . + + Linking LAMMPS statically or dynamically with other modules is making a + combined work based on LAMMPS. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + In addition, as a special exception, the copyright holders of LAMMPS give + you permission to combine LAMMPS with free software programs or libraries + that are released under the GNU LGPL and with code included in the standard + release of the "kim-api" under the CDDL (or modified versions of such code, + with unchanged license). You may copy and distribute such a system following + the terms of the GNU GPL for LAMMPS and the licenses of the other code + concerned, provided that you include the source code of that other code + when and as the GNU GPL requires distribution of source code. + + Note that people who make modified versions of LAMMPS are not obligated to + grant this special exception for their modified versions; it is their choice + whether to do so. The GNU General Public License gives permission to release + a modified version without this exception; this exception also makes it + possible to release a modified version which carries forward this exception. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Designed for use with the kim-api-v2-2.0.0 (and newer) package +------------------------------------------------------------------------- */ + +#include +#include +#include +#include "kim_query.h" +#include "comm.h" +#include "error.h" +#include "input.h" +#include "variable.h" + +#include +#include + +using namespace LAMMPS_NS; + +#if defined(LMP_KIM_CURL) + +struct WriteBuf { + char *dataptr; + size_t sizeleft; +}; + +static char *do_query(char *, int, char **, int, MPI_Comm); +static size_t write_callback(void *, size_t, size_t, void *); + +#endif + +/* ---------------------------------------------------------------------- */ + +void KimQuery::command(int narg, char **arg) +{ + char *varname, *function, *value; + + if (narg < 2) error->all(FLERR,"Illegal kim_query command"); + + varname = arg[0]; + function = arg[1]; + +#if defined(LMP_KIM_CURL) + + value = do_query(function, narg-2, arg+2, comm->me, world); + + // check for valid result + // on error the content of "value" is a '\0' byte + // as the first element, and then the error message + // that was returned by the web server + + if (0 == strlen(value)) { + char errmsg[512]; + + sprintf(errmsg,"OpenKIM query failed: %s",value+1); + error->all(FLERR,errmsg); + } + + char **varcmd = new char*[3]; + varcmd[0] = varname; + varcmd[1] = (char *) "string"; + varcmd[2] = value; + + input->variable->set(3,varcmd); + + delete[] varcmd; + delete[] value; +#else + error->all(FLERR,"Cannot use 'kim_query' command when KIM package " + "is compiled without support for libcurl"); +#endif +} + +#if defined(LMP_KIM_CURL) + +// copy data to the user provided data structure, optionally in increments + +size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) +{ + struct WriteBuf *buf = (struct WriteBuf *)userp; + size_t buffer_size = size*nmemb; + + // copy chunks into the buffer for as long as there is space left + if (buf->sizeleft) { + size_t copy_this_much = buf->sizeleft; + if (copy_this_much > buffer_size) + copy_this_much = buffer_size; + memcpy(buf->dataptr, data, copy_this_much); + + buf->dataptr += copy_this_much; + buf->sizeleft -= copy_this_much; + return copy_this_much; + } + return 0; // done +} + +char *do_query(char *qfunction, int narg, char **arg, int rank, MPI_Comm comm) +{ + char value[512], *retval; + + // run the web query from rank 0 only + + if (rank == 0) { + CURL *handle; + CURLcode res; + + // set up and clear receive buffer + + struct WriteBuf buf; + buf.dataptr = value; + buf.sizeleft = 511; + memset(value,0,512); + + // create curl web query instance + curl_global_init(CURL_GLOBAL_DEFAULT); + handle = curl_easy_init(); + + if (handle) { + std::string url("https://query.openkim.org/api/"); + url += qfunction; + + std::string query(arg[0]); + for (int i=1; i < narg; ++i) { + query += '&'; + query += arg[i]; + } + +#if LMP_DEBUG_CURL + curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); +#endif + +#if defined(LMP_NO_SSL_CHECK) + // disable verifying SSL certificate and host name + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L); +#endif + + curl_easy_setopt(handle, CURLOPT_URL, url.c_str()); + curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(handle, CURLOPT_POSTFIELDS, query.c_str()); + + curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION,write_callback); + curl_easy_setopt(handle, CURLOPT_WRITEDATA,&buf); + + // perform OpenKIM query and check for errors + res = curl_easy_perform(handle); + if (res != CURLE_OK) { + // on error we return an "empty" string but add error message after it + value[0]= '\0'; + strcpy(value+1,curl_easy_strerror(res)); + } + curl_easy_cleanup(handle); + } + curl_global_cleanup(); + } + MPI_Bcast(value, 512, MPI_CHAR, 0, comm); + + // we must make a proper copy of the query, as the stack allocation + // for "value" will go out of scope. a valid query has a '[' as + // the first character. skip over it (and the last character ']', too) + // an error messages starts with a '\0' character. copy that and + // the remaining string, as that is the error message. + + if (value[0] == '[') { + int len = strlen(value)-1; + retval = new char[len]; + value[len] = '\0'; + strcpy(retval,value+1); + } else if (value[0] == '\0') { + int len = strlen(value+1)+2; + retval = new char[len]; + retval[0] = '\0'; + strcpy(retval+1,value+1); + } else { + // unknown response type. we should not get here. + // copy response without modifications. + int len = strlen(value)+1; + retval = new char[len]; + strcpy(retval,value); + } + return retval; +} +#endif diff --git a/src/KIM/kim_query.h b/src/KIM/kim_query.h new file mode 100644 index 0000000000..ed5a7c88f3 --- /dev/null +++ b/src/KIM/kim_query.h @@ -0,0 +1,85 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Axel Kohlmeyer (Temple U), + Ryan S. Elliott (UMN) +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, see . + + Linking LAMMPS statically or dynamically with other modules is making a + combined work based on LAMMPS. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + In addition, as a special exception, the copyright holders of LAMMPS give + you permission to combine LAMMPS with free software programs or libraries + that are released under the GNU LGPL and with code included in the standard + release of the "kim-api" under the CDDL (or modified versions of such code, + with unchanged license). You may copy and distribute such a system following + the terms of the GNU GPL for LAMMPS and the licenses of the other code + concerned, provided that you include the source code of that other code + when and as the GNU GPL requires distribution of source code. + + Note that people who make modified versions of LAMMPS are not obligated to + grant this special exception for their modified versions; it is their choice + whether to do so. The GNU General Public License gives permission to release + a modified version without this exception; this exception also makes it + possible to release a modified version which carries forward this exception. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Designed for use with the kim-api-v2-2.0.0 (and newer) package +------------------------------------------------------------------------- */ + +#ifdef COMMAND_CLASS + +CommandStyle(kim_query,KimQuery) + +#else + +#ifndef LMP_KIM_QUERY_H +#define LMP_KIM_QUERY_H + +#include "pointers.h" + +namespace LAMMPS_NS { + +class KimQuery : protected Pointers { + public: + KimQuery(class LAMMPS *lmp) : Pointers(lmp) {}; + void command(int, char **); + +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + + +*/ diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index a4517b848c..84842f87cc 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -191,10 +191,7 @@ void PairKIM::compute(int eflag , int vflag) { int kimerror; - if (eflag || vflag) - ev_setup(eflag,vflag); - else - ev_unset(); + ev_init(eflag,vflag); // grow kim_particleSpecies and kim_particleContributing array if necessary // needs to be atom->nmax in length diff --git a/src/KOKKOS/angle_charmm_kokkos.cpp b/src/KOKKOS/angle_charmm_kokkos.cpp index ec2955b28d..0f46c958d6 100644 --- a/src/KOKKOS/angle_charmm_kokkos.cpp +++ b/src/KOKKOS/angle_charmm_kokkos.cpp @@ -64,8 +64,7 @@ void AngleCharmmKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/angle_class2_kokkos.cpp b/src/KOKKOS/angle_class2_kokkos.cpp index fe5b1895fe..836714764d 100644 --- a/src/KOKKOS/angle_class2_kokkos.cpp +++ b/src/KOKKOS/angle_class2_kokkos.cpp @@ -64,8 +64,7 @@ void AngleClass2Kokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/angle_cosine_kokkos.cpp b/src/KOKKOS/angle_cosine_kokkos.cpp index 08faa254f4..4a4866948f 100644 --- a/src/KOKKOS/angle_cosine_kokkos.cpp +++ b/src/KOKKOS/angle_cosine_kokkos.cpp @@ -64,8 +64,7 @@ void AngleCosineKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/angle_harmonic_kokkos.cpp b/src/KOKKOS/angle_harmonic_kokkos.cpp index 8cdab2063a..dbe705800c 100644 --- a/src/KOKKOS/angle_harmonic_kokkos.cpp +++ b/src/KOKKOS/angle_harmonic_kokkos.cpp @@ -64,8 +64,7 @@ void AngleHarmonicKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/bond_class2_kokkos.cpp b/src/KOKKOS/bond_class2_kokkos.cpp index d84b3d390c..798fb41c92 100644 --- a/src/KOKKOS/bond_class2_kokkos.cpp +++ b/src/KOKKOS/bond_class2_kokkos.cpp @@ -60,8 +60,7 @@ void BondClass2Kokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/bond_fene_kokkos.cpp b/src/KOKKOS/bond_fene_kokkos.cpp index d37943ba82..b5cdc1a05a 100644 --- a/src/KOKKOS/bond_fene_kokkos.cpp +++ b/src/KOKKOS/bond_fene_kokkos.cpp @@ -69,8 +69,7 @@ void BondFENEKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/bond_harmonic_kokkos.cpp b/src/KOKKOS/bond_harmonic_kokkos.cpp index 6cdd4fe856..51a9fa4389 100644 --- a/src/KOKKOS/bond_harmonic_kokkos.cpp +++ b/src/KOKKOS/bond_harmonic_kokkos.cpp @@ -61,8 +61,7 @@ void BondHarmonicKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 3931309dc1..61ddcc425a 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralCharmmKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/KOKKOS/dihedral_class2_kokkos.cpp b/src/KOKKOS/dihedral_class2_kokkos.cpp index c7db07a6cb..98436bc696 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.cpp +++ b/src/KOKKOS/dihedral_class2_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralClass2Kokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index 9d01cf1a54..f50dea2c36 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralOPLSKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/improper_class2_kokkos.cpp b/src/KOKKOS/improper_class2_kokkos.cpp index e3af52b494..ad32e6da4e 100644 --- a/src/KOKKOS/improper_class2_kokkos.cpp +++ b/src/KOKKOS/improper_class2_kokkos.cpp @@ -71,8 +71,7 @@ void ImproperClass2Kokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/improper_harmonic_kokkos.cpp b/src/KOKKOS/improper_harmonic_kokkos.cpp index 4d41f3ef48..bb397a2c2f 100644 --- a/src/KOKKOS/improper_harmonic_kokkos.cpp +++ b/src/KOKKOS/improper_harmonic_kokkos.cpp @@ -71,8 +71,7 @@ void ImproperHarmonicKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index 18d09965be..57ac3a9c57 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -92,8 +92,7 @@ void PairBuckCoulCutKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index 0b44a83ebb..349c4c0601 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -111,8 +111,7 @@ void PairBuckCoulLongKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 999aefe4c3..02c02c986e 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -81,8 +81,7 @@ void PairBuckKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 7d29adc625..54ba0b63ce 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -80,8 +80,7 @@ void PairCoulCutKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index 3de83b5bc4..8966e30394 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -87,8 +87,7 @@ void PairCoulDebyeKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_coul_dsf_kokkos.cpp index 7d03ee4968..748fed71a7 100644 --- a/src/KOKKOS/pair_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_dsf_kokkos.cpp @@ -80,8 +80,7 @@ void PairCoulDSFKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 73b9521da0..a21cb050ff 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -104,8 +104,7 @@ void PairCoulLongKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.cpp b/src/KOKKOS/pair_coul_wolf_kokkos.cpp index fe9c581cc1..20391d9530 100644 --- a/src/KOKKOS/pair_coul_wolf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_wolf_kokkos.cpp @@ -75,8 +75,7 @@ void PairCoulWolfKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp index d2fcc81ea4..a44ef1790e 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.cpp @@ -165,8 +165,7 @@ void PairDPDfdtEnergyKokkos::compute(int eflag_in, int vflag_in) vflag = vflag_in; if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 6039282141..b580f00ed0 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -74,8 +74,7 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 81d9ba8326..1b1ec5c31e 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -74,8 +74,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 22383f57c5..d423f2c927 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -68,8 +68,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index df24a5f4c7..fa10c6d30f 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -147,8 +147,7 @@ void PairExp6rxKokkos::compute(int eflag_in, int vflag_in) vflag = vflag_in; if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index 189407b541..068580b525 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -111,8 +111,7 @@ void PairGranHookeHistoryKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); int shearupdate = 1; if (update->setupflag) shearupdate = 0; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index 03ad77c34a..00df4a8f3c 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -78,9 +78,7 @@ void PairHybridKokkos::compute(int eflag, int vflag) if (no_virial_fdotr_compute && vflag % 4 == 2) vflag = 1 + vflag/4 * 4; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // check if global component of incoming vflag = 2 // if so, reset vflag passed to substyle as if it were 0 diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index ce7df2bec1..510740112a 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -112,8 +112,7 @@ void PairLJCharmmCoulCharmmImplicitKokkos::compute(int eflag_in, int if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index b31282e595..51c96354f9 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -112,8 +112,7 @@ void PairLJCharmmCoulCharmmKokkos::compute(int eflag_in, int vflag_i if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index 5d8a202aa4..22faa98935 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -112,8 +112,7 @@ void PairLJCharmmCoulLongKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index 6eb3028101..60d480188b 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -89,8 +89,7 @@ void PairLJClass2CoulCutKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index a388694876..4c8aea8e92 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -97,8 +97,7 @@ void PairLJClass2CoulLongKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index 33d1477443..dd42baa4e0 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -89,8 +89,7 @@ void PairLJClass2Kokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index 6001fabbed..cb5ab96871 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -89,8 +89,7 @@ void PairLJCutCoulCutKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 10923bc5da..800092a09b 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -93,8 +93,7 @@ void PairLJCutCoulDebyeKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index 47aa2ea7cc..f793485b47 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -101,8 +101,7 @@ void PairLJCutCoulDSFKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index fa36cb1866..02150586f4 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -101,8 +101,7 @@ void PairLJCutCoulLongKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 9b0ff902af..4ba8c00f88 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -89,8 +89,7 @@ void PairLJCutKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 3b8b9343d8..5ea6c9e438 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -88,8 +88,7 @@ void PairLJExpandKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index d06ad9b44e..2421d059da 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -103,8 +103,7 @@ void PairLJGromacsCoulGromacsKokkos::compute(int eflag_in, int vflag if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index d447846333..09a0261ae1 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -100,8 +100,7 @@ void PairLJGromacsKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index 990e464341..c2375fa7a8 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -88,8 +88,7 @@ void PairLJSDKKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index ab5eb817a1..b308330ead 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -93,8 +93,7 @@ void PairMorseKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index 5f19d73dfa..7d17ac3f43 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -148,8 +148,7 @@ void PairMultiLucyRXKokkos::compute_style(int eflag_in, int vflag_in vflag = vflag_in; if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 56d2ebd8aa..c6ee50c6ac 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -677,8 +677,7 @@ void PairReaxCKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); atomKK->sync(execution_space,datamask_read); k_params_sing.template sync(); diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 998e75fabe..569783f926 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -137,8 +137,7 @@ void PairSNAPKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 24022475ab..da4737a2c1 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -80,8 +80,7 @@ void PairSWKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index 9522e94706..737d600d1e 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -86,8 +86,7 @@ void PairTableKokkos::compute_style(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 376984afa2..ec7a2ffb94 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -619,8 +619,7 @@ void PairTableRXKokkos::compute_style(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); if (eflag_atom) { memoryKK->destroy_kokkos(k_eatom,eatom); diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index a6668ca064..9252e3de52 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -164,8 +164,7 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 303d2bdfda..585074b128 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -164,8 +164,7 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index ad4a2d444e..e1e2211ab5 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -178,8 +178,7 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index 78ab8bfc85..4a1f291b17 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -79,8 +79,7 @@ void PairVashishtaKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 951613a33e..27e18533a2 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -177,8 +177,7 @@ void PairYukawaKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index bcf33b405d..06c84e5189 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -129,8 +129,7 @@ void PairZBLKokkos::compute(int eflag_in, int vflag_in) if (neighflag == FULL) no_virial_fdotr_compute = 1; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index bcac29ba9b..c233ca6264 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -615,8 +615,7 @@ void PPPMKokkos::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = evflag_atom = eflag_global = vflag_global = + ev_init(eflag,vflag,0); eflag_atom = vflag_atom = 0; // reallocate per-atom arrays if necessary diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 283c672bad..ccbb3ed708 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -365,9 +365,7 @@ void Ewald::compute(int eflag, int vflag) // set energy/virial flags - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // if atom count has changed, update qsum and qsqsum diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 4cbdf7b9cb..0603d68eb2 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -688,8 +688,7 @@ void EwaldDisp::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (!peratom_allocate_flag && (eflag_atom || vflag_atom)) { allocate_peratom(); diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index d8964ffa67..d7cc3f6876 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -454,9 +454,7 @@ void MSM::compute(int eflag, int vflag) // set energy/virial flags - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = eflag_either = vflag_either = 0; + ev_init(eflag,vflag); if (scalar_pressure_flag && vflag_either) { if (vflag_atom) diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 55435e5a6e..c7896db50c 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -90,9 +90,7 @@ void MSMCG::compute(int eflag, int vflag) // set energy/virial flags - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = eflag_either = vflag_either = 0; + ev_init(eflag,vflag); // invoke allocate_peratom() if needed for first time diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index d55a5a3afe..f12f5779d9 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -87,8 +87,7 @@ void PairBornCoulLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_born_coul_msm.cpp b/src/KSPACE/pair_born_coul_msm.cpp index 775d26df95..eaa1c116c1 100644 --- a/src/KSPACE/pair_born_coul_msm.cpp +++ b/src/KSPACE/pair_born_coul_msm.cpp @@ -82,8 +82,7 @@ void PairBornCoulMSM::compute(int eflag, int vflag) } evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index a37e4ab4e9..0a1ec88da5 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -50,23 +50,23 @@ PairBuckCoulLong::PairBuckCoulLong(LAMMPS *lmp) : Pair(lmp) PairBuckCoulLong::~PairBuckCoulLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(a); - memory->destroy(rho); - memory->destroy(c); - memory->destroy(rhoinv); - memory->destroy(buck1); - memory->destroy(buck2); - memory->destroy(offset); - } - if (ftable) free_tables(); + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(a); + memory->destroy(rho); + memory->destroy(c); + memory->destroy(rhoinv); + memory->destroy(buck1); + memory->destroy(buck2); + memory->destroy(offset); } + if (ftable) free_tables(); } /* ---------------------------------------------------------------------- */ @@ -82,8 +82,7 @@ void PairBuckCoulLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_buck_coul_msm.cpp b/src/KSPACE/pair_buck_coul_msm.cpp index fc72f1a4d6..257d1b661f 100644 --- a/src/KSPACE/pair_buck_coul_msm.cpp +++ b/src/KSPACE/pair_buck_coul_msm.cpp @@ -79,8 +79,7 @@ void PairBuckCoulMSM::compute(int eflag, int vflag) } evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index d5bb7b6c5b..c7a4a4b2f6 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -445,8 +445,7 @@ void PairBuckLongCoulLong::compute(int eflag, int vflag) double evdwl,ecoul,fpair; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; @@ -785,8 +784,7 @@ void PairBuckLongCoulLong::compute_outer(int eflag, int vflag) { double evdwl,ecoul,fpair,fvirial; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 8db5979b39..ae268b9857 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -55,15 +55,15 @@ PairCoulLong::PairCoulLong(LAMMPS *lmp) : Pair(lmp) PairCoulLong::~PairCoulLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(scale); - } - if (ftable) free_tables(); + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(scale); } + if (ftable) free_tables(); } /* ---------------------------------------------------------------------- */ @@ -79,8 +79,7 @@ void PairCoulLong::compute(int eflag, int vflag) double rsq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_coul_msm.cpp b/src/KSPACE/pair_coul_msm.cpp index ab59dfa4c1..960505142c 100644 --- a/src/KSPACE/pair_coul_msm.cpp +++ b/src/KSPACE/pair_coul_msm.cpp @@ -67,8 +67,7 @@ void PairCoulMSM::compute(int eflag, int vflag) } ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 749d9657aa..b40eab244b 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -59,27 +59,27 @@ PairLJCharmmCoulLong::PairLJCharmmCoulLong(LAMMPS *lmp) : Pair(lmp) PairLJCharmmCoulLong::~PairLJCharmmCoulLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(eps14); - memory->destroy(sigma14); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(lj14_1); - memory->destroy(lj14_2); - memory->destroy(lj14_3); - memory->destroy(lj14_4); - memory->destroy(offset); - } - if (ftable) free_tables(); + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(eps14); + memory->destroy(sigma14); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(lj14_1); + memory->destroy(lj14_2); + memory->destroy(lj14_3); + memory->destroy(lj14_4); + memory->destroy(offset); } + if (ftable) free_tables(); } /* ---------------------------------------------------------------------- */ @@ -96,8 +96,7 @@ void PairLJCharmmCoulLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -404,8 +403,7 @@ void PairLJCharmmCoulLong::compute_outer(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.cpp b/src/KSPACE/pair_lj_charmm_coul_msm.cpp index aecadcf127..72a8e340bc 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_msm.cpp @@ -87,8 +87,7 @@ void PairLJCharmmCoulMSM::compute(int eflag, int vflag) } evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -265,8 +264,7 @@ void PairLJCharmmCoulMSM::compute_outer(int eflag, int vflag) "for rRESPA with kspace_style MSM"); evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 614980117e..4aecc8453a 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -77,27 +77,6 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp) PairLJCharmmfswCoulLong::~PairLJCharmmfswCoulLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(eps14); - memory->destroy(sigma14); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(lj14_1); - memory->destroy(lj14_2); - memory->destroy(lj14_3); - memory->destroy(lj14_4); - } - if (ftable) free_tables(); - } - // switch qqr2e back from CHARMM value to LAMMPS value if (update && strcmp(update->unit_style,"real") == 0) { @@ -106,6 +85,27 @@ PairLJCharmmfswCoulLong::~PairLJCharmmfswCoulLong() " conversion constant"); force->qqr2e = force->qqr2e_lammps_real; } + + if (copymode) return; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(eps14); + memory->destroy(sigma14); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(lj14_1); + memory->destroy(lj14_2); + memory->destroy(lj14_3); + memory->destroy(lj14_4); + } + if (ftable) free_tables(); } /* ---------------------------------------------------------------------- */ @@ -121,8 +121,7 @@ void PairLJCharmmfswCoulLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -452,8 +451,7 @@ void PairLJCharmmfswCoulLong::compute_outer(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index c9530fe157..fde7fa8e35 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -90,8 +90,7 @@ void PairLJCutCoulLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -397,8 +396,7 @@ void PairLJCutCoulLong::compute_outer(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_cut_coul_msm.cpp b/src/KSPACE/pair_lj_cut_coul_msm.cpp index 78c364bd6a..c2e566a117 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.cpp +++ b/src/KSPACE/pair_lj_cut_coul_msm.cpp @@ -87,8 +87,7 @@ void PairLJCutCoulMSM::compute(int eflag, int vflag) } evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -252,8 +251,7 @@ void PairLJCutCoulMSM::compute_outer(int eflag, int vflag) "for rRESPA with kspace_style MSM"); evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index d622a83b39..f5889fd520 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -94,8 +94,7 @@ void PairLJCutTIP4PLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 2de527ab39..493866a895 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -441,8 +441,7 @@ void PairLJLongCoulLong::compute(int eflag, int vflag) { double evdwl,ecoul,fpair; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; @@ -778,8 +777,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) { double evdwl,ecoul,fvirial,fpair; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index a571e30fc3..3137b9d79a 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -92,8 +92,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred @@ -1004,8 +1003,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) int respa_flag; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index ac428d483a..9419fdf196 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -90,8 +90,7 @@ void PairTIP4PLong::compute(int eflag, int vflag) double rsq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 8fd74d00dc..773305bb5e 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -630,9 +630,7 @@ void PPPM::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index fa73588363..3285dba21c 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -88,9 +88,7 @@ void PPPMCG::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 687ea0b3f9..45dce0895b 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -928,9 +928,7 @@ void PPPMDisp::compute(int eflag, int vflag) int i; // convert atoms from box to lamda coords - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index ca369cf260..a5ed6de626 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -124,9 +124,7 @@ void PPPMStagger::compute(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index d1a96d32c6..645b298e09 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -239,8 +239,7 @@ void FixLatte::pre_reverse(int eflag, int /*vflag*/) void FixLatte::post_force(int vflag) { int eflag = eflag_caller; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // compute Coulombic potential = pe[i]/q[i] // invoke compute pe/atom diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 4fd19a36c4..68511b8709 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -133,8 +133,7 @@ void PairADP::compute(int eflag, int vflag) double sumlamxx,sumlamyy,sumlamzz,sumlamyz,sumlamxz,sumlamxy; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // grow local arrays if necessary // need to be atom->nmax in length diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index f8221e6381..4502bd9a82 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -108,8 +108,7 @@ PairAIREBO::~PairAIREBO() void PairAIREBO::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); pvector[0] = pvector[1] = pvector[2] = 0.0; REBO_neigh(); diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index e3be72443e..c157e0763c 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -82,8 +82,7 @@ void PairATM::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 6540dedf98..ac157e071c 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -297,8 +297,7 @@ void PairBOP::compute(int eflag, int vflag) ilist = list->ilist; firstneigh = list->firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // BOP Neighbor lists must be updated every timestep maxnall=nall; diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 85ea4812bf..980aa84b2a 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -144,8 +144,7 @@ void PairComb::compute(int eflag, int vflag) int sht_jnum, *sht_jlist, nj; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); // Build short range neighbor list diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index d82f6dfed0..097f235ff2 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -987,8 +987,7 @@ void PairComb3::compute(int eflag, int vflag) evdwl = eng_tmp = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); // Build short range neighbor list Short_neigh(); diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index f4b4901075..b7957349b6 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -142,8 +142,7 @@ void PairEAM::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // grow energy and fp arrays if necessary // need to be atom->nmax in length diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 8db1b6dd9a..c111c6d950 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -73,8 +73,7 @@ void PairEAMCD::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // Grow per-atom arrays if necessary diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index b0fa1b1eef..f1c028ef38 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -113,8 +113,7 @@ void PairEIM::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); // grow energy array if necessary diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 7649090a99..e4b74f7a29 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -87,8 +87,7 @@ void PairGW::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 0c8b3ef2a6..05cdea8055 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -87,8 +87,7 @@ PairLCBOP::~PairLCBOP() void PairLCBOP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); SR_neigh(); FSR(eflag,vflag); diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index ce449e4890..a61b403459 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -87,8 +87,7 @@ void PairNb3bHarmonic::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 41c5892d4e..d3aca4e889 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -117,8 +117,7 @@ void PairPolymorphic::compute(int eflag, int vflag) double emb; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 91e11b3d26..5a148fb152 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -91,8 +91,7 @@ void PairSW::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 54101aef9e..213b1037bb 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -93,8 +93,7 @@ void PairTersoff::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index b4c3086ca8..3d4b1d900e 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -93,8 +93,7 @@ void PairVashishta::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index 1055db99fa..d4eaa59f1a 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -64,8 +64,7 @@ void PairVashishtaTable::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 4b1611b137..124832b63e 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -70,8 +70,7 @@ void PairNMCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 999fab1d6e..6a09d579b7 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -74,8 +74,7 @@ void PairNMCutCoulCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index fb82436dba..af21f02881 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -90,8 +90,7 @@ void PairNMCutCoulLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 3608601c1f..efd1c682f7 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -61,8 +61,7 @@ void AngleCharmm::compute(int eflag, int vflag) double delxUB,delyUB,delzUB,rsqUB,rUB,dr,rk,forceUB; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 18763e1b76..6e1b9fa2fb 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -52,8 +52,7 @@ void AngleCosine::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_cosine_delta.cpp b/src/MOLECULE/angle_cosine_delta.cpp index 6f4f5c20d7..eca10970f2 100644 --- a/src/MOLECULE/angle_cosine_delta.cpp +++ b/src/MOLECULE/angle_cosine_delta.cpp @@ -44,8 +44,7 @@ void AngleCosineDelta::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,a,cot,a11,a12,a22,b11,b12,b22,c0,s0,s; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index e8dd970b3b..cb0a26871a 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -61,8 +61,7 @@ void AngleCosinePeriodic::compute(int eflag, int vflag) double tn,tn_1,tn_2,un,un_1,un_2; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index c83ba90a60..28d63344a4 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -62,8 +62,7 @@ void AngleCosineSquared::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index d28afd76d6..48b493d9b2 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -58,8 +58,7 @@ void AngleHarmonic::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 6c1af54dcf..7dd56ffb76 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -72,8 +72,7 @@ void AngleTable::compute(int eflag, int vflag) double theta,u,mdu; //mdu: minus du, -du/dx=f eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index 671290b0ad..c023a7e81e 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -54,8 +54,7 @@ void BondFENE::compute(int eflag, int vflag) double rsq,r0sq,rlogarg,sr2,sr6; ebond = sr6 = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 3e191683fb..b1bfdc6a1b 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -56,8 +56,7 @@ void BondFENEExpand::compute(int eflag, int vflag) double r,rshift,rshiftsq; ebond = sr6 = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 57091903af..f65adeb2cb 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -55,8 +55,7 @@ void BondGromos::compute(int eflag, int vflag) double delx,dely,delz,ebond,fbond; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index fb4581d0d6..cb8434ce6e 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -52,8 +52,7 @@ void BondHarmonic::compute(int eflag, int vflag) double rsq,r,dr,rk; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 06af28f2b0..91dd2dbc49 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -53,8 +53,7 @@ void BondMorse::compute(int eflag, int vflag) double rsq,r,dr,ralpha; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 645b081779..9999ead47f 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -49,8 +49,7 @@ void BondNonlinear::compute(int eflag, int vflag) double rsq,r,dr,drsq,lamdasq,denom,denomsq; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index f200030d6c..895202ff00 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -60,8 +60,7 @@ void BondQuartic::compute(int eflag, int vflag) double r,rsq,dr,r2,ra,rb,sr2,sr6; ebond = evdwl = sr6 = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index c75779922a..94e843eb65 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -68,8 +68,7 @@ void BondTable::compute(int eflag, int vflag) double u,mdu; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 2372fae38b..68c62eb4fd 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -76,8 +76,7 @@ void DihedralCharmm::compute(int eflag, int vflag) double forcecoul,forcelj,fpair,ecoul,evdwl; edihedral = evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 99a5333620..f65d01e9ed 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -79,8 +79,7 @@ void DihedralCharmmfsw::compute(int eflag, int vflag) double forcecoul,forcelj,fpair,ecoul,evdwl; edihedral = evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index cb122f4bc2..ddb94dc571 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -67,8 +67,7 @@ void DihedralHarmonic::compute(int eflag, int vflag) double c,s,p,sx2,sy2,sz2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 0998d654af..d19731c097 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -70,8 +70,7 @@ void DihedralHelix::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 09c90f8d81..04e7bbb627 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -67,8 +67,7 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag) double s2,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index b5103413b2..293245e411 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -67,8 +67,7 @@ void DihedralOPLS::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index ec2588e61b..3395c7ef14 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -341,8 +341,7 @@ void FixCMAP::post_force(int vflag) ecmap = 0.0; int eflag = eflag_caller; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (n = 0; n < ncrosstermlist; n++) { i1 = crosstermlist[n][0]; diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 641eea74a8..01e9729e80 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -61,8 +61,7 @@ void ImproperCvff::compute(int eflag, int vflag) double a33,a12,a13,a23,sx2,sy2,sz2; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 091bd46316..c5421fffdb 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -61,8 +61,7 @@ void ImproperHarmonic::compute(int eflag, int vflag) double sx2,sy2,sz2; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 8ed3d3a84c..3de46df0f3 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -65,8 +65,7 @@ void ImproperUmbrella::compute(int eflag, int vflag) double ax,ay,az,ra2,rh2,ra,rh,rar,rhr,arx,ary,arz,hrx,hry,hrz; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index c0c885d4d4..ddc1110081 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -91,8 +91,7 @@ void PairHbondDreidingLJ::compute(int eflag, int vflag) tagint *klist; evdwl = ehbond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index f464d2c621..055f0ed46b 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -61,8 +61,7 @@ void PairHbondDreidingMorse::compute(int eflag, int vflag) tagint *klist; evdwl = ehbond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 688c675815..af4611e014 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -43,8 +43,9 @@ PairLJCharmmCoulCharmm::PairLJCharmmCoulCharmm(LAMMPS *lmp) : Pair(lmp) PairLJCharmmCoulCharmm::~PairLJCharmmCoulCharmm() { - if (!copymode) { - if (allocated) { + if (copymode) return; + + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -60,7 +61,6 @@ PairLJCharmmCoulCharmm::~PairLJCharmmCoulCharmm() memory->destroy(lj14_2); memory->destroy(lj14_3); memory->destroy(lj14_4); - } } } @@ -75,8 +75,7 @@ void PairLJCharmmCoulCharmm::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp index 6c083a49b0..d68d5e8f6d 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp @@ -39,8 +39,7 @@ void PairLJCharmmCoulCharmmImplicit::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 4b9147c169..0e1cbd85a5 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -62,26 +62,6 @@ PairLJCharmmfswCoulCharmmfsh::PairLJCharmmfswCoulCharmmfsh(LAMMPS *lmp) : PairLJCharmmfswCoulCharmmfsh::~PairLJCharmmfswCoulCharmmfsh() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); - - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(eps14); - memory->destroy(sigma14); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(lj14_1); - memory->destroy(lj14_2); - memory->destroy(lj14_3); - memory->destroy(lj14_4); - } - } - // switch qqr2e back from CHARMM value to LAMMPS value if (update && strcmp(update->unit_style,"real") == 0) { @@ -90,6 +70,26 @@ PairLJCharmmfswCoulCharmmfsh::~PairLJCharmmfswCoulCharmmfsh() " conversion constant"); force->qqr2e = force->qqr2e_lammps_real; } + + if (copymode) return; + + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(eps14); + memory->destroy(sigma14); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(lj14_1); + memory->destroy(lj14_2); + memory->destroy(lj14_3); + memory->destroy(lj14_4); + } } /* ---------------------------------------------------------------------- */ @@ -103,8 +103,7 @@ void PairLJCharmmfswCoulCharmmfsh::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 92dead8435..2b3d2c60f5 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -91,8 +91,7 @@ void PairLJCutTIP4PCut::compute(int eflag, int vflag) double *x1,*x2,*xH1,*xH2; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 79dd79b180..e6fb9aab99 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -79,8 +79,7 @@ void PairTIP4PCut::compute(int eflag, int vflag) double *x1,*x2,*xH1,*xH2; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index 5345d7f8d6..fc2b6731ee 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -38,8 +38,7 @@ PairEAMOpt::PairEAMOpt(LAMMPS *lmp) : PairEAM(lmp) {} void PairEAMOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.cpp b/src/OPT/pair_lj_charmm_coul_long_opt.cpp index 43f4ba7f5a..d80d3d1ec4 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.cpp +++ b/src/OPT/pair_lj_charmm_coul_long_opt.cpp @@ -44,8 +44,7 @@ PairLJCharmmCoulLongOpt::PairLJCharmmCoulLongOpt(LAMMPS *lmp) : void PairLJCharmmCoulLongOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/OPT/pair_lj_cut_coul_long_opt.cpp b/src/OPT/pair_lj_cut_coul_long_opt.cpp index 98683a67a4..a25010cf1f 100644 --- a/src/OPT/pair_lj_cut_coul_long_opt.cpp +++ b/src/OPT/pair_lj_cut_coul_long_opt.cpp @@ -38,8 +38,7 @@ PairLJCutCoulLongOpt::PairLJCutCoulLongOpt(LAMMPS *lmp) : PairLJCutCoulLong(lmp) void PairLJCutCoulLongOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (!ncoultablebits) { if (evflag) { diff --git a/src/OPT/pair_lj_cut_opt.cpp b/src/OPT/pair_lj_cut_opt.cpp index ed35178c1f..c6684461be 100644 --- a/src/OPT/pair_lj_cut_opt.cpp +++ b/src/OPT/pair_lj_cut_opt.cpp @@ -34,8 +34,7 @@ PairLJCutOpt::PairLJCutOpt(LAMMPS *lmp) : PairLJCut(lmp) {} void PairLJCutOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/OPT/pair_lj_cut_tip4p_long_opt.cpp b/src/OPT/pair_lj_cut_tip4p_long_opt.cpp index 4842cc4fc0..92facca43e 100644 --- a/src/OPT/pair_lj_cut_tip4p_long_opt.cpp +++ b/src/OPT/pair_lj_cut_tip4p_long_opt.cpp @@ -53,8 +53,7 @@ PairLJCutTIP4PLongOpt::PairLJCutTIP4PLongOpt(LAMMPS *lmp) : void PairLJCutTIP4PLongOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/OPT/pair_lj_long_coul_long_opt.cpp b/src/OPT/pair_lj_long_coul_long_opt.cpp index 6bd1e8cb96..243b64391f 100644 --- a/src/OPT/pair_lj_long_coul_long_opt.cpp +++ b/src/OPT/pair_lj_long_coul_long_opt.cpp @@ -44,8 +44,7 @@ PairLJLongCoulLongOpt::PairLJLongCoulLongOpt(LAMMPS *lmp) : PairLJLongCoulLong(l void PairLJLongCoulLongOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int order1 = ewald_order&(1<<1), order6 = ewald_order&(1<<6); if (order6) { @@ -290,8 +289,7 @@ void PairLJLongCoulLongOpt::compute(int eflag, int vflag) void PairLJLongCoulLongOpt::compute_outer(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int order1 = ewald_order&(1<<1), order6 = ewald_order&(1<<6); if (order6) { diff --git a/src/OPT/pair_morse_opt.cpp b/src/OPT/pair_morse_opt.cpp index 6299136f46..c9c6bba355 100644 --- a/src/OPT/pair_morse_opt.cpp +++ b/src/OPT/pair_morse_opt.cpp @@ -35,8 +35,7 @@ PairMorseOpt::PairMorseOpt(LAMMPS *lmp) : PairMorse(lmp) {} void PairMorseOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/OPT/pair_ufm_opt.cpp b/src/OPT/pair_ufm_opt.cpp index 85c76d624d..f463dac3f1 100644 --- a/src/OPT/pair_ufm_opt.cpp +++ b/src/OPT/pair_ufm_opt.cpp @@ -34,8 +34,7 @@ PairUFMOpt::PairUFMOpt(LAMMPS *lmp) : PairUFM(lmp) {} void PairUFMOpt::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 76267426c6..c00495ba4d 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -96,8 +96,7 @@ void PairPeriEPS::compute(int eflag, int vflag) double d_ij,delta,stretch; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); double **f = atom->f; double **x = atom->x; diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 383b91c6f5..f0418c8c8d 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -93,8 +93,7 @@ void PairPeriLPS::compute(int eflag, int vflag) double d_ij,delta,stretch; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); double **f = atom->f; double **x = atom->x; diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 772e47f2d6..ad2f3fb7c7 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -84,8 +84,7 @@ void PairPeriPMB::compute(int eflag, int vflag) double d_ij,delta,stretch; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **f = atom->f; double **x = atom->x; diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index 7590077f0e..24a9f92a97 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -98,8 +98,7 @@ void PairPeriVES::compute(int eflag, int vflag) double d_ij,delta,stretch; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); double **f = atom->f; double **x = atom->x; diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 4899e5e2ef..2148fc67b8 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -82,8 +82,7 @@ void PairPython::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index 81c5e9f6d1..8b547e6e73 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -176,8 +176,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) int *jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -486,8 +485,7 @@ void PairSNAP::compute_optimized(int eflag, int vflag) #pragma omp master #endif { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); } #if defined(_OPENMP) diff --git a/src/SPIN/README b/src/SPIN/README index c3c02b1445..a4eb4ff22b 100644 --- a/src/SPIN/README +++ b/src/SPIN/README @@ -11,6 +11,7 @@ atom in the system * minimizing spin configurations with an adaptive timestep scheme * performing geodesic NEB calculations * computing and outputing magnetic quantities +* minimizing the energy or total torque of a magnetic system The different options provided by this package are explained in the LAMMPS documentation. diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index dc16190c98..0a881e1de6 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -84,7 +84,7 @@ void ComputeSpin::compute_vector() invoked_vector = update->ntimestep; - countsp = countsptot = 0.0; + countsp = countsptot = 0.0; mag[0] = mag[1] = mag[2] = mag[3] = 0.0; magtot[0] = magtot[1] = magtot[2] = magtot[3] = 0.0; magenergy = magenergytot = 0.0; @@ -96,7 +96,7 @@ void ComputeSpin::compute_vector() double **sp = atom->sp; double **fm = atom->fm; double tx,ty,tz; - + int nlocal = atom->nlocal; // compute total magnetization and magnetic energy @@ -105,16 +105,16 @@ void ComputeSpin::compute_vector() for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (atom->sp_flag) { - mag[0] += sp[i][0]; - mag[1] += sp[i][1]; - mag[2] += sp[i][2]; - magenergy -= (sp[i][0]*fm[i][0] + sp[i][1]*fm[i][1] + sp[i][2]*fm[i][2]); + mag[0] += sp[i][0]; + mag[1] += sp[i][1]; + mag[2] += sp[i][2]; + magenergy -= (sp[i][0]*fm[i][0] + sp[i][1]*fm[i][1] + sp[i][2]*fm[i][2]); tx = sp[i][1]*fm[i][2]-sp[i][2]*fm[i][1]; ty = sp[i][2]*fm[i][0]-sp[i][0]*fm[i][2]; tz = sp[i][0]*fm[i][1]-sp[i][1]*fm[i][0]; tempnum += tx*tx+ty*ty+tz*tz; - tempdenom += sp[i][0]*fm[i][0]+fm[i][1]*sp[i][1]+sp[i][2]*fm[i][2]; - countsp++; + tempdenom += sp[i][0]*fm[i][0]+fm[i][1]*sp[i][1]+sp[i][2]*fm[i][2]; + countsp++; } } else error->all(FLERR,"Compute compute/spin requires atom/spin style"); diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 55b4d8dfec..ec6f719a77 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -131,8 +131,8 @@ void FixLangevinSpin::init() gil_factor = 1.0/(1.0+(alpha_t)*(alpha_t)); dts = update->dt; - double hbar = force->hplanck/MY_2PI; // eV/(rad.THz) - double kb = force->boltz; // eV/K + double hbar = force->hplanck/MY_2PI; // eV/(rad.THz) + double kb = force->boltz; // eV/K D = (MY_2PI*alpha_t*gil_factor*kb*temp); D /= (hbar*dts); sigma = sqrt(2.0*D); @@ -158,7 +158,7 @@ void FixLangevinSpin::add_tdamping(double spi[3], double fmi[3]) double cpx = fmi[1]*spi[2] - fmi[2]*spi[1]; double cpy = fmi[2]*spi[0] - fmi[0]*spi[2]; double cpz = fmi[0]*spi[1] - fmi[1]*spi[0]; - + // adding the transverse damping fmi[0] -= alpha_t*cpx; diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 7d96aca6d4..8d549ed64a 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -183,7 +183,7 @@ void FixNVESpin::init() npairs = pair->instance_total; for (int i = 0; ipair_match("spin",0,i)) { - npairspin ++; + npairspin ++; } } } @@ -203,8 +203,8 @@ void FixNVESpin::init() } else if (npairspin > 1) { for (int i = 0; ipair_match("spin",0,i)) { - spin_pairs[count] = (PairSpin *) force->pair_match("spin",0,i); - count++; + spin_pairs[count] = (PairSpin *) force->pair_match("spin",0,i); + count++; } } } @@ -264,8 +264,8 @@ void FixNVESpin::init() void FixNVESpin::initial_integrate(int /*vflag*/) { double dtfm; - - double **x = atom->x; + + double **x = atom->x; double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; @@ -291,32 +291,32 @@ void FixNVESpin::initial_integrate(int /*vflag*/) // update half s for all atoms - if (sector_flag) { // sectoring seq. update - for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal + if (sector_flag) { // sectoring seq. update + for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal comm->forward_comm(); int i = stack_foot[j]; while (i >= 0) { ComputeInteractionsSpin(i); - AdvanceSingleSpin(i); - i = forward_stacks[i]; + AdvanceSingleSpin(i); + i = forward_stacks[i]; } } - for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal + for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal comm->forward_comm(); int i = stack_head[j]; while (i >= 0) { ComputeInteractionsSpin(i); - AdvanceSingleSpin(i); - i = backward_stacks[i]; + AdvanceSingleSpin(i); + i = backward_stacks[i]; } } - } else if (sector_flag == 0) { // serial seq. update - comm->forward_comm(); // comm. positions of ghost atoms - for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal + } else if (sector_flag == 0) { // serial seq. update + comm->forward_comm(); // comm. positions of ghost atoms + for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } - for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal + for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } @@ -336,32 +336,32 @@ void FixNVESpin::initial_integrate(int /*vflag*/) // update half s for all particles - if (sector_flag) { // sectoring seq. update - for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal + if (sector_flag) { // sectoring seq. update + for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal comm->forward_comm(); int i = stack_foot[j]; while (i >= 0) { ComputeInteractionsSpin(i); - AdvanceSingleSpin(i); - i = forward_stacks[i]; + AdvanceSingleSpin(i); + i = forward_stacks[i]; } } - for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal + for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal comm->forward_comm(); int i = stack_head[j]; while (i >= 0) { ComputeInteractionsSpin(i); - AdvanceSingleSpin(i); - i = backward_stacks[i]; + AdvanceSingleSpin(i); + i = backward_stacks[i]; } } - } else if (sector_flag == 0) { // serial seq. update - comm->forward_comm(); // comm. positions of ghost atoms - for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1 + } else if (sector_flag == 0) { // serial seq. update + comm->forward_comm(); // comm. positions of ghost atoms + for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1 ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } - for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal-1 + for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal-1 ComputeInteractionsSpin(i); AdvanceSingleSpin(i); } @@ -384,10 +384,10 @@ void FixNVESpin::setup_pre_neighbor() void FixNVESpin::pre_neighbor() { - double **x = atom->x; + double **x = atom->x; int nlocal = atom->nlocal; - if (nlocal_max < nlocal) { // grow linked lists if necessary + if (nlocal_max < nlocal) { // grow linked lists if necessary nlocal_max = nlocal; backward_stacks = memory->grow(backward_stacks,nlocal_max,"NVE/spin:backward_stacks"); forward_stacks = memory->grow(forward_stacks,nlocal_max,"NVE/spin:forward_stacks"); @@ -399,7 +399,7 @@ void FixNVESpin::pre_neighbor() } int nseci; - for (int j = 0; j < nsectors; j++) { // stacking backward order + for (int j = 0; j < nsectors; j++) { // stacking backward order for (int i = 0; i < nlocal; i++) { nseci = coords2sector(x[i]); if (j != nseci) continue; @@ -407,7 +407,7 @@ void FixNVESpin::pre_neighbor() stack_head[j] = i; } } - for (int j = nsectors-1; j >= 0; j--) { // stacking forward order + for (int j = nsectors-1; j >= 0; j--) { // stacking forward order for (int i = nlocal-1; i >= 0; i--) { nseci = coords2sector(x[i]); if (j != nseci) continue; @@ -453,11 +453,11 @@ void FixNVESpin::ComputeInteractionsSpin(int i) // update langevin damping and random force - if (maglangevin_flag) { // mag. langevin - if (tdamp_flag) { // transverse damping + if (maglangevin_flag) { // mag. langevin + if (tdamp_flag) { // transverse damping locklangevinspin->add_tdamping(spi,fmi); } - if (temp_flag) { // spin temperature + if (temp_flag) { // spin temperature locklangevinspin->add_temperature(fmi); } } @@ -567,7 +567,7 @@ void FixNVESpin::AdvanceSingleSpin(int i) g[0] = g[1] = g[2] = 0.0; fm2 = (fm[i][0]*fm[i][0])+(fm[i][1]*fm[i][1])+(fm[i][2]*fm[i][2]); energy = (sp[i][0]*fm[i][0])+(sp[i][1]*fm[i][1])+(sp[i][2]*fm[i][2]); - dts2 = dts*dts; + dts2 = dts*dts; cp[0] = fm[i][1]*sp[i][2]-fm[i][2]*sp[i][1]; cp[1] = fm[i][2]*sp[i][0]-fm[i][0]*sp[i][2]; @@ -576,18 +576,18 @@ void FixNVESpin::AdvanceSingleSpin(int i) g[0] = sp[i][0]+cp[0]*dts; g[1] = sp[i][1]+cp[1]*dts; g[2] = sp[i][2]+cp[2]*dts; - + g[0] += (fm[i][0]*energy-0.5*sp[i][0]*fm2)*0.5*dts2; g[1] += (fm[i][1]*energy-0.5*sp[i][1]*fm2)*0.5*dts2; g[2] += (fm[i][2]*energy-0.5*sp[i][2]*fm2)*0.5*dts2; - + g[0] /= (1+0.25*fm2*dts2); g[1] /= (1+0.25*fm2*dts2); g[2] /= (1+0.25*fm2*dts2); - + sp[i][0] = g[0]; sp[i][1] = g[1]; - sp[i][2] = g[2]; + sp[i][2] = g[2]; // renormalization (check if necessary) @@ -616,9 +616,9 @@ void FixNVESpin::AdvanceSingleSpin(int i) /* ---------------------------------------------------------------------- */ void FixNVESpin::final_integrate() -{ +{ double dtfm; - + double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index d065f38d16..9ee691c227 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -177,7 +177,7 @@ void FixPrecessionSpin::min_setup(int vflag) /* ---------------------------------------------------------------------- */ -void FixPrecessionSpin::post_force(int vflag) +void FixPrecessionSpin::post_force(int /* vflag */) { // update mag field with time (potential improvement) diff --git a/src/SPIN/min_spin.cpp b/src/SPIN/min_spin.cpp index 99aa4ac3b7..33b602f519 100644 --- a/src/SPIN/min_spin.cpp +++ b/src/SPIN/min_spin.cpp @@ -19,6 +19,8 @@ #include #include +#include +#include #include "min_spin.h" #include "universe.h" #include "atom.h" @@ -27,12 +29,9 @@ #include "output.h" #include "timer.h" #include "error.h" -#include -#include #include "modify.h" #include "math_special.h" #include "math_const.h" -#include "fix_neb_spin.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -52,7 +51,11 @@ MinSpin::MinSpin(LAMMPS *lmp) : Min(lmp) {} void MinSpin::init() { alpha_damp = 1.0; +<<<<<<< HEAD discret_factor = 10.0; +======= + discrete_factor = 10.0; +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 Min::init(); @@ -85,9 +88,15 @@ int MinSpin::modify_param(int narg, char **arg) alpha_damp = force->numeric(FLERR,arg[1]); return 2; } +<<<<<<< HEAD if (strcmp(arg[0],"discret_factor") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); discret_factor = force->numeric(FLERR,arg[1]); +======= + if (strcmp(arg[0],"discrete_factor") == 0) { + if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + discrete_factor = force->numeric(FLERR,arg[1]); +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 return 2; } return 0; @@ -105,10 +114,17 @@ void MinSpin::reset_vectors() // size sp is 4N vector nvec = 4 * atom->nlocal; if (nvec) spvec = atom->sp[0]; +<<<<<<< HEAD nvec = 3 * atom->nlocal; if (nvec) fmvec = atom->fm[0]; +======= + + nvec = 3 * atom->nlocal; + if (nvec) fmvec = atom->fm[0]; + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 if (nvec) xvec = atom->x[0]; if (nvec) fvec = atom->f[0]; } @@ -120,7 +136,11 @@ void MinSpin::reset_vectors() int MinSpin::iterate(int maxiter) { bigint ntimestep; +<<<<<<< HEAD double fmdotfm,fmdotfmall; +======= + double fmdotfm; +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 int flag,flagall; for (int iter = 0; iter < maxiter; iter++) { @@ -133,12 +153,21 @@ int MinSpin::iterate(int maxiter) // optimize timestep accross processes / replicas // need a force calculation for timestep optimization +<<<<<<< HEAD energy_force(0); dts = evaluate_dt(); // apply damped precessional dynamics to the spins +======= + + energy_force(0); + dts = evaluate_dt(); + + // apply damped precessional dynamics to the spins + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 advance_spins(dts); eprevious = ecurrent; @@ -201,11 +230,18 @@ double MinSpin::evaluate_dt() double fmsq; double fmaxsqone,fmaxsqloc,fmaxsqall; int nlocal = atom->nlocal; +<<<<<<< HEAD int *mask = atom->mask; double **fm = atom->fm; // finding max fm on this proc. +======= + double **fm = atom->fm; + + // finding max fm on this proc. + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 fmsq = fmaxsqone = fmaxsqloc = fmaxsqall = 0.0; for (int i = 0; i < nlocal; i++) { fmsq = fm[i][0]*fm[i][0]+fm[i][1]*fm[i][1]+fm[i][2]*fm[i][2]; @@ -213,10 +249,17 @@ double MinSpin::evaluate_dt() } // finding max fm on this replica +<<<<<<< HEAD fmaxsqloc = fmaxsqone; MPI_Allreduce(&fmaxsqone,&fmaxsqloc,1,MPI_DOUBLE,MPI_MAX,world); +======= + + fmaxsqloc = fmaxsqone; + MPI_Allreduce(&fmaxsqone,&fmaxsqloc,1,MPI_DOUBLE,MPI_MAX,world); + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 // finding max fm over all replicas, if necessary // this communicator would be invalid for multiprocess replicas @@ -229,10 +272,17 @@ double MinSpin::evaluate_dt() if (fmaxsqall == 0.0) error->all(FLERR,"Incorrect fmaxsqall calculation"); +<<<<<<< HEAD // define max timestep by dividing by the // inverse of max frequency by discret_factor dtmax = MY_2PI/(discret_factor*sqrt(fmaxsqall)); +======= + // define max timestep by dividing by the + // inverse of max frequency by discrete_factor + + dtmax = MY_2PI/(discrete_factor*sqrt(fmaxsqall)); +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 return dtmax; } @@ -244,18 +294,26 @@ double MinSpin::evaluate_dt() void MinSpin::advance_spins(double dts) { int nlocal = atom->nlocal; +<<<<<<< HEAD int *mask = atom->mask; +======= +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 double **sp = atom->sp; double **fm = atom->fm; double tdampx,tdampy,tdampz; double msq,scale,fm2,energy,dts2; double cp[3],g[3]; +<<<<<<< HEAD dts2 = dts*dts; +======= + dts2 = dts*dts; +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 // loop on all spins on proc. for (int i = 0; i < nlocal; i++) { +<<<<<<< HEAD // calc. damping torque @@ -280,22 +338,59 @@ void MinSpin::advance_spins(double dts) g[1] += (tdampy*energy-0.5*sp[i][1]*fm2)*0.5*dts2; g[2] += (tdampz*energy-0.5*sp[i][2]*fm2)*0.5*dts2; +======= + + // calc. damping torque + + tdampx = -alpha_damp*(fm[i][1]*sp[i][2] - fm[i][2]*sp[i][1]); + tdampy = -alpha_damp*(fm[i][2]*sp[i][0] - fm[i][0]*sp[i][2]); + tdampz = -alpha_damp*(fm[i][0]*sp[i][1] - fm[i][1]*sp[i][0]); + + // apply advance algorithm (geometric, norm preserving) + + fm2 = (tdampx*tdampx+tdampy*tdampy+tdampz*tdampz); + energy = (sp[i][0]*tdampx)+(sp[i][1]*tdampy)+(sp[i][2]*tdampz); + + cp[0] = tdampy*sp[i][2]-tdampz*sp[i][1]; + cp[1] = tdampz*sp[i][0]-tdampx*sp[i][2]; + cp[2] = tdampx*sp[i][1]-tdampy*sp[i][0]; + + g[0] = sp[i][0]+cp[0]*dts; + g[1] = sp[i][1]+cp[1]*dts; + g[2] = sp[i][2]+cp[2]*dts; + + g[0] += (tdampx*energy-0.5*sp[i][0]*fm2)*0.5*dts2; + g[1] += (tdampy*energy-0.5*sp[i][1]*fm2)*0.5*dts2; + g[2] += (tdampz*energy-0.5*sp[i][2]*fm2)*0.5*dts2; + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 g[0] /= (1+0.25*fm2*dts2); g[1] /= (1+0.25*fm2*dts2); g[2] /= (1+0.25*fm2*dts2); sp[i][0] = g[0]; sp[i][1] = g[1]; +<<<<<<< HEAD sp[i][2] = g[2]; // renormalization (check if necessary) +======= + sp[i][2] = g[2]; + + // renormalization (check if necessary) + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 msq = g[0]*g[0] + g[1]*g[1] + g[2]*g[2]; scale = 1.0/sqrt(msq); sp[i][0] *= scale; sp[i][1] *= scale; sp[i][2] *= scale; +<<<<<<< HEAD +======= + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 // no comm. to atoms with same tag // because no need for simplecticity } @@ -307,16 +402,23 @@ void MinSpin::advance_spins(double dts) double MinSpin::fmnorm_sqr() { +<<<<<<< HEAD int i,n; double *fmatom; +======= +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 int nlocal = atom->nlocal; double tx,ty,tz; double **sp = atom->sp; double **fm = atom->fm; // calc. magnetic torques +<<<<<<< HEAD +======= + +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 double local_norm2_sqr = 0.0; for (int i = 0; i < nlocal; i++) { tx = (fm[i][1]*sp[i][2] - fm[i][2]*sp[i][1]); @@ -325,11 +427,19 @@ double MinSpin::fmnorm_sqr() local_norm2_sqr += tx*tx + ty*ty + tz*tz; } +<<<<<<< HEAD // no extra atom calc. for spins if (nextra_atom) error->all(FLERR,"extra atom option not available yet"); +======= + + // no extra atom calc. for spins + + if (nextra_atom) + error->all(FLERR,"extra atom option not available yet"); +>>>>>>> e2e4fe2cf7a95a04ae6a7de93d9b72ad56f0b620 double norm2_sqr = 0.0; MPI_Allreduce(&local_norm2_sqr,&norm2_sqr,1,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/SPIN/min_spin.h b/src/SPIN/min_spin.h index 569bcbaab2..224d205000 100644 --- a/src/SPIN/min_spin.h +++ b/src/SPIN/min_spin.h @@ -45,7 +45,7 @@ class MinSpin : public Min { double dts; double alpha_damp; // damping for spin minimization - double discret_factor; // factor for spin timestep evaluation + double discrete_factor; // factor for spin timestep evaluation double *spvec; // variables for atomic dof, as 1d vector double *fmvec; // variables for atomic dof, as 1d vector diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index e54864e126..5e9ff7a39e 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -173,9 +173,8 @@ void PairSpinDmi::init_style() if (strcmp(modify->fix[ifix]->style,"nve/spin") == 0) break; ifix++; } - // test remove if test - //if (ifix == modify->nfix) - // error->all(FLERR,"pair/spin style requires nve/spin"); + if ((ifix == modify->nfix) && (comm->me == 0)) + error->warning(FLERR,"Using pair/spin style without nve/spin"); // get the lattice_flag from nve/spin @@ -234,13 +233,12 @@ void PairSpinDmi::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; double **fm = atom->fm; - double **sp = atom->sp; + double **sp = atom->sp; int *type = atom->type; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -297,32 +295,32 @@ void PairSpinDmi::compute(int eflag, int vflag) // compute dmi interaction if (rsq <= local_cut2) { - compute_dmi(i,j,eij,fmi,spj); - if (lattice_flag) { - compute_dmi_mech(i,j,rsq,eij,fi,spi,spj); - } + compute_dmi(i,j,eij,fmi,spj); + if (lattice_flag) { + compute_dmi_mech(i,j,rsq,eij,fi,spi,spj); + } } - f[i][0] += fi[0]; - f[i][1] += fi[1]; + f[i][0] += fi[0]; + f[i][1] += fi[1]; f[i][2] += fi[2]; - fm[i][0] += fmi[0]; - fm[i][1] += fmi[1]; + fm[i][0] += fmi[0]; + fm[i][1] += fmi[1]; fm[i][2] += fmi[2]; if (newton_pair || j < nlocal) { - f[j][0] -= fi[0]; - f[j][1] -= fi[1]; + f[j][0] -= fi[0]; + f[j][1] -= fi[1]; f[j][2] -= fi[2]; } if (eflag) { - evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]); - evdwl *= hbar; + evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]); + evdwl *= hbar; } else evdwl = 0.0; if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair, - evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz); + evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz); } } @@ -344,7 +342,7 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3]) double delx,dely,delz; double spj[3]; - int i,j,jnum,itype,jtype,ntypes; + int j,jnum,itype,jtype,ntypes; int k,locflag; int *jlist,*numneigh,**firstneigh; @@ -352,7 +350,7 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3]) numneigh = list->numneigh; firstneigh = list->firstneigh; - + // check if interaction applies to type of ii itype = type[ii]; @@ -362,20 +360,20 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3]) while (k <= ntypes) { if (k <= itype) { if (setflag[k][itype] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else if (k > itype) { if (setflag[itype][k] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else error->all(FLERR,"Wrong type number"); } - // if interaction applies to type ii, + // if interaction applies to type ii, // locflag = 1 and compute pair interaction //i = ilist[ii]; @@ -424,7 +422,7 @@ void PairSpinDmi::compute_dmi(int i, int j, double eij[3], double fmi[3], double { int *type = atom->type; int itype, jtype; - double dmix, dmiy, dmiz; + double dmix, dmiy, dmiz; itype = type[i]; jtype = type[j]; @@ -446,7 +444,7 @@ void PairSpinDmi::compute_dmi_mech(int i, int j, double rsq, double /*eij*/[3], { int *type = atom->type; int itype, jtype; - double dmix,dmiy,dmiz; + double dmix,dmiy,dmiz; itype = type[i]; jtype = type[j]; double csx,csy,csz,cdmx,cdmy,cdmz,irij; @@ -511,7 +509,7 @@ void PairSpinDmi::write_restart(FILE *fp) for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j],sizeof(int),1,fp); if (setflag[i][j]) { - fwrite(&DM[i][j],sizeof(double),1,fp); + fwrite(&DM[i][j],sizeof(double),1,fp); fwrite(&v_dmx[i][j],sizeof(double),1,fp); fwrite(&v_dmy[i][j],sizeof(double),1,fp); fwrite(&v_dmz[i][j],sizeof(double),1,fp); diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 07543c559e..71b4c2ebf6 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -161,9 +161,8 @@ void PairSpinExchange::init_style() if (strcmp(modify->fix[ifix]->style,"neb/spin") == 0) break; ifix++; } - // test remove if test - //if (ifix == modify->nfix) - // error->all(FLERR,"pair/spin style requires nve/spin"); + if ((ifix == modify->nfix) && (comm->me == 0)) + error->warning(FLERR,"Using pair/spin style without nve/spin"); // get the lattice_flag from nve/spin @@ -220,13 +219,12 @@ void PairSpinExchange::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; double **fm = atom->fm; - double **sp = atom->sp; + double **sp = atom->sp; int *type = atom->type; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; @@ -281,32 +279,32 @@ void PairSpinExchange::compute(int eflag, int vflag) // compute exchange interaction if (rsq <= local_cut2) { - compute_exchange(i,j,rsq,fmi,spj); + compute_exchange(i,j,rsq,fmi,spj); if (lattice_flag) { - compute_exchange_mech(i,j,rsq,eij,fi,spi,spj); - } + compute_exchange_mech(i,j,rsq,eij,fi,spi,spj); + } } - f[i][0] += fi[0]; - f[i][1] += fi[1]; + f[i][0] += fi[0]; + f[i][1] += fi[1]; f[i][2] += fi[2]; - fm[i][0] += fmi[0]; - fm[i][1] += fmi[1]; + fm[i][0] += fmi[0]; + fm[i][1] += fmi[1]; fm[i][2] += fmi[2]; if (newton_pair || j < nlocal) { - f[j][0] -= fi[0]; - f[j][1] -= fi[1]; + f[j][0] -= fi[0]; + f[j][1] -= fi[1]; f[j][2] -= fi[2]; } if (eflag) { - evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]); - evdwl *= hbar; + evdwl -= (spi[0]*fmi[0] + spi[1]*fmi[1] + spi[2]*fmi[2]); + evdwl *= hbar; } else evdwl = 0.0; if (evflag) ev_tally_xyz(i,j,nlocal,newton_pair, - evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz); + evdwl,ecoul,fi[0],fi[1],fi[2],delx,dely,delz); } } @@ -328,7 +326,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3]) double delx,dely,delz; double spj[3]; - int i,j,jnum,itype,jtype,ntypes; + int j,jnum,itype,jtype,ntypes; int k,locflag; int *jlist,*numneigh,**firstneigh; @@ -346,24 +344,24 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3]) while (k <= ntypes) { if (k <= itype) { if (setflag[k][itype] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else if (k > itype) { if (setflag[itype][k] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else error->all(FLERR,"Wrong type number"); } - // if interaction applies to type ii, + // if interaction applies to type ii, // locflag = 1 and compute pair interaction if (locflag == 1) { - + xi[0] = x[ii][0]; xi[1] = x[ii][1]; xi[2] = x[ii][2]; @@ -391,7 +389,7 @@ void PairSpinExchange::compute_single_pair(int ii, double fmi[3]) compute_exchange(ii,j,rsq,fmi,spj); } } - } + } } /* ---------------------------------------------------------------------- diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index a7357f61e3..6ff003521d 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -166,8 +166,8 @@ void PairSpinMagelec::init_style() if (strcmp(modify->fix[ifix]->style,"nve/spin") == 0) break; ifix++; } - if (ifix == modify->nfix) - error->all(FLERR,"pair/spin style requires nve/spin"); + if ((ifix == modify->nfix) && (comm->me == 0)) + error->warning(FLERR,"Using pair/spin style without nve/spin"); // get the lattice_flag from nve/spin @@ -225,8 +225,7 @@ void PairSpinMagelec::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -333,7 +332,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3]) double delx,dely,delz; double spj[3]; - int i,j,jnum,itype,jtype,ntypes; + int j,jnum,itype,jtype,ntypes; int k,locflag; int *jlist,*numneigh,**firstneigh; @@ -341,7 +340,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3]) numneigh = list->numneigh; firstneigh = list->firstneigh; - + // check if interaction applies to type of ii itype = type[ii]; @@ -351,42 +350,42 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3]) while (k <= ntypes) { if (k <= itype) { if (setflag[k][itype] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else if (k > itype) { if (setflag[itype][k] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else error->all(FLERR,"Wrong type number"); } - // if interaction applies to type ii, + // if interaction applies to type ii, // locflag = 1 and compute pair interaction if (locflag == 1) { - + xi[0] = x[ii][0]; xi[1] = x[ii][1]; xi[2] = x[ii][2]; - + jlist = firstneigh[ii]; jnum = numneigh[ii]; - + for (int jj = 0; jj < jnum; jj++) { - + j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; local_cut2 = cut_spin_magelec[itype][jtype]*cut_spin_magelec[itype][jtype]; - + spj[0] = sp[j][0]; spj[1] = sp[j][1]; spj[2] = sp[j][2]; - + delx = xi[0] - x[j][0]; dely = xi[1] - x[j][1]; delz = xi[2] - x[j][2]; @@ -395,7 +394,7 @@ void PairSpinMagelec::compute_single_pair(int ii, double fmi[3]) eij[0] = -inorm*delx; eij[1] = -inorm*dely; eij[2] = -inorm*delz; - + if (rsq <= local_cut2) { compute_magelec(ii,j,eij,fmi,spj); } diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index bd12832a8d..a39d6f3461 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -173,8 +173,8 @@ void PairSpinNeel::init_style() if (strcmp(modify->fix[ifix]->style,"nve/spin") == 0) break; ifix++; } - if (ifix == modify->nfix) - error->all(FLERR,"pair/spin style requires nve/spin"); + if ((ifix == modify->nfix) && (comm->me == 0)) + error->warning(FLERR,"Using pair/spin style without nve/spin"); // get the lattice_flag from nve/spin @@ -232,8 +232,7 @@ void PairSpinNeel::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -344,7 +343,7 @@ void PairSpinNeel::compute_single_pair(int ii, double fmi[3]) double xi[3], rij[3], eij[3]; double spi[3], spj[3]; - int i,j,jnum,itype,jtype,ntypes; + int j,jnum,itype,jtype,ntypes; int k,locflag; int *jlist,*numneigh,**firstneigh; @@ -352,7 +351,7 @@ void PairSpinNeel::compute_single_pair(int ii, double fmi[3]) numneigh = list->numneigh; firstneigh = list->firstneigh; - + // check if interaction applies to type of ii itype = type[ii]; @@ -362,20 +361,20 @@ void PairSpinNeel::compute_single_pair(int ii, double fmi[3]) while (k <= ntypes) { if (k <= itype) { if (setflag[k][itype] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else if (k > itype) { if (setflag[itype][k] == 1) { - locflag =1; - break; + locflag =1; + break; } k++; } else error->all(FLERR,"Wrong type number"); } - // if interaction applies to type ii, + // if interaction applies to type ii, // locflag = 1 and compute pair interaction if (locflag == 1) { diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 806e4f3a14..1b7bf35c28 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -108,10 +108,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) // pvector = [KE, Pauli, ecoul, radial_restraint] for (int i=0; i<4; i++) pvector[i] = 0.0; - if (eflag || vflag) - ev_setup(eflag,vflag); - else - evflag = vflag_fdotr = 0; //?? + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index 34a25a9b5a..8271668e3f 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -96,8 +96,7 @@ void BondOxdnaFene::compute(int eflag, int vflag) int newton_bond = force->newton_bond; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // loop over FENE bonds diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 0b220a3275..f54197aea7 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -144,8 +144,7 @@ void PairOxdna2Coaxstk::compute(int eflag, int vflag) double df2,df4f6t1,df4t4,df4t5,df4t6,rsint; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index da6e1f8bbd..10e7121427 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -114,8 +114,7 @@ void PairOxdna2Dh::compute(int eflag, int vflag) int a,b,ia,ib,anum,bnum,atype,btype; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index ef0ff16150..6d3061620d 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -156,8 +156,7 @@ void PairOxdnaCoaxstk::compute(int eflag, int vflag) double df2,df4t1,df4t4,df4t5,df4t6,df5c3,rsint; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index 719a63b5f4..82af5ed1c7 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -144,8 +144,7 @@ void PairOxdnaExcv::compute(int eflag, int vflag) int a,b,ia,ib,anum,bnum,atype,btype; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index d8305e30de..d2aa236a05 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -161,8 +161,7 @@ void PairOxdnaHbond::compute(int eflag, int vflag) double df1,df4t1,df4t4,df4t2,df4t3,df4t7,df4t8; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index f713e4d27c..4cbc0317dd 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -154,8 +154,7 @@ void PairOxdnaStk::compute(int eflag, int vflag) double tptofp; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // loop over stacking interaction neighours using bond topology diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index a354a604fd..071886556c 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -153,8 +153,7 @@ void PairOxdnaXstk::compute(int eflag, int vflag) double df2,df4t1,df4t4,df4t2,df4t3,df4t7,df4t8,rsint; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); anum = list->inum; alist = list->ilist; diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 6b8245b491..823c725e07 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -68,8 +68,7 @@ void AngleSDK::compute(int eflag, int vflag) double rsq1,rsq2,rsq3,r1,r2,c,s,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 3404beb58a..7dd6c04436 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -78,9 +78,7 @@ PairLJSDK::~PairLJSDK() void PairLJSDK::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index c51235518b..33a1659df9 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -90,9 +90,7 @@ PairLJSDKCoulLong::~PairLJSDKCoulLong() void PairLJSDKCoulLong::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp index c4882fdbdb..d26f8efcdc 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp @@ -57,9 +57,7 @@ void PairLJSDKCoulMSM::compute(int eflag, int vflag) if (force->kspace->scalar_pressure_flag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' with Pair style"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (evflag) { if (eflag) { diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 12e6d9f257..07ef8190f0 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -76,8 +76,7 @@ void PairDPDfdt::compute(int eflag, int vflag) double gamma_ij; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index 42c23e3ad2..12e6989c00 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -85,8 +85,7 @@ void PairDPDfdtEnergy::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 0251f019c5..13521b52b1 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -121,8 +121,7 @@ void PairExp6rx::compute(int eflag, int vflag) evdwlOld = 0.0; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 19a4a02f0b..ffc1562f88 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -95,8 +95,7 @@ void PairMultiLucy::compute(int eflag, int vflag) int tlm1 = tablength - 1; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index f3ad86eb2f..801e8ff039 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -111,8 +111,7 @@ void PairMultiLucyRX::compute(int eflag, int vflag) evdwlOld = 0.0; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index 1e7bc440d1..f2d0d7b1fb 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -78,8 +78,7 @@ void PairTableRX::compute(int eflag, int vflag) evdwlOld = 0.0; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index f9da40dfb9..1ebe4a4c2d 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -98,8 +98,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) int di_closest; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 5a518d819b..1bb75af825 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -64,8 +64,7 @@ void PairThole::compute(int eflag, int vflag) double dcoul,asr,exp_asr; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index b4e9011e33..f566922ef7 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -81,8 +81,7 @@ void PairEffCut::compute(int eflag, int vflag) // pvector = [KE, Pauli, ecoul, radial_restraint] for (i=0; i<4; i++) pvector[i] = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index 529ffe6b09..86a6d02819 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -60,8 +60,7 @@ void PairCoulCutSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index e45dbe72d6..9d3ffc0da1 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -78,8 +78,7 @@ void PairCoulLongSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index 34758b159b..ac6f1e6384 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -92,8 +92,7 @@ void PairLJCharmmCoulLongSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -415,8 +414,7 @@ void PairLJCharmmCoulLongSoft::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index 7970097cfe..ae79515488 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -39,24 +39,24 @@ PairLJClass2CoulCutSoft::PairLJClass2CoulCutSoft(LAMMPS *lmp) : Pair(lmp) PairLJClass2CoulCutSoft::~PairLJClass2CoulCutSoft() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(cut_coul); - memory->destroy(cut_coulsq); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lambda); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(cut_coul); + memory->destroy(cut_coulsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lambda); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } } @@ -72,8 +72,7 @@ void PairLJClass2CoulCutSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index 13096a64c6..6410f83fa1 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -49,22 +49,22 @@ PairLJClass2CoulLongSoft::PairLJClass2CoulLongSoft(LAMMPS *lmp) : Pair(lmp) PairLJClass2CoulLongSoft::~PairLJClass2CoulLongSoft() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lambda); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lambda); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } } @@ -82,8 +82,7 @@ void PairLJClass2CoulLongSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index b7f21fc59c..d22cd53883 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -32,28 +32,26 @@ using namespace MathConst; PairLJClass2Soft::PairLJClass2Soft(LAMMPS *lmp) : Pair(lmp) { writedata = 1; - allocated = 0; } /* ---------------------------------------------------------------------- */ PairLJClass2Soft::~PairLJClass2Soft() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lambda); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(offset); - allocated=0; - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lambda); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(offset); } } @@ -68,8 +66,7 @@ void PairLJClass2Soft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index fc887fbec5..35c9162dbc 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -73,8 +73,7 @@ void PairLJCutCoulCutSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index a9032ab4d7..79253d2b9c 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -89,8 +89,7 @@ void PairLJCutCoulLongSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -390,8 +389,7 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 1322565473..4192d6546b 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -77,8 +77,7 @@ void PairLJCutSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -323,8 +322,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 8653800ee6..8ac28f9fa9 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -92,8 +92,7 @@ void PairLJCutTIP4PLongSoft::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index f4c5a4b910..21f616a082 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -53,8 +53,7 @@ void PairMorseSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index 5e8c5000f8..9b6a6841fe 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -91,8 +91,7 @@ void PairTIP4PLongSoft::compute(int eflag, int vflag) double rsq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh & newsite if necessary // initialize hneigh[0] to -1 on steps when reneighboring occurred diff --git a/src/USER-INTEL/angle_charmm_intel.cpp b/src/USER-INTEL/angle_charmm_intel.cpp index f2542fc0c7..c5ada951a5 100644 --- a/src/USER-INTEL/angle_charmm_intel.cpp +++ b/src/USER-INTEL/angle_charmm_intel.cpp @@ -78,8 +78,7 @@ void AngleCharmmIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/angle_harmonic_intel.cpp b/src/USER-INTEL/angle_harmonic_intel.cpp index 6d8901a5ee..aae6fcf0a2 100644 --- a/src/USER-INTEL/angle_harmonic_intel.cpp +++ b/src/USER-INTEL/angle_harmonic_intel.cpp @@ -78,8 +78,7 @@ void AngleHarmonicIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/bond_fene_intel.cpp b/src/USER-INTEL/bond_fene_intel.cpp index bff3722a44..bd8bc94c18 100644 --- a/src/USER-INTEL/bond_fene_intel.cpp +++ b/src/USER-INTEL/bond_fene_intel.cpp @@ -74,8 +74,7 @@ void BondFENEIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/bond_harmonic_intel.cpp b/src/USER-INTEL/bond_harmonic_intel.cpp index 65894efa05..4424b868eb 100644 --- a/src/USER-INTEL/bond_harmonic_intel.cpp +++ b/src/USER-INTEL/bond_harmonic_intel.cpp @@ -74,8 +74,7 @@ void BondHarmonicIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/dihedral_charmm_intel.cpp b/src/USER-INTEL/dihedral_charmm_intel.cpp index c9237e7309..4f4b091300 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.cpp +++ b/src/USER-INTEL/dihedral_charmm_intel.cpp @@ -84,9 +84,7 @@ void DihedralCharmmIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/USER-INTEL/dihedral_fourier_intel.cpp b/src/USER-INTEL/dihedral_fourier_intel.cpp index 6ccc165c61..030d371e44 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.cpp +++ b/src/USER-INTEL/dihedral_fourier_intel.cpp @@ -73,9 +73,7 @@ void DihedralFourierIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/dihedral_harmonic_intel.cpp b/src/USER-INTEL/dihedral_harmonic_intel.cpp index ae5eb914e7..d84db4f4ac 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.cpp +++ b/src/USER-INTEL/dihedral_harmonic_intel.cpp @@ -73,9 +73,7 @@ void DihedralHarmonicIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/dihedral_opls_intel.cpp b/src/USER-INTEL/dihedral_opls_intel.cpp index 7a60b62cae..eae796974b 100644 --- a/src/USER-INTEL/dihedral_opls_intel.cpp +++ b/src/USER-INTEL/dihedral_opls_intel.cpp @@ -77,9 +77,7 @@ void DihedralOPLSIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/improper_cvff_intel.cpp b/src/USER-INTEL/improper_cvff_intel.cpp index 03bd134b40..de316250c0 100644 --- a/src/USER-INTEL/improper_cvff_intel.cpp +++ b/src/USER-INTEL/improper_cvff_intel.cpp @@ -83,8 +83,7 @@ void ImproperCvffIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/improper_harmonic_intel.cpp b/src/USER-INTEL/improper_harmonic_intel.cpp index 167095150e..846c3cfbf9 100644 --- a/src/USER-INTEL/improper_harmonic_intel.cpp +++ b/src/USER-INTEL/improper_harmonic_intel.cpp @@ -84,8 +84,7 @@ void ImproperHarmonicIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index 198f8798fa..f330e3ec86 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -292,8 +292,7 @@ template void PairAIREBOIntel::compute( int eflag, int vflag, IntelBuffers * buffers ) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); pvector[0] = pvector[1] = pvector[2] = 0.0; const int inum = list->inum; diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index f82f4c1c7a..3f2d64fb93 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -73,9 +73,7 @@ void PairBuckCoulCutIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index 059413c3d9..2ddcd55663 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -73,9 +73,7 @@ void PairBuckCoulLongIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index 0e0bd0f56f..34af3462e2 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -66,9 +66,7 @@ void PairBuckIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_dpd_intel.cpp b/src/USER-INTEL/pair_dpd_intel.cpp index 5d67a60c4b..016f3b5ca0 100644 --- a/src/USER-INTEL/pair_dpd_intel.cpp +++ b/src/USER-INTEL/pair_dpd_intel.cpp @@ -82,9 +82,7 @@ void PairDPDIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_eam_intel.cpp b/src/USER-INTEL/pair_eam_intel.cpp index 95d0272d33..7f4806c87c 100644 --- a/src/USER-INTEL/pair_eam_intel.cpp +++ b/src/USER-INTEL/pair_eam_intel.cpp @@ -78,9 +78,7 @@ void PairEAMIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index 51524355d5..1d9ee7d4cd 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -72,9 +72,7 @@ void PairGayBerneIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); const int inum = list->inum; const int nall = atom->nlocal + atom->nghost; diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index 0b6ac3ffa5..9689c0bf50 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -66,9 +66,7 @@ void PairLJCharmmCoulCharmmIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index 753a9afdd9..8de4ced549 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -70,9 +70,7 @@ void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 35ed9061ce..8ad1823d97 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -71,9 +71,7 @@ void PairLJCutCoulLongIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index 94133a7f47..74dae7e096 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -62,9 +62,7 @@ void PairLJCutIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 9e00516087..8482895fb6 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -95,9 +95,7 @@ void PairSWIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 5d4c5f2cb6..668cb0cf33 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -107,9 +107,7 @@ void PairTersoffIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int inum = list->inum; const int nthreads = comm->nthreads; diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 795fe1a47d..9d075c78a1 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -174,9 +174,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) int i; // convert atoms from box to lamda coords - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index 59455bcf52..e3d1e7d4aa 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -161,9 +161,7 @@ void PPPMIntel::compute_first(int eflag, int vflag) // set energy/virial flags // invoke allocate_peratom() if needed for first time - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); if (evflag_atom && !peratom_allocate_flag) { allocate_peratom(); diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index b74416a46d..3a934694bf 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -93,9 +93,7 @@ void PairMEAMC::compute(int eflag, int vflag) int *ilist_half,*numneigh_half,**firstneigh_half; int *numneigh_full,**firstneigh_full; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // neighbor list info diff --git a/src/USER-MESO/pair_edpd.cpp b/src/USER-MESO/pair_edpd.cpp index 1f6222944a..e428b02822 100644 --- a/src/USER-MESO/pair_edpd.cpp +++ b/src/USER-MESO/pair_edpd.cpp @@ -99,8 +99,7 @@ PairEDPD::~PairEDPD() void PairEDPD::compute(int eflag, int vflag) { double evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/USER-MESO/pair_mdpd.cpp b/src/USER-MESO/pair_mdpd.cpp index f9acd3dbe1..4102499d46 100644 --- a/src/USER-MESO/pair_mdpd.cpp +++ b/src/USER-MESO/pair_mdpd.cpp @@ -88,8 +88,7 @@ void PairMDPD::compute(int eflag, int vflag) double rhoi, rhoj; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/USER-MESO/pair_mdpd_rhosum.cpp b/src/USER-MESO/pair_mdpd_rhosum.cpp index 806a63f898..2fd238088c 100644 --- a/src/USER-MESO/pair_mdpd_rhosum.cpp +++ b/src/USER-MESO/pair_mdpd_rhosum.cpp @@ -84,10 +84,7 @@ void PairMDPDRhoSum::compute(int eflag, int vflag) { // neighbor list variables int inum, *ilist, *numneigh, **firstneigh; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **x = atom->x; double *rho = atom->rho; diff --git a/src/USER-MESO/pair_tdpd.cpp b/src/USER-MESO/pair_tdpd.cpp index a41282c0d8..7df9d6d163 100644 --- a/src/USER-MESO/pair_tdpd.cpp +++ b/src/USER-MESO/pair_tdpd.cpp @@ -91,8 +91,7 @@ PairTDPD::~PairTDPD() void PairTDPD::compute(int eflag, int vflag) { double evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 347bc9cc69..91c624eec5 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -1673,8 +1673,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, void PairMGPT::compute(int eflag, int vflag) { - if(eflag || vflag) ev_setup(eflag, vflag); - else evflag = vflag_fdotr = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag, vflag); int newton_pair = force->newton_pair; double e_s,e_p,e_t,e_q; diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index a361db4970..18c87c81e3 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -62,8 +62,7 @@ void AngleCosineShift::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,s,cps,kcos,ksin,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index c87c73171a..8c6282de20 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -72,8 +72,7 @@ void AngleCosineShiftExp::compute(int eflag, int vflag) double exp2,aa,uumin,cccpsss,cssmscc; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index c4186da472..781da46869 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -59,8 +59,7 @@ void AngleDipole::compute(int eflag, int vflag) double r,cosGamma,deltaGamma,kdg,rmu; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; // position vector double **mu = atom->mu; // point-dipole components and moment magnitude diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index e6cc1f1a7e..8f5074ff5d 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -67,8 +67,7 @@ void AngleFourier::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,c2,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index 8464fe815c..615556bbe7 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -65,8 +65,7 @@ void AngleFourierSimple::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,cn,th,nth,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 356f2df5d4..21a96100aa 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -61,8 +61,7 @@ void AngleQuartic::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index b34f71e888..c7e4444cce 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -53,8 +53,7 @@ void BondHarmonicShift::compute(int eflag, int vflag) double rsq,r,dr,rk; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index a58df70878..5b396f5d72 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -53,8 +53,7 @@ void BondHarmonicShiftCut::compute(int eflag, int vflag) double rsq,r,dr,rk; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 6a04228226..c411ea8150 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -71,8 +71,7 @@ void DihedralCosineShiftExp::compute(int eflag, int vflag) double cccpsss,cssmscc,exp2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 7c405ee28c..af86259c01 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -79,8 +79,7 @@ void DihedralFourier::compute(int eflag, int vflag) double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz; double c,s,p_,sx2,sy2,sz2; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index aa3f6a6f3e..ea2b76f415 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -67,8 +67,7 @@ void DihedralNHarmonic::compute(int eflag, int vflag) double s2,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index c9bce4f02c..8436e73c5c 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -68,8 +68,7 @@ void DihedralQuadratic::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 8ce58243ac..3b30121551 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -216,8 +216,7 @@ void DihedralSpherical::compute(int eflag, int vflag) // perp34on23[d] = v34[d] - proj34on23[d] edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (n = 0; n < ndihedrallist; n++) { diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index e221a54a82..a97ae3649f 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -549,8 +549,7 @@ void DihedralTable::compute(int eflag, int vflag) edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (n = 0; n < ndihedrallist; n++) { diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index e9596df6c8..18a645cd75 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -461,8 +461,7 @@ void DihedralTableCut::compute(int eflag, int vflag) double fabcd[4][3]; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index 2483840e42..c8eb0808fb 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -63,8 +63,7 @@ void ImproperCossq::compute(int eflag, int vflag) eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 2edf37ec5c..50babcc84e 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -67,8 +67,7 @@ void ImproperDistance::compute(int eflag, int vflag) double domega,a; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index 927478fa1a..288d888d12 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -59,8 +59,7 @@ void ImproperFourier::compute(int eflag, int vflag) int i1,i2,i3,i4,n,type; double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; int **improperlist = neighbor->improperlist; diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index 70124b2ed1..36ba73af0f 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -95,8 +95,7 @@ void ImproperRing::compute(int eflag, int vflag) double cjiji, ckjji, ckjkj, fix, fiy, fiz, fjx, fjy, fjz, fkx, fky, fkz; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); /* References to simulation data. */ double **x = atom->x; diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 0277969d15..21a6f1deee 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -136,8 +136,7 @@ void PairAGNI::compute(int eflag, int vflag) double rsq; int *ilist,*jlist,*numneigh,**firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 38de1c7c50..b5e81417ee 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -68,8 +68,7 @@ void PairBuckMDF::compute(int eflag, int vflag) double dp, d, tt, dt, dd; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index 0154e89731..a86921d296 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -58,8 +58,7 @@ void PairCoulDiel::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 11df975c19..f74dcfe7d8 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -64,8 +64,7 @@ void PairCoulShield::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 491268567f..0b5220fdfd 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -149,8 +149,7 @@ void PairEDIP::compute(int eflag, int vflag) double potential2B_factor; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index f56650d2f6..ab48fbaa73 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -118,8 +118,7 @@ void PairEDIPMulti::compute(int eflag, int vflag) // vflag != 0 means compute virial contributions in this step evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 364fd45016..132b857dde 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -190,8 +190,7 @@ void PairExTeP::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); SR_neigh(); diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index a000eff028..24d0b191d8 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -69,8 +69,7 @@ void PairGaussCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 6257c1d72b..d1b8a3be38 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -117,8 +117,7 @@ void PairILPGrapheneHBN::compute(int eflag, int vflag) int *ILP_neighs_i,*ILP_neighs_j; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index cbcf6c7934..289ed19bd3 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -115,8 +115,7 @@ void PairKolmogorovCrespiFull::compute(int eflag, int vflag) int *KC_neighs_i,*KC_neighs_j; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index e9583032fe..dcea990a3b 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -87,8 +87,7 @@ void PairKolmogorovCrespiZ::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index 5153857c2f..0ab22e04c1 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -87,8 +87,7 @@ void PairLebedevaZ::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 4bc2da23f8..b51639e80e 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -65,8 +65,7 @@ void PairLJ_AB_MDF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index aaeb586c1d..562a60aa99 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -80,9 +80,7 @@ PairList::~PairList() void PairList::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = - vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int newton_pair = force->newton_pair; diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 79a3c2a497..fe21538f2d 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -91,8 +91,7 @@ void PairLJExpandCoulLong::compute(int eflag, int vflag) double rsq,rshift,rshiftsq,rshift2inv; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -412,8 +411,7 @@ void PairLJExpandCoulLong::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index 4cd21b1dbe..ca0118ffb0 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -65,8 +65,7 @@ void PairLJMDF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index 523b2ca71a..af7d23370d 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -79,8 +79,7 @@ void PairLJSFDipoleSF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 0300e2c7a2..f09919ce0f 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -103,12 +103,7 @@ void PairMEAMSpline::compute(int eflag, int vflag) double* const * const forces = atom->f; const int ntypes = atom->ntypes; - if (eflag || vflag) { - ev_setup(eflag, vflag); - } else { - evflag = vflag_fdotr = eflag_global = 0; - vflag_global = eflag_atom = vflag_atom = 0; - } + ev_init(eflag, vflag); // Grow per-atom array if necessary diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index e17c13865d..af1e8788bd 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -85,9 +85,7 @@ PairMEAMSWSpline::~PairMEAMSWSpline() void PairMEAMSWSpline::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag, vflag); - else evflag = vflag_fdotr = - eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag, vflag); double cutforcesq = cutoff*cutoff; diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index 927181ebf6..1716149a98 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -81,8 +81,7 @@ void PairMomb::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index a88e7a1a27..7c7973f830 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -60,8 +60,7 @@ void PairMorseSmoothLinear::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index 8f34e846c5..01deaf0fbe 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -143,10 +143,7 @@ void PairSRP::compute(int eflag, int vflag) { // setup energy and virial - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index d1044cc336..e0985d1dce 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -117,8 +117,7 @@ void PairTersoffTable::compute(int eflag, int vflag) double evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index d2a6e21e6b..e8e6f279de 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -79,8 +79,7 @@ void AngleClass2P6::compute(int eflag, int vflag) double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index f358097802..3829d2b8dc 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -69,8 +69,7 @@ void AngleCosineBuck6d::compute(int eflag, int vflag) double rcu,rqu,sme,smf; eangle = evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-3 virial contribution diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index 8404984b53..3f1e61e54a 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -66,8 +66,7 @@ void ImproperInversionHarmonic::compute(int eflag, int vflag) double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z; double rrvb1,rrvb2,rrvb3,rr2vb1,rr2vb2,rr2vb3; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; int **improperlist = neighbor->improperlist; diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 1fc4644420..282bb0c58f 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -48,29 +48,29 @@ PairBuck6dCoulGaussDSF::PairBuck6dCoulGaussDSF(LAMMPS *lmp) : Pair(lmp) PairBuck6dCoulGaussDSF::~PairBuck6dCoulGaussDSF() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(alpha_ij); - memory->destroy(f_shift_ij); - memory->destroy(e_shift_ij); - memory->destroy(buck6d1); - memory->destroy(buck6d2); - memory->destroy(buck6d3); - memory->destroy(buck6d4); - memory->destroy(c0); - memory->destroy(c1); - memory->destroy(c2); - memory->destroy(c3); - memory->destroy(c4); - memory->destroy(c5); - memory->destroy(rsmooth_sq); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(alpha_ij); + memory->destroy(f_shift_ij); + memory->destroy(e_shift_ij); + memory->destroy(buck6d1); + memory->destroy(buck6d2); + memory->destroy(buck6d3); + memory->destroy(buck6d4); + memory->destroy(c0); + memory->destroy(c1); + memory->destroy(c2); + memory->destroy(c3); + memory->destroy(c4); + memory->destroy(c5); + memory->destroy(rsmooth_sq); + memory->destroy(offset); } } @@ -87,8 +87,7 @@ void PairBuck6dCoulGaussDSF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index 1ca42d864e..d6a4121d21 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -51,27 +51,27 @@ PairBuck6dCoulGaussLong::PairBuck6dCoulGaussLong(LAMMPS *lmp) : Pair(lmp) PairBuck6dCoulGaussLong::~PairBuck6dCoulGaussLong() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(alpha_ij); - memory->destroy(buck6d1); - memory->destroy(buck6d2); - memory->destroy(buck6d3); - memory->destroy(buck6d4); - memory->destroy(c0); - memory->destroy(c1); - memory->destroy(c2); - memory->destroy(c3); - memory->destroy(c4); - memory->destroy(c5); - memory->destroy(rsmooth_sq); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(alpha_ij); + memory->destroy(buck6d1); + memory->destroy(buck6d2); + memory->destroy(buck6d3); + memory->destroy(buck6d4); + memory->destroy(c0); + memory->destroy(c1); + memory->destroy(c2); + memory->destroy(c3); + memory->destroy(c4); + memory->destroy(c5); + memory->destroy(rsmooth_sq); + memory->destroy(offset); } } @@ -89,8 +89,7 @@ void PairBuck6dCoulGaussLong::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-OMP/angle_charmm_omp.cpp b/src/USER-OMP/angle_charmm_omp.cpp index 1f24438df3..118ba00226 100644 --- a/src/USER-OMP/angle_charmm_omp.cpp +++ b/src/USER-OMP/angle_charmm_omp.cpp @@ -44,10 +44,7 @@ using namespace MathConst; void AngleCharmmOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_class2_omp.cpp b/src/USER-OMP/angle_class2_omp.cpp index bd13e20bcc..e072d136e1 100644 --- a/src/USER-OMP/angle_class2_omp.cpp +++ b/src/USER-OMP/angle_class2_omp.cpp @@ -44,10 +44,7 @@ AngleClass2OMP::AngleClass2OMP(class LAMMPS *lmp) void AngleClass2OMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_delta_omp.cpp b/src/USER-OMP/angle_cosine_delta_omp.cpp index b3bb3e1f8a..a6dfb20433 100644 --- a/src/USER-OMP/angle_cosine_delta_omp.cpp +++ b/src/USER-OMP/angle_cosine_delta_omp.cpp @@ -44,10 +44,7 @@ AngleCosineDeltaOMP::AngleCosineDeltaOMP(class LAMMPS *lmp) void AngleCosineDeltaOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_omp.cpp b/src/USER-OMP/angle_cosine_omp.cpp index 04b3870bc4..9097c8569c 100644 --- a/src/USER-OMP/angle_cosine_omp.cpp +++ b/src/USER-OMP/angle_cosine_omp.cpp @@ -44,10 +44,7 @@ AngleCosineOMP::AngleCosineOMP(class LAMMPS *lmp) void AngleCosineOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_periodic_omp.cpp b/src/USER-OMP/angle_cosine_periodic_omp.cpp index 8060ebec7b..3fcea7ad1d 100644 --- a/src/USER-OMP/angle_cosine_periodic_omp.cpp +++ b/src/USER-OMP/angle_cosine_periodic_omp.cpp @@ -46,10 +46,7 @@ AngleCosinePeriodicOMP::AngleCosinePeriodicOMP(class LAMMPS *lmp) void AngleCosinePeriodicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp index 3e00681ec9..6bd2feb023 100644 --- a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp @@ -44,10 +44,7 @@ AngleCosineShiftExpOMP::AngleCosineShiftExpOMP(class LAMMPS *lmp) void AngleCosineShiftExpOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_shift_omp.cpp b/src/USER-OMP/angle_cosine_shift_omp.cpp index 0ab3df4359..56486faac1 100644 --- a/src/USER-OMP/angle_cosine_shift_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_omp.cpp @@ -44,10 +44,7 @@ AngleCosineShiftOMP::AngleCosineShiftOMP(class LAMMPS *lmp) void AngleCosineShiftOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_cosine_squared_omp.cpp b/src/USER-OMP/angle_cosine_squared_omp.cpp index a1b1ffdf1a..6dd2a3bb3b 100644 --- a/src/USER-OMP/angle_cosine_squared_omp.cpp +++ b/src/USER-OMP/angle_cosine_squared_omp.cpp @@ -44,10 +44,7 @@ AngleCosineSquaredOMP::AngleCosineSquaredOMP(class LAMMPS *lmp) void AngleCosineSquaredOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_dipole_omp.cpp b/src/USER-OMP/angle_dipole_omp.cpp index 92a5ba092e..da2e819ee2 100644 --- a/src/USER-OMP/angle_dipole_omp.cpp +++ b/src/USER-OMP/angle_dipole_omp.cpp @@ -45,10 +45,7 @@ AngleDipoleOMP::AngleDipoleOMP(class LAMMPS *lmp) void AngleDipoleOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (!force->newton_bond) error->all(FLERR,"'newton' flag for bonded interactions must be 'on'"); diff --git a/src/USER-OMP/angle_fourier_omp.cpp b/src/USER-OMP/angle_fourier_omp.cpp index dfc713c372..b2f9b47e05 100644 --- a/src/USER-OMP/angle_fourier_omp.cpp +++ b/src/USER-OMP/angle_fourier_omp.cpp @@ -44,10 +44,7 @@ AngleFourierOMP::AngleFourierOMP(class LAMMPS *lmp) void AngleFourierOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_fourier_simple_omp.cpp b/src/USER-OMP/angle_fourier_simple_omp.cpp index dea7a88723..93532a30e5 100644 --- a/src/USER-OMP/angle_fourier_simple_omp.cpp +++ b/src/USER-OMP/angle_fourier_simple_omp.cpp @@ -44,10 +44,7 @@ AngleFourierSimpleOMP::AngleFourierSimpleOMP(class LAMMPS *lmp) void AngleFourierSimpleOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_harmonic_omp.cpp b/src/USER-OMP/angle_harmonic_omp.cpp index 0a71e5c9dd..824b254287 100644 --- a/src/USER-OMP/angle_harmonic_omp.cpp +++ b/src/USER-OMP/angle_harmonic_omp.cpp @@ -44,10 +44,7 @@ AngleHarmonicOMP::AngleHarmonicOMP(class LAMMPS *lmp) void AngleHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_quartic_omp.cpp b/src/USER-OMP/angle_quartic_omp.cpp index 97a9b14f1d..fff08ddb39 100644 --- a/src/USER-OMP/angle_quartic_omp.cpp +++ b/src/USER-OMP/angle_quartic_omp.cpp @@ -44,10 +44,7 @@ AngleQuarticOMP::AngleQuarticOMP(class LAMMPS *lmp) void AngleQuarticOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_sdk_omp.cpp b/src/USER-OMP/angle_sdk_omp.cpp index 9383a9af83..e8c762092c 100644 --- a/src/USER-OMP/angle_sdk_omp.cpp +++ b/src/USER-OMP/angle_sdk_omp.cpp @@ -46,10 +46,7 @@ AngleSDKOMP::AngleSDKOMP(class LAMMPS *lmp) void AngleSDKOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/angle_table_omp.cpp b/src/USER-OMP/angle_table_omp.cpp index c3d2307489..d9d80b744d 100644 --- a/src/USER-OMP/angle_table_omp.cpp +++ b/src/USER-OMP/angle_table_omp.cpp @@ -44,10 +44,7 @@ AngleTableOMP::AngleTableOMP(class LAMMPS *lmp) void AngleTableOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 1f9bcaa320..fdd73c20b0 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -40,10 +40,7 @@ BondClass2OMP::BondClass2OMP(class LAMMPS *lmp) void BondClass2OMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index d002d454dd..a8eec11760 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -41,10 +41,7 @@ BondFENEExpandOMP::BondFENEExpandOMP(class LAMMPS *lmp) void BondFENEExpandOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index ba958e1d6f..be7dcd4b49 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -41,10 +41,7 @@ BondFENEOMP::BondFENEOMP(class LAMMPS *lmp) void BondFENEOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_gromos_omp.cpp b/src/USER-OMP/bond_gromos_omp.cpp index bcfde436d5..8f0926c0e9 100644 --- a/src/USER-OMP/bond_gromos_omp.cpp +++ b/src/USER-OMP/bond_gromos_omp.cpp @@ -39,10 +39,7 @@ BondGromosOMP::BondGromosOMP(class LAMMPS *lmp) void BondGromosOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index 46a93cbbdd..a3bb69c53c 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -39,10 +39,7 @@ BondHarmonicOMP::BondHarmonicOMP(class LAMMPS *lmp) void BondHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 5f39bb1b64..5c16e27a32 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -39,10 +39,7 @@ BondHarmonicShiftCutOMP::BondHarmonicShiftCutOMP(class LAMMPS *lmp) void BondHarmonicShiftCutOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 8c260bfc9b..39e957c137 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -39,10 +39,7 @@ BondHarmonicShiftOMP::BondHarmonicShiftOMP(class LAMMPS *lmp) void BondHarmonicShiftOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 0c3cded71a..c0203de0d6 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -39,10 +39,7 @@ BondMorseOMP::BondMorseOMP(class LAMMPS *lmp) void BondMorseOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index cdc70eac8d..8fa3daf8ab 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -39,10 +39,7 @@ BondNonlinearOMP::BondNonlinearOMP(class LAMMPS *lmp) void BondNonlinearOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/bond_quartic_omp.cpp b/src/USER-OMP/bond_quartic_omp.cpp index b2b1696bb4..fd0ccaf79d 100644 --- a/src/USER-OMP/bond_quartic_omp.cpp +++ b/src/USER-OMP/bond_quartic_omp.cpp @@ -40,10 +40,7 @@ BondQuarticOMP::BondQuarticOMP(class LAMMPS *lmp) void BondQuarticOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index 71dc237496..1616988385 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -39,10 +39,7 @@ BondTableOMP::BondTableOMP(class LAMMPS *lmp) void BondTableOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index 1bed449774..b09863613e 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -45,10 +45,7 @@ DihedralCharmmOMP::DihedralCharmmOMP(class LAMMPS *lmp) void DihedralCharmmOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index c7ae1572c7..03ac9d9bab 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -43,10 +43,7 @@ DihedralClass2OMP::DihedralClass2OMP(class LAMMPS *lmp) void DihedralClass2OMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp index c43b990028..c64cad9fc3 100644 --- a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp @@ -43,10 +43,7 @@ DihedralCosineShiftExpOMP::DihedralCosineShiftExpOMP(class LAMMPS *lmp) void DihedralCosineShiftExpOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 319acb0beb..94bdae3795 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -44,10 +44,7 @@ DihedralFourierOMP::DihedralFourierOMP(class LAMMPS *lmp) void DihedralFourierOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_harmonic_omp.cpp b/src/USER-OMP/dihedral_harmonic_omp.cpp index bb659cf262..10ccbd3d9f 100644 --- a/src/USER-OMP/dihedral_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_harmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralHarmonicOMP::DihedralHarmonicOMP(class LAMMPS *lmp) void DihedralHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index e40f084e54..8c8e29cac0 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -46,10 +46,7 @@ DihedralHelixOMP::DihedralHelixOMP(class LAMMPS *lmp) void DihedralHelixOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp index e10fc7b94a..38961e1746 100644 --- a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralMultiHarmonicOMP::DihedralMultiHarmonicOMP(class LAMMPS *lmp) void DihedralMultiHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index ad758fc892..e74238265d 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralNHarmonicOMP::DihedralNHarmonicOMP(class LAMMPS *lmp) void DihedralNHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_opls_omp.cpp b/src/USER-OMP/dihedral_opls_omp.cpp index 53fddf51cb..64eaffe6fe 100644 --- a/src/USER-OMP/dihedral_opls_omp.cpp +++ b/src/USER-OMP/dihedral_opls_omp.cpp @@ -44,10 +44,7 @@ DihedralOPLSOMP::DihedralOPLSOMP(class LAMMPS *lmp) void DihedralOPLSOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index f6110cd505..8df622b847 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -44,10 +44,7 @@ DihedralQuadraticOMP::DihedralQuadraticOMP(class LAMMPS *lmp) void DihedralQuadraticOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_table_omp.cpp b/src/USER-OMP/dihedral_table_omp.cpp index 1457f7b2bf..792ee90c26 100644 --- a/src/USER-OMP/dihedral_table_omp.cpp +++ b/src/USER-OMP/dihedral_table_omp.cpp @@ -111,10 +111,7 @@ DihedralTableOMP::DihedralTableOMP(class LAMMPS *lmp) void DihedralTableOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index 1fece5c31b..b56fc25142 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -61,9 +61,7 @@ void EwaldOMP::compute(int eflag, int vflag) { // set energy/virial flags - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // extend size of per-atom arrays if necessary diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 7184cbeb69..c2b493f425 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -43,10 +43,7 @@ ImproperClass2OMP::ImproperClass2OMP(class LAMMPS *lmp) void ImproperClass2OMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_cossq_omp.cpp b/src/USER-OMP/improper_cossq_omp.cpp index 022cfa6adf..3b328e5b78 100644 --- a/src/USER-OMP/improper_cossq_omp.cpp +++ b/src/USER-OMP/improper_cossq_omp.cpp @@ -43,10 +43,7 @@ ImproperCossqOMP::ImproperCossqOMP(class LAMMPS *lmp) void ImproperCossqOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_cvff_omp.cpp b/src/USER-OMP/improper_cvff_omp.cpp index 78c5a55e05..fe1fc45bec 100644 --- a/src/USER-OMP/improper_cvff_omp.cpp +++ b/src/USER-OMP/improper_cvff_omp.cpp @@ -43,10 +43,7 @@ ImproperCvffOMP::ImproperCvffOMP(class LAMMPS *lmp) void ImproperCvffOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_fourier_omp.cpp b/src/USER-OMP/improper_fourier_omp.cpp index 77dd36b64f..b5af428cb9 100644 --- a/src/USER-OMP/improper_fourier_omp.cpp +++ b/src/USER-OMP/improper_fourier_omp.cpp @@ -43,10 +43,7 @@ ImproperFourierOMP::ImproperFourierOMP(class LAMMPS *lmp) void ImproperFourierOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_harmonic_omp.cpp b/src/USER-OMP/improper_harmonic_omp.cpp index 3f1895142d..6e02d0968e 100644 --- a/src/USER-OMP/improper_harmonic_omp.cpp +++ b/src/USER-OMP/improper_harmonic_omp.cpp @@ -43,10 +43,7 @@ ImproperHarmonicOMP::ImproperHarmonicOMP(class LAMMPS *lmp) void ImproperHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_ring_omp.cpp b/src/USER-OMP/improper_ring_omp.cpp index 7970de3839..e198b99337 100644 --- a/src/USER-OMP/improper_ring_omp.cpp +++ b/src/USER-OMP/improper_ring_omp.cpp @@ -45,10 +45,7 @@ ImproperRingOMP::ImproperRingOMP(class LAMMPS *lmp) void ImproperRingOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/improper_umbrella_omp.cpp b/src/USER-OMP/improper_umbrella_omp.cpp index 69d41176c6..ceaca35074 100644 --- a/src/USER-OMP/improper_umbrella_omp.cpp +++ b/src/USER-OMP/improper_umbrella_omp.cpp @@ -43,10 +43,7 @@ ImproperUmbrellaOMP::ImproperUmbrellaOMP(class LAMMPS *lmp) void ImproperUmbrellaOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index dee9fd85b6..8a920e05d5 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -90,9 +90,7 @@ void MSMCGOMP::compute(int eflag, int vflag) // set energy/virial flags - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = eflag_either = vflag_either = 0; + ev_init(eflag,vflag); // invoke allocate_peratom() if needed for first time diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 264169773b..645d697994 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -39,9 +39,7 @@ PairADPOMP::PairADPOMP(LAMMPS *lmp) : void PairADPOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index e8f003ea88..854bcbebf3 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -42,9 +42,7 @@ PairAGNIOMP::PairAGNIOMP(LAMMPS *lmp) : void PairAGNIOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index ec5c02d727..bed6c81ee4 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -49,9 +49,7 @@ void PairAIREBOOMP::compute(int eflag, int vflag) { double pv0=0.0,pv1=0.0,pv2=0.0; - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); REBO_neigh_thr(); diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 1494ec2987..90c3777932 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -38,9 +38,7 @@ PairBeckOMP::PairBeckOMP(LAMMPS *lmp) : void PairBeckOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index f198184406..a5df8f8182 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -44,9 +44,7 @@ PairBornCoulLongOMP::PairBornCoulLongOMP(LAMMPS *lmp) : void PairBornCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index 1b4757359f..ad1e5e63cd 100644 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -41,9 +41,7 @@ void PairBornCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' " "with OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 7904181ba5..567eddc9cb 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -38,9 +38,7 @@ PairBornCoulWolfOMP::PairBornCoulWolfOMP(LAMMPS *lmp) : void PairBornCoulWolfOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index f75d4b9f35..fce2013745 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -36,9 +36,7 @@ PairBornOMP::PairBornOMP(LAMMPS *lmp) : void PairBornOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index b1af821bba..cef9fb0955 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -68,9 +68,7 @@ PairBrownianOMP::~PairBrownianOMP() void PairBrownianOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int inum = list->inum; diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 2e677ed535..239a820242 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -68,9 +68,7 @@ PairBrownianPolyOMP::~PairBrownianPolyOMP() void PairBrownianPolyOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int inum = list->inum; diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 8fa6be06b2..b9b77dc2b6 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -36,9 +36,7 @@ PairBuckCoulCutOMP::PairBuckCoulCutOMP(LAMMPS *lmp) : void PairBuckCoulCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 4d30eb3e82..951ba0688c 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -44,9 +44,7 @@ PairBuckCoulLongOMP::PairBuckCoulLongOMP(LAMMPS *lmp) : void PairBuckCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index a8bca36394..6226191627 100644 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -41,9 +41,7 @@ void PairBuckCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' " "with OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index acb95ab76c..20d380a464 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -46,9 +46,8 @@ PairBuckLongCoulLongOMP::PairBuckLongCoulLongOMP(LAMMPS *lmp) : void PairBuckLongCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); + const int order1 = ewald_order&(1<<1); const int order6 = ewald_order&(1<<6); diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index f3fa32a5ea..cc7e81b9c5 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -36,9 +36,7 @@ PairBuckOMP::PairBuckOMP(LAMMPS *lmp) : void PairBuckOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index 536b7644bd..64613cb31d 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -39,9 +39,7 @@ PairColloidOMP::PairColloidOMP(LAMMPS *lmp) : void PairColloidOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 8a77ab955f..be641dd0b9 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -41,9 +41,7 @@ PairCombOMP::PairCombOMP(LAMMPS *lmp) : void PairCombOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index b9ac72421e..056daf210a 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -36,9 +36,7 @@ PairCoulCutOMP::PairCoulCutOMP(LAMMPS *lmp) : void PairCoulCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index c7e8c5e560..70997da62b 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -36,9 +36,7 @@ PairCoulCutSoftOMP::PairCoulCutSoftOMP(LAMMPS *lmp) : void PairCoulCutSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index cb7a9025ce..d202e314bf 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -36,9 +36,7 @@ PairCoulDebyeOMP::PairCoulDebyeOMP(LAMMPS *lmp) : void PairCoulDebyeOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index c75e36b55e..f2bb6a46bf 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -36,9 +36,7 @@ PairCoulDielOMP::PairCoulDielOMP(LAMMPS *lmp) : void PairCoulDielOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index 740e3242ad..217fb844c3 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -46,9 +46,7 @@ PairCoulDSFOMP::PairCoulDSFOMP(LAMMPS *lmp) : void PairCoulDSFOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index eb74bb9615..1e3170c73c 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -45,9 +45,7 @@ PairCoulLongOMP::PairCoulLongOMP(LAMMPS *lmp) : void PairCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index 4e65483a17..dd1fc1030d 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -44,9 +44,7 @@ PairCoulLongSoftOMP::PairCoulLongSoftOMP(LAMMPS *lmp) : void PairCoulLongSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index f4bc279532..9b50b86954 100644 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -42,9 +42,7 @@ void PairCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' with " "OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index bc86cdbf5d..0913a2b188 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -38,9 +38,7 @@ PairCoulWolfOMP::PairCoulWolfOMP(LAMMPS *lmp) : void PairCoulWolfOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 29b5568def..77db3d9183 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -55,9 +55,7 @@ PairDPDOMP::~PairDPDOMP() void PairDPDOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int inum = list->inum; diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 0a9e96fa0c..d7233a16c5 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -55,9 +55,7 @@ PairDPDTstatOMP::~PairDPDTstatOMP() void PairDPDTstatOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int inum = list->inum; diff --git a/src/USER-OMP/pair_eam_cd_omp.cpp b/src/USER-OMP/pair_eam_cd_omp.cpp index 68c01c83d2..51b83f3bf5 100644 --- a/src/USER-OMP/pair_eam_cd_omp.cpp +++ b/src/USER-OMP/pair_eam_cd_omp.cpp @@ -55,9 +55,7 @@ PairEAMCDOMP::PairEAMCDOMP(LAMMPS *lmp, int _cdeamVersion) : void PairEAMCDOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index 492ff79769..99417f27da 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -39,9 +39,7 @@ PairEAMOMP::PairEAMOMP(LAMMPS *lmp) : void PairEAMOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 3392160d92..144d893c1c 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -43,9 +43,7 @@ PairEDIPOMP::PairEDIPOMP(LAMMPS *lmp) : void PairEDIPOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 6a3e0bc529..2ecd6f8ec7 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -39,9 +39,7 @@ PairEIMOMP::PairEIMOMP(LAMMPS *lmp) : void PairEIMOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index 9a41dcc87e..928312240b 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -36,9 +36,7 @@ PairGaussCutOMP::PairGaussCutOMP(LAMMPS *lmp) : void PairGaussCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 059c77c677..159f1c3e31 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -37,9 +37,7 @@ PairGaussOMP::PairGaussOMP(LAMMPS *lmp) : void PairGaussOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 5b0ff67afe..cfa05745ff 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -38,9 +38,7 @@ PairGayBerneOMP::PairGayBerneOMP(LAMMPS *lmp) : void PairGayBerneOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 9854b8f9ff..271c70e9b9 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -40,9 +40,7 @@ PairGranHertzHistoryOMP::PairGranHertzHistoryOMP(LAMMPS *lmp) : void PairGranHertzHistoryOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 2327fc815a..9a0e8aab76 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -41,9 +41,7 @@ PairGranHookeHistoryOMP::PairGranHookeHistoryOMP(LAMMPS *lmp) : void PairGranHookeHistoryOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int shearupdate = (update->setupflag) ? 0 : 1; diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index 876fe9c4de..d226ceaa14 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -38,9 +38,7 @@ PairGranHookeOMP::PairGranHookeOMP(LAMMPS *lmp) : void PairGranHookeOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index ec9da78b16..ea56ff51b5 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -57,9 +57,7 @@ PairHbondDreidingLJOMP::~PairHbondDreidingLJOMP() void PairHbondDreidingLJOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 4965be43b8..1cff2de3b2 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -57,9 +57,7 @@ PairHbondDreidingMorseOMP::~PairHbondDreidingMorseOMP() void PairHbondDreidingMorseOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 1cca674369..9ba8e09a54 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -37,9 +37,7 @@ PairLJ96CutOMP::PairLJ96CutOMP(LAMMPS *lmp) : void PairLJ96CutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 2f72f3851e..3dc9b77c0f 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -36,9 +36,7 @@ PairLJCharmmCoulCharmmImplicitOMP::PairLJCharmmCoulCharmmImplicitOMP(LAMMPS *lmp void PairLJCharmmCoulCharmmImplicitOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index b61a80a178..f9230996f0 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -36,9 +36,7 @@ PairLJCharmmCoulCharmmOMP::PairLJCharmmCoulCharmmOMP(LAMMPS *lmp) : void PairLJCharmmCoulCharmmOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index 5351ab9aea..4bdaa3519f 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -37,9 +37,7 @@ PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) : void PairLJCharmmCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index ea5d739e49..1f6daf052c 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -37,9 +37,7 @@ PairLJCharmmCoulLongSoftOMP::PairLJCharmmCoulLongSoftOMP(LAMMPS *lmp) : void PairLJCharmmCoulLongSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index 3baa9597a8..eab62d919e 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -42,9 +42,7 @@ void PairLJCharmmCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' " "with OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 38390918c7..b9ffad134b 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -36,9 +36,7 @@ PairLJClass2CoulCutOMP::PairLJClass2CoulCutOMP(LAMMPS *lmp) : void PairLJClass2CoulCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index f47672c9bc..e5995363ad 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -44,9 +44,7 @@ PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : void PairLJClass2CoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 7ab4626c3e..67715572ae 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -36,9 +36,7 @@ PairLJClass2OMP::PairLJClass2OMP(LAMMPS *lmp) : void PairLJClass2OMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 3e8adb33b8..5fa4f92f45 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -37,9 +37,7 @@ PairLJCubicOMP::PairLJCubicOMP(LAMMPS *lmp) : void PairLJCubicOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index ea560a09bf..69cc2d3042 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -36,9 +36,7 @@ PairLJCutCoulCutOMP::PairLJCutCoulCutOMP(LAMMPS *lmp) : void PairLJCutCoulCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index 4ef12bb1bb..5dfa414bd4 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -36,9 +36,7 @@ PairLJCutCoulCutSoftOMP::PairLJCutCoulCutSoftOMP(LAMMPS *lmp) : void PairLJCutCoulCutSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 9163e98edd..4644e565a7 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -36,9 +36,7 @@ PairLJCutCoulDebyeOMP::PairLJCutCoulDebyeOMP(LAMMPS *lmp) : void PairLJCutCoulDebyeOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index 9d9c098f87..13d877ec07 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -46,9 +46,7 @@ PairLJCutCoulDSFOMP::PairLJCutCoulDSFOMP(LAMMPS *lmp) : void PairLJCutCoulDSFOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index d2eaae4ca4..d4fe5fd2a7 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -45,9 +45,7 @@ PairLJCutCoulLongOMP::PairLJCutCoulLongOMP(LAMMPS *lmp) : void PairLJCutCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index 725bfe4724..4a0ef73f60 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -45,9 +45,7 @@ PairLJCutCoulLongSoftOMP::PairLJCutCoulLongSoftOMP(LAMMPS *lmp) : void PairLJCutCoulLongSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 234204af93..4c34b73622 100644 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -42,9 +42,7 @@ void PairLJCutCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' " "with OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp index 36ef9d54f9..052be0a2fa 100644 --- a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -38,9 +38,7 @@ PairLJCutCoulWolfOMP::PairLJCutCoulWolfOMP(LAMMPS *lmp) : void PairLJCutCoulWolfOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index d4145d9835..55359db3be 100644 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -36,9 +36,7 @@ PairLJCutDipoleCutOMP::PairLJCutDipoleCutOMP(LAMMPS *lmp) : void PairLJCutDipoleCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 319257b56b..34068185d2 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -37,9 +37,7 @@ PairLJCutOMP::PairLJCutOMP(LAMMPS *lmp) : void PairLJCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 7698f19b95..9bbe58146c 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -37,9 +37,7 @@ PairLJCutSoftOMP::PairLJCutSoftOMP(LAMMPS *lmp) : void PairLJCutSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index 536d5bcb86..85cab4fe7b 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -57,9 +57,7 @@ PairLJCutTholeLongOMP::PairLJCutTholeLongOMP(LAMMPS *lmp) : void PairLJCutTholeLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp index 619e970bb0..288724cd77 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -62,8 +62,7 @@ PairLJCutTIP4PCutOMP::~PairLJCutTIP4PCutOMP() void PairLJCutTIP4PCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index ca8f450dc6..e2c1da1a89 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -62,8 +62,7 @@ PairLJCutTIP4PLongOMP::~PairLJCutTIP4PLongOMP() void PairLJCutTIP4PLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp index 80b17fba96..6baba8aec4 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -62,8 +62,7 @@ PairLJCutTIP4PLongSoftOMP::~PairLJCutTIP4PLongSoftOMP() void PairLJCutTIP4PLongSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 064ea97809..6c6ddb045e 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -36,9 +36,7 @@ PairLJExpandOMP::PairLJExpandOMP(LAMMPS *lmp) : void PairLJExpandOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index c87f369d11..77c5bc0da0 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -36,9 +36,7 @@ PairLJGromacsCoulGromacsOMP::PairLJGromacsCoulGromacsOMP(LAMMPS *lmp) : void PairLJGromacsCoulGromacsOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index 1d7cec5eef..15bcb08eed 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -36,9 +36,7 @@ PairLJGromacsOMP::PairLJGromacsOMP(LAMMPS *lmp) : void PairLJGromacsOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index 391840285b..c9edc087b6 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -46,9 +46,8 @@ PairLJLongCoulLongOMP::PairLJLongCoulLongOMP(LAMMPS *lmp) : void PairLJLongCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); + const int order1 = ewald_order&(1<<1); const int order6 = ewald_order&(1<<6); diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index 19278d19bb..6d7c5b5638 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -63,9 +63,7 @@ PairLJLongTIP4PLongOMP::~PairLJLongTIP4PLongOMP() void PairLJLongTIP4PLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // reallocate hneigh_thr & newsite_thr if necessary // initialize hneigh_thr[0] to -1 on steps when reneighboring occured diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index c87f26204e..16c87d5ed4 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -38,9 +38,7 @@ PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) : void PairLJSDKCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 8ff0cfe921..1002cc193e 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -44,9 +44,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' " "with OMP MSM Pair styles"); - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index e107399316..1e64973cbb 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -40,9 +40,7 @@ PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) : void PairLJSDKOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 250f6ff272..aea22fc4df 100644 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -36,9 +36,7 @@ PairLJSFDipoleSFOMP::PairLJSFDipoleSFOMP(LAMMPS *lmp) : void PairLJSFDipoleSFOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index b06de641f5..420c55b0ed 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -36,9 +36,7 @@ PairLJSmoothLinearOMP::PairLJSmoothLinearOMP(LAMMPS *lmp) : void PairLJSmoothLinearOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index 36935616bf..d61dc19ff1 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -36,9 +36,7 @@ PairLJSmoothOMP::PairLJSmoothOMP(LAMMPS *lmp) : void PairLJSmoothOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index a7f9fc65b5..132dbc575e 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -54,9 +54,7 @@ PairLubricateOMP::~PairLubricateOMP() void PairLubricateOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index 3f0ef1dba6..3a5f03364d 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -54,9 +54,7 @@ PairLubricatePolyOMP::~PairLubricatePolyOMP() void PairLubricatePolyOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index dfc3b978a2..e9307c8666 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -39,9 +39,7 @@ PairMEAMSplineOMP::PairMEAMSplineOMP(LAMMPS *lmp) : void PairMEAMSplineOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index 922b67b463..bf57019f11 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -36,9 +36,7 @@ PairMorseOMP::PairMorseOMP(LAMMPS *lmp) : void PairMorseOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp index 61cef69c37..5ba6acb439 100644 --- a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp @@ -40,9 +40,7 @@ PairMorseSmoothLinearOMP::PairMorseSmoothLinearOMP(LAMMPS *lmp) : void PairMorseSmoothLinearOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index fcbf5dbabb..d62b4e5c62 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -36,9 +36,7 @@ PairNMCutCoulCutOMP::PairNMCutCoulCutOMP(LAMMPS *lmp) : void PairNMCutCoulCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index b31387dbfe..a8696c74a1 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -44,9 +44,7 @@ PairNMCutCoulLongOMP::PairNMCutCoulLongOMP(LAMMPS *lmp) : void PairNMCutCoulLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index 79cd046311..9304b10ef0 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -36,9 +36,7 @@ PairNMCutOMP::PairNMCutOMP(LAMMPS *lmp) : void PairNMCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index 7b174face7..61db45363e 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -45,9 +45,7 @@ PairPeriLPSOMP::PairPeriLPSOMP(LAMMPS *lmp) : void PairPeriLPSOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = eflag_global = eflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 8199d8aa47..b1816e4052 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -43,9 +43,7 @@ PairPeriPMBOMP::PairPeriPMBOMP(LAMMPS *lmp) : void PairPeriPMBOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 63beb61be6..7f2db420bf 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -191,8 +191,7 @@ void PairReaxCOMP::compute(int eflag, int vflag) int *num_hbonds = fix_reax->num_hbonds; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else ev_unset(); + ev_init(eflag,vflag); if (vflag_global) control->virial = 1; else control->virial = 0; diff --git a/src/USER-OMP/pair_resquared_omp.cpp b/src/USER-OMP/pair_resquared_omp.cpp index 1736e794f5..d9e0059a9f 100644 --- a/src/USER-OMP/pair_resquared_omp.cpp +++ b/src/USER-OMP/pair_resquared_omp.cpp @@ -38,9 +38,7 @@ PairRESquaredOMP::PairRESquaredOMP(LAMMPS *lmp) : void PairRESquaredOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index a860ad97d9..eb151bc0df 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -40,9 +40,7 @@ PairSoftOMP::PairSoftOMP(LAMMPS *lmp) : void PairSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index e323fc4c37..745b3a1f04 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -37,9 +37,7 @@ PairSWOMP::PairSWOMP(LAMMPS *lmp) : void PairSWOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index d27456e1b5..b55817e75c 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -37,9 +37,7 @@ PairTableOMP::PairTableOMP(LAMMPS *lmp) : void PairTableOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index fad077ca12..a11bd87640 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -36,9 +36,7 @@ PairTersoffMODCOMP::PairTersoffMODCOMP(LAMMPS *lmp) : void PairTersoffMODCOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index 04e54c6e69..da22110c1c 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -36,9 +36,7 @@ PairTersoffMODOMP::PairTersoffMODOMP(LAMMPS *lmp) : void PairTersoffMODOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index a5afdc7509..661f15d64d 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -37,9 +37,7 @@ PairTersoffOMP::PairTersoffOMP(LAMMPS *lmp) : void PairTersoffOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index de045f9c62..7e83814f95 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -61,9 +61,7 @@ PairTersoffTableOMP::~PairTersoffTableOMP() void PairTersoffTableOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 85589cf043..1900ed4394 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -62,8 +62,7 @@ PairTIP4PCutOMP::~PairTIP4PCutOMP() void PairTIP4PCutOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_tip4p_long_omp.cpp b/src/USER-OMP/pair_tip4p_long_omp.cpp index c6c4bfe5fc..ee65937c46 100644 --- a/src/USER-OMP/pair_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_omp.cpp @@ -62,8 +62,7 @@ PairTIP4PLongOMP::~PairTIP4PLongOMP() void PairTIP4PLongOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp index 7e9d3b6dff..adb984a2cd 100644 --- a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp @@ -62,8 +62,7 @@ PairTIP4PLongSoftOMP::~PairTIP4PLongSoftOMP() void PairTIP4PLongSoftOMP::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nlocal = atom->nlocal; const int nall = nlocal + atom->nghost; diff --git a/src/USER-OMP/pair_ufm_omp.cpp b/src/USER-OMP/pair_ufm_omp.cpp index ff258b5b3b..08d8cc15f9 100644 --- a/src/USER-OMP/pair_ufm_omp.cpp +++ b/src/USER-OMP/pair_ufm_omp.cpp @@ -38,9 +38,7 @@ PairUFMOMP::PairUFMOMP(LAMMPS *lmp) : void PairUFMOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 194a3e2d86..28104013f0 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -37,9 +37,7 @@ PairVashishtaOMP::PairVashishtaOMP(LAMMPS *lmp) : void PairVashishtaOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index e0d96d8bb6..b044902ebe 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -37,9 +37,7 @@ PairVashishtaTableOMP::PairVashishtaTableOMP(LAMMPS *lmp) : void PairVashishtaTableOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index c1d2133a1c..86314ce7b8 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -36,9 +36,7 @@ PairYukawaColloidOMP::PairYukawaColloidOMP(LAMMPS *lmp) : void PairYukawaColloidOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index cbfd627f97..add81e9b04 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -36,9 +36,7 @@ PairYukawaOMP::PairYukawaOMP(LAMMPS *lmp) : void PairYukawaOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 788679434b..f6856c4fa0 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -37,9 +37,7 @@ PairZBLOMP::PairZBLOMP(LAMMPS *lmp) : void PairZBLOMP::compute(int eflag, int vflag) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index fce6313754..c3b03bc5e0 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -75,8 +75,7 @@ void PairQUIP::compute(int eflag, int vflag) double *quip_local_e, *quip_force, *quip_local_virial, *quip_virial, quip_energy, *lattice; - if (eflag || vflag) ev_setup(eflag,vflag); - else ev_unset(); + ev_init(eflag,vflag); inum = list->inum; ilist = list->ilist; diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index b68e0d0779..b9d488d8cf 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -497,8 +497,7 @@ void PairReaxC::compute(int eflag, int vflag) int *num_hbonds = fix_reax->num_hbonds; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else ev_unset(); + ev_init(eflag,vflag); if (vflag_global) control->virial = 1; else control->virial = 0; diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index 4b8e10123c..497442fbe8 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -197,12 +197,7 @@ void Scafacos::compute(int eflag, int vflag) fcs_set_redistribute((FCS)fcs,0); } - if (eflag || vflag) ev_setup(eflag,vflag); - else - { - eflag_atom = 0; - vflag_global = 0; - } + ev_init(eflag,vflag); // grow xpbc, epot, efield if necessary diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index 7cfc950eff..db80debe51 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -71,8 +71,7 @@ void PairSDPDTaitwaterIsothermal::compute (int eflag, int vflag) { double rsq, tmp, wfd, delVdotDelR; double prefactor, wiener[3][3], f_random[3]; - if (eflag || vflag) ev_setup (eflag, vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **v = atom->vest; double **x = atom->x; diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 13f48e995e..541be9f05c 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -87,10 +87,7 @@ void PairHertz::compute(int eflag, int vflag) { double *rmass = atom->rmass; evdwl = 0.0; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **f = atom->f; double **x = atom->x; diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index ab6b7d2785..ac67a3279a 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -448,10 +448,7 @@ void PairTlsph::ComputeForces(int eflag, int vflag) { Matrix3d eye; eye.setIdentity(); - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); /* * iterate over pairs of particles i, j and assign forces using PK1 stress tensor diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index e40c876ec3..d3a4983379 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -96,10 +96,7 @@ void PairTriSurf::compute(int eflag, int vflag) { Vector2d w2d, rhs; evdwl = 0.0; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); tagint *mol = atom->molecule; double **f = atom->f; diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 50af6e2356..2c4a2de989 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -386,10 +386,7 @@ void PairULSPH::compute(int eflag, int vflag) { int k; SelfAdjointEigenSolver < Matrix3d > es; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); if (atom->nmax > nmax) { //printf("... allocating in compute with nmax = %d\n", atom->nmax); diff --git a/src/USER-SMTBQ/README b/src/USER-SMTBQ/README index 74b621eef1..e778c65be2 100644 --- a/src/USER-SMTBQ/README +++ b/src/USER-SMTBQ/README @@ -2,9 +2,11 @@ This package implements the Second Moment Tight Binding - QEq (SMTB-Q) potential for the description of ionocovalent bonds in oxides. Authors: Nicolas Salles, Emile Maras, Olivier Politano, Robert Tetot -at LAAS-CNRS in France. +at ICB, Universite de Bourgogne and ICMMO, Universite Paris-Sud. -Contact emails: lammps@u-bourgogne.fr, nsalles@laas.fr +Contact emails: lammps@u-bourgogne.fr, nsalles33@gmail.com + +This package is occasionally maintained. See the doc page for the pair_style smtbq command to get started. diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 5c3189fc31..ba7f8eb88c 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -899,8 +899,7 @@ void PairSMTBQ::compute(int eflag, int vflag) evdwl = ecoul = ecovtot = ErepOO = ErepMO = Eion = 0.0; Eself = 0.0; - if (eflag || vflag) { ev_setup(eflag,vflag); } - else { evflag = vflag_fdotr = vflag_atom = 0; } + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-SPH/pair_sph_heatconduction.cpp b/src/USER-SPH/pair_sph_heatconduction.cpp index c93e8040b2..bafa26be89 100644 --- a/src/USER-SPH/pair_sph_heatconduction.cpp +++ b/src/USER-SPH/pair_sph_heatconduction.cpp @@ -52,10 +52,7 @@ void PairSPHHeatConduction::compute(int eflag, int vflag) { double imass, jmass, h, ih, ihsq; double rsq, wfd, D, deltaE; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **x = atom->x; double *e = atom->e; diff --git a/src/USER-SPH/pair_sph_idealgas.cpp b/src/USER-SPH/pair_sph_idealgas.cpp index d12ee06736..db5ec964bc 100644 --- a/src/USER-SPH/pair_sph_idealgas.cpp +++ b/src/USER-SPH/pair_sph_idealgas.cpp @@ -53,10 +53,7 @@ void PairSPHIdealGas::compute(int eflag, int vflag) { double vxtmp, vytmp, vztmp, imass, jmass, fi, fj, fvisc, h, ih, ihsq; double rsq, wfd, delVdotDelR, mu, deltaE, ci, cj; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **v = atom->vest; double **x = atom->x; diff --git a/src/USER-SPH/pair_sph_lj.cpp b/src/USER-SPH/pair_sph_lj.cpp index 3a30ecb5fa..7d315c975c 100644 --- a/src/USER-SPH/pair_sph_lj.cpp +++ b/src/USER-SPH/pair_sph_lj.cpp @@ -53,10 +53,7 @@ void PairSPHLJ::compute(int eflag, int vflag) { double vxtmp, vytmp, vztmp, imass, jmass, fi, fj, fvisc, h, ih, ihsq, ihcub; double rsq, wfd, delVdotDelR, mu, deltaE, ci, cj, lrc; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **v = atom->vest; double **x = atom->x; diff --git a/src/USER-SPH/pair_sph_rhosum.cpp b/src/USER-SPH/pair_sph_rhosum.cpp index 896a422782..842dddc744 100644 --- a/src/USER-SPH/pair_sph_rhosum.cpp +++ b/src/USER-SPH/pair_sph_rhosum.cpp @@ -72,10 +72,7 @@ void PairSPHRhoSum::compute(int eflag, int vflag) { // neighbor list variables int inum, *ilist, *numneigh, **firstneigh; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **x = atom->x; double *rho = atom->rho; diff --git a/src/USER-SPH/pair_sph_taitwater.cpp b/src/USER-SPH/pair_sph_taitwater.cpp index 9d5a417e5b..cf3c0e914b 100644 --- a/src/USER-SPH/pair_sph_taitwater.cpp +++ b/src/USER-SPH/pair_sph_taitwater.cpp @@ -58,10 +58,7 @@ void PairSPHTaitwater::compute(int eflag, int vflag) { double vxtmp, vytmp, vztmp, imass, jmass, fi, fj, fvisc, h, ih, ihsq; double rsq, tmp, wfd, delVdotDelR, mu, deltaE; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **v = atom->vest; double **x = atom->x; diff --git a/src/USER-SPH/pair_sph_taitwater_morris.cpp b/src/USER-SPH/pair_sph_taitwater_morris.cpp index fb745ac7da..5cbaa5959f 100644 --- a/src/USER-SPH/pair_sph_taitwater_morris.cpp +++ b/src/USER-SPH/pair_sph_taitwater_morris.cpp @@ -58,10 +58,7 @@ void PairSPHTaitwaterMorris::compute(int eflag, int vflag) { double vxtmp, vytmp, vztmp, imass, jmass, fi, fj, fvisc, h, ih, ihsq, velx, vely, velz; double rsq, tmp, wfd, delVdotDelR, deltaE; - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; + ev_init(eflag, vflag); double **v = atom->vest; double **x = atom->x; diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index 6333c2f035..2e6731f494 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -67,8 +67,7 @@ void AngleCross::compute(int eflag, int vflag) double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index 4e44f10408..53cb11b5df 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -61,8 +61,7 @@ void AngleMM3::compute(int eflag, int vflag) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; eangle = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index 1c464ff895..ee1ebcdd61 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -54,8 +54,7 @@ void BondMM3::compute(int eflag, int vflag) double rsq,r,dr,dr2,de_bond,K3,K4; ebond = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 9a54afed9a..b45087a9ab 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -67,8 +67,7 @@ void ImproperDistHarm::compute(int eflag, int vflag) double domega,a; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index 763d82f1c5..ae702820cb 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -67,8 +67,7 @@ void ImproperSQDistHarm::compute(int eflag, int vflag) double domega,a; eimproper = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 91c75d6945..f37dcc3ed1 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -91,8 +91,7 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index aa656e5b2d..931ed1d116 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -91,8 +91,7 @@ void PairMM3Switch3CoulGaussLong::compute(int eflag, int vflag) double rsq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/angle.h b/src/angle.h index 0247fa0ff8..3d8371242e 100644 --- a/src/angle.h +++ b/src/angle.h @@ -58,6 +58,10 @@ class Angle : protected Pointers { int vflag_either,vflag_global,vflag_atom; int maxeatom,maxvatom; + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int, int alloc = 1); void ev_tally(int, int, int, int, int, double, double *, double *, double, double, double, double, double, double); diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index c29eaac2ae..6afa7413b2 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -103,8 +103,7 @@ void AngleHybrid::compute(int eflag, int vflag) // set neighbor->anglelist to sub-style anglelist before call // accumulate sub-style global/peratom energy/virial in hybrid - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); for (m = 0; m < nstyles; m++) { neighbor->nanglelist = nanglelist[m]; diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index d7b7c9cdb5..6eb127fa58 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -47,8 +47,7 @@ AngleZero::~AngleZero() void AngleZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/bond.h b/src/bond.h index 9c353a1a6d..8fb7040832 100644 --- a/src/bond.h +++ b/src/bond.h @@ -64,6 +64,10 @@ class Bond : protected Pointers { int vflag_either,vflag_global,vflag_atom; int maxeatom,maxvatom; + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int, int alloc = 1); void ev_tally(int, int, int, int, double, double, double, double, double); }; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 4e5a26f731..65609b4b6e 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -103,8 +103,7 @@ void BondHybrid::compute(int eflag, int vflag) // set neighbor->bondlist to sub-style bondlist before call // accumulate sub-style global/peratom energy/virial in hybrid - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); for (m = 0; m < nstyles; m++) { neighbor->nbondlist = nbondlist[m]; diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index 9fcf300b21..0847cf9e6b 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -45,8 +45,7 @@ BondZero::~BondZero() void BondZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/dihedral.h b/src/dihedral.h index 627104871b..f1b42008bf 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -56,6 +56,10 @@ class Dihedral : protected Pointers { int vflag_either,vflag_global,vflag_atom; int maxeatom,maxvatom; + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int, int alloc = 1); void ev_tally(int, int, int, int, int, int, double, double *, double *, double *, double, double, double, diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index b9107ac874..f3e4823d53 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -104,8 +104,7 @@ void DihedralHybrid::compute(int eflag, int vflag) // set neighbor->dihedrallist to sub-style dihedrallist before call // accumulate sub-style global/peratom energy/virial in hybrid - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); for (m = 0; m < nstyles; m++) { neighbor->ndihedrallist = ndihedrallist[m]; diff --git a/src/dihedral_zero.cpp b/src/dihedral_zero.cpp index 46facdb6db..8145d5f32d 100644 --- a/src/dihedral_zero.cpp +++ b/src/dihedral_zero.cpp @@ -44,8 +44,7 @@ DihedralZero::~DihedralZero() void DihedralZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/dump.cpp b/src/dump.cpp index 7cd80dcf71..8fa07a9cb2 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -423,7 +423,12 @@ void Dump::write() atom->x = xpbc; atom->v = vpbc; atom->image = imagepbc; + + // for triclinic, PBC is applied in lamda coordinates + + if (domain->triclinic) domain->x2lamda(nlocal); domain->pbc(); + if (domain->triclinic) domain->lamda2x(nlocal); } // pack my data into buf diff --git a/src/fix.h b/src/fix.h index 21dfc955a8..7eaff38bd3 100644 --- a/src/fix.h +++ b/src/fix.h @@ -223,6 +223,10 @@ class Fix : protected Pointers { int dynamic; // recount atoms for temperature computes + void ev_init(int eflag, int vflag) { + if (eflag||vflag) ev_setup(eflag, vflag); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int); void ev_tally(int, int *, double, double, double *); void v_setup(int); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index 5ac9206e7f..b1ffa65e49 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -141,8 +141,7 @@ void FixExternal::post_force(int vflag) bigint ntimestep = update->ntimestep; int eflag = eflag_caller; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // invoke the callback in driver program // it will fill fexternal with forces diff --git a/src/improper.h b/src/improper.h index adcf6d29c8..d940b43a13 100644 --- a/src/improper.h +++ b/src/improper.h @@ -56,6 +56,10 @@ class Improper : protected Pointers { int vflag_either,vflag_global,vflag_atom; int maxeatom,maxvatom; + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int, int alloc = 1); void ev_tally(int, int, int, int, int, int, double, double *, double *, double *, double, double, double, diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 3c17e42eaf..5fdcb42a96 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -104,8 +104,7 @@ void ImproperHybrid::compute(int eflag, int vflag) // set neighbor->improperlist to sub-style improperlist before call // accumulate sub-style global/peratom energy/virial in hybrid - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); for (m = 0; m < nstyles; m++) { neighbor->nimproperlist = nimproperlist[m]; diff --git a/src/improper_zero.cpp b/src/improper_zero.cpp index 8a1fa529c6..747dd57919 100644 --- a/src/improper_zero.cpp +++ b/src/improper_zero.cpp @@ -44,8 +44,7 @@ ImproperZero::~ImproperZero() void ImproperZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/kspace.cpp b/src/kspace.cpp index 25491cd964..0144ea59a3 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -168,9 +168,7 @@ void KSpace::triclinic_check() void KSpace::compute_dummy(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- diff --git a/src/kspace.h b/src/kspace.h index f29659d0e8..2345cebf24 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -194,6 +194,10 @@ class KSpace : protected Pointers { int kx_ewald,ky_ewald,kz_ewald; // kspace settings for Ewald sum void pair_check(); + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_setup(int, int, int alloc = 1); double estimate_table_accuracy(double, double); }; diff --git a/src/pair.cpp b/src/pair.cpp index 44cf3a43ea..c1b7dfc9ea 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -72,6 +72,9 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) single_extra = 0; svector = NULL; + setflag = NULL; + cutsq = NULL; + ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = 0; reinitflag = 1; @@ -688,8 +691,7 @@ double Pair::mix_distance(double sig1, double sig2) void Pair::compute_dummy(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */ diff --git a/src/pair.h b/src/pair.h index 27b6d41eef..5ce62f1b35 100644 --- a/src/pair.h +++ b/src/pair.h @@ -218,6 +218,10 @@ class Pair : protected Pointers { int copymode; // if set, do not deallocate during destruction // required when classes are used as functors by Kokkos + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else ev_unset(); + } virtual void ev_setup(int, int, int alloc = 1); void ev_unset(); void ev_tally_full(int, double, double, double, double, double, double); diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index d9c0fb902c..17731ebf0b 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -63,8 +63,7 @@ void PairBeck::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 1a1db9dd90..78434c91f8 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -71,8 +71,7 @@ void PairBorn::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index be7f41ca2b..2e565897b5 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -77,8 +77,7 @@ void PairBornCoulDSF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 22dcfa9f2d..3bb0e39e57 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -76,8 +76,7 @@ void PairBornCoulWolf::compute(int eflag, int vflag) double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 8b6d79234b..a3cf1a38d6 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -66,8 +66,7 @@ void PairBuck::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 7eecb62121..094797694c 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -42,7 +42,9 @@ PairBuckCoulCut::PairBuckCoulCut(LAMMPS *lmp) : Pair(lmp) PairBuckCoulCut::~PairBuckCoulCut() { - if (!copymode) { + if (copymode) return; + + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -71,8 +73,7 @@ void PairBuckCoulCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 8741abdb89..e7c0e0aabb 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -53,8 +53,7 @@ void PairCoulCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index 432a015598..c8afdabb93 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -40,8 +40,7 @@ void PairCoulDebye::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 8cd5f7fece..e487ff171c 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -68,8 +68,7 @@ void PairCoulDSF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 920770ed7f..244dccda12 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -412,8 +412,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) ci_jfi = ci_fifj = dci_jfi = dci_fifj = 0.0; forcecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = vflag_atom = 0; + ev_init(eflag,vflag); inum = list->inum; ilist = list->ilist; diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index 762491166e..dbf21b8bee 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -64,8 +64,7 @@ void PairCoulWolf::compute(int eflag, int vflag) double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index 5c5fc4254b..914b4aee17 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -70,8 +70,7 @@ void PairDPD::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **v = atom->v; diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index f2c0b157ea..1207c954eb 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -43,8 +43,7 @@ void PairDPDTstat::compute(int eflag, int vflag) double rsq,r,rinv,dot,wd,randnum,factor_dpd; int *ilist,*jlist,*numneigh,**firstneigh; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); // adjust sigma if target T is changing diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 426389753b..2d157d6cac 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -68,8 +68,7 @@ void PairGauss::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); int occ = 0; double **x = atom->x; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 2b2304718c..a1a6c81195 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -1,3 +1,4 @@ + /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories @@ -45,7 +46,7 @@ PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), PairHybrid::~PairHybrid() { - if (nstyles) { + if (nstyles > 0) { for (int m = 0; m < nstyles; m++) { delete styles[m]; delete [] keywords[m]; @@ -95,9 +96,7 @@ void PairHybrid::compute(int eflag, int vflag) if (no_virial_fdotr_compute && vflag % 4 == 2) vflag = 1 + vflag/4 * 4; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = vflag_global = - eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); // check if global component of incoming vflag = 2 // if so, reset vflag passed to substyle as if it were 0 @@ -243,11 +242,18 @@ void PairHybrid::settings(int narg, char **arg) // delete old lists, since cannot just change settings - if (nstyles) { - for (int m = 0; m < nstyles; m++) delete styles[m]; - delete [] styles; - for (int m = 0; m < nstyles; m++) delete [] keywords[m]; - delete [] keywords; + if (nstyles > 0) { + for (int m = 0; m < nstyles; m++) { + delete styles[m]; + delete [] keywords[m]; + if (special_lj[m]) delete [] special_lj[m]; + if (special_coul[m]) delete [] special_coul[m]; + } + delete[] styles; + delete[] keywords; + delete[] multiple; + delete[] special_lj; + delete[] special_coul; } if (allocated) { @@ -670,6 +676,12 @@ void PairHybrid::read_restart(FILE *fp) // allocate list of sub-styles + delete[] styles; + delete[] keywords; + delete[] multiple; + delete[] special_lj; + delete[] special_coul; + styles = new Pair*[nstyles]; keywords = new char*[nstyles]; multiple = new int[nstyles]; diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index 457eba0e79..cefe9b87e0 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -73,8 +73,7 @@ void PairLJ96Cut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -308,8 +307,7 @@ void PairLJ96Cut::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index 770caa6359..fdbfca608f 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -67,8 +67,7 @@ void PairLJCubic::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index 13a546f5a5..2a0fcde3a5 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -73,8 +73,7 @@ void PairLJCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -305,8 +304,7 @@ void PairLJCut::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 15c06ab36a..6f2ba75309 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -67,8 +67,7 @@ void PairLJCutCoulCut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index dfd866ca7a..cc6e92b2e3 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -37,8 +37,7 @@ void PairLJCutCoulDebye::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index a49af13fb2..f114a5851f 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -52,21 +52,21 @@ PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp) PairLJCutCoulDSF::~PairLJCutCoulDSF() { - if (!copymode) { - if (allocated) { - memory->destroy(setflag); - memory->destroy(cutsq); + if (copymode) return; - memory->destroy(cut_lj); - memory->destroy(cut_ljsq); - memory->destroy(epsilon); - memory->destroy(sigma); - memory->destroy(lj1); - memory->destroy(lj2); - memory->destroy(lj3); - memory->destroy(lj4); - memory->destroy(offset); - } + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); } } @@ -81,8 +81,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index fc8a858ce1..2f796ded12 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -77,8 +77,7 @@ void PairLJCutCoulWolf::compute(int eflag, int vflag) evdwl = 0.0; ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 9aa58b3b88..d5c0a40f2d 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -38,8 +38,9 @@ PairLJExpand::PairLJExpand(LAMMPS *lmp) : Pair(lmp) PairLJExpand::~PairLJExpand() { - if (!copymode) { - if (allocated) { + if (copymode) return; + + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -52,7 +53,6 @@ PairLJExpand::~PairLJExpand() memory->destroy(lj3); memory->destroy(lj4); memory->destroy(offset); - } } } @@ -67,8 +67,7 @@ void PairLJExpand::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 495e96c368..1fdaefebe9 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -41,8 +41,9 @@ PairLJGromacs::PairLJGromacs(LAMMPS *lmp) : Pair(lmp) PairLJGromacs::~PairLJGromacs() { - if (!copymode) { - if (allocated) { + if (copymode) return; + + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -60,7 +61,6 @@ PairLJGromacs::~PairLJGromacs() memory->destroy(ljsw3); memory->destroy(ljsw4); memory->destroy(ljsw5); - } } } @@ -75,8 +75,7 @@ void PairLJGromacs::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index 414bfea92a..28dc8ec79b 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -41,8 +41,9 @@ PairLJGromacsCoulGromacs::PairLJGromacsCoulGromacs(LAMMPS *lmp) : Pair(lmp) PairLJGromacsCoulGromacs::~PairLJGromacsCoulGromacs() { - if (!copymode) { - if (allocated) { + if (copymode) return; + + if (allocated) { memory->destroy(setflag); memory->destroy(cutsq); @@ -57,7 +58,6 @@ PairLJGromacsCoulGromacs::~PairLJGromacsCoulGromacs() memory->destroy(ljsw3); memory->destroy(ljsw4); memory->destroy(ljsw5); - } } } @@ -72,8 +72,7 @@ void PairLJGromacsCoulGromacs::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index a12046bb3b..ecacadbffa 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -72,8 +72,7 @@ void PairLJSmooth::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 17c789bcee..265828c4cf 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -62,8 +62,7 @@ void PairLJSmoothLinear::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index c1e1c1ff50..231832dc48 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -75,8 +75,7 @@ void PairMIECut::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; @@ -310,8 +309,7 @@ void PairMIECut::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index c1031343e1..dca1834c14 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -59,8 +59,7 @@ void PairMorse::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index d1c51ac600..7602f7b925 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -58,8 +58,7 @@ void PairSoft::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 04b1e4ceee..cf9e5c3bfb 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -74,8 +74,7 @@ void PairTable::compute(int eflag, int vflag) int tlm1 = tablength - 1; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index a9f076f504..226fb6e7d9 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -74,8 +74,7 @@ void PairUFM::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index af520fd3da..913afbd5a1 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -55,8 +55,7 @@ void PairYukawa::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index f23a1e5d56..254a82ea64 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -78,8 +78,7 @@ void PairZBL::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index d423e196af..143808f598 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -50,8 +50,7 @@ PairZero::~PairZero() void PairZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = 0; + ev_init(eflag,vflag); if (vflag_fdotr) virial_fdotr_compute(); }