Merge pull request #4227 from akohlmey/collected-small-changes
Collected small changes and fixes
This commit is contained in:
@ -204,7 +204,7 @@ option(BUILD_LAMMPS_GUI "Build and install the LAMMPS GUI" OFF)
|
||||
# Support using clang-tidy for C++ files with selected options
|
||||
set(ENABLE_CLANG_TIDY OFF CACHE BOOL "Include clang-tidy processing when compiling")
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings")
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*,performance-trivially-destructible,performance-unnecessary-copy-initialization,performance-unnecessary-value-param,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-qualified-auto,misc-unused-parameters,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-shrink-to-fit,modernize-use-auto,modernize-use-using,modernize-use-override,modernize-use-bool-literals,modernize-use-emplace,modernize-return-braced-init-list,modernize-use-equals-default,modernize-use-equals-delete,modernize-replace-random-shuffle,modernize-deprecated-headers,modernize-use-nullptr,modernize-use-noexcept,modernize-redundant-void-arg;-fix;-header-filter=.*,header-filter=library.h,header-filter=fmt/*.h" CACHE STRING "clang-tidy settings")
|
||||
else()
|
||||
unset(CMAKE_CXX_CLANG_TIDY CACHE)
|
||||
endif()
|
||||
@ -940,6 +940,7 @@ message(STATUS "<<< Compilers and Flags: >>>
|
||||
-- C++ Compiler: ${CMAKE_CXX_COMPILER}
|
||||
Type: ${CMAKE_CXX_COMPILER_ID}
|
||||
Version: ${CMAKE_CXX_COMPILER_VERSION}
|
||||
C++ Standard: ${CMAKE_CXX_STANDARD}
|
||||
C++ Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}
|
||||
Defines: ${DEFINES}")
|
||||
get_target_property(OPTIONS lammps COMPILE_OPTIONS)
|
||||
|
||||
@ -27,7 +27,7 @@ if(DOWNLOAD_QUIP)
|
||||
else()
|
||||
message(FATAL_ERROR "The ${CMAKE_Fortran_COMPILER_ID} Fortran compiler is not (yet) supported for building QUIP")
|
||||
endif()
|
||||
set(temp "${temp}CFLAGS += -fPIC \nCPLUSPLUSFLAGS += -fPIC\nAR_ADD=src\n")
|
||||
set(temp "${temp}CFLAGS += -fPIC -Wno-return-mismatch \nCPLUSPLUSFLAGS += -fPIC -Wno-return-mismatch\nAR_ADD=src\n")
|
||||
set(temp "${temp}MATH_LINKOPTS=")
|
||||
foreach(flag ${BLAS_LIBRARIES})
|
||||
set(temp "${temp} ${flag}")
|
||||
|
||||
@ -102,9 +102,9 @@ endif()
|
||||
#######################################
|
||||
# select code sanitizer options
|
||||
#######################################
|
||||
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)")
|
||||
set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, hwaddress, leak, thread, undefined)")
|
||||
mark_as_advanced(ENABLE_SANITIZER)
|
||||
set(ENABLE_SANITIZER_VALUES none address leak thread undefined)
|
||||
set(ENABLE_SANITIZER_VALUES none address hwaddress leak thread undefined)
|
||||
set_property(CACHE ENABLE_SANITIZER PROPERTY STRINGS ${ENABLE_SANITIZER_VALUES})
|
||||
validate_option(ENABLE_SANITIZER ENABLE_SANITIZER_VALUES)
|
||||
string(TOLOWER ${ENABLE_SANITIZER} ENABLE_SANITIZER)
|
||||
|
||||
@ -88,8 +88,8 @@ on recording all commands required to do the compilation.
|
||||
|
||||
.. _sanitizer:
|
||||
|
||||
Address, Undefined Behavior, and Thread Sanitizer Support (CMake only)
|
||||
----------------------------------------------------------------------
|
||||
Address, Leak, Undefined Behavior, and Thread Sanitizer Support (CMake only)
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Compilers such as GCC and Clang support generating instrumented binaries
|
||||
which use different sanitizer libraries to detect problems in the code
|
||||
@ -110,6 +110,7 @@ compilation and linking stages. This is done through setting the
|
||||
|
||||
-D ENABLE_SANITIZER=none # no sanitizer active (default)
|
||||
-D ENABLE_SANITIZER=address # enable address sanitizer / memory leak checker
|
||||
-D ENABLE_SANITIZER=hwaddress # enable hardware assisted address sanitizer / memory leak checker
|
||||
-D ENABLE_SANITIZER=leak # enable memory leak checker (only)
|
||||
-D ENABLE_SANITIZER=undefined # enable undefined behavior sanitizer
|
||||
-D ENABLE_SANITIZER=thread # enable thread sanitizer
|
||||
|
||||
@ -45,8 +45,8 @@ executable code from the library is copied into the calling executable.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mpicc -c -O $(pkgconf liblammps --cflags) caller.c
|
||||
mpicxx -o caller caller.o -$(pkgconf liblammps --libs)
|
||||
mpicc -c -O $(pkg-config --cflags liblammps) caller.c
|
||||
mpicxx -o caller caller.o -$(pkg-config --libs liblammps)
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
@ -155,8 +155,8 @@ POEMS package installed becomes:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mpicc -c -O $(pkgconf liblammps --cflags) caller.c
|
||||
mpicxx -o caller caller.o -$(pkgconf --libs)
|
||||
mpicc -c -O $(pkg-config --cflags liblammps) caller.c
|
||||
mpicxx -o caller caller.o -$(pkg-config --libs liblammps)
|
||||
|
||||
.. tab:: Traditional make
|
||||
|
||||
|
||||
@ -35,6 +35,10 @@ OPT.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* :doc:`adp (ko) <pair_adp>`
|
||||
* :doc:`agni (o) <pair_agni>`
|
||||
* :doc:`aip/water/2dm (t) <pair_aip_water_2dm>`
|
||||
|
||||
@ -571,11 +571,12 @@ General Settings:
|
||||
size for the text editor and log font of the application can be set.
|
||||
- *GUI update interval:* Allows to set the time interval between GUI
|
||||
and data updates during a LAMMPS run in milliseconds. The default is
|
||||
to update the GUI every 100 milliseconds. This is good for most cases.
|
||||
For LAMMPS runs that run very fast, however, data may be missed and
|
||||
to update the GUI every 10 milliseconds. This is good for most cases.
|
||||
For LAMMPS runs that run *very* fast, however, data may be missed and
|
||||
through lowering this interval, this can be corrected. However, this
|
||||
will make the GUI use more resources, which may be a problem on some
|
||||
computers with slower CPUs. The default value is 100 milliseconds.
|
||||
computers with slower CPUs and a small number of CPU cores. This
|
||||
setting may be changed to a value between 1 and 1000 milliseconds.
|
||||
|
||||
Accelerators:
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
@ -1323,18 +1323,19 @@ KSPACE package
|
||||
|
||||
**Contents:**
|
||||
|
||||
A variety of long-range Coulombic solvers, as well as pair styles
|
||||
which compute the corresponding short-range pairwise Coulombic
|
||||
interactions. These include Ewald, particle-particle particle-mesh
|
||||
(PPPM), and multilevel summation method (MSM) solvers.
|
||||
A variety of long-range Coulombic solvers, as well as pair styles which
|
||||
compute the corresponding short-range pairwise Coulombic interactions.
|
||||
These include Ewald, particle-particle particle-mesh (PPPM), and
|
||||
multilevel summation method (MSM) solvers.
|
||||
|
||||
**Install:**
|
||||
|
||||
Building with this package requires a 1d FFT library be present on
|
||||
your system for use by the PPPM solvers. This can be the KISS FFT
|
||||
library provided with LAMMPS, third party libraries like FFTW, or a
|
||||
vendor-supplied FFT library. See the :doc:`Build settings <Build_settings>` page for details on how to select
|
||||
different FFT options for your LAMPMS build.
|
||||
Building with this package requires a 1d FFT library be present on your
|
||||
system for use by the PPPM solvers. This can be the KISS FFT library
|
||||
provided with LAMMPS, third party libraries like FFTW, or a
|
||||
vendor-supplied FFT library. See the :doc:`Build settings
|
||||
<Build_settings>` page for details on how to select different FFT
|
||||
options for your LAMMPS build.
|
||||
|
||||
**Supporting info:**
|
||||
|
||||
|
||||
@ -1329,7 +1329,7 @@ for Tcl with:
|
||||
.. code-block:: bash
|
||||
|
||||
swig -tcl -module tcllammps lammps.i
|
||||
gcc -fPIC -shared $(pkgconf --cflags tcl) -o tcllammps.so \
|
||||
gcc -fPIC -shared $(pkg-config tcl --cflags) -o tcllammps.so \
|
||||
lammps_wrap.c -L ../src/ -llammps
|
||||
tclsh
|
||||
|
||||
@ -1340,8 +1340,8 @@ functions included with:
|
||||
|
||||
swig -tcl -module tcllmps lammps_shell.i
|
||||
gcc -o tcllmpsh lammps_wrap.c -Xlinker -export-dynamic \
|
||||
-DHAVE_CONFIG_H $(pkgconf --cflags tcl) \
|
||||
$(pkgconf --libs tcl) -L ../src -llammps
|
||||
-DHAVE_CONFIG_H $(pkg-config tcl --cflags) \
|
||||
$(pkg-config tcl --libs) -L ../src -llammps
|
||||
|
||||
In both cases it is assumed that the LAMMPS library was compiled
|
||||
as a shared library in the ``src`` folder. Otherwise the last
|
||||
|
||||
@ -190,7 +190,7 @@ Default
|
||||
By default, *id* is yes. By default, atomic systems (no bond topology
|
||||
info) do not use a map. For molecular systems (with bond topology
|
||||
info), the default is to use a map of either *array* or *hash* style
|
||||
depending on the size of the sustem, as explained above for the *map
|
||||
depending on the size of the system, as explained above for the *map
|
||||
yes* keyword/value option. By default, a *first* group is not
|
||||
defined. By default, sorting is enabled with a frequency of 1000 and
|
||||
a binsize of 0.0, which means the neighbor cutoff will be used to set
|
||||
|
||||
@ -4,9 +4,6 @@
|
||||
fix deform command
|
||||
==================
|
||||
|
||||
:doc:`fix deform/pressure <fix_deform_pressure>` command
|
||||
========================================================
|
||||
|
||||
Accelerator Variants: *deform/kk*
|
||||
|
||||
Syntax
|
||||
@ -14,12 +11,11 @@ Syntax
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
fix ID group-ID fix_style N parameter style args ... keyword value ...
|
||||
fix ID group-ID deform N parameter style args ... keyword value ...
|
||||
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* fix_style = *deform* or *deform/pressure*
|
||||
* N = perform box deformation every this many timesteps
|
||||
* one or more parameter/style/args sequences of arguments may be appended
|
||||
* one or more parameter/args sequences may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
@ -46,12 +42,6 @@ Syntax
|
||||
*variable* values = v_name1 v_name2
|
||||
v_name1 = variable with name1 for box length change as function of time
|
||||
v_name2 = variable with name2 for change rate as function of time
|
||||
*pressure* values = target gain (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
*pressure/mean* values = target gain (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
|
||||
*xy*, *xz*, *yz* args = style value
|
||||
style = *final* or *delta* or *vel* or *erate* or *trate* or *wiggle* or *variable*
|
||||
@ -64,8 +54,6 @@ Syntax
|
||||
effectively an engineering shear strain rate
|
||||
*erate* value = R
|
||||
R = engineering shear strain rate (1/time units)
|
||||
*erate/rescale* value = R (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
R = engineering shear strain rate (1/time units)
|
||||
*trate* value = R
|
||||
R = true shear strain rate (1/time units)
|
||||
*wiggle* values = A Tp
|
||||
@ -74,9 +62,6 @@ Syntax
|
||||
*variable* values = v_name1 v_name2
|
||||
v_name1 = variable with name1 for tilt change as function of time
|
||||
v_name2 = variable with name2 for change rate as function of time
|
||||
*pressure* values = target gain (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
|
||||
* zero or more keyword/value pairs may be appended
|
||||
* keyword = *remap* or *flip* or *units* or *couple* or *vol/balance/p* or *max/rate* or *normalize/pressure*
|
||||
@ -92,15 +77,6 @@ Syntax
|
||||
*units* value = *lattice* or *box*
|
||||
lattice = distances are defined in lattice units
|
||||
box = distances are defined in simulation box units
|
||||
*couple* value = *none* or *xyz* or *xy* or *yz* or *xz* (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
couple pressure values of various dimensions
|
||||
*vol/balance/p* value = *yes* or *no* (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
Modifies the behavior of the *volume* option to try and balance pressures
|
||||
*max/rate* value = *rate* (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
rate = maximum strain rate for pressure control
|
||||
*normalize/pressure* value = *yes* or *no* (ONLY available in :doc:`fix deform/pressure <fix_deform_pressure>` command)
|
||||
Modifies pressure controls such that the deviation in pressure is normalized by the target pressure
|
||||
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -112,8 +88,6 @@ Examples
|
||||
fix 1 all deform 1 xy erate 0.001 remap v
|
||||
fix 1 all deform 10 y delta -0.5 0.5 xz vel 1.0
|
||||
|
||||
See examples for :doc:`fix deform/pressure <fix_deform_pressure>` on its doc page
|
||||
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
@ -123,17 +97,13 @@ run. Orthogonal simulation boxes have 3 adjustable parameters
|
||||
adjustable parameters (x,y,z,xy,xz,yz). Any or all of them can be
|
||||
adjusted independently and simultaneously.
|
||||
|
||||
The fix deform command allows use of all the arguments listed above,
|
||||
except those flagged as available ONLY for the :doc:`fix
|
||||
deform/pressure <fix_deform_pressure>` command, which are
|
||||
pressure-based controls. The fix deform/pressure command allows use
|
||||
of all the arguments listed above.
|
||||
|
||||
The rest of this doc page explains the options common to both
|
||||
commands. The :doc:`fix deform/pressure <fix_deform_pressure>` doc
|
||||
page explains the options available ONLY with the fix deform/pressure
|
||||
command. Note that a simulation can define only a single deformation
|
||||
command: fix deform or fix deform/pressure.
|
||||
The :doc:`fix deform/pressure <fix_deform_pressure>` command extends
|
||||
this command with additional keywords and arguments. The rest of this
|
||||
page explains the options common to both commands. The :doc:`fix
|
||||
deform/pressure <fix_deform_pressure>` page explains the options
|
||||
available ONLY with the fix deform/pressure command. Note that a
|
||||
simulation can define only a single deformation command: fix deform or
|
||||
fix deform/pressure.
|
||||
|
||||
Both these fixes can be used to perform non-equilibrium MD (NEMD)
|
||||
simulations of a continuously strained system. See the :doc:`fix
|
||||
@ -143,6 +113,24 @@ simulation of a continuously extended system (extensional flow) can be
|
||||
modeled using the :ref:`UEF package <PKG-UEF>` and its :doc:`fix
|
||||
commands <fix_nh_uef>`.
|
||||
|
||||
.. admonition:: Inconsistent trajectories due to image flags
|
||||
:class: warning
|
||||
|
||||
When running long simulations while shearing the box or using a high
|
||||
shearing rate, it is possible that the image flags used for storing
|
||||
unwrapped atom positions will "wrap around". When LAMMPS is compiled
|
||||
with the default settings, case image flags are limited to a range of
|
||||
:math:`-512 \le i \le 511`, which will overflow when atoms starting
|
||||
at zero image flag value have passed through a periodic box dimension
|
||||
more than 512 times.
|
||||
|
||||
Changing the :ref:`size of LAMMPS integer types <size>` to the
|
||||
"bigbig" setting can make this overflow much less likely, since it
|
||||
increases the image flag value range to :math:`- 1,048,576 \le i \le
|
||||
1\,048\,575`
|
||||
|
||||
----------
|
||||
|
||||
For the *x*, *y*, *z* parameters, the associated dimension cannot be
|
||||
shrink-wrapped. For the *xy*, *yz*, *xz* parameters, the associated
|
||||
second dimension cannot be shrink-wrapped. Dimensions not varied by
|
||||
|
||||
@ -13,29 +13,66 @@ Syntax
|
||||
* ID, group-ID are documented in :doc:`fix <fix>` command
|
||||
* deform/pressure = style name of this fix command
|
||||
* N = perform box deformation every this many timesteps
|
||||
* one or more parameter/arg sequences may be appended
|
||||
* one or more parameter/args sequences may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
parameter = *x* or *y* or *z* or *xy* or *xz* or *yz* or *box*
|
||||
*x*, *y*, *z* args = style value(s)
|
||||
style = *final* or *delta* or *scale* or *vel* or *erate* or *trate* or *volume* or *wiggle* or *variable* or *pressure* or *pressure/mean*
|
||||
*final* values = lo hi
|
||||
lo hi = box boundaries at end of run (distance units)
|
||||
*delta* values = dlo dhi
|
||||
dlo dhi = change in box boundaries at end of run (distance units)
|
||||
*scale* values = factor
|
||||
factor = multiplicative factor for change in box length at end of run
|
||||
*vel* value = V
|
||||
V = change box length at this velocity (distance/time units),
|
||||
effectively an engineering strain rate
|
||||
*erate* value = R
|
||||
R = engineering strain rate (1/time units)
|
||||
*trate* value = R
|
||||
R = true strain rate (1/time units)
|
||||
*volume* value = none = adjust this dim to preserve volume of system
|
||||
*wiggle* values = A Tp
|
||||
A = amplitude of oscillation (distance units)
|
||||
Tp = period of oscillation (time units)
|
||||
*variable* values = v_name1 v_name2
|
||||
v_name1 = variable with name1 for box length change as function of time
|
||||
v_name2 = variable with name2 for change rate as function of time
|
||||
*pressure* values = target gain
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
*pressure/mean* values = target gain
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
NOTE: All other styles are documented by the :doc:`fix deform <fix_deform>` command
|
||||
|
||||
*xy*, *xz*, *yz* args = style value
|
||||
style = *final* or *delta* or *vel* or *erate* or *trate* or *wiggle* or *variable* or *pressure* or *erate/rescale*
|
||||
*final* value = tilt
|
||||
tilt = tilt factor at end of run (distance units)
|
||||
*delta* value = dtilt
|
||||
dtilt = change in tilt factor at end of run (distance units)
|
||||
*vel* value = V
|
||||
V = change tilt factor at this velocity (distance/time units),
|
||||
effectively an engineering shear strain rate
|
||||
*erate* value = R
|
||||
R = engineering shear strain rate (1/time units)
|
||||
*erate/rescale* value = R
|
||||
R = engineering shear strain rate (1/time units)
|
||||
*trate* value = R
|
||||
R = true shear strain rate (1/time units)
|
||||
*wiggle* values = A Tp
|
||||
A = amplitude of oscillation (distance units)
|
||||
Tp = period of oscillation (time units)
|
||||
*variable* values = v_name1 v_name2
|
||||
v_name1 = variable with name1 for tilt change as function of time
|
||||
v_name2 = variable with name2 for change rate as function of time
|
||||
*pressure* values = target gain
|
||||
target = target pressure (pressure units)
|
||||
gain = proportional gain constant (1/(time * pressure) or 1/time units)
|
||||
*erate/rescale* value = R
|
||||
R = engineering shear strain rate (1/time units)
|
||||
NOTE: All other styles are documented by the :doc:`fix deform <fix_deform>` command
|
||||
|
||||
*box* = style value
|
||||
style = *volume* or *pressure*
|
||||
@ -49,6 +86,15 @@ Syntax
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
*remap* value = *x* or *v* or *none*
|
||||
x = remap coords of atoms in group into deforming box
|
||||
v = remap velocities of atoms in group when they cross periodic boundaries
|
||||
none = no remapping of x or v
|
||||
*flip* value = *yes* or *no*
|
||||
allow or disallow box flips when it becomes highly skewed
|
||||
*units* value = *lattice* or *box*
|
||||
lattice = distances are defined in lattice units
|
||||
box = distances are defined in simulation box units
|
||||
*couple* value = *none* or *xyz* or *xy* or *yz* or *xz*
|
||||
couple pressure values of various dimensions
|
||||
*vol/balance/p* value = *yes* or *no*
|
||||
@ -57,7 +103,6 @@ Syntax
|
||||
rate = maximum strain rate for pressure control
|
||||
*normalize/pressure* value = *yes* or *no*
|
||||
Modifies pressure controls such that the deviation in pressure is normalized by the target pressure
|
||||
NOTE: All other keywords are documented by the :doc:`fix deform <fix_deform>` command
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -79,10 +124,26 @@ pressure-based controls implemented by this command.
|
||||
|
||||
All arguments described on the :doc:`fix deform <fix_deform>` doc page
|
||||
also apply to this fix unless otherwise noted below. The rest of this
|
||||
doc page explains the arguments specific to this fix. Note that a
|
||||
page explains the arguments specific to this fix only. Note that a
|
||||
simulation can define only a single deformation command: fix deform or
|
||||
fix deform/pressure.
|
||||
|
||||
.. admonition:: Inconsistent trajectories due to image flags
|
||||
:class: warning
|
||||
|
||||
When running long simulations while shearing the box or using a high
|
||||
shearing rate, it is possible that the image flags used for storing
|
||||
unwrapped atom positions will "wrap around". When LAMMPS is compiled
|
||||
with the default settings, case image flags are limited to a range of
|
||||
:math:`-512 \le i \le 511`, which will overflow when atoms starting
|
||||
at zero image flag value have passed through a periodic box dimension
|
||||
more than 512 times.
|
||||
|
||||
Changing the :ref:`size of LAMMPS integer types <size>` to the
|
||||
"bigbig" setting can make this overflow much less likely, since it
|
||||
increases the image flag value range to :math:`- 1,048,576 \le i \le
|
||||
1\,048\,575`
|
||||
|
||||
----------
|
||||
|
||||
For the *x*, *y*, and *z* parameters, this is the meaning of the
|
||||
|
||||
@ -68,10 +68,10 @@ material or as an obstacle in a flow. Alternatively, it can be used as a
|
||||
constraining wall around a simulation; see the discussion of the
|
||||
*side* keyword below.
|
||||
|
||||
The *gstyle* geometry of the indenter can either be a sphere, a
|
||||
cylinder, a cone, or a plane.
|
||||
The *gstyle* keyword selects the geometry of the indenter and it can
|
||||
either have the value of *sphere*, *cylinder*, *cone*, or *plane*\ .
|
||||
|
||||
A spherical indenter exerts a force of magnitude
|
||||
A spherical indenter (*gstyle* = *sphere*) exerts a force of magnitude
|
||||
|
||||
.. math::
|
||||
|
||||
@ -82,13 +82,16 @@ distance from the atom to the center of the indenter, and *R* is the
|
||||
radius of the indenter. The force is repulsive and F(r) = 0 for *r* >
|
||||
*R*\ .
|
||||
|
||||
A cylindrical indenter exerts the same force, except that *r* is the
|
||||
distance from the atom to the center axis of the cylinder. The
|
||||
cylinder extends infinitely along its axis.
|
||||
A cylindrical indenter (*gstyle* = *cylinder*) follows the same formula
|
||||
for the force as a sphere, except that *r* is defined the distance
|
||||
from the atom to the center axis of the cylinder. The cylinder extends
|
||||
infinitely along its axis.
|
||||
|
||||
A conical indenter is similar to a cylindrical indenter except that it
|
||||
has a finite length (between *lo* and *hi*), and that two different
|
||||
radii (one at each end, *radlo* and *radhi*) can be defined.
|
||||
.. versionadded:: 17April2024
|
||||
|
||||
A conical indenter (*gstyle* = *cone*) is similar to a cylindrical indenter
|
||||
except that it has a finite length (between *lo* and *hi*), and that two
|
||||
different radii (one at each end, *radlo* and *radhi*) can be defined.
|
||||
|
||||
Spherical, cylindrical, and conical indenters account for periodic
|
||||
boundaries in two ways. First, the center point of a spherical
|
||||
@ -101,15 +104,15 @@ or axis accounts for periodic boundaries. Both of these mean that an
|
||||
indenter can effectively move through and straddle one or more
|
||||
periodic boundaries.
|
||||
|
||||
A planar indenter is really an axis-aligned infinite-extent wall
|
||||
exerting the same force on atoms in the system, where *R* is the
|
||||
position of the plane and *r-R* is the distance from the plane. If
|
||||
the *side* parameter of the plane is specified as *lo* then it will
|
||||
indent from the lo end of the simulation box, meaning that atoms with
|
||||
a coordinate less than the plane's current position will be pushed
|
||||
towards the hi end of the box and atoms with a coordinate higher than
|
||||
the plane's current position will feel no force. Vice versa if *side*
|
||||
is specified as *hi*\ .
|
||||
A planar indenter (*gstyle* = *plane*) behaves like an axis-aligned
|
||||
infinite-extent wall with the same force expression on atoms in the
|
||||
system as before, but where *R* is the position of the plane and *r-R*
|
||||
is the distance of an from the plane. If the *side* parameter of the
|
||||
plane is specified as *lo* then it will indent from the lo end of the
|
||||
simulation box, meaning that atoms with a coordinate less than the
|
||||
plane's current position will be pushed towards the hi end of the box
|
||||
and atoms with a coordinate higher than the plane's current position
|
||||
will feel no force. Vice versa if *side* is specified as *hi*\ .
|
||||
|
||||
Any of the 4 quantities defining a spherical indenter's geometry can
|
||||
be specified as an equal-style :doc:`variable <variable>`, namely *x*,
|
||||
|
||||
@ -23,11 +23,12 @@ Examples
|
||||
Description
|
||||
"""""""""""
|
||||
|
||||
Store the forces on atoms in the group at the point during each
|
||||
timestep when the fix is invoked, as described below. This is useful
|
||||
for storing forces before constraints or other boundary conditions are
|
||||
computed which modify the forces, so that unmodified forces can be
|
||||
:doc:`written to a dump file <dump>` or accessed by other :doc:`output commands <Howto_output>` that use per-atom quantities.
|
||||
Store the forces on atoms in the group at the point during each timestep
|
||||
when the fix is invoked, as described below. This is useful for storing
|
||||
forces before constraints or other boundary conditions are computed
|
||||
which modify the forces, so that unmodified forces can be :doc:`written
|
||||
to a dump file <dump>` or accessed by other :doc:`output commands
|
||||
<Howto_output>` that use per-atom quantities.
|
||||
|
||||
This fix is invoked at the point in the velocity-Verlet timestepping
|
||||
immediately after :doc:`pair <pair_style>`, :doc:`bond <bond_style>`,
|
||||
@ -36,12 +37,13 @@ immediately after :doc:`pair <pair_style>`, :doc:`bond <bond_style>`,
|
||||
forces have been calculated. It is the point in the timestep when
|
||||
various fixes that compute constraint forces are calculated and
|
||||
potentially modify the force on each atom. Examples of such fixes are
|
||||
:doc:`fix shake <fix_shake>`, :doc:`fix wall <fix_wall>`, and :doc:`fix indent <fix_indent>`.
|
||||
:doc:`fix shake <fix_shake>`, :doc:`fix wall <fix_wall>`, and :doc:`fix
|
||||
indent <fix_indent>`.
|
||||
|
||||
.. note::
|
||||
|
||||
The order in which various fixes are applied which operate at
|
||||
the same point during the timestep, is the same as the order they are
|
||||
The order in which various fixes are applied which operate at the
|
||||
same point during the timestep, is the same as the order they are
|
||||
specified in the input script. Thus normally, if you want to store
|
||||
per-atom forces due to force field interactions, before constraints
|
||||
are applied, you should list this fix first within that set of fixes,
|
||||
@ -52,8 +54,9 @@ potentially modify the force on each atom. Examples of such fixes are
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
No information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix_modify <fix_modify>` options
|
||||
are relevant to this fix.
|
||||
No information about this fix is written to :doc:`binary restart files
|
||||
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
|
||||
relevant to this fix.
|
||||
|
||||
This fix produces a per-atom array which can be accessed by various
|
||||
:doc:`output commands <Howto_output>`. The number of columns for each
|
||||
@ -61,7 +64,8 @@ atom is 3, and the columns store the x,y,z forces on each atom. The
|
||||
per-atom values be accessed on any timestep.
|
||||
|
||||
No parameter of this fix can be used with the *start/stop* keywords of
|
||||
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
|
||||
the :doc:`run <run>` command. This fix is not invoked during
|
||||
:doc:`energy minimization <minimize>`.
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
.. index:: pair_style coul/cut/gpu
|
||||
.. index:: pair_style coul/cut/kk
|
||||
.. index:: pair_style coul/cut/omp
|
||||
.. index:: pair_style coul/cut/global
|
||||
.. index:: pair_style coul/cut/global/omp
|
||||
.. index:: pair_style coul/debye
|
||||
.. index:: pair_style coul/debye/gpu
|
||||
.. index:: pair_style coul/debye/kk
|
||||
@ -11,8 +13,6 @@
|
||||
.. index:: pair_style coul/dsf/kk
|
||||
.. index:: pair_style coul/dsf/omp
|
||||
.. index:: pair_style coul/exclude
|
||||
.. index:: pair_style coul/cut/global
|
||||
.. index:: pair_style coul/cut/global/omp
|
||||
.. index:: pair_style coul/long
|
||||
.. index:: pair_style coul/long/omp
|
||||
.. index:: pair_style coul/long/kk
|
||||
@ -33,6 +33,11 @@ pair_style coul/cut command
|
||||
|
||||
Accelerator Variants: *coul/cut/gpu*, *coul/cut/kk*, *coul/cut/omp*
|
||||
|
||||
pair_style coul/cut/global command
|
||||
==================================
|
||||
|
||||
Accelerator Variants: *coul/cut/omp*
|
||||
|
||||
pair_style coul/debye command
|
||||
=============================
|
||||
|
||||
@ -46,11 +51,6 @@ Accelerator Variants: *coul/dsf/gpu*, *coul/dsf/kk*, *coul/dsf/omp*
|
||||
pair_style coul/exclude command
|
||||
===============================
|
||||
|
||||
pair_style coul/cut/global command
|
||||
==================================
|
||||
|
||||
Accelerator Variants: *coul/cut/omp*
|
||||
|
||||
pair_style coul/long command
|
||||
============================
|
||||
|
||||
@ -79,16 +79,17 @@ pair_style tip4p/long command
|
||||
|
||||
Accelerator Variants: *tip4p/long/omp*
|
||||
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
pair_style coul/cut cutoff
|
||||
pair_style coul/cut/global cutoff
|
||||
pair_style coul/debye kappa cutoff
|
||||
pair_style coul/dsf alpha cutoff
|
||||
pair_style coul/exclude cutoff
|
||||
pair_style coul/cut/global cutoff
|
||||
pair_style coul/long cutoff
|
||||
pair_style coul/wolf alpha cutoff
|
||||
pair_style coul/streitz cutoff keyword alpha
|
||||
@ -152,6 +153,11 @@ the 2 atoms, and :math:`\epsilon` is the dielectric constant which can be set
|
||||
by the :doc:`dielectric <dielectric>` command. The cutoff :math:`r_c` truncates
|
||||
the interaction distance.
|
||||
|
||||
Pair style *coul/cut/global* computes the same Coulombic interactions
|
||||
as style *coul/cut* except that it allows only a single global cutoff
|
||||
and thus makes it compatible for use in combination with long-range
|
||||
coulomb styles in :doc:`hybrid pair styles <pair_hybrid>`.
|
||||
|
||||
----------
|
||||
|
||||
Style *coul/debye* adds an additional exp() damping factor to the
|
||||
@ -262,11 +268,6 @@ Streitz-Mintmire parameterization for the material being modeled.
|
||||
|
||||
----------
|
||||
|
||||
Pair style *coul/cut/global* computes the same Coulombic interactions
|
||||
as style *coul/cut* except that it allows only a single global cutoff
|
||||
and thus makes it compatible for use in combination with long-range
|
||||
coulomb styles in :doc:`hybrid pair styles <pair_hybrid>`.
|
||||
|
||||
Pair style *coul/exclude* computes Coulombic interactions like *coul/cut*
|
||||
but **only** applies them to excluded pairs using a scaling factor
|
||||
of :math:`\gamma - 1.0` with :math:`\gamma` being the factor assigned
|
||||
|
||||
@ -41,7 +41,7 @@ sys.path.append(os.path.join(LAMMPS_DOC_DIR, 'utils', 'sphinx-config', '_themes'
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
needs_sphinx = '5.2.0'
|
||||
needs_sphinx = '5.3.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
@ -69,7 +69,7 @@ images_config = {
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
source_suffix = {'.rst': 'restructuredtext'}
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
@ -46,8 +46,8 @@ QELIBS += -lgfortran -lmpi_mpifh
|
||||
|
||||
# part 3: add-on libraries and main library for LAMMPS
|
||||
sinclude ../../src/Makefile.package
|
||||
LAMMPSFLAGS = $(shell pkgconf liblammps --cflags)
|
||||
LAMMPSLIB = $(shell pkgconf liblammps --libs)
|
||||
LAMMPSFLAGS = $(shell pkg-config --cflags liblammps)
|
||||
LAMMPSLIB = $(shell pkg-config --libs liblammps)
|
||||
|
||||
# part 4: local QM/MM library and progams
|
||||
SRC=pwqmmm.c libqmmm.c
|
||||
|
||||
@ -101,7 +101,7 @@ Makefile.gfortran-cmake and make adjustments to the makefile variables
|
||||
according to the comments in the file. You probably need to adjust
|
||||
the QETOPDIR variable to point to the location of your QE
|
||||
compilation/installation.
|
||||
Please also check that the command "pkgconf liblammps --libs" works.
|
||||
Please also check that the command "pkg-config --libs liblammps" works.
|
||||
Then you should be able to compile the QM/MM executable with:
|
||||
|
||||
make -f Makefile.gfortran-cmake pwqmmm.x
|
||||
|
||||
@ -105,6 +105,13 @@ void FixPythonInvoke::end_of_step()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixPythonInvoke::setup(int vflag)
|
||||
{
|
||||
if (selected_callback == POST_FORCE) post_force(vflag);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixPythonInvoke::post_force(int vflag)
|
||||
{
|
||||
if (update->ntimestep % nevery != 0) return;
|
||||
|
||||
@ -30,6 +30,7 @@ class FixPythonInvoke : public Fix {
|
||||
FixPythonInvoke(class LAMMPS *, int, char **);
|
||||
~FixPythonInvoke() override;
|
||||
int setmask() override;
|
||||
void setup(int) override;
|
||||
void end_of_step() override;
|
||||
void post_force(int) override;
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ FixReaxFFBonds::FixReaxFFBonds(LAMMPS *lmp, int narg, char **arg) :
|
||||
ntypes = atom->ntypes;
|
||||
nmax = atom->nmax;
|
||||
compressed = 0;
|
||||
first_flag = true;
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
|
||||
@ -94,7 +95,10 @@ int FixReaxFFBonds::setmask()
|
||||
|
||||
void FixReaxFFBonds::setup(int /*vflag*/)
|
||||
{
|
||||
end_of_step();
|
||||
// only print output during setup() at the very beginning
|
||||
// to avoid duplicate outputs when using multiple run statements
|
||||
if (first_flag) end_of_step();
|
||||
first_flag = false;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -40,6 +40,7 @@ class FixReaxFFBonds : public Fix {
|
||||
tagint **neighid;
|
||||
double **abo;
|
||||
FILE *fp;
|
||||
bool first_flag;
|
||||
|
||||
void allocate();
|
||||
void destroy();
|
||||
@ -50,7 +51,6 @@ class FixReaxFFBonds : public Fix {
|
||||
int nint(const double &);
|
||||
double memory_usage() override;
|
||||
|
||||
bigint nvalid, nextvalid();
|
||||
struct _reax_list *lists;
|
||||
class PairReaxFF *reaxff;
|
||||
class NeighList *list;
|
||||
|
||||
@ -62,7 +62,8 @@ Finish::Finish(LAMMPS *lmp) : Pointers(lmp) {}
|
||||
|
||||
void Finish::end(int flag)
|
||||
{
|
||||
int i,nneigh,nneighfull;
|
||||
int i;
|
||||
bigint nneigh,nneighfull;
|
||||
int histo[10];
|
||||
int minflag,prdflag,tadflag,hyperflag;
|
||||
int timeflag,fftflag,histoflag,neighflag;
|
||||
|
||||
@ -61,6 +61,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// read geometry of indenter and optional args
|
||||
|
||||
istyle = NONE;
|
||||
int iarg = geometry(narg - 4, &arg[4]) + 4;
|
||||
options(narg - iarg, &arg[iarg]);
|
||||
|
||||
@ -474,14 +475,12 @@ int FixIndent::geometry(int narg, char **arg)
|
||||
{
|
||||
if (narg < 0) utils::missing_cmd_args(FLERR, "fix indent", error);
|
||||
|
||||
istyle = NONE;
|
||||
xstr = ystr = zstr = rstr = pstr = nullptr;
|
||||
xvalue = yvalue = zvalue = rvalue = pvalue = 0.0;
|
||||
|
||||
// sphere
|
||||
|
||||
if (strcmp(arg[0], "sphere") == 0) {
|
||||
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
||||
if (5 > narg) utils::missing_cmd_args(FLERR, "fix indent sphere", error);
|
||||
|
||||
if (utils::strmatch(arg[1], "^v_")) {
|
||||
@ -508,7 +507,6 @@ int FixIndent::geometry(int narg, char **arg)
|
||||
// cylinder
|
||||
|
||||
if (strcmp(arg[0], "cylinder") == 0) {
|
||||
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
||||
if (5 > narg) utils::missing_cmd_args(FLERR, "fix indent cylinder", error);
|
||||
|
||||
if (strcmp(arg[1], "x") == 0) {
|
||||
@ -556,7 +554,6 @@ int FixIndent::geometry(int narg, char **arg)
|
||||
// cone
|
||||
|
||||
if (strcmp(arg[0], "cone") == 0) {
|
||||
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
||||
if (8 > narg) utils::missing_cmd_args(FLERR, "fix indent cone", error);
|
||||
|
||||
if (strcmp(arg[1], "x") == 0) {
|
||||
@ -619,7 +616,6 @@ int FixIndent::geometry(int narg, char **arg)
|
||||
// plane
|
||||
|
||||
if (strcmp(arg[0], "plane") == 0) {
|
||||
if (istyle != NONE) error->all(FLERR, "Fix indent requires a single geometry keyword");
|
||||
if (4 > narg) utils::missing_cmd_args(FLERR, "fix indent plane", error);
|
||||
if (strcmp(arg[1], "x") == 0)
|
||||
cdim = 0;
|
||||
@ -647,7 +643,7 @@ int FixIndent::geometry(int narg, char **arg)
|
||||
|
||||
// invalid istyle arg
|
||||
|
||||
error->all(FLERR, "Unknown fix indent argument: {}", arg[0]);
|
||||
error->all(FLERR, "Unknown fix indent geometry: {}", arg[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
#include <new>
|
||||
|
||||
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
||||
#include <fenv.h>
|
||||
@ -89,6 +90,11 @@ int main(int argc, char **argv)
|
||||
finalize();
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
exit(1);
|
||||
} catch (std::bad_alloc &ae) {
|
||||
fprintf(stderr, "C++ memory allocation failed: %s\n", ae.what());
|
||||
finalize();
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
exit(1);
|
||||
} catch (std::exception &e) {
|
||||
fprintf(stderr, "Exception: %s\n", e.what());
|
||||
finalize();
|
||||
|
||||
@ -447,30 +447,30 @@ void Molecule::read(int flag)
|
||||
|
||||
int nmatch = values.count();
|
||||
int nwant = 0;
|
||||
if (values.contains("atoms")) {
|
||||
if (values.matches("^\\s*\\d+\\s+atoms")) {
|
||||
natoms = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("bonds")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+bonds")) {
|
||||
nbonds = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("angles")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+angles")) {
|
||||
nangles = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("dihedrals")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+dihedrals")) {
|
||||
ndihedrals = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("impropers")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+impropers")) {
|
||||
nimpropers = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("fragments")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+fragments")) {
|
||||
nfragments = values.next_int();
|
||||
nwant = 2;
|
||||
} else if (values.contains("mass")) {
|
||||
} else if (values.matches("^\\s*\\f+\\s+mass")) {
|
||||
massflag = 1;
|
||||
masstotal = values.next_double();
|
||||
nwant = 2;
|
||||
masstotal *= sizescale * sizescale * sizescale;
|
||||
} else if (values.contains("com")) {
|
||||
} else if (values.matches("^\\s*\\f+\\s+\\f+\\s+\\f+\\s+com")) {
|
||||
comflag = 1;
|
||||
com[0] = values.next_double();
|
||||
com[1] = values.next_double();
|
||||
@ -480,8 +480,8 @@ void Molecule::read(int flag)
|
||||
com[1] *= sizescale;
|
||||
com[2] *= sizescale;
|
||||
if (domain->dimension == 2 && com[2] != 0.0)
|
||||
error->all(FLERR, "Molecule file z center-of-mass must be 0.0 for 2d");
|
||||
} else if (values.contains("inertia")) {
|
||||
error->all(FLERR, "Molecule file z center-of-mass must be 0.0 for 2d systems");
|
||||
} else if (values.matches("^\\s*\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+\\f+\\s+inertia")) {
|
||||
inertiaflag = 1;
|
||||
itensor[0] = values.next_double();
|
||||
itensor[1] = values.next_double();
|
||||
@ -497,7 +497,7 @@ void Molecule::read(int flag)
|
||||
itensor[3] *= scale5;
|
||||
itensor[4] *= scale5;
|
||||
itensor[5] *= scale5;
|
||||
} else if (values.contains("body")) {
|
||||
} else if (values.matches("^\\s*\\d+\\s+\\f+\\s+body")) {
|
||||
bodyflag = 1;
|
||||
avec_body = dynamic_cast<AtomVecBody *>(atom->style_match("body"));
|
||||
if (!avec_body) error->all(FLERR, "Molecule file requires atom style body");
|
||||
@ -506,10 +506,8 @@ void Molecule::read(int flag)
|
||||
nwant = 3;
|
||||
} else {
|
||||
// unknown header keyword
|
||||
if (utils::strmatch(text, "^\\d+\\s+\\S+")) {
|
||||
values.next_int();
|
||||
auto keyword = values.next_string();
|
||||
error->one(FLERR, "Invalid header keyword: {}", keyword);
|
||||
if (values.matches("^\\s*\\f+\\s+\\S+")) {
|
||||
error->one(FLERR, "Unknown keyword or incorrectly formatted header line: {}", line);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ struct HyperOneCoeff {
|
||||
|
||||
template <class T> class MyPage {
|
||||
public:
|
||||
int ndatum; // total # of stored datums
|
||||
int nchunk; // total # of stored chunks
|
||||
bigint ndatum; // total # of stored datums
|
||||
int nchunk; // total # of stored chunks
|
||||
MyPage();
|
||||
virtual ~MyPage();
|
||||
|
||||
@ -105,7 +105,7 @@ template <class T> class MyPage {
|
||||
// 1 = chunk size exceeded maxchunk
|
||||
// 2 = memory allocation error
|
||||
#if defined(_OPENMP)
|
||||
char pad[64]; // to avoid false sharing with multi-threading
|
||||
char pad[64]; // to avoid false sharing with multi-threading
|
||||
#endif
|
||||
void allocate();
|
||||
void deallocate();
|
||||
|
||||
@ -14,12 +14,14 @@
|
||||
#ifndef LAMMPS_MY_POOL_CHUNK_H
|
||||
#define LAMMPS_MY_POOL_CHUNK_H
|
||||
|
||||
#include "lmptype.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template <class T> class MyPoolChunk {
|
||||
public:
|
||||
int ndatum; // total # of stored datums
|
||||
int nchunk; // total # of stored chunks
|
||||
bigint ndatum; // total # of stored datums
|
||||
int nchunk; // total # of stored chunks
|
||||
|
||||
MyPoolChunk(int user_minchunk = 1, int user_maxchunk = 1, int user_nbin = 1,
|
||||
int user_chunkperpage = 1024, int user_pagedelta = 1);
|
||||
|
||||
@ -99,6 +99,8 @@ void Tokenizer::reset()
|
||||
}
|
||||
|
||||
/*! Search the text to be processed for a sub-string.
|
||||
*
|
||||
* This method does a generic sub-string match.
|
||||
*
|
||||
* \param str string to be searched for
|
||||
* \return true if string was found, false if not */
|
||||
@ -107,6 +109,20 @@ bool Tokenizer::contains(const std::string &str) const
|
||||
return text.find(str) != std::string::npos;
|
||||
}
|
||||
|
||||
/*! Search the text to be processed for regular expression match.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
This method matches the current string against a regular expression using
|
||||
the :cpp:func:`utils::strmatch() <LAMMPS_NS::utils::strmatch>` function.
|
||||
\endverbatim
|
||||
*
|
||||
* \param str regular expression to be matched against
|
||||
* \return true if string was found, false if not */
|
||||
bool Tokenizer::matches(const std::string &str) const
|
||||
{
|
||||
return utils::strmatch(text, str);
|
||||
}
|
||||
|
||||
/*! Skip over a given number of tokens
|
||||
*
|
||||
* \param n number of tokens to skip over */
|
||||
@ -233,6 +249,8 @@ bool ValueTokenizer::has_next() const
|
||||
}
|
||||
|
||||
/*! Search the text to be processed for a sub-string.
|
||||
*
|
||||
* This method does a generic sub-string match.
|
||||
*
|
||||
* \param value string with value to be searched for
|
||||
* \return true if string was found, false if not */
|
||||
@ -241,6 +259,20 @@ bool ValueTokenizer::contains(const std::string &value) const
|
||||
return tokens.contains(value);
|
||||
}
|
||||
|
||||
/*! Search the text to be processed for regular expression match.
|
||||
*
|
||||
\verbatim embed:rst
|
||||
This method matches the current string against a regular expression using
|
||||
the :cpp:func:`utils::strmatch() <LAMMPS_NS::utils::strmatch>` function.
|
||||
\endverbatim
|
||||
*
|
||||
* \param str regular expression to be matched against
|
||||
* \return true if string was found, false if not */
|
||||
bool ValueTokenizer::matches(const std::string &str) const
|
||||
{
|
||||
return tokens.matches(str);
|
||||
}
|
||||
|
||||
/*! Retrieve next token
|
||||
*
|
||||
* \return string with next token */
|
||||
|
||||
@ -46,6 +46,7 @@ class Tokenizer {
|
||||
void skip(int n = 1);
|
||||
bool has_next() const;
|
||||
bool contains(const std::string &str) const;
|
||||
bool matches(const std::string &str) const;
|
||||
std::string next();
|
||||
|
||||
size_t count();
|
||||
@ -119,6 +120,7 @@ class ValueTokenizer {
|
||||
|
||||
bool has_next() const;
|
||||
bool contains(const std::string &value) const;
|
||||
bool matches(const std::string &str) const;
|
||||
void skip(int ntokens = 1);
|
||||
|
||||
size_t count();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(lammps-gui VERSION 1.5.11 LANGUAGES CXX)
|
||||
project(lammps-gui VERSION 1.5.12 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@ -207,30 +207,34 @@ if(APPLE)
|
||||
)
|
||||
# additional targets to populate the bundle tree and create the .dmg image file
|
||||
set(APP_CONTENTS ${CMAKE_BINARY_DIR}/lammps-gui.app/Contents)
|
||||
add_custom_target(complete-bundle
|
||||
${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/bin
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lmp ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/msi2lmp ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/binary2txt ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/stl_bin2txt ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/phana ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ../MacOS/lammps-gui ${APP_CONTENTS}/bin/lammps-gui
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/README.macos ${APP_CONTENTS}/Resources/README.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/lammps.icns ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps/man/man1
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/potentials
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/bench
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/frc_files
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/lmp.1
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/msi2lmp.1 ${APP_CONTENTS}/share/lammps/man/man1
|
||||
DEPENDS lammps-gui lammps lmp binary2txt stl_bin2txt msi2lmp phana
|
||||
COMMENT "Copying additional files into macOS app bundle tree"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(BUILD_TOOLS)
|
||||
add_custom_target(complete-bundle
|
||||
${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/bin
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lmp ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/msi2lmp ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/binary2txt ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/stl_bin2txt ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/phana ${APP_CONTENTS}/bin/
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ../MacOS/lammps-gui ${APP_CONTENTS}/bin/lammps-gui
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/README.macos ${APP_CONTENTS}/Resources/README.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/lammps.icns ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/cmake/packaging/LAMMPS_DMG_Background.png ${APP_CONTENTS}/Resources
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APP_CONTENTS}/share/lammps/man/man1
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/potentials ${APP_CONTENTS}/share/lammps/potentials
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/bench ${APP_CONTENTS}/share/lammps/bench
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DIR}/tools/msi2lmp/frc_files ${APP_CONTENTS}/share/lammps/frc_files
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink lammps.1 ${APP_CONTENTS}/share/lammps/man/man1/lmp.1
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LAMMPS_DIR}/doc/msi2lmp.1 ${APP_CONTENTS}/share/lammps/man/man1
|
||||
DEPENDS lammps-gui lammps lmp binary2txt stl_bin2txt msi2lmp phana
|
||||
COMMENT "Copying additional files into macOS app bundle tree"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Must use -D BUILD_TOOLS=yes for building app bundle")
|
||||
endif()
|
||||
if(FFMPEG_EXECUTABLE)
|
||||
add_custom_target(copy-ffmpeg
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FFMPEG_EXECUTABLE} ${APP_CONTENTS}/bin/
|
||||
|
||||
@ -138,7 +138,8 @@ void ChartWindow::quit()
|
||||
void ChartWindow::reset_zoom()
|
||||
{
|
||||
int choice = columns->currentData().toInt();
|
||||
charts[choice]->reset_zoom();
|
||||
if ((choice >= 0) && (choice < charts.size()))
|
||||
charts[choice]->reset_zoom();
|
||||
}
|
||||
|
||||
void ChartWindow::stop_run()
|
||||
@ -253,7 +254,7 @@ void ChartWindow::closeEvent(QCloseEvent *event)
|
||||
bool ChartWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
||||
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
||||
stop_run();
|
||||
|
||||
@ -582,7 +582,9 @@ void CodeEditor::keyPressEvent(QKeyEvent *event)
|
||||
if (line[begin].isSpace()) break;
|
||||
--begin;
|
||||
}
|
||||
if (((cursor.positionInBlock() - begin) > 2) || (line[begin + 1] == '$')) runCompletion();
|
||||
if (((cursor.positionInBlock() - begin) > 2) ||
|
||||
((line.length() > begin + 1) && (line[begin + 1] == '$')))
|
||||
runCompletion();
|
||||
if (current_comp && current_comp->popup()->isVisible() &&
|
||||
((cursor.positionInBlock() - begin) < 2)) {
|
||||
current_comp->popup()->hide();
|
||||
@ -620,7 +622,7 @@ void CodeEditor::dropEvent(QDropEvent *event)
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->accept();
|
||||
auto file = event->mimeData()->urls()[0].toLocalFile();
|
||||
auto gui = dynamic_cast<LammpsGui *>(parent());
|
||||
auto *gui = dynamic_cast<LammpsGui *>(parent());
|
||||
if (gui) {
|
||||
moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||
gui->open_file(file);
|
||||
@ -687,17 +689,17 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
||||
auto *menu = createStandardContextMenu();
|
||||
menu->addSeparator();
|
||||
if (textCursor().hasSelection()) {
|
||||
auto action1 = menu->addAction("Comment out selection");
|
||||
auto *action1 = menu->addAction("Comment out selection");
|
||||
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
||||
connect(action1, &QAction::triggered, this, &CodeEditor::comment_selection);
|
||||
auto action2 = menu->addAction("Uncomment selection");
|
||||
auto *action2 = menu->addAction("Uncomment selection");
|
||||
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
||||
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_selection);
|
||||
} else {
|
||||
auto action1 = menu->addAction("Comment out line");
|
||||
auto *action1 = menu->addAction("Comment out line");
|
||||
action1->setIcon(QIcon(":/icons/expand-text.png"));
|
||||
connect(action1, &QAction::triggered, this, &CodeEditor::comment_line);
|
||||
auto action2 = menu->addAction("Uncomment line");
|
||||
auto *action2 = menu->addAction("Uncomment line");
|
||||
action2->setIcon(QIcon(":/icons/expand-text.png"));
|
||||
connect(action2, &QAction::triggered, this, &CodeEditor::uncomment_line);
|
||||
}
|
||||
@ -705,14 +707,14 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
// print augmented context menu if an entry was found
|
||||
if (!help.isEmpty()) {
|
||||
auto action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
||||
auto *action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
||||
action->setIcon(QIcon(":/icons/expand-text.png"));
|
||||
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
if (!page.isEmpty()) {
|
||||
auto action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
||||
auto *action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
||||
action->setIcon(QIcon(":/icons/format-indent-less-3.png"));
|
||||
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);
|
||||
|
||||
@ -728,13 +730,13 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
||||
help = words.at(0);
|
||||
page = words.at(0);
|
||||
page += ".html";
|
||||
auto action2 = menu->addAction(QString("View Documentation for '%1'").arg(help));
|
||||
auto *action2 = menu->addAction(QString("View Documentation for '%1'").arg(help));
|
||||
action2->setIcon(QIcon(":/icons/system-help.png"));
|
||||
action2->setData(page);
|
||||
connect(action2, &QAction::triggered, this, &CodeEditor::open_help);
|
||||
}
|
||||
}
|
||||
auto action = menu->addAction(QString("LAMMPS Manual"));
|
||||
auto *action = menu->addAction(QString("LAMMPS Manual"));
|
||||
action->setIcon(QIcon(":/icons/help-browser.png"));
|
||||
action->setData(QString());
|
||||
connect(action, &QAction::triggered, this, &CodeEditor::open_help);
|
||||
@ -1093,11 +1095,12 @@ void CodeEditor::insertCompletedCommand(const QString &completion)
|
||||
// special characters as part of a word.
|
||||
auto cursor = textCursor();
|
||||
auto line = cursor.block().text();
|
||||
int begin = cursor.positionInBlock();
|
||||
do {
|
||||
int begin = qMin(cursor.positionInBlock(), line.length() - 1);
|
||||
|
||||
while (begin >= 0) {
|
||||
if (line[begin].isSpace()) break;
|
||||
--begin;
|
||||
} while (begin >= 0);
|
||||
}
|
||||
|
||||
int end = begin + 1;
|
||||
while (end < line.length()) {
|
||||
@ -1166,7 +1169,7 @@ void CodeEditor::find_help(QString &page, QString &help)
|
||||
|
||||
void CodeEditor::open_help()
|
||||
{
|
||||
QAction *act = qobject_cast<QAction *>(sender());
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
QDesktopServices::openUrl(
|
||||
QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString())));
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
// duplicate string, STL version
|
||||
char *mystrdup(const std::string &text)
|
||||
{
|
||||
auto tmp = new char[text.size() + 1];
|
||||
auto *tmp = new char[text.size() + 1];
|
||||
memcpy(tmp, text.c_str(), text.size() + 1);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
|
||||
scrollArea->setWidget(imageLabel);
|
||||
scrollArea->setVisible(false);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
auto *mainLayout = new QVBoxLayout;
|
||||
|
||||
QSettings settings;
|
||||
|
||||
@ -223,7 +223,7 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
|
||||
combo->addItem(gname);
|
||||
}
|
||||
|
||||
QHBoxLayout *menuLayout = new QHBoxLayout;
|
||||
auto *menuLayout = new QHBoxLayout;
|
||||
menuLayout->addWidget(menuBar);
|
||||
menuLayout->addWidget(renderstatus);
|
||||
menuLayout->addWidget(new QLabel(" Width: "));
|
||||
@ -324,7 +324,7 @@ void ImageViewer::reset_view()
|
||||
|
||||
void ImageViewer::edit_size()
|
||||
{
|
||||
QSpinBox *field = qobject_cast<QSpinBox *>(sender());
|
||||
auto *field = qobject_cast<QSpinBox *>(sender());
|
||||
if (field->objectName() == "xsize") {
|
||||
xsize = field->value();
|
||||
} else if (field->objectName() == "ysize") {
|
||||
@ -335,7 +335,7 @@ void ImageViewer::edit_size()
|
||||
|
||||
void ImageViewer::toggle_ssao()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
usessao = !usessao;
|
||||
button->setChecked(usessao);
|
||||
createImage();
|
||||
@ -343,7 +343,7 @@ void ImageViewer::toggle_ssao()
|
||||
|
||||
void ImageViewer::toggle_anti()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
antialias = !antialias;
|
||||
button->setChecked(antialias);
|
||||
createImage();
|
||||
@ -351,7 +351,7 @@ void ImageViewer::toggle_anti()
|
||||
|
||||
void ImageViewer::toggle_vdw()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
if (vdwfactor > 1.0)
|
||||
vdwfactor = 0.5;
|
||||
else
|
||||
@ -362,7 +362,7 @@ void ImageViewer::toggle_vdw()
|
||||
|
||||
void ImageViewer::toggle_box()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
showbox = !showbox;
|
||||
button->setChecked(showbox);
|
||||
createImage();
|
||||
@ -370,7 +370,7 @@ void ImageViewer::toggle_box()
|
||||
|
||||
void ImageViewer::toggle_axes()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
showaxes = !showaxes;
|
||||
button->setChecked(showaxes);
|
||||
createImage();
|
||||
@ -420,14 +420,14 @@ void ImageViewer::do_rot_up()
|
||||
|
||||
void ImageViewer::change_group(int)
|
||||
{
|
||||
QComboBox *box = findChild<QComboBox *>("group");
|
||||
auto *box = findChild<QComboBox *>("group");
|
||||
if (box) group = box->currentText();
|
||||
createImage();
|
||||
}
|
||||
|
||||
void ImageViewer::createImage()
|
||||
{
|
||||
QLabel *renderstatus = findChild<QLabel *>("renderstatus");
|
||||
auto *renderstatus = findChild<QLabel *>("renderstatus");
|
||||
if (renderstatus) renderstatus->setEnabled(true);
|
||||
repaint();
|
||||
|
||||
@ -443,7 +443,7 @@ void ImageViewer::createImage()
|
||||
// determine elements from masses and set their covalent radii
|
||||
int ntypes = lammps->extract_setting("ntypes");
|
||||
int nbondtypes = lammps->extract_setting("nbondtypes");
|
||||
double *masses = (double *)lammps->extract_atom("mass");
|
||||
auto *masses = (double *)lammps->extract_atom("mass");
|
||||
QString units = (const char *)lammps->extract_global("units");
|
||||
QString elements = "element ";
|
||||
QString adiams;
|
||||
|
||||
@ -300,14 +300,14 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
||||
const char *varstyles[] = {"delete", "atomfile", "file", "format", "getenv", "index",
|
||||
"internal", "loop", "python", "string", "timer", "uloop",
|
||||
"universe", "world", "equal", "vector", "atom"};
|
||||
for (const auto var : varstyles)
|
||||
for (const auto *const var : varstyles)
|
||||
style_list << var;
|
||||
style_list.sort();
|
||||
ui->textEdit->setVariableList(style_list);
|
||||
|
||||
style_list.clear();
|
||||
const char *unitstyles[] = {"lj", "real", "metal", "si", "cgs", "electron", "micro", "nano"};
|
||||
for (const auto unit : unitstyles)
|
||||
for (const auto *const unit : unitstyles)
|
||||
style_list << unit;
|
||||
style_list.sort();
|
||||
ui->textEdit->setUnitsList(style_list);
|
||||
@ -392,14 +392,14 @@ void LammpsGui::open()
|
||||
|
||||
void LammpsGui::open_recent()
|
||||
{
|
||||
QAction *act = qobject_cast<QAction *>(sender());
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
if (act) open_file(act->data().toString());
|
||||
}
|
||||
|
||||
void LammpsGui::start_exe()
|
||||
{
|
||||
if (!lammps.extract_setting("box_exists")) return;
|
||||
QAction *act = qobject_cast<QAction *>(sender());
|
||||
auto *act = qobject_cast<QAction *>(sender());
|
||||
if (act) {
|
||||
auto exe = act->data().toString();
|
||||
QString datacmd = "write_data '";
|
||||
@ -811,8 +811,8 @@ void LammpsGui::logupdate()
|
||||
step = (int)*(int64_t *)ptr;
|
||||
}
|
||||
|
||||
// extract cached thermo data
|
||||
if (chartwindow) {
|
||||
// extract cached thermo data when LAMMPS is executing a minimize or run command
|
||||
if (chartwindow && lammps.is_running()) {
|
||||
// thermo data is not yet valid during setup
|
||||
void *ptr = lammps.last_thermo("setup", 0);
|
||||
if (ptr && *(int *)ptr) return;
|
||||
@ -1052,7 +1052,7 @@ void LammpsGui::do_run(bool use_buffer)
|
||||
logwindow->document()->setDefaultFont(text_font);
|
||||
logwindow->setLineWrapMode(LogWindow::NoWrap);
|
||||
logwindow->setMinimumSize(400, 300);
|
||||
QShortcut *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow);
|
||||
auto *shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), logwindow);
|
||||
QObject::connect(shortcut, &QShortcut::activated, logwindow, &LogWindow::close);
|
||||
shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Slash), logwindow);
|
||||
QObject::connect(shortcut, &QShortcut::activated, this, &LammpsGui::stop_run);
|
||||
@ -1088,7 +1088,7 @@ void LammpsGui::do_run(bool use_buffer)
|
||||
|
||||
logupdater = new QTimer(this);
|
||||
connect(logupdater, &QTimer::timeout, this, &LammpsGui::logupdate);
|
||||
logupdater->start(settings.value("updfreq", "100").toInt());
|
||||
logupdater->start(settings.value("updfreq", "10").toInt());
|
||||
}
|
||||
|
||||
void LammpsGui::render_image()
|
||||
@ -1244,7 +1244,7 @@ void LammpsGui::about()
|
||||
msg.setFont(font);
|
||||
|
||||
auto *minwidth = new QSpacerItem(700, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QGridLayout *layout = (QGridLayout *)msg.layout();
|
||||
auto *layout = (QGridLayout *)msg.layout();
|
||||
layout->addItem(minwidth, layout->rowCount(), 0, 1, layout->columnCount());
|
||||
|
||||
msg.exec();
|
||||
|
||||
@ -35,7 +35,7 @@ LogWindow::LogWindow(const QString &_filename, QWidget *parent) :
|
||||
QSettings settings;
|
||||
resize(settings.value("logx", 500).toInt(), settings.value("logy", 320).toInt());
|
||||
|
||||
auto action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
|
||||
auto *action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_S), this);
|
||||
connect(action, &QShortcut::activated, this, &LogWindow::save_as);
|
||||
action = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
||||
connect(action, &QShortcut::activated, this, &LogWindow::quit);
|
||||
@ -99,7 +99,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
// show augmented context menu
|
||||
auto *menu = createStandardContextMenu();
|
||||
menu->addSeparator();
|
||||
auto action = menu->addAction(QString("Save Log to File ..."));
|
||||
auto *action = menu->addAction(QString("Save Log to File ..."));
|
||||
action->setIcon(QIcon(":/icons/document-save-as.png"));
|
||||
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
|
||||
connect(action, &QAction::triggered, this, &LogWindow::save_as);
|
||||
@ -114,7 +114,7 @@ void LogWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
bool LogWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||
auto *keyEvent = dynamic_cast<QKeyEvent *>(event);
|
||||
if (!keyEvent) return QWidget::eventFilter(watched, event);
|
||||
if (keyEvent->modifiers().testFlag(Qt::ControlModifier) && keyEvent->key() == '/') {
|
||||
stop_run();
|
||||
|
||||
@ -93,25 +93,25 @@ void Preferences::accept()
|
||||
|
||||
// store selected accelerator
|
||||
QList<QRadioButton *> allButtons = tabWidget->findChildren<QRadioButton *>();
|
||||
for (int i = 0; i < allButtons.size(); ++i) {
|
||||
if (allButtons[i]->isChecked()) {
|
||||
if (allButtons[i]->objectName() == "none")
|
||||
for (auto & allButton : allButtons) {
|
||||
if (allButton->isChecked()) {
|
||||
if (allButton->objectName() == "none")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::None));
|
||||
if (allButtons[i]->objectName() == "opt")
|
||||
if (allButton->objectName() == "opt")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Opt));
|
||||
if (allButtons[i]->objectName() == "openmp")
|
||||
if (allButton->objectName() == "openmp")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::OpenMP));
|
||||
if (allButtons[i]->objectName() == "intel")
|
||||
if (allButton->objectName() == "intel")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Intel));
|
||||
if (allButtons[i]->objectName() == "kokkos")
|
||||
if (allButton->objectName() == "kokkos")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Kokkos));
|
||||
if (allButtons[i]->objectName() == "gpu")
|
||||
if (allButton->objectName() == "gpu")
|
||||
settings->setValue("accelerator", QString::number(AcceleratorTab::Gpu));
|
||||
}
|
||||
}
|
||||
|
||||
// store number of threads, reset to 1 for "None" and "Opt" settings
|
||||
QLineEdit *field = tabWidget->findChild<QLineEdit *>("nthreads");
|
||||
auto *field = tabWidget->findChild<QLineEdit *>("nthreads");
|
||||
if (field) {
|
||||
int accel = settings->value("accelerator", AcceleratorTab::None).toInt();
|
||||
if ((accel == AcceleratorTab::None) || (accel == AcceleratorTab::Opt))
|
||||
@ -132,7 +132,7 @@ void Preferences::accept()
|
||||
field = tabWidget->findChild<QLineEdit *>("zoom");
|
||||
if (field)
|
||||
if (field->hasAcceptableInput()) settings->setValue("zoom", field->text());
|
||||
QCheckBox *box = tabWidget->findChild<QCheckBox *>("anti");
|
||||
auto *box = tabWidget->findChild<QCheckBox *>("anti");
|
||||
if (box) settings->setValue("antialias", box->isChecked());
|
||||
box = tabWidget->findChild<QCheckBox *>("ssao");
|
||||
if (box) settings->setValue("ssao", box->isChecked());
|
||||
@ -142,7 +142,7 @@ void Preferences::accept()
|
||||
if (box) settings->setValue("axes", box->isChecked());
|
||||
box = tabWidget->findChild<QCheckBox *>("vdwstyle");
|
||||
if (box) settings->setValue("vdwstyle", box->isChecked());
|
||||
QComboBox *combo = tabWidget->findChild<QComboBox *>("background");
|
||||
auto *combo = tabWidget->findChild<QComboBox *>("background");
|
||||
if (combo) settings->setValue("background", combo->currentText());
|
||||
combo = tabWidget->findChild<QComboBox *>("boxcolor");
|
||||
if (combo) settings->setValue("boxcolor", combo->currentText());
|
||||
@ -166,7 +166,7 @@ void Preferences::accept()
|
||||
box = tabWidget->findChild<QCheckBox *>("viewslide");
|
||||
if (box) settings->setValue("viewslide", box->isChecked());
|
||||
|
||||
auto spin = tabWidget->findChild<QSpinBox *>("updfreq");
|
||||
auto *spin = tabWidget->findChild<QSpinBox *>("updfreq");
|
||||
if (spin) settings->setValue("updfreq", spin->value());
|
||||
|
||||
if (need_relaunch) {
|
||||
@ -260,7 +260,7 @@ GeneralTab::GeneralTab(QSettings *_settings, LammpsWrapper *_lammps, QWidget *pa
|
||||
auto *freqval = new QSpinBox;
|
||||
freqval->setRange(1, 1000);
|
||||
freqval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType);
|
||||
freqval->setValue(settings->value("updfreq", "100").toInt());
|
||||
freqval->setValue(settings->value("updfreq", "10").toInt());
|
||||
freqval->setObjectName("updfreq");
|
||||
freqlayout->addWidget(freqlabel);
|
||||
freqlayout->addWidget(freqval);
|
||||
@ -324,7 +324,7 @@ void GeneralTab::newtextfont()
|
||||
|
||||
void GeneralTab::pluginpath()
|
||||
{
|
||||
QLineEdit *field = findChild<QLineEdit *>("pluginedit");
|
||||
auto *field = findChild<QLineEdit *>("pluginedit");
|
||||
QString pluginfile =
|
||||
QFileDialog::getOpenFileName(this, "Select Shared LAMMPS Library to Load", field->text(),
|
||||
"Shared Objects (*.so *.dll *.dylib)");
|
||||
|
||||
@ -281,7 +281,7 @@ void SlideShow::play()
|
||||
}
|
||||
|
||||
// reset push button state. use findChild() if not triggered from button.
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
if (!button) button = findChild<QPushButton *>("play");
|
||||
if (button) button->setChecked(playtimer);
|
||||
}
|
||||
@ -315,7 +315,7 @@ void SlideShow::prev()
|
||||
|
||||
void SlideShow::loop()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
do_loop = !do_loop;
|
||||
button->setChecked(do_loop);
|
||||
}
|
||||
|
||||
@ -25,9 +25,8 @@ protected:
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite",
|
||||
"-var", "x", "2", "-var", "zpos", "1.5",
|
||||
nullptr};
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-echo", "screen", "-nocite", "-var",
|
||||
"x", "2", "-var", "zpos", "1.5", nullptr};
|
||||
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
|
||||
@ -18,8 +18,8 @@ extern "C" {
|
||||
typedef int32_t step_t;
|
||||
typedef int32_t tag_t;
|
||||
#elif LAMMPS_SMALLBIG
|
||||
typedef int64_t step_t;
|
||||
typedef int32_t tag_t;
|
||||
using step_t = int64_t;
|
||||
using tag_t = int32_t;
|
||||
#else
|
||||
typedef int64_t step_t;
|
||||
typedef int64_t tag_t;
|
||||
@ -42,10 +42,10 @@ static void callback(void *handle, step_t timestep, int nlocal, tag_t *, double
|
||||
lammps_fix_external_set_vector(handle, "ext", 5, -1.0);
|
||||
lammps_fix_external_set_vector(handle, "ext", 6, 0.25);
|
||||
}
|
||||
double *eatom = new double[nlocal];
|
||||
double **vatom = new double *[nlocal];
|
||||
vatom[0] = new double[nlocal * 6];
|
||||
eatom[0] = 0.0;
|
||||
auto *eatom = new double[nlocal];
|
||||
auto **vatom = new double *[nlocal];
|
||||
vatom[0] = new double[nlocal * 6];
|
||||
eatom[0] = 0.0;
|
||||
vatom[0][0] = vatom[0][1] = vatom[0][2] = vatom[0][3] = vatom[0][4] = vatom[0][5] = 0.0;
|
||||
|
||||
for (int i = 1; i < nlocal; ++i) {
|
||||
@ -107,7 +107,7 @@ TEST(lammps_external, callback)
|
||||
val += *valp;
|
||||
lammps_free(valp);
|
||||
}
|
||||
double *reduce =
|
||||
auto *reduce =
|
||||
(double *)lammps_extract_compute(handle, "sum", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR);
|
||||
output = ::testing::internal::GetCapturedStdout();
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
@ -97,8 +97,8 @@ TEST(MPI, sub_box)
|
||||
EXPECT_EQ(boxhi[1], 2.0);
|
||||
EXPECT_EQ(boxhi[2], 2.0);
|
||||
|
||||
double *sublo = (double *)lammps_extract_global(lmp, "sublo");
|
||||
double *subhi = (double *)lammps_extract_global(lmp, "subhi");
|
||||
auto *sublo = (double *)lammps_extract_global(lmp, "sublo");
|
||||
auto *subhi = (double *)lammps_extract_global(lmp, "subhi");
|
||||
|
||||
ASSERT_NE(sublo, nullptr);
|
||||
ASSERT_NE(subhi, nullptr);
|
||||
@ -172,8 +172,8 @@ TEST(MPI, multi_partition)
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &me);
|
||||
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1",
|
||||
"-echo", "screen", "-nocite", "-in", "none", nullptr};
|
||||
const char *args[] = {"LAMMPS_test", "-log", "none", "-partition", "4x1", "-echo",
|
||||
"screen", "-nocite", "-in", "none", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
void *lmp = lammps_open(argc, argv, MPI_COMM_WORLD, nullptr);
|
||||
@ -258,7 +258,7 @@ TEST_F(MPITest, size_rank)
|
||||
|
||||
TEST_F(MPITest, gather)
|
||||
{
|
||||
int64_t natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
auto natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
ASSERT_EQ(natoms, 32);
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
@ -266,11 +266,11 @@ TEST_F(MPITest, gather)
|
||||
EXPECT_EQ(nlocal, 8);
|
||||
|
||||
// get the entire x on all procs
|
||||
double *x = new double[natoms * 3];
|
||||
auto *x = new double[natoms * 3];
|
||||
lammps_gather(lmp, (char *)"x", 1, 3, x);
|
||||
|
||||
int *tag = (int *)lammps_extract_atom(lmp, "id");
|
||||
double **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
int *tag = (int *)lammps_extract_atom(lmp, "id");
|
||||
auto **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
|
||||
// each proc checks its local atoms
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
@ -287,10 +287,10 @@ TEST_F(MPITest, gather)
|
||||
|
||||
TEST_F(MPITest, scatter)
|
||||
{
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
double *x_orig = new double[3 * nlocal];
|
||||
double **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
int *p_nlocal = (int *)lammps_extract_global(lmp, "nlocal");
|
||||
int nlocal = *p_nlocal;
|
||||
auto *x_orig = new double[3 * nlocal];
|
||||
auto **x_local = (double **)lammps_extract_atom(lmp, "x");
|
||||
|
||||
// make copy of original local x vector
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
@ -301,8 +301,8 @@ TEST_F(MPITest, scatter)
|
||||
}
|
||||
|
||||
// get the entire x on all procs
|
||||
int64_t natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
double *x = new double[natoms * 3];
|
||||
auto natoms = (int64_t)lammps_get_natoms(lmp);
|
||||
auto *x = new double[natoms * 3];
|
||||
lammps_gather(lmp, (char *)"x", 1, 3, x);
|
||||
|
||||
// shift all coordinates by 0.001
|
||||
|
||||
@ -112,75 +112,75 @@ TEST_F(LibraryObjects, variables)
|
||||
if (verbose) std::cout << output;
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "unknown"), -1);
|
||||
void *ptr = lammps_extract_variable(lmp, "unknown", NULL);
|
||||
void *ptr = lammps_extract_variable(lmp, "unknown", nullptr);
|
||||
EXPECT_EQ(ptr, nullptr);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "one"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "one", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "one", nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "two"), LMP_VAR_EQUAL);
|
||||
ptr = lammps_extract_variable(lmp, "two", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "two", nullptr);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 2.0);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "three"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "three", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "three", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("three"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "four1", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "four1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "four2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "four2", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "four2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("2"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "five1", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "five1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("001"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "five2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "five2", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "five2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("010"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "six"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "six", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "six", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("one"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "seven"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "seven", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "seven", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq(" 2.00"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "eight"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "eight", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "eight", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq(""));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "nine"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "nine", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "nine", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("one"));
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten"), LMP_VAR_EQUAL);
|
||||
ptr = lammps_extract_variable(lmp, "ten", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
variable->internal_set(variable->find("ten"), 2.5);
|
||||
ptr = lammps_extract_variable(lmp, "ten", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 2.5);
|
||||
lammps_free(ptr);
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten1"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten1", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten1", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten2"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten2", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten2", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten3"), LMP_VAR_STRING);
|
||||
ptr = lammps_extract_variable(lmp, "ten3", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten3", nullptr);
|
||||
EXPECT_THAT((char *)ptr, StrEq("1"));
|
||||
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten4"), LMP_VAR_VECTOR);
|
||||
ptr = lammps_extract_variable(lmp, "ten4", (const char *)1);
|
||||
double *dptr = (double *)lammps_extract_variable(lmp, "ten4", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten4", (const char *)1);
|
||||
auto *dptr = (double *)lammps_extract_variable(lmp, "ten4", nullptr);
|
||||
EXPECT_EQ((*(int *)ptr), 7);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(dptr[0], 0);
|
||||
EXPECT_EQ(dptr[4], 5);
|
||||
EXPECT_EQ(dptr[6], 11);
|
||||
EXPECT_EQ(lammps_extract_variable_datatype(lmp, "ten5"), LMP_VAR_VECTOR);
|
||||
ptr = lammps_extract_variable(lmp, "ten5", (const char *)1);
|
||||
dptr = (double *)lammps_extract_variable(lmp, "ten5", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "ten5", (const char *)1);
|
||||
dptr = (double *)lammps_extract_variable(lmp, "ten5", nullptr);
|
||||
EXPECT_EQ((*(int *)ptr), 2);
|
||||
lammps_free(ptr);
|
||||
EXPECT_EQ(dptr[0], 0.5);
|
||||
@ -196,10 +196,10 @@ TEST_F(LibraryObjects, variables)
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
#elif defined(__linux__)
|
||||
ptr = lammps_extract_variable(lmp, "iswin", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "iswin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 0.0);
|
||||
lammps_free(ptr);
|
||||
ptr = lammps_extract_variable(lmp, "islin", NULL);
|
||||
ptr = lammps_extract_variable(lmp, "islin", nullptr);
|
||||
EXPECT_THAT(*(double *)ptr, 1.0);
|
||||
lammps_free(ptr);
|
||||
#else
|
||||
|
||||
@ -25,7 +25,7 @@ TEST(lammps_open, null_args)
|
||||
int mpi_init = 0;
|
||||
MPI_Initialized(&mpi_init);
|
||||
EXPECT_GT(mpi_init, 0);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -53,7 +53,7 @@ TEST(lammps_open, with_args)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
// MPI STUBS uses no real communicators
|
||||
#if !defined(MPI_STUBS)
|
||||
@ -89,7 +89,7 @@ TEST(lammps_open, with_kokkos)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -118,7 +118,7 @@ TEST(lammps_open_no_mpi, no_screen)
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.c_str(), "");
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -138,7 +138,7 @@ TEST(lammps_open_no_mpi, no_screen)
|
||||
TEST(lammps_open_no_mpi, with_omp)
|
||||
{
|
||||
if (!LAMMPS_NS::LAMMPS::is_installed_pkg("OPENMP")) GTEST_SKIP();
|
||||
const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no",
|
||||
const char *args[] = {"liblammps", "-pk", "omp", "2", "neigh", "no",
|
||||
"-sf", "omp", "-log", "none", "-nocite", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = (sizeof(args) / sizeof(char *)) - 1;
|
||||
@ -150,7 +150,7 @@ TEST(lammps_open_no_mpi, with_omp)
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -179,7 +179,7 @@ TEST(lammps_open_fortran, no_args)
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
if (verbose) std::cout << output;
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
// MPI STUBS uses no real communicators
|
||||
#if !defined(MPI_STUBS)
|
||||
@ -210,7 +210,7 @@ TEST(lammps_open_no_mpi, lammps_error)
|
||||
void *handle = lammps_open_no_mpi(argc, argv, &alt_ptr);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(handle, alt_ptr);
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
@ -226,4 +226,3 @@ TEST(lammps_open_no_mpi, lammps_error)
|
||||
output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, HasSubstr("WARNING: test_warning"));
|
||||
}
|
||||
|
||||
|
||||
@ -376,18 +376,18 @@ TEST_F(LibraryProperties, global)
|
||||
EXPECT_EQ((*i_ptr), 2);
|
||||
#else
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "ntimestep"), LAMMPS_INT64);
|
||||
int64_t *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep");
|
||||
auto *b_ptr = (int64_t *)lammps_extract_global(lmp, "ntimestep");
|
||||
EXPECT_EQ((*b_ptr), 2);
|
||||
#endif
|
||||
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "dt"), LAMMPS_DOUBLE);
|
||||
double *d_ptr = (double *)lammps_extract_global(lmp, "dt");
|
||||
auto *d_ptr = (double *)lammps_extract_global(lmp, "dt");
|
||||
EXPECT_DOUBLE_EQ((*d_ptr), 0.1);
|
||||
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_lj"), LAMMPS_DOUBLE);
|
||||
EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_coul"), LAMMPS_DOUBLE);
|
||||
double *special_lj = (double *)lammps_extract_global(lmp, "special_lj");
|
||||
double *special_coul = (double *)lammps_extract_global(lmp, "special_coul");
|
||||
auto *special_lj = (double *)lammps_extract_global(lmp, "special_lj");
|
||||
auto *special_coul = (double *)lammps_extract_global(lmp, "special_coul");
|
||||
EXPECT_DOUBLE_EQ(special_lj[0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(special_lj[1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(special_lj[2], 0.5);
|
||||
@ -418,14 +418,14 @@ TEST_F(LibraryProperties, global)
|
||||
EXPECT_EQ(map_style, Atom::MAP_ARRAY);
|
||||
EXPECT_NE(sametag, nullptr);
|
||||
|
||||
tagint *tags = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
tagint sometags[] = {1, 5, 10, 15, 20};
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
int idx = lammps_map_atom(lmp, (const void *)&sometags[i]);
|
||||
EXPECT_EQ(sometags[i], tags[idx]);
|
||||
auto *tags = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
const tagint sometags[] = {1, 5, 10, 15, 20};
|
||||
for (const auto &sometag : sometags) {
|
||||
int idx = lammps_map_atom(lmp, (const void *)&sometag);
|
||||
EXPECT_EQ(sometag, tags[idx]);
|
||||
int nextidx = sametag[idx];
|
||||
if (nextidx >= 0) {
|
||||
EXPECT_EQ(sometags[i], tags[nextidx]);
|
||||
EXPECT_EQ(sometag, tags[nextidx]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,7 +655,7 @@ TEST_F(AtomProperties, invalid)
|
||||
TEST_F(AtomProperties, mass)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "mass"), LAMMPS_DOUBLE);
|
||||
double *mass = (double *)lammps_extract_atom(lmp, "mass");
|
||||
auto *mass = (double *)lammps_extract_atom(lmp, "mass");
|
||||
ASSERT_NE(mass, nullptr);
|
||||
ASSERT_DOUBLE_EQ(mass[1], 3.0);
|
||||
}
|
||||
@ -663,7 +663,7 @@ TEST_F(AtomProperties, mass)
|
||||
TEST_F(AtomProperties, id)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "id"), LAMMPS_TAGINT);
|
||||
tagint *id = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
auto *id = (tagint *)lammps_extract_atom(lmp, "id");
|
||||
ASSERT_NE(id, nullptr);
|
||||
ASSERT_EQ(id[0], 1);
|
||||
ASSERT_EQ(id[1], 2);
|
||||
@ -681,7 +681,7 @@ TEST_F(AtomProperties, type)
|
||||
TEST_F(AtomProperties, position)
|
||||
{
|
||||
EXPECT_EQ(lammps_extract_atom_datatype(lmp, "x"), LAMMPS_DOUBLE_2D);
|
||||
double **x = (double **)lammps_extract_atom(lmp, "x");
|
||||
auto **x = (double **)lammps_extract_atom(lmp, "x");
|
||||
ASSERT_NE(x, nullptr);
|
||||
EXPECT_DOUBLE_EQ(x[0][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(x[0][1], 1.0);
|
||||
|
||||
@ -67,7 +67,7 @@ TEST_F(GatherProperties, gather_bonds_newton_on)
|
||||
bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds");
|
||||
EXPECT_EQ(nbonds, 24);
|
||||
|
||||
tagint *bonds = new tagint[3 * nbonds];
|
||||
auto *bonds = new tagint[3 * nbonds];
|
||||
lammps_gather_bonds(lmp, bonds);
|
||||
|
||||
#define CHECK_BOND(idx, type, atom1, atom2) \
|
||||
@ -108,7 +108,7 @@ TEST_F(GatherProperties, gather_bonds_newton_off)
|
||||
bigint nbonds = *(bigint *)lammps_extract_global(lmp, "nbonds");
|
||||
EXPECT_EQ(nbonds, 24);
|
||||
|
||||
tagint *bonds = new tagint[3 * nbonds];
|
||||
auto *bonds = new tagint[3 * nbonds];
|
||||
lammps_gather_bonds(lmp, bonds);
|
||||
|
||||
#define CHECK_BOND(idx, type, atom1, atom2) \
|
||||
@ -149,7 +149,7 @@ TEST_F(GatherProperties, gather_angles_newton_on)
|
||||
bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles");
|
||||
EXPECT_EQ(nangles, 30);
|
||||
|
||||
tagint *angles = new tagint[4 * nangles];
|
||||
auto *angles = new tagint[4 * nangles];
|
||||
lammps_gather_angles(lmp, angles);
|
||||
|
||||
#define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \
|
||||
@ -192,7 +192,7 @@ TEST_F(GatherProperties, gather_angles_newton_off)
|
||||
bigint nangles = *(bigint *)lammps_extract_global(lmp, "nangles");
|
||||
EXPECT_EQ(nangles, 30);
|
||||
|
||||
tagint *angles = new tagint[4 * nangles];
|
||||
auto *angles = new tagint[4 * nangles];
|
||||
lammps_gather_angles(lmp, angles);
|
||||
|
||||
#define CHECK_ANGLE(idx, type, atom1, atom2, atom3) \
|
||||
@ -235,7 +235,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_on)
|
||||
bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals");
|
||||
EXPECT_EQ(ndihedrals, 31);
|
||||
|
||||
tagint *dihedrals = new tagint[5 * ndihedrals];
|
||||
auto *dihedrals = new tagint[5 * ndihedrals];
|
||||
lammps_gather_dihedrals(lmp, dihedrals);
|
||||
|
||||
#define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -276,7 +276,7 @@ TEST_F(GatherProperties, gather_dihedrals_newton_off)
|
||||
bigint ndihedrals = *(bigint *)lammps_extract_global(lmp, "ndihedrals");
|
||||
EXPECT_EQ(ndihedrals, 31);
|
||||
|
||||
tagint *dihedrals = new tagint[5 * ndihedrals];
|
||||
auto *dihedrals = new tagint[5 * ndihedrals];
|
||||
lammps_gather_dihedrals(lmp, dihedrals);
|
||||
|
||||
#define CHECK_DIHEDRAL(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -316,7 +316,7 @@ TEST_F(GatherProperties, gather_impropers_newton_on)
|
||||
bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers");
|
||||
EXPECT_EQ(nimpropers, 2);
|
||||
|
||||
tagint *impropers = new tagint[5 * nimpropers];
|
||||
auto *impropers = new tagint[5 * nimpropers];
|
||||
lammps_gather_impropers(lmp, impropers);
|
||||
|
||||
#define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \
|
||||
@ -349,7 +349,7 @@ TEST_F(GatherProperties, gather_impropers_newton_off)
|
||||
bigint nimpropers = *(bigint *)lammps_extract_global(lmp, "nimpropers");
|
||||
EXPECT_EQ(nimpropers, 2);
|
||||
|
||||
tagint *impropers = new tagint[5 * nimpropers];
|
||||
auto *impropers = new tagint[5 * nimpropers];
|
||||
lammps_gather_impropers(lmp, impropers);
|
||||
|
||||
#define CHECK_IMPROPER(idx, type, atom1, atom2, atom3, atom4) \
|
||||
|
||||
@ -120,14 +120,14 @@ TEST_F(ComputeChunkTest, ChunkAtom)
|
||||
EXPECT_EQ(get_scalar("mols"), 6);
|
||||
EXPECT_EQ(get_scalar("types"), 5);
|
||||
|
||||
auto cbin1d = get_peratom("bin1d");
|
||||
auto cbin2d = get_peratom("bin2d");
|
||||
auto cbin3d = get_peratom("bin3d");
|
||||
auto cbinsph = get_peratom("binsph");
|
||||
auto cbincyl = get_peratom("bincyl");
|
||||
auto cmols = get_peratom("mols");
|
||||
auto ctypes = get_peratom("types");
|
||||
auto tag = get_peratom("tags");
|
||||
auto *cbin1d = get_peratom("bin1d");
|
||||
auto *cbin2d = get_peratom("bin2d");
|
||||
auto *cbin3d = get_peratom("bin3d");
|
||||
auto *cbinsph = get_peratom("binsph");
|
||||
auto *cbincyl = get_peratom("bincyl");
|
||||
auto *cmols = get_peratom("mols");
|
||||
auto *ctypes = get_peratom("types");
|
||||
auto *tag = get_peratom("tags");
|
||||
|
||||
for (int i = 0; i < natoms; ++i) {
|
||||
EXPECT_EQ(cbin1d[i], chunk1d[(int)tag[i]]);
|
||||
@ -180,16 +180,16 @@ TEST_F(ComputeChunkTest, PropertyChunk)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto cprop1 = get_vector("prop1");
|
||||
auto *cprop1 = get_vector("prop1");
|
||||
EXPECT_EQ(cprop1[0], 0);
|
||||
EXPECT_EQ(cprop1[1], 7);
|
||||
EXPECT_EQ(cprop1[2], 16);
|
||||
EXPECT_EQ(cprop1[3], 6);
|
||||
EXPECT_EQ(cprop1[4], 0);
|
||||
|
||||
auto cprop2 = get_vector("prop2");
|
||||
int nempty = 0;
|
||||
int ncount = 0;
|
||||
auto *cprop2 = get_vector("prop2");
|
||||
int nempty = 0;
|
||||
int ncount = 0;
|
||||
for (int i = 0; i < 25; ++i) {
|
||||
if (cprop2[i] == 0)
|
||||
++nempty;
|
||||
@ -199,7 +199,7 @@ TEST_F(ComputeChunkTest, PropertyChunk)
|
||||
EXPECT_EQ(nempty, 17);
|
||||
EXPECT_EQ(ncount, 29);
|
||||
|
||||
auto cprop3 = get_array("prop3");
|
||||
auto *cprop3 = get_array("prop3");
|
||||
EXPECT_EQ(cprop3[0][0], 34);
|
||||
EXPECT_EQ(cprop3[1][0], 38);
|
||||
EXPECT_EQ(cprop3[2][0], 43);
|
||||
@ -250,15 +250,15 @@ TEST_F(ComputeChunkTest, ChunkComputes)
|
||||
command("fix hist2 all ave/time 1 1 1 c_tmp mode vector");
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
auto cang = get_array("ang");
|
||||
auto ccom = get_array("com");
|
||||
auto cdip = get_array("dip");
|
||||
auto cgyr = get_vector("gyr");
|
||||
auto cmom = get_array("mom");
|
||||
auto comg = get_array("omg");
|
||||
auto ctmp = get_vector("tmp");
|
||||
auto ctrq = get_array("trq");
|
||||
auto cvcm = get_array("vcm");
|
||||
auto *cang = get_array("ang");
|
||||
auto *ccom = get_array("com");
|
||||
auto *cdip = get_array("dip");
|
||||
auto *cgyr = get_vector("gyr");
|
||||
auto *cmom = get_array("mom");
|
||||
auto *comg = get_array("omg");
|
||||
auto *ctmp = get_vector("tmp");
|
||||
auto *ctrq = get_array("trq");
|
||||
auto *cvcm = get_array("vcm");
|
||||
EXPECT_NEAR(cang[0][0], -0.01906982, EPSILON);
|
||||
EXPECT_NEAR(cang[0][1], -0.02814532, EPSILON);
|
||||
EXPECT_NEAR(cang[0][2], -0.03357393, EPSILON);
|
||||
@ -329,7 +329,7 @@ TEST_F(ComputeChunkTest, ChunkTIP4PComputes)
|
||||
command("fix hist1 all ave/time 1 1 1 c_dip[*] mode vector");
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
auto cdip = get_array("dip");
|
||||
auto *cdip = get_array("dip");
|
||||
EXPECT_NEAR(cdip[0][3], 0.35912150, EPSILON);
|
||||
EXPECT_NEAR(cdip[1][3], 0.68453713, EPSILON);
|
||||
EXPECT_NEAR(cdip[2][3], 0.50272643, EPSILON);
|
||||
@ -358,11 +358,11 @@ TEST_F(ComputeChunkTest, ChunkSpreadGlobal)
|
||||
|
||||
const int natoms = lammps_get_natoms(lmp);
|
||||
|
||||
auto cgyr = get_vector("gyr");
|
||||
auto cspr = get_peratom("spr");
|
||||
auto cglb = get_peratom("glb");
|
||||
auto codd = get_peratom("odd");
|
||||
auto ctag = get_peratom("tags");
|
||||
auto *cgyr = get_vector("gyr");
|
||||
auto *cspr = get_peratom("spr");
|
||||
auto *cglb = get_peratom("glb");
|
||||
auto *codd = get_peratom("odd");
|
||||
auto *ctag = get_peratom("tags");
|
||||
|
||||
for (int i = 0; i < natoms; ++i) {
|
||||
EXPECT_EQ(cspr[i], cgyr[chunkmol[(int)ctag[i]] - 1]);
|
||||
@ -389,8 +389,8 @@ TEST_F(ComputeChunkTest, ChunkReduce)
|
||||
|
||||
const int nchunks = get_scalar("mols");
|
||||
|
||||
auto cprp = get_vector("prp");
|
||||
auto cred = get_vector("red");
|
||||
auto *cprp = get_vector("prp");
|
||||
auto *cred = get_vector("red");
|
||||
|
||||
for (int i = 0; i < nchunks; ++i)
|
||||
EXPECT_EQ(cprp[i], cred[i]);
|
||||
|
||||
@ -103,9 +103,9 @@ TEST_F(ComputeGlobalTest, Energy)
|
||||
EXPECT_NEAR(get_scalar("pr1"), 1956948.4735454607, 0.000000005);
|
||||
EXPECT_NEAR(get_scalar("pr2"), 1956916.7725807722, 0.000000005);
|
||||
EXPECT_DOUBLE_EQ(get_scalar("pr3"), 0.0);
|
||||
auto pr1 = get_vector("pr1");
|
||||
auto pr2 = get_vector("pr2");
|
||||
auto pr3 = get_vector("pr3");
|
||||
auto *pr1 = get_vector("pr1");
|
||||
auto *pr2 = get_vector("pr2");
|
||||
auto *pr3 = get_vector("pr3");
|
||||
EXPECT_NEAR(pr1[0], 2150600.9207200543, 0.000000005);
|
||||
EXPECT_NEAR(pr1[1], 1466949.7512112649, 0.000000005);
|
||||
EXPECT_NEAR(pr1[2], 2253294.7487050635, 0.000000005);
|
||||
@ -127,7 +127,7 @@ TEST_F(ComputeGlobalTest, Energy)
|
||||
|
||||
if (has_tally) {
|
||||
EXPECT_NEAR(get_scalar("pe4"), 15425.840923850392, 0.000000005);
|
||||
auto pe5 = get_vector("pe5");
|
||||
auto *pe5 = get_vector("pe5");
|
||||
EXPECT_NEAR(pe5[0], 23803.966677151559, 0.000000005);
|
||||
EXPECT_NEAR(pe5[1], -94.210004432380643, 0.000000005);
|
||||
EXPECT_NEAR(pe5[2], 115.58040355478101, 0.000000005);
|
||||
@ -177,12 +177,12 @@ TEST_F(ComputeGlobalTest, Geometry)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto com1 = get_vector("com1");
|
||||
auto com2 = get_vector("com2");
|
||||
auto mu1 = get_vector("mu1");
|
||||
auto mu2 = get_vector("mu2");
|
||||
auto rg1 = get_vector("rg1");
|
||||
auto rg2 = get_vector("rg2");
|
||||
auto *com1 = get_vector("com1");
|
||||
auto *com2 = get_vector("com2");
|
||||
auto *mu1 = get_vector("mu1");
|
||||
auto *mu2 = get_vector("mu2");
|
||||
auto *rg1 = get_vector("rg1");
|
||||
auto *rg2 = get_vector("rg2");
|
||||
|
||||
EXPECT_NEAR(com1[0], 1.4300952724948282, 0.0000000005);
|
||||
EXPECT_NEAR(com1[1], -0.29759806705328351, 0.0000000005);
|
||||
@ -215,10 +215,10 @@ TEST_F(ComputeGlobalTest, Geometry)
|
||||
EXPECT_NEAR(rg2[4], -5.0315240817290841, 0.0000000005);
|
||||
EXPECT_NEAR(rg2[5], 1.1103378503822141, 0.0000000005);
|
||||
if (has_extra) {
|
||||
auto mom1 = get_vector("mom1");
|
||||
auto mom2 = get_vector("mom2");
|
||||
auto mop1 = get_vector("mop1");
|
||||
auto mop2 = get_array("mop2");
|
||||
auto *mom1 = get_vector("mom1");
|
||||
auto *mom2 = get_vector("mom2");
|
||||
auto *mop1 = get_vector("mop1");
|
||||
auto *mop2 = get_array("mop2");
|
||||
EXPECT_DOUBLE_EQ(mom1[0], 0.0054219056685341164);
|
||||
EXPECT_DOUBLE_EQ(mom1[1], -0.054897225112275558);
|
||||
EXPECT_DOUBLE_EQ(mom1[2], 0.059097392692385661);
|
||||
@ -263,11 +263,11 @@ TEST_F(ComputeGlobalTest, Reduction)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto min = get_vector("min");
|
||||
auto max = get_vector("max");
|
||||
auto sum = get_vector("sum");
|
||||
auto ave = get_vector("ave");
|
||||
auto rep = get_vector("rep");
|
||||
auto *min = get_vector("min");
|
||||
auto *max = get_vector("max");
|
||||
auto *sum = get_vector("sum");
|
||||
auto *ave = get_vector("ave");
|
||||
auto *rep = get_vector("rep");
|
||||
|
||||
EXPECT_DOUBLE_EQ(get_scalar("chg"), 0.51000000000000001);
|
||||
|
||||
@ -318,13 +318,13 @@ TEST_F(ComputeGlobalTest, Counts)
|
||||
command("run 0 post no");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto tsum = get_vector("tsum");
|
||||
auto tcnt = get_vector("tcnt");
|
||||
auto bcnt = get_vector("bcnt");
|
||||
auto bbrk = get_scalar("bcnt");
|
||||
auto acnt = get_vector("acnt");
|
||||
auto dcnt = get_vector("dcnt");
|
||||
auto icnt = get_vector("icnt");
|
||||
auto *tsum = get_vector("tsum");
|
||||
auto *tcnt = get_vector("tcnt");
|
||||
auto *bcnt = get_vector("bcnt");
|
||||
auto bbrk = get_scalar("bcnt");
|
||||
auto *acnt = get_vector("acnt");
|
||||
auto *dcnt = get_vector("dcnt");
|
||||
auto *icnt = get_vector("icnt");
|
||||
|
||||
EXPECT_DOUBLE_EQ(tsum[0], tcnt[0]);
|
||||
EXPECT_DOUBLE_EQ(tsum[1], tcnt[1]);
|
||||
|
||||
@ -341,9 +341,9 @@ TEST_F(GroupTest, VariableFunctions)
|
||||
int three = group->find("three");
|
||||
int four = group->find("four");
|
||||
|
||||
auto right = domain->get_region_by_id("right");
|
||||
auto left = domain->get_region_by_id("left");
|
||||
auto top = domain->get_region_by_id("top");
|
||||
auto *right = domain->get_region_by_id("right");
|
||||
auto *left = domain->get_region_by_id("left");
|
||||
auto *top = domain->get_region_by_id("top");
|
||||
|
||||
EXPECT_EQ(group->count_all(), 64);
|
||||
EXPECT_EQ(group->count(one), 16);
|
||||
|
||||
@ -106,7 +106,7 @@ TEST_F(LabelMapTest, Atoms)
|
||||
EXPECT_EQ(utils::expand_type(FLERR, "**", Atom::ATOM, lmp), nullptr);
|
||||
EXPECT_EQ(utils::expand_type(FLERR, "1*2*", Atom::ATOM, lmp), nullptr);
|
||||
|
||||
auto expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp);
|
||||
auto *expanded = utils::expand_type(FLERR, "C1", Atom::ATOM, lmp);
|
||||
EXPECT_THAT(expanded, StrEq("1"));
|
||||
delete[] expanded;
|
||||
expanded = utils::expand_type(FLERR, "O#", Atom::ATOM, lmp);
|
||||
@ -268,7 +268,7 @@ TEST_F(LabelMapTest, Topology)
|
||||
EXPECT_EQ(atom->lmap->find("N2'-C1\"-N2'", Atom::BOND), -1);
|
||||
platform::unlink("labelmap_topology.inc");
|
||||
|
||||
auto expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp);
|
||||
auto *expanded = utils::expand_type(FLERR, "N2'", Atom::ATOM, lmp);
|
||||
EXPECT_THAT(expanded, StrEq("2"));
|
||||
delete[] expanded;
|
||||
expanded = utils::expand_type(FLERR, "[C1][C1]", Atom::BOND, lmp);
|
||||
|
||||
@ -54,7 +54,7 @@ TEST_F(LatticeRegionTest, lattice_none)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice none 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::NONE);
|
||||
ASSERT_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_EQ(lattice->ylattice, 2.0);
|
||||
@ -84,7 +84,7 @@ TEST_F(LatticeRegionTest, lattice_sc)
|
||||
auto output = END_CAPTURE_OUTPUT();
|
||||
ASSERT_THAT(output, ContainsRegex(".*Lattice spacing in x,y,z = 1.5.* 2.* 3.*"));
|
||||
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->xlattice, 1.5);
|
||||
ASSERT_EQ(lattice->ylattice, 2.0);
|
||||
ASSERT_EQ(lattice->zlattice, 3.0);
|
||||
@ -152,7 +152,7 @@ TEST_F(LatticeRegionTest, lattice_bcc)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice bcc 4.2 orient x 1 1 0 orient y -1 1 0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::BCC);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, sqrt(2.0) * 4.2);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, sqrt(2.0) * 4.2);
|
||||
@ -177,7 +177,7 @@ TEST_F(LatticeRegionTest, lattice_fcc)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice fcc 3.5 origin 0.5 0.5 0.5");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::FCC);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.5);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.5);
|
||||
@ -215,7 +215,7 @@ TEST_F(LatticeRegionTest, lattice_hcp)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice hcp 3.0 orient z 0 0 1");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::HCP);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0 * sqrt(3.0));
|
||||
@ -259,7 +259,7 @@ TEST_F(LatticeRegionTest, lattice_diamond)
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("lattice diamond 4.1 orient x 1 1 2 orient y -1 1 0 orient z -1 -1 1");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::DIAMOND);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 6.6952719636073539);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 5.7982756057296889);
|
||||
@ -312,7 +312,7 @@ TEST_F(LatticeRegionTest, lattice_sq)
|
||||
command("dimension 2");
|
||||
command("lattice sq 3.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::SQ);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 3.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.0);
|
||||
@ -338,7 +338,7 @@ TEST_F(LatticeRegionTest, lattice_sq2)
|
||||
command("dimension 2");
|
||||
command("lattice sq2 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::SQ2);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 2.0);
|
||||
@ -364,7 +364,7 @@ TEST_F(LatticeRegionTest, lattice_hex)
|
||||
command("dimension 2");
|
||||
command("lattice hex 2.0");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::HEX);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 2.0);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 3.4641016151377544);
|
||||
@ -414,7 +414,7 @@ TEST_F(LatticeRegionTest, lattice_custom)
|
||||
"basis $t 0.0 0.125 "
|
||||
"basis $f 0.5 0.125 ");
|
||||
END_HIDE_OUTPUT();
|
||||
auto lattice = lmp->domain->lattice;
|
||||
auto *lattice = lmp->domain->lattice;
|
||||
ASSERT_EQ(lattice->style, Lattice::CUSTOM);
|
||||
ASSERT_DOUBLE_EQ(lattice->xlattice, 4.34);
|
||||
ASSERT_DOUBLE_EQ(lattice->ylattice, 4.34 * sqrt(3.0));
|
||||
@ -499,7 +499,7 @@ TEST_F(LatticeRegionTest, region_block_lattice)
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
ASSERT_EQ(lmp->domain->triclinic, 0);
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
ASSERT_EQ(lmp->atom->natoms, 8);
|
||||
ASSERT_DOUBLE_EQ(x[0][0], 0.0);
|
||||
ASSERT_DOUBLE_EQ(x[0][1], 0.0);
|
||||
@ -525,7 +525,7 @@ TEST_F(LatticeRegionTest, region_block_box)
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->domain->triclinic, 0);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
ASSERT_EQ(lmp->atom->natoms, 1);
|
||||
ASSERT_DOUBLE_EQ(x[0][0], 1.125);
|
||||
ASSERT_DOUBLE_EQ(x[0][1], 1.125);
|
||||
|
||||
@ -80,7 +80,7 @@ TEST_F(RegionTest, NoBox)
|
||||
list = domain->get_region_list();
|
||||
EXPECT_EQ(list.size(), 9);
|
||||
|
||||
auto reg = domain->get_region_by_id("reg1");
|
||||
auto *reg = domain->get_region_by_id("reg1");
|
||||
EXPECT_EQ(reg->interior, 1);
|
||||
EXPECT_EQ(reg->scaleflag, 1);
|
||||
EXPECT_EQ(reg->bboxflag, 1);
|
||||
@ -231,17 +231,17 @@ TEST_F(RegionTest, Counts)
|
||||
command("region reg10 prism 0 5 0 5 -5 5 0.0 0.0 0.0"); // same as block
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto x = atom->x;
|
||||
auto reg1 = domain->get_region_by_id("reg1");
|
||||
auto reg2 = domain->get_region_by_id("reg2");
|
||||
auto reg3 = domain->get_region_by_id("reg3");
|
||||
auto reg4 = domain->get_region_by_id("reg4");
|
||||
auto reg5 = domain->get_region_by_id("reg5");
|
||||
auto reg6 = domain->get_region_by_id("reg6");
|
||||
auto reg7 = domain->get_region_by_id("reg7");
|
||||
auto reg8 = domain->get_region_by_id("reg8");
|
||||
auto reg9 = domain->get_region_by_id("reg9");
|
||||
auto reg10 = domain->get_region_by_id("reg10");
|
||||
auto *x = atom->x;
|
||||
auto *reg1 = domain->get_region_by_id("reg1");
|
||||
auto *reg2 = domain->get_region_by_id("reg2");
|
||||
auto *reg3 = domain->get_region_by_id("reg3");
|
||||
auto *reg4 = domain->get_region_by_id("reg4");
|
||||
auto *reg5 = domain->get_region_by_id("reg5");
|
||||
auto *reg6 = domain->get_region_by_id("reg6");
|
||||
auto *reg7 = domain->get_region_by_id("reg7");
|
||||
auto *reg8 = domain->get_region_by_id("reg8");
|
||||
auto *reg9 = domain->get_region_by_id("reg9");
|
||||
auto *reg10 = domain->get_region_by_id("reg10");
|
||||
int count1, count2, count3, count4, count5, count6, count7, count8, count9, count10;
|
||||
count1 = count2 = count3 = count4 = count5 = count6 = count7 = count8 = count9 = count10 = 0;
|
||||
reg1->prematch();
|
||||
|
||||
@ -56,7 +56,7 @@ TEST_F(ResetAtomsIDTest, MolIDAll)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
ASSERT_EQ(molid[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molid[GETIDX(2)], 1);
|
||||
ASSERT_EQ(molid[GETIDX(3)], 1);
|
||||
@ -128,7 +128,7 @@ TEST_F(ResetAtomsIDTest, DeletePlusAtomID)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -206,7 +206,7 @@ TEST_F(ResetAtomsIDTest, PartialOffset)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -286,7 +286,7 @@ TEST_F(ResetAtomsIDTest, DeleteAdd)
|
||||
{
|
||||
if (lmp->atom->natoms == 0) GTEST_SKIP();
|
||||
|
||||
auto molid = lmp->atom->molecule;
|
||||
auto *molid = lmp->atom->molecule;
|
||||
|
||||
// delete two water molecules
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -445,12 +445,12 @@ TEST_F(ResetAtomsIDTest, TopologyData)
|
||||
ASSERT_EQ(lmp->atom->natoms, 23);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 26);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto num_angle = lmp->atom->num_angle;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto angle_atom1 = lmp->atom->angle_atom1;
|
||||
auto angle_atom2 = lmp->atom->angle_atom2;
|
||||
auto angle_atom3 = lmp->atom->angle_atom3;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *num_angle = lmp->atom->num_angle;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
auto *angle_atom1 = lmp->atom->angle_atom1;
|
||||
auto *angle_atom2 = lmp->atom->angle_atom2;
|
||||
auto *angle_atom3 = lmp->atom->angle_atom3;
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 2);
|
||||
ASSERT_EQ(bond_atom[GETIDX(1)][0], 2);
|
||||
ASSERT_EQ(bond_atom[GETIDX(1)][1], 3);
|
||||
|
||||
@ -85,7 +85,7 @@ TEST_F(SetTest, NoBoxNoAtoms)
|
||||
command("create_atoms 1 single 0.5 0.5 0.5");
|
||||
command("compute 0 all property/atom proc");
|
||||
END_HIDE_OUTPUT();
|
||||
auto compute = lmp->modify->get_compute_by_id("0");
|
||||
auto *compute = lmp->modify->get_compute_by_id("0");
|
||||
compute->compute_peratom();
|
||||
ASSERT_EQ(compute->vector_atom[0], 0);
|
||||
|
||||
@ -119,7 +119,7 @@ TEST_F(SetTest, StylesTypes)
|
||||
command("compute 1 all property/atom id type mol");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id("1");
|
||||
auto *compute = lmp->modify->get_compute_by_id("1");
|
||||
ASSERT_NE(compute, nullptr);
|
||||
compute->compute_peratom();
|
||||
|
||||
@ -409,7 +409,7 @@ TEST_F(SetTest, EffPackage)
|
||||
command("compute 2 all property/atom espin eradius");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto compute = lmp->modify->get_compute_by_id("2");
|
||||
auto *compute = lmp->modify->get_compute_by_id("2");
|
||||
ASSERT_NE(compute, nullptr);
|
||||
compute->compute_peratom();
|
||||
|
||||
|
||||
@ -389,8 +389,9 @@ TEST_F(VariableTest, Expressions)
|
||||
command("print \"${err2}\""););
|
||||
TEST_FAILURE(".*ERROR on proc 0: Variable err3: Invalid power expression in variable formula.*",
|
||||
command("print \"${err3}\""););
|
||||
TEST_FAILURE(".*ERROR: Variable one: Mis-matched special function variable in variable formula.*",
|
||||
command("print \"${isrt}\""););
|
||||
TEST_FAILURE(
|
||||
".*ERROR: Variable one: Mis-matched special function variable in variable formula.*",
|
||||
command("print \"${isrt}\""););
|
||||
TEST_FAILURE(".*ERROR: Variable vec4: index 11 exceeds vector size of 10.*",
|
||||
command("print \"${xxxl}\""););
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
Input_commands()
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
|
||||
@ -21,9 +21,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_plain() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -37,7 +37,7 @@ protected:
|
||||
LAMMPS::argv args = {"LAMMPS_test", "-log", "none", "-echo", "both", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, StartsWith("LAMMPS ("));
|
||||
}
|
||||
@ -157,9 +157,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_omp() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -238,9 +238,9 @@ protected:
|
||||
LAMMPS *lmp;
|
||||
LAMMPS_kokkos() : lmp(nullptr)
|
||||
{
|
||||
const char * args[] = {"LAMMPS_test", nullptr};
|
||||
char ** argv = (char**)args;
|
||||
int argc = 1;
|
||||
const char *args[] = {"LAMMPS_test", nullptr};
|
||||
char **argv = (char **)args;
|
||||
int argc = 1;
|
||||
|
||||
int flag;
|
||||
MPI_Initialized(&flag);
|
||||
@ -330,7 +330,7 @@ TEST(LAMMPS_init, OpenMP)
|
||||
LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_empty", "-log", "none", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, ContainsRegex(".*using 2 OpenMP thread.*per MPI task.*"));
|
||||
|
||||
@ -361,7 +361,7 @@ TEST(LAMMPS_init, NoOpenMP)
|
||||
LAMMPS::argv args = {"LAMMPS_init", "-in", "in.lammps_class_noomp", "-log", "none", "-nocite"};
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_THAT(output, ContainsRegex(
|
||||
".*OMP_NUM_THREADS environment is not set.*Defaulting to 1 thread.*"));
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for angle styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("angle_style " + cfg.angle_style);
|
||||
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.angle_style.substr(0, 6) == "hybrid") || !lmp->force->angle->writedata) {
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &angle_coeff : cfg.angle_coeff) {
|
||||
for (const auto &angle_coeff : cfg.angle_coeff) {
|
||||
command("angle_coeff " + angle_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// angle_coeff
|
||||
block.clear();
|
||||
for (auto &angle_coeff : config.angle_coeff) {
|
||||
for (const auto &angle_coeff : config.angle_coeff) {
|
||||
block += angle_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("angle_coeff", block);
|
||||
@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->angle->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->angle->virial;
|
||||
auto *stress = lmp->force->angle->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// init_forces
|
||||
block.clear();
|
||||
auto f = lmp->atom->f;
|
||||
auto *f = lmp->atom->f;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
|
||||
@ -345,7 +345,7 @@ TEST(AngleStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto angle = lmp->force->angle;
|
||||
auto *angle = lmp->force->angle;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, epsilon);
|
||||
@ -463,7 +463,7 @@ TEST(AngleStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto angle = lmp->force->angle;
|
||||
auto *angle = lmp->force->angle;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", angle->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -746,9 +746,9 @@ TEST(AngleStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto angle = lmp->force->angle;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
auto *angle = lmp->force->angle;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = angle->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for bond styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("bond_style " + cfg.bond_style);
|
||||
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.bond_style.substr(0, 6) == "hybrid") || !lmp->force->bond->writedata) {
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &bond_coeff : cfg.bond_coeff) {
|
||||
for (const auto &bond_coeff : cfg.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// bond_coeff
|
||||
block.clear();
|
||||
for (auto &bond_coeff : config.bond_coeff) {
|
||||
for (const auto &bond_coeff : config.bond_coeff) {
|
||||
block += bond_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("bond_coeff", block);
|
||||
@ -277,14 +277,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->bond->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->bond->virial;
|
||||
auto *stress = lmp->force->bond->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// init_forces
|
||||
block.clear();
|
||||
auto f = lmp->atom->f;
|
||||
auto *f = lmp->atom->f;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
|
||||
@ -345,7 +345,7 @@ TEST(BondStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, epsilon);
|
||||
@ -465,7 +465,7 @@ TEST(BondStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", bond->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -532,7 +532,6 @@ TEST(BondStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(BondStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
@ -652,7 +651,7 @@ TEST(BondStyle, single)
|
||||
command("pair_coeff * *");
|
||||
|
||||
command("bond_style " + test_config.bond_style);
|
||||
auto bond = lmp->force->bond;
|
||||
auto *bond = lmp->force->bond;
|
||||
|
||||
for (auto &bond_coeff : test_config.bond_coeff) {
|
||||
command("bond_coeff " + bond_coeff);
|
||||
@ -860,9 +859,9 @@ TEST(BondStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto bond = lmp->force->bond;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
auto *bond = lmp->force->bond;
|
||||
void *ptr = nullptr;
|
||||
int dim = 0;
|
||||
for (auto extract : test_config.extract) {
|
||||
ptr = bond->extract(extract.first.c_str(), dim);
|
||||
EXPECT_NE(ptr, nullptr);
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
restart_vel.clear();
|
||||
global_vector.clear();
|
||||
}
|
||||
TestConfig(const TestConfig &) = delete;
|
||||
TestConfig(const TestConfig &) = delete;
|
||||
TestConfig &operator=(const TestConfig &) = delete;
|
||||
|
||||
std::string tags_line() const
|
||||
|
||||
@ -22,8 +22,8 @@ class TestConfigReader : public YamlReader<TestConfigReader> {
|
||||
|
||||
public:
|
||||
TestConfigReader(TestConfig &config);
|
||||
TestConfigReader() = delete;
|
||||
const TestConfigReader & operator=(TestConfig &) = delete;
|
||||
TestConfigReader() = delete;
|
||||
const TestConfigReader &operator=(TestConfig &) = delete;
|
||||
|
||||
void skip_tests(const yaml_event_t &event);
|
||||
void prerequisites(const yaml_event_t &event);
|
||||
|
||||
@ -63,12 +63,12 @@ void cleanup_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
|
||||
LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton = true)
|
||||
{
|
||||
LAMMPS *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
auto *lmp = new LAMMPS(args, MPI_COMM_WORLD);
|
||||
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for dihedral styles, so if the suffixed
|
||||
@ -118,7 +118,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -127,11 +127,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("dihedral_style " + cfg.dihedral_style);
|
||||
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -174,12 +174,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.dihedral_style.substr(0, 6) == "hybrid") || !lmp->force->dihedral->writedata) {
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -221,10 +221,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : cfg.dihedral_coeff) {
|
||||
command("dihedral_coeff " + dihedral_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -241,7 +241,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -260,7 +260,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// dihedral_coeff
|
||||
block.clear();
|
||||
for (auto &dihedral_coeff : config.dihedral_coeff) {
|
||||
for (const auto &dihedral_coeff : config.dihedral_coeff) {
|
||||
block += dihedral_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("dihedral_coeff", block);
|
||||
@ -278,14 +278,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->dihedral->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->dihedral->virial;
|
||||
auto *stress = lmp->force->dihedral->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// init_forces
|
||||
block.clear();
|
||||
auto f = lmp->atom->f;
|
||||
auto *f = lmp->atom->f;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
|
||||
@ -346,7 +346,7 @@ TEST(DihedralStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto dihedral = lmp->force->dihedral;
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress, epsilon);
|
||||
@ -466,7 +466,7 @@ TEST(DihedralStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto dihedral = lmp->force->dihedral;
|
||||
auto *dihedral = lmp->force->dihedral;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", dihedral->virial, test_config.init_stress,
|
||||
@ -534,7 +534,6 @@ TEST(DihedralStyle, omp)
|
||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||
};
|
||||
|
||||
|
||||
TEST(DihedralStyle, numdiff)
|
||||
{
|
||||
if (!LAMMPS::is_installed_pkg("EXTRA-FIX")) GTEST_SKIP();
|
||||
|
||||
@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for fix styles, so if the suffixed
|
||||
@ -97,7 +97,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
};
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
for (auto &pre_command : cfg.pre_commands)
|
||||
for (const auto &pre_command : cfg.pre_commands)
|
||||
command(pre_command);
|
||||
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
@ -128,7 +128,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re
|
||||
command("group solute molecule 1:2");
|
||||
command("group solvent molecule 3:5");
|
||||
|
||||
for (auto &post_command : cfg.post_commands)
|
||||
for (const auto &post_command : cfg.post_commands)
|
||||
command(post_command);
|
||||
|
||||
command("timestep 0.25");
|
||||
@ -158,10 +158,10 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool use_rmass, bool use
|
||||
|
||||
if (use_respa) command("run_style respa 2 1 bond 1 pair 2");
|
||||
|
||||
for (auto &post_command : cfg.post_commands)
|
||||
for (const auto &post_command : cfg.post_commands)
|
||||
command(post_command);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (ifix && !utils::strmatch(ifix->style, "^move")) {
|
||||
// must be set to trigger calling Fix::reset_dt() with timestep
|
||||
lmp->update->first_update = 1;
|
||||
@ -198,16 +198,16 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
// natoms
|
||||
writer.emit("natoms", natoms);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
std::cerr << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
exit(1);
|
||||
} else {
|
||||
// run_stress, if enabled
|
||||
if (ifix->thermo_virial) {
|
||||
auto stress = ifix->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}",
|
||||
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
auto *stress = ifix->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}",
|
||||
stress[0], stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("run_stress", block);
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// run_pos
|
||||
block.clear();
|
||||
auto x = lmp->atom->x;
|
||||
auto *x = lmp->atom->x;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, x[j][0], x[j][1], x[j][2]);
|
||||
@ -238,7 +238,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// run_vel
|
||||
block.clear();
|
||||
auto v = lmp->atom->v;
|
||||
auto *v = lmp->atom->v;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, v[j][0], v[j][1], v[j][2]);
|
||||
@ -289,7 +289,7 @@ TEST(FixTimestep, plain)
|
||||
EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
@ -317,8 +317,8 @@ TEST(FixTimestep, plain)
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)ifix->extract("t_target", dim);
|
||||
int dim = -1;
|
||||
auto *ptr = (double *)ifix->extract("t_target", dim);
|
||||
if ((ptr != nullptr) && (dim == 0)) {
|
||||
int ivar = lmp->input->variable->find("t_target");
|
||||
if (ivar >= 0) {
|
||||
@ -583,7 +583,7 @@ TEST(FixTimestep, omp)
|
||||
EXPECT_POSITIONS("run_pos (normal run, verlet)", lmp->atom, test_config.run_pos, epsilon);
|
||||
EXPECT_VELOCITIES("run_vel (normal run, verlet)", lmp->atom, test_config.run_vel, epsilon);
|
||||
|
||||
auto ifix = lmp->modify->get_fix_by_id("test");
|
||||
auto *ifix = lmp->modify->get_fix_by_id("test");
|
||||
if (!ifix) {
|
||||
FAIL() << "ERROR: no fix defined with fix ID 'test'\n";
|
||||
} else {
|
||||
@ -611,8 +611,8 @@ TEST(FixTimestep, omp)
|
||||
|
||||
// check t_target for thermostats
|
||||
|
||||
int dim = -1;
|
||||
double *ptr = (double *)ifix->extract("t_target", dim);
|
||||
int dim = -1;
|
||||
auto *ptr = (double *)ifix->extract("t_target", dim);
|
||||
if ((ptr != nullptr) && (dim == 0)) {
|
||||
int ivar = lmp->input->variable->find("t_target");
|
||||
if (ivar >= 0) {
|
||||
|
||||
@ -70,7 +70,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for improper styles, so if the suffixed
|
||||
@ -120,7 +120,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -129,11 +129,11 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("improper_style " + cfg.improper_style);
|
||||
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
}
|
||||
|
||||
if ((cfg.improper_style.substr(0, 6) == "hybrid") || !lmp->force->improper->writedata) {
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_bond delete");
|
||||
command("variable newton_bond index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -214,10 +214,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &improper_coeff : cfg.improper_coeff) {
|
||||
for (const auto &improper_coeff : cfg.improper_coeff) {
|
||||
command("improper_coeff " + improper_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -234,7 +234,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
if (!lmp) {
|
||||
std::cerr << "One or more prerequisite styles are not available "
|
||||
"in this LAMMPS configuration:\n";
|
||||
for (auto &prerequisite : config.prerequisites) {
|
||||
for (const auto &prerequisite : config.prerequisites) {
|
||||
std::cerr << prerequisite.first << "_style " << prerequisite.second << "\n";
|
||||
}
|
||||
return;
|
||||
@ -253,7 +253,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// improper_coeff
|
||||
block.clear();
|
||||
for (auto &improper_coeff : config.improper_coeff) {
|
||||
for (const auto &improper_coeff : config.improper_coeff) {
|
||||
block += improper_coeff + "\n";
|
||||
}
|
||||
writer.emit_block("improper_coeff", block);
|
||||
@ -271,14 +271,14 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_energy", lmp->force->improper->energy);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->improper->virial;
|
||||
auto *stress = lmp->force->improper->virial;
|
||||
block = fmt::format("{:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e} {:23.16e}", stress[0],
|
||||
stress[1], stress[2], stress[3], stress[4], stress[5]);
|
||||
writer.emit_block("init_stress", block);
|
||||
|
||||
// init_forces
|
||||
block.clear();
|
||||
auto f = lmp->atom->f;
|
||||
auto *f = lmp->atom->f;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
|
||||
@ -339,7 +339,7 @@ TEST(ImproperStyle, plain)
|
||||
double epsilon = test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto improper = lmp->force->improper;
|
||||
auto *improper = lmp->force->improper;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress, epsilon);
|
||||
@ -459,7 +459,7 @@ TEST(ImproperStyle, omp)
|
||||
double epsilon = 5.0 * test_config.epsilon;
|
||||
|
||||
ErrorStats stats;
|
||||
auto improper = lmp->force->improper;
|
||||
auto *improper = lmp->force->improper;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", improper->virial, test_config.init_stress,
|
||||
|
||||
@ -130,7 +130,7 @@ void write_yaml_header(YamlWriter *writer, TestConfig *cfg, const char *version)
|
||||
|
||||
// skip tests
|
||||
block.clear();
|
||||
for (auto &skip : cfg->skip_tests) {
|
||||
for (const auto &skip : cfg->skip_tests) {
|
||||
if (block.empty())
|
||||
block = skip;
|
||||
else
|
||||
|
||||
@ -14,9 +14,9 @@
|
||||
#ifndef TEST_MAIN_H
|
||||
#define TEST_MAIN_H
|
||||
|
||||
#include "test_config.h"
|
||||
#include "lammps.h"
|
||||
#include "atom.h"
|
||||
#include "lammps.h"
|
||||
#include "test_config.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -37,9 +37,13 @@ void write_yaml_header(class YamlWriter *writer, TestConfig *cfg, const char *ve
|
||||
EXPECT_PRED_FORMAT2(::testing::DoubleLE, err, eps); \
|
||||
} while (0);
|
||||
|
||||
void EXPECT_STRESS(const std::string & name, double * stress, const stress_t & expected_stress, double epsilon);
|
||||
void EXPECT_FORCES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & f_ref, double epsilon);
|
||||
void EXPECT_POSITIONS(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & x_ref, double epsilon);
|
||||
void EXPECT_VELOCITIES(const std::string & name, LAMMPS_NS::Atom * atom, const std::vector<coord_t> & v_ref, double epsilon);
|
||||
void EXPECT_STRESS(const std::string &name, double *stress, const stress_t &expected_stress,
|
||||
double epsilon);
|
||||
void EXPECT_FORCES(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &f_ref, double epsilon);
|
||||
void EXPECT_POSITIONS(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &x_ref, double epsilon);
|
||||
void EXPECT_VELOCITIES(const std::string &name, LAMMPS_NS::Atom *atom,
|
||||
const std::vector<coord_t> &v_ref, double epsilon);
|
||||
|
||||
#endif
|
||||
|
||||
@ -71,7 +71,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
// check if prerequisite styles are available
|
||||
Info *info = new Info(lmp);
|
||||
int nfail = 0;
|
||||
for (auto &prerequisite : cfg.prerequisites) {
|
||||
for (const auto &prerequisite : cfg.prerequisites) {
|
||||
std::string style = prerequisite.second;
|
||||
|
||||
// this is a test for pair styles, so if the suffixed
|
||||
@ -122,7 +122,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("variable input_dir index " + INPUT_FOLDER);
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
|
||||
command("pair_style " + cfg.pair_style);
|
||||
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool newton
|
||||
command("pair_modify table 0");
|
||||
command("pair_modify table/disp 0");
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
|
||||
@ -188,12 +188,12 @@ void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool nofdotr = false, bo
|
||||
command("pair_style " + cfg.pair_style);
|
||||
}
|
||||
if (!lmp->force->pair->restartinfo || !lmp->force->pair->writedata) {
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
if (nofdotr) command("pair_modify nofdotr");
|
||||
@ -217,7 +217,7 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
command("variable newton_pair delete");
|
||||
command("variable newton_pair index on");
|
||||
|
||||
for (auto &pre_command : cfg.pre_commands) {
|
||||
for (const auto &pre_command : cfg.pre_commands) {
|
||||
command(pre_command);
|
||||
}
|
||||
|
||||
@ -227,10 +227,10 @@ void data_lammps(LAMMPS *lmp, const TestConfig &cfg)
|
||||
std::string input_file = platform::path_join(INPUT_FOLDER, cfg.input_file);
|
||||
parse_input_script(input_file);
|
||||
|
||||
for (auto &pair_coeff : cfg.pair_coeff) {
|
||||
for (const auto &pair_coeff : cfg.pair_coeff) {
|
||||
command("pair_coeff " + pair_coeff);
|
||||
}
|
||||
for (auto &post_command : cfg.post_commands) {
|
||||
for (const auto &post_command : cfg.post_commands) {
|
||||
command(post_command);
|
||||
}
|
||||
command("run 0 post no");
|
||||
@ -287,7 +287,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
writer.emit("init_coul", lmp->force->pair->eng_coul);
|
||||
|
||||
// init_stress
|
||||
auto stress = lmp->force->pair->virial;
|
||||
auto *stress = lmp->force->pair->virial;
|
||||
// avoid false positives on tiny stresses. force to zero instead.
|
||||
for (int i = 0; i < 6; ++i)
|
||||
if (fabs(stress[i]) < 1.0e-13) stress[i] = 0.0;
|
||||
@ -297,7 +297,7 @@ void generate_yaml_file(const char *outfile, const TestConfig &config)
|
||||
|
||||
// init_forces
|
||||
block.clear();
|
||||
auto f = lmp->atom->f;
|
||||
auto *f = lmp->atom->f;
|
||||
for (int i = 1; i <= natoms; ++i) {
|
||||
const int j = lmp->atom->map(i);
|
||||
block += fmt::format("{:3} {:23.16e} {:23.16e} {:23.16e}\n", i, f[j][0], f[j][1], f[j][2]);
|
||||
@ -367,7 +367,7 @@ TEST(PairStyle, plain)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton on)", pair->virial, test_config.init_stress, epsilon);
|
||||
@ -547,7 +547,7 @@ TEST(PairStyle, omp)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
ErrorStats stats;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
@ -679,7 +679,7 @@ TEST(PairStyle, kokkos_omp)
|
||||
if (lmp->force->kspace && lmp->force->kspace->compute_flag)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
ErrorStats stats;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton on)", lmp->atom, test_config.init_forces, epsilon);
|
||||
@ -821,7 +821,7 @@ TEST(PairStyle, gpu)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress (newton off)", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -902,7 +902,7 @@ TEST(PairStyle, intel)
|
||||
ASSERT_EQ(lmp->atom->natoms, nlocal);
|
||||
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -973,7 +973,7 @@ TEST(PairStyle, opt)
|
||||
if (utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
|
||||
#endif
|
||||
ErrorStats stats;
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
|
||||
EXPECT_FORCES("init_forces (newton off)", lmp->atom, test_config.init_forces, epsilon);
|
||||
EXPECT_STRESS("init_stress", pair->virial, test_config.init_stress, 10 * epsilon);
|
||||
@ -1284,7 +1284,7 @@ TEST(PairStyle, extract)
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto pair = lmp->force->pair;
|
||||
auto *pair = lmp->force->pair;
|
||||
if (!pair->compute_flag) {
|
||||
std::cerr << "Pair style disabled" << std::endl;
|
||||
if (!verbose) ::testing::internal::CaptureStdout();
|
||||
|
||||
@ -22,9 +22,9 @@ class YamlWriter {
|
||||
public:
|
||||
YamlWriter(const char *outfile);
|
||||
virtual ~YamlWriter();
|
||||
YamlWriter() = delete;
|
||||
YamlWriter(const YamlWriter &) = delete;
|
||||
const YamlWriter & operator=(const YamlWriter &) = delete;
|
||||
YamlWriter() = delete;
|
||||
YamlWriter(const YamlWriter &) = delete;
|
||||
const YamlWriter &operator=(const YamlWriter &) = delete;
|
||||
|
||||
// emitters
|
||||
void emit(const std::string &key, const double value);
|
||||
|
||||
@ -101,8 +101,8 @@ public:
|
||||
{
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.'));
|
||||
std::string cmdline =
|
||||
fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE, compressed_file, converted_file);
|
||||
std::string cmdline = fmt::format("\"{}\" -d -c {} > {}", COMPRESS_EXECUTABLE,
|
||||
compressed_file, converted_file);
|
||||
system(cmdline.c_str());
|
||||
END_HIDE_OUTPUT();
|
||||
return converted_file;
|
||||
|
||||
@ -553,8 +553,8 @@ TEST_F(AtomStyleTest, atomic)
|
||||
ASSERT_EQ(lmp->atom->molecular, Atom::ATOMIC);
|
||||
ASSERT_EQ(lmp->atom->ntypes, 2);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -642,7 +642,7 @@ TEST_F(AtomStyleTest, atomic)
|
||||
command("replicate 2 2 2");
|
||||
END_HIDE_OUTPUT();
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 16);
|
||||
x = lmp->atom->x;
|
||||
x = lmp->atom->x;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -870,9 +870,9 @@ TEST_F(AtomStyleTest, charge)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1056,10 +1056,10 @@ TEST_F(AtomStyleTest, sphere)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto omega = lmp->atom->omega;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *omega = lmp->atom->omega;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1243,13 +1243,13 @@ TEST_F(AtomStyleTest, ellipsoid)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -1571,13 +1571,13 @@ TEST_F(AtomStyleTest, line)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto line = lmp->atom->line;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto avec = dynamic_cast<AtomVecLine *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *line = lmp->atom->line;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *avec = dynamic_cast<AtomVecLine *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.0, EPSILON);
|
||||
@ -1853,14 +1853,14 @@ TEST_F(AtomStyleTest, tri)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto tri = lmp->atom->tri;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto radius = lmp->atom->radius;
|
||||
auto avec = dynamic_cast<AtomVecTri *>(lmp->atom->avec);
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *tri = lmp->atom->tri;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *radius = lmp->atom->radius;
|
||||
auto *avec = dynamic_cast<AtomVecTri *>(lmp->atom->avec);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -2180,7 +2180,7 @@ TEST_F(AtomStyleTest, body_nparticle)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto avec = dynamic_cast<AtomVecBody *>(lmp->atom->avec);
|
||||
auto *avec = dynamic_cast<AtomVecBody *>(lmp->atom->avec);
|
||||
ASSERT_NE(lmp->atom->avec, nullptr);
|
||||
ASSERT_NE(avec->bptr, nullptr);
|
||||
ASSERT_THAT(std::string(avec->bptr->style), Eq("nparticle"));
|
||||
@ -2265,14 +2265,14 @@ TEST_F(AtomStyleTest, body_nparticle)
|
||||
ASSERT_NE(lmp->atom->radius, nullptr);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag, nullptr);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto body = lmp->atom->body;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto radius = lmp->atom->radius;
|
||||
auto angmom = lmp->atom->angmom;
|
||||
auto bonus = avec->bonus;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *body = lmp->atom->body;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *radius = lmp->atom->radius;
|
||||
auto *angmom = lmp->atom->angmom;
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -2832,9 +2832,9 @@ TEST_F(AtomStyleTest, template)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 12);
|
||||
|
||||
auto molecule = lmp->atom->molecule;
|
||||
auto molindex = lmp->atom->molindex;
|
||||
auto molatom = lmp->atom->molatom;
|
||||
auto *molecule = lmp->atom->molecule;
|
||||
auto *molindex = lmp->atom->molindex;
|
||||
auto *molatom = lmp->atom->molatom;
|
||||
|
||||
ASSERT_EQ(molecule[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molecule[GETIDX(2)], 1);
|
||||
@ -2933,9 +2933,9 @@ TEST_F(AtomStyleTest, template)
|
||||
ASSERT_EQ(molatom[GETIDX(11)], -1);
|
||||
ASSERT_EQ(molatom[GETIDX(12)], -1);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON);
|
||||
@ -3147,7 +3147,7 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 2);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("template"));
|
||||
@ -3247,9 +3247,9 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 12);
|
||||
|
||||
auto molecule = lmp->atom->molecule;
|
||||
auto molindex = lmp->atom->molindex;
|
||||
auto molatom = lmp->atom->molatom;
|
||||
auto *molecule = lmp->atom->molecule;
|
||||
auto *molindex = lmp->atom->molindex;
|
||||
auto *molatom = lmp->atom->molatom;
|
||||
|
||||
ASSERT_EQ(molecule[GETIDX(1)], 1);
|
||||
ASSERT_EQ(molecule[GETIDX(2)], 1);
|
||||
@ -3348,10 +3348,10 @@ TEST_F(AtomStyleTest, template_charge)
|
||||
ASSERT_EQ(molatom[GETIDX(11)], -1);
|
||||
ASSERT_EQ(molatom[GETIDX(12)], -1);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *q = lmp->atom->q;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(10)][0], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(10)][1], -2.0, EPSILON);
|
||||
@ -3655,9 +3655,9 @@ TEST_F(AtomStyleTest, bond)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 2);
|
||||
ASSERT_EQ(num_bond[GETIDX(2)], 0);
|
||||
@ -3714,12 +3714,12 @@ TEST_F(AtomStyleTest, bond)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_type = lmp->atom->bond_type;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_type = lmp->atom->bond_type;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
@ -4013,14 +4013,14 @@ TEST_F(AtomStyleTest, angle)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto num_angle = lmp->atom->num_angle;
|
||||
auto angle_type = lmp->atom->angle_type;
|
||||
auto angle_atom1 = lmp->atom->angle_atom1;
|
||||
auto angle_atom2 = lmp->atom->angle_atom2;
|
||||
auto angle_atom3 = lmp->atom->angle_atom3;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
auto *num_angle = lmp->atom->num_angle;
|
||||
auto *angle_type = lmp->atom->angle_type;
|
||||
auto *angle_atom1 = lmp->atom->angle_atom1;
|
||||
auto *angle_atom2 = lmp->atom->angle_atom2;
|
||||
auto *angle_atom3 = lmp->atom->angle_atom3;
|
||||
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 2);
|
||||
ASSERT_EQ(num_bond[GETIDX(2)], 0);
|
||||
@ -4107,9 +4107,9 @@ TEST_F(AtomStyleTest, angle)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
num_bond = lmp->atom->num_bond;
|
||||
bond_atom = lmp->atom->bond_atom;
|
||||
num_angle = lmp->atom->num_angle;
|
||||
@ -4288,7 +4288,7 @@ TEST_F(AtomStyleTest, full_ellipsoid)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 2);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("full"));
|
||||
@ -4398,15 +4398,15 @@ TEST_F(AtomStyleTest, full_ellipsoid)
|
||||
ASSERT_EQ(lmp->atom->map_user, 1);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 6);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto bonus = avec->bonus;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto *bonus = avec->bonus;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -4768,9 +4768,9 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
ASSERT_EQ(lmp->atom->map_user, Atom::MAP_ARRAY);
|
||||
ASSERT_EQ(lmp->atom->map_tag_max, 4);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto q = lmp->atom->q;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *q = lmp->atom->q;
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], 2.0, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][2], 0.1, EPSILON);
|
||||
@ -4805,10 +4805,10 @@ TEST_F(AtomStyleTest, property_atom)
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[1], 1);
|
||||
ASSERT_EQ(lmp->atom->mass_setflag[2], 1);
|
||||
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto one = lmp->atom->ivector[0];
|
||||
auto two = lmp->atom->dvector[0];
|
||||
auto three = lmp->atom->dvector[1];
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
auto *one = lmp->atom->ivector[0];
|
||||
auto *two = lmp->atom->dvector[0];
|
||||
auto *three = lmp->atom->dvector[1];
|
||||
|
||||
EXPECT_NEAR(rmass[GETIDX(1)], 4.0, EPSILON);
|
||||
EXPECT_NEAR(rmass[GETIDX(2)], 4.0, EPSILON);
|
||||
@ -4939,7 +4939,7 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
|
||||
ASSERT_ATOM_STATE_EQ(lmp->atom, expected);
|
||||
|
||||
auto hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
auto *hybrid = dynamic_cast<AtomVecHybrid *>(lmp->atom->avec);
|
||||
ASSERT_THAT(std::string(lmp->atom->atom_style), Eq("hybrid"));
|
||||
ASSERT_EQ(hybrid->nstyles, 3);
|
||||
ASSERT_THAT(std::string(hybrid->keywords[0]), Eq("bond"));
|
||||
@ -5152,14 +5152,14 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
ASSERT_NE(lmp->atom->mass_setflag, nullptr);
|
||||
ASSERT_NE(lmp->atom->id5p, nullptr);
|
||||
|
||||
auto x = lmp->atom->x;
|
||||
auto v = lmp->atom->v;
|
||||
auto type = lmp->atom->type;
|
||||
auto ellipsoid = lmp->atom->ellipsoid;
|
||||
auto rmass = lmp->atom->rmass;
|
||||
auto *x = lmp->atom->x;
|
||||
auto *v = lmp->atom->v;
|
||||
auto *type = lmp->atom->type;
|
||||
auto *ellipsoid = lmp->atom->ellipsoid;
|
||||
auto *rmass = lmp->atom->rmass;
|
||||
|
||||
auto avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto bonus = avec->bonus;
|
||||
auto *avec = dynamic_cast<AtomVecEllipsoid *>(hybrid->styles[1]);
|
||||
auto *bonus = avec->bonus;
|
||||
|
||||
EXPECT_NEAR(x[GETIDX(1)][0], -0.33741452300167507, EPSILON);
|
||||
EXPECT_NEAR(x[GETIDX(1)][1], -0.43708835412476305, EPSILON);
|
||||
@ -5328,10 +5328,10 @@ TEST_F(AtomStyleTest, oxdna)
|
||||
EXPECT_NEAR(bonus[9].quat[2], 0.9849325709665359, EPSILON);
|
||||
EXPECT_NEAR(bonus[9].quat[3], -0.0516705065113425, EPSILON);
|
||||
|
||||
auto num_bond = lmp->atom->num_bond;
|
||||
auto bond_type = lmp->atom->bond_type;
|
||||
auto bond_atom = lmp->atom->bond_atom;
|
||||
auto id5p = lmp->atom->id5p;
|
||||
auto *num_bond = lmp->atom->num_bond;
|
||||
auto *bond_type = lmp->atom->bond_type;
|
||||
auto *bond_atom = lmp->atom->bond_atom;
|
||||
auto *id5p = lmp->atom->id5p;
|
||||
|
||||
ASSERT_EQ(num_bond[GETIDX(1)], 1);
|
||||
ASSERT_EQ(num_bond[GETIDX(2)], 1);
|
||||
|
||||
@ -93,15 +93,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_run1_0.melt";
|
||||
auto base_name_1 = "multi_file_run1_1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
if (compression_style == "atom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||
@ -133,15 +133,15 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1);
|
||||
|
||||
@ -174,18 +174,18 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2);
|
||||
|
||||
@ -220,9 +220,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0);
|
||||
|
||||
@ -244,9 +244,9 @@ TEST_F(DumpAtomCompressTest, compressed_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0);
|
||||
|
||||
@ -268,9 +268,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0);
|
||||
@ -293,9 +293,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_units_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0);
|
||||
@ -318,9 +318,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_time_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0);
|
||||
@ -343,9 +343,9 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_image_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "tri_with_image_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "tri_with_image_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
enable_triclinic();
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "image yes", 0);
|
||||
@ -396,9 +396,9 @@ TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||
0);
|
||||
|
||||
@ -51,8 +51,8 @@ TEST_F(DumpCfgTest, invalid_options)
|
||||
|
||||
TEST_F(DumpCfgTest, require_multifile)
|
||||
{
|
||||
auto dump_file = "dump.melt.cfg_run.cfg";
|
||||
auto fields =
|
||||
const auto *dump_file = "dump.melt.cfg_run.cfg";
|
||||
const auto *fields =
|
||||
"mass type xs ys zs id proc procp1 x y z ix iy iz xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
@ -64,8 +64,8 @@ TEST_F(DumpCfgTest, require_multifile)
|
||||
|
||||
TEST_F(DumpCfgTest, run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -78,8 +78,8 @@ TEST_F(DumpCfgTest, run0)
|
||||
|
||||
TEST_F(DumpCfgTest, write_dump)
|
||||
{
|
||||
auto dump_file = "dump_cfg_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command("run 0 post no");
|
||||
@ -105,8 +105,8 @@ TEST_F(DumpCfgTest, write_dump)
|
||||
|
||||
TEST_F(DumpCfgTest, unwrap_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_unwrap_run*.melt.cfg";
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_unwrap_run*.melt.cfg";
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -119,8 +119,8 @@ TEST_F(DumpCfgTest, unwrap_run0)
|
||||
|
||||
TEST_F(DumpCfgTest, no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_no_buffer_run*.melt.cfg";
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_no_buffer_run*.melt.cfg";
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "buffer no", 0);
|
||||
|
||||
@ -133,8 +133,8 @@ TEST_F(DumpCfgTest, no_buffer_run0)
|
||||
|
||||
TEST_F(DumpCfgTest, no_unwrap_no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg";
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *dump_file = "dump_cfg_no_unwrap_no_buffer_run*.melt.cfg";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "buffer no", 0);
|
||||
|
||||
|
||||
@ -35,14 +35,14 @@ TEST_F(DumpCfgCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.cfg";
|
||||
const auto *base_name = "run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -69,14 +69,14 @@ TEST_F(DumpCfgCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.cfg";
|
||||
const auto *base_name = "no_buffer_run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "no_buffer_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||
@ -103,14 +103,14 @@ TEST_F(DumpCfgCompressTest, compressed_unwrap_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "unwrap_run*.melt.cfg";
|
||||
const auto *base_name = "unwrap_run*.melt.cfg";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
|
||||
auto base_name_0 = "unwrap_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name_0 = "unwrap_run0.melt.cfg";
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0);
|
||||
|
||||
@ -132,16 +132,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.cfg";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "cfg/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -174,16 +174,16 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.cfg";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -216,19 +216,19 @@ TEST_F(DumpCfgCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.cfg";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.cfg";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.cfg";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.cfg";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -263,7 +263,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_bad_param)
|
||||
{
|
||||
if (compression_style != "cfg/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_bad_param_run0_*.melt.cfg"), fields));
|
||||
@ -278,7 +278,7 @@ TEST_F(DumpCfgCompressTest, compressed_modify_multi_bad_param)
|
||||
{
|
||||
if (compression_style != "cfg/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.cfg"),
|
||||
@ -294,13 +294,13 @@ TEST_F(DumpCfgCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run*.melt.cfg";
|
||||
auto base_name_0 = "modify_clevel_run0.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
const auto *base_name = "modify_clevel_run*.melt.cfg";
|
||||
const auto *base_name_0 = "modify_clevel_run0.melt.cfg";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
TEST_F(DumpCustomTest, run1)
|
||||
{
|
||||
auto dump_file = dump_filename("run1");
|
||||
auto fields =
|
||||
const auto *fields =
|
||||
"id type proc procp1 mass x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
@ -128,8 +128,8 @@ TEST_F(DumpCustomTest, run1)
|
||||
|
||||
TEST_F(DumpCustomTest, thresh_run0)
|
||||
{
|
||||
auto dump_file = dump_filename("thresh_run0");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("thresh_run0");
|
||||
const auto *fields = "id type x y z";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes thresh x < 1 thresh y < 1 thresh z < 1", 0);
|
||||
|
||||
@ -149,8 +149,8 @@ TEST_F(DumpCustomTest, compute_run0)
|
||||
command("compute comp all property/atom x y z");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("compute_run0");
|
||||
auto fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]";
|
||||
auto dump_file = dump_filename("compute_run0");
|
||||
const auto *fields = "id type x y z c_comp[1] c_comp[2] c_comp[3]";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -172,8 +172,8 @@ TEST_F(DumpCustomTest, fix_run0)
|
||||
command("fix numdiff all numdiff 1 0.0001");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("fix_run0");
|
||||
auto fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]";
|
||||
auto dump_file = dump_filename("fix_run0");
|
||||
const auto *fields = "id x y z f_numdiff[1] f_numdiff[2] f_numdiff[3]";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -194,8 +194,8 @@ TEST_F(DumpCustomTest, custom_run0)
|
||||
command("compute 1 all property/atom i_flag1 d_flag2");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("custom_run0");
|
||||
auto fields = "id x y z i_flag1 d_flag2";
|
||||
auto dump_file = dump_filename("custom_run0");
|
||||
const auto *fields = "id x y z i_flag1 d_flag2";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 0);
|
||||
|
||||
@ -215,7 +215,8 @@ TEST_F(DumpCustomTest, binary_run1)
|
||||
|
||||
auto text_file = text_dump_filename("run1");
|
||||
auto binary_file = binary_dump_filename("run1");
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_binary_dump(text_file, binary_file, fields, "units yes", 1);
|
||||
|
||||
@ -234,7 +235,8 @@ TEST_F(DumpCustomTest, binary_run1)
|
||||
TEST_F(DumpCustomTest, triclinic_run1)
|
||||
{
|
||||
auto dump_file = dump_filename("tri_run1");
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -254,9 +256,9 @@ TEST_F(DumpCustomTest, binary_triclinic_run1)
|
||||
{
|
||||
if (!BINARY2TXT_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto text_file = text_dump_filename("tri_run1");
|
||||
auto binary_file = binary_dump_filename("tri_run1");
|
||||
auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
auto text_file = text_dump_filename("tri_run1");
|
||||
auto binary_file = binary_dump_filename("tri_run1");
|
||||
const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -281,8 +283,8 @@ TEST_F(DumpCustomTest, with_variable_run1)
|
||||
command("variable p atom (c_1%10)+1");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto dump_file = dump_filename("with_variable_run1");
|
||||
auto fields = "id type x y z v_p";
|
||||
auto dump_file = dump_filename("with_variable_run1");
|
||||
const auto *fields = "id type x y z v_p";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
|
||||
@ -298,8 +300,8 @@ TEST_F(DumpCustomTest, with_variable_run1)
|
||||
|
||||
TEST_F(DumpCustomTest, run1plus1)
|
||||
{
|
||||
auto dump_file = dump_filename("run1plus1");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("run1plus1");
|
||||
const auto *fields = "id type x y z";
|
||||
|
||||
generate_dump(dump_file, fields, "units yes", 1);
|
||||
|
||||
@ -315,8 +317,8 @@ TEST_F(DumpCustomTest, run1plus1)
|
||||
|
||||
TEST_F(DumpCustomTest, run2)
|
||||
{
|
||||
auto dump_file = dump_filename("run2");
|
||||
auto fields = "id type x y z";
|
||||
auto dump_file = dump_filename("run2");
|
||||
const auto *fields = "id type x y z";
|
||||
generate_dump(dump_file, fields, "", 2);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -326,8 +328,8 @@ TEST_F(DumpCustomTest, run2)
|
||||
|
||||
TEST_F(DumpCustomTest, rerun)
|
||||
{
|
||||
auto dump_file = dump_filename("rerun");
|
||||
auto fields = "id type xs ys zs";
|
||||
auto dump_file = dump_filename("rerun");
|
||||
const auto *fields = "id type xs ys zs";
|
||||
|
||||
HIDE_OUTPUT([&] {
|
||||
command("fix 1 all nve");
|
||||
@ -358,8 +360,8 @@ TEST_F(DumpCustomTest, rerun)
|
||||
|
||||
TEST_F(DumpCustomTest, rerun_bin)
|
||||
{
|
||||
auto dump_file = binary_dump_filename("rerun");
|
||||
auto fields = "id type xs ys zs";
|
||||
auto dump_file = binary_dump_filename("rerun");
|
||||
const auto *fields = "id type xs ys zs";
|
||||
|
||||
HIDE_OUTPUT([&] {
|
||||
command("fix 1 all nve");
|
||||
|
||||
@ -31,10 +31,11 @@ TEST_F(DumpCustomCompressTest, compressed_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "units yes",
|
||||
@ -61,10 +62,11 @@ TEST_F(DumpCustomCompressTest, compressed_with_time_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "with_time_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "time yes",
|
||||
@ -91,10 +93,11 @@ TEST_F(DumpCustomCompressTest, compressed_no_buffer_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "no_buffer_custom_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "buffer no",
|
||||
@ -121,10 +124,10 @@ TEST_F(DumpCustomCompressTest, compressed_triclinic_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "custom_tri_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "custom_tri_run1.melt";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields = "id type proc x y z xs ys zs xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
enable_triclinic();
|
||||
|
||||
@ -148,16 +151,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.custom";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
if (compression_style == "custom/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -190,16 +194,17 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.custom";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -232,19 +237,20 @@ TEST_F(DumpCustomCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.custom";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.custom";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.custom";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.custom";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.custom";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.custom";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -279,7 +285,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_bad_param)
|
||||
{
|
||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_bad_param_run0_*.melt.custom"), fields));
|
||||
|
||||
@ -292,7 +299,8 @@ TEST_F(DumpCustomCompressTest, compressed_modify_multi_bad_param)
|
||||
{
|
||||
if (compression_style != "custom/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
compressed_dump_filename("modify_multi_bad_param_run0_*.melt.custom"),
|
||||
fields));
|
||||
@ -306,11 +314,12 @@ TEST_F(DumpCustomCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt.custom";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
auto fields = "id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
const auto *fields =
|
||||
"id type proc x y z ix iy iz xs ys zs xu yu zu xsu ysu zsu vx vy vz fx fy fz";
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
TEST_F(DumpLocalTest, run0)
|
||||
{
|
||||
auto dump_file = "dump_local_run0.melt";
|
||||
const auto *dump_file = "dump_local_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -98,7 +98,7 @@ TEST_F(DumpLocalTest, run0)
|
||||
|
||||
TEST_F(DumpLocalTest, label_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_label_run0.melt";
|
||||
const auto *dump_file = "dump_local_label_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "label ELEMENTS", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -110,7 +110,7 @@ TEST_F(DumpLocalTest, label_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_line_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_line_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_line_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format line \"%d %20.8g\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -123,7 +123,7 @@ TEST_F(DumpLocalTest, format_line_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_int_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_int_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_int_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format int \"%20d\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -136,7 +136,7 @@ TEST_F(DumpLocalTest, format_int_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_float_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_float_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_float_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format float \"%20.5g\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -149,7 +149,7 @@ TEST_F(DumpLocalTest, format_float_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, format_column_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_column_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_column_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "format 1 \"%20d\"", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -162,7 +162,7 @@ TEST_F(DumpLocalTest, format_column_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, no_buffer_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_format_line_run0.melt";
|
||||
const auto *dump_file = "dump_local_format_line_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "buffer no", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -187,7 +187,7 @@ TEST_F(DumpLocalTest, no_buffer_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, with_units_run0)
|
||||
{
|
||||
auto dump_file = "dump_with_units_run0.melt";
|
||||
const auto *dump_file = "dump_with_units_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "units yes", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -206,7 +206,7 @@ TEST_F(DumpLocalTest, with_units_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, with_time_run0)
|
||||
{
|
||||
auto dump_file = "dump_with_time_run0.melt";
|
||||
const auto *dump_file = "dump_with_time_run0.melt";
|
||||
generate_dump(dump_file, "index c_comp[1]", "time yes", 0);
|
||||
|
||||
ASSERT_FILE_EXISTS(dump_file);
|
||||
@ -225,7 +225,7 @@ TEST_F(DumpLocalTest, with_time_run0)
|
||||
|
||||
TEST_F(DumpLocalTest, triclinic_run0)
|
||||
{
|
||||
auto dump_file = "dump_local_triclinic_run0.melt";
|
||||
const auto *dump_file = "dump_local_triclinic_run0.melt";
|
||||
enable_triclinic();
|
||||
generate_dump(dump_file, "index c_comp[1]", "", 0);
|
||||
|
||||
|
||||
@ -40,13 +40,13 @@ TEST_F(DumpLocalCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.local";
|
||||
auto base_name_0 = "run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "run*.melt.local";
|
||||
const auto *base_name_0 = "run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -73,13 +73,13 @@ TEST_F(DumpLocalCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.local";
|
||||
auto base_name_0 = "no_buffer_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "no_buffer_run*.melt.local";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "buffer no",
|
||||
@ -106,13 +106,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_time_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_time_run*.melt.local";
|
||||
auto base_name_0 = "with_time_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "with_time_run*.melt.local";
|
||||
const auto *base_name_0 = "with_time_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "time yes",
|
||||
@ -139,13 +139,13 @@ TEST_F(DumpLocalCompressTest, compressed_with_units_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "with_units_run*.melt.local";
|
||||
auto base_name_0 = "with_units_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "with_units_run*.melt.local";
|
||||
const auto *base_name_0 = "with_units_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "units yes",
|
||||
@ -173,13 +173,13 @@ TEST_F(DumpLocalCompressTest, compressed_triclinic_run0)
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
enable_triclinic();
|
||||
|
||||
auto base_name = "triclinic_run*.melt.local";
|
||||
auto base_name_0 = "triclinic_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "triclinic_run*.melt.local";
|
||||
const auto *base_name_0 = "triclinic_run0.melt.local";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, fields, fields, "",
|
||||
@ -206,16 +206,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.local";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.local";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
if (compression_style == "local/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
@ -248,16 +248,16 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.local";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.local";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "pad 3", 1);
|
||||
|
||||
@ -290,19 +290,19 @@ TEST_F(DumpLocalCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.local";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.local";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.local";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.local";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.local";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.local";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, "maxfiles 2", 2);
|
||||
|
||||
@ -337,7 +337,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_bad_param)
|
||||
{
|
||||
if (compression_style != "local/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
@ -353,7 +353,7 @@ TEST_F(DumpLocalCompressTest, compressed_modify_multi_bad_param)
|
||||
{
|
||||
if (compression_style != "local/gz") GTEST_SKIP();
|
||||
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
BEGIN_HIDE_OUTPUT();
|
||||
command(fmt::format("dump id1 all {} 1 {} {}", compression_style,
|
||||
@ -370,10 +370,10 @@ TEST_F(DumpLocalCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto fields = "index c_comp[1]";
|
||||
const auto *base_name = "modify_clevel_run0.melt.local";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *fields = "index c_comp[1]";
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, fields, fields, "",
|
||||
"compression_level 3", 0);
|
||||
|
||||
@ -91,8 +91,8 @@ public:
|
||||
TEST_F(DumpNetCDFTest, run0_plain)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "dump", "netcdf")) GTEST_SKIP();
|
||||
auto dump_file = dump_filename("run0");
|
||||
auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
auto dump_file = dump_filename("run0");
|
||||
const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
set_style("netcdf");
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
@ -285,8 +285,8 @@ TEST_F(DumpNetCDFTest, run0_plain)
|
||||
TEST_F(DumpNetCDFTest, run0_mpi)
|
||||
{
|
||||
if (!lammps_has_style(lmp, "dump", "netcdf/mpiio")) GTEST_SKIP();
|
||||
auto dump_file = dump_filename("mpi0");
|
||||
auto fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
auto dump_file = dump_filename("mpi0");
|
||||
const auto *fields = "id type proc procp1 mass x y z ix iy iz xu yu zu vx vy vz fx fy fz";
|
||||
set_style("netcdf/mpiio");
|
||||
generate_dump(dump_file, fields, "", 0);
|
||||
|
||||
|
||||
@ -31,12 +31,12 @@ TEST_F(DumpXYZCompressTest, compressed_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "run*.melt.xyz";
|
||||
auto base_name_0 = "run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *base_name = "run*.melt.xyz";
|
||||
const auto *base_name_0 = "run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "", "checksum yes",
|
||||
@ -63,12 +63,12 @@ TEST_F(DumpXYZCompressTest, compressed_no_buffer_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "no_buffer_run*.melt.xyz";
|
||||
auto base_name_0 = "no_buffer_run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
const auto *base_name = "no_buffer_run*.melt.xyz";
|
||||
const auto *base_name_0 = "no_buffer_run0.melt.xyz";
|
||||
auto text_files = text_dump_filename(base_name);
|
||||
auto compressed_files = compressed_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_files, compressed_files, "", "", "buffer no",
|
||||
@ -95,15 +95,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_run1_0.melt.xyz";
|
||||
auto base_name_1 = "multi_file_run1_1.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_run1_0.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_run1_1.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
if (compression_style == "xyz/zstd") {
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "checksum no", 1);
|
||||
@ -135,15 +135,15 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_pad_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_pad_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_pad_run1_000.melt.xyz";
|
||||
auto base_name_1 = "multi_file_pad_run1_001.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
const auto *base_name = "multi_file_pad_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_pad_run1_000.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_pad_run1_001.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1);
|
||||
|
||||
@ -176,18 +176,18 @@ TEST_F(DumpXYZCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "multi_file_maxfiles_run1_*.melt.xyz";
|
||||
auto base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz";
|
||||
auto base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz";
|
||||
auto base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
const auto *base_name = "multi_file_maxfiles_run1_*.melt.xyz";
|
||||
const auto *base_name_0 = "multi_file_maxfiles_run1_0.melt.xyz";
|
||||
const auto *base_name_1 = "multi_file_maxfiles_run1_1.melt.xyz";
|
||||
const auto *base_name_2 = "multi_file_maxfiles_run1_2.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto text_file_0 = text_dump_filename(base_name_0);
|
||||
auto text_file_1 = text_dump_filename(base_name_1);
|
||||
auto text_file_2 = text_dump_filename(base_name_2);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||
auto compressed_file_1 = compressed_dump_filename(base_name_1);
|
||||
auto compressed_file_2 = compressed_dump_filename(base_name_2);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2);
|
||||
|
||||
@ -250,9 +250,9 @@ TEST_F(DumpXYZCompressTest, compressed_modify_clevel_run0)
|
||||
{
|
||||
if (!COMPRESS_EXECUTABLE) GTEST_SKIP();
|
||||
|
||||
auto base_name = "modify_clevel_run0.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
const auto *base_name = "modify_clevel_run0.melt.xyz";
|
||||
auto text_file = text_dump_filename(base_name);
|
||||
auto compressed_file = compressed_dump_filename(base_name);
|
||||
|
||||
generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3",
|
||||
0);
|
||||
|
||||
@ -511,10 +511,10 @@ TEST_F(FileOperationsTest, read_data_fix)
|
||||
lmp->atom->molecule[1] = 6;
|
||||
lmp->atom->molecule[2] = 5;
|
||||
lmp->atom->molecule[3] = 6;
|
||||
lmp->atom->tag[0] = 9;
|
||||
lmp->atom->tag[1] = 6;
|
||||
lmp->atom->tag[2] = 7;
|
||||
lmp->atom->tag[3] = 8;
|
||||
lmp->atom->tag[0] = 9;
|
||||
lmp->atom->tag[1] = 6;
|
||||
lmp->atom->tag[2] = 7;
|
||||
lmp->atom->tag[3] = 8;
|
||||
lmp->atom->map_init(1);
|
||||
lmp->atom->map_set();
|
||||
command("write_data test_mol_id_merge.data");
|
||||
|
||||
@ -61,10 +61,10 @@ protected:
|
||||
|
||||
TEST_F(ImageFlagsTest, change_box)
|
||||
{
|
||||
auto image = lmp->atom->image;
|
||||
int imx = (image[0] & IMGMASK) - IMGMAX;
|
||||
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int imz = (image[0] >> IMG2BITS) - IMGMAX;
|
||||
auto *image = lmp->atom->image;
|
||||
int imx = (image[0] & IMGMASK) - IMGMAX;
|
||||
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int imz = (image[0] >> IMG2BITS) - IMGMAX;
|
||||
|
||||
ASSERT_EQ(imx, -1);
|
||||
ASSERT_EQ(imy, 2);
|
||||
@ -153,10 +153,10 @@ TEST_F(ImageFlagsTest, read_data)
|
||||
command("read_data test_image_flags.data");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto image = lmp->atom->image;
|
||||
int imx = (image[0] & IMGMASK) - IMGMAX;
|
||||
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int imz = (image[0] >> IMG2BITS) - IMGMAX;
|
||||
auto *image = lmp->atom->image;
|
||||
int imx = (image[0] & IMGMASK) - IMGMAX;
|
||||
int imy = (image[0] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||
int imz = (image[0] >> IMG2BITS) - IMGMAX;
|
||||
|
||||
ASSERT_EQ(imx, -1);
|
||||
ASSERT_EQ(imy, 2);
|
||||
|
||||
@ -67,7 +67,7 @@ TEST_F(PotentialFileReaderTest, Sw_native)
|
||||
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ TEST_F(PotentialFileReaderTest, Sw_conv)
|
||||
PotentialFileReader reader(lmp, "Si.sw", "Stillinger-Weber", utils::METAL2REAL);
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairSW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairSW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ TEST_F(PotentialFileReaderTest, Comb)
|
||||
PotentialFileReader reader(lmp, "ffield.comb", "COMB");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairComb::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairComb::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairComb::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ TEST_F(PotentialFileReaderTest, Comb3)
|
||||
PotentialFileReader reader(lmp, "ffield.comb3", "COMB3");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairComb3::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairComb3::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairComb3::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ TEST_F(PotentialFileReaderTest, Tersoff)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff", "Tersoff");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoff::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoff::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoff::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ TEST_F(PotentialFileReaderTest, TersoffMod)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff.mod", "Tersoff/Mod");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffMOD::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ TEST_F(PotentialFileReaderTest, TersoffModC)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff.modc", "Tersoff/ModC");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ TEST_F(PotentialFileReaderTest, TersoffTable)
|
||||
PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ TEST_F(PotentialFileReaderTest, TersoffZBL)
|
||||
PotentialFileReader reader(lmp, "SiC.tersoff.zbl", "Tersoff/ZBL");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairTersoffZBL::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ TEST_F(PotentialFileReaderTest, GW)
|
||||
PotentialFileReader reader(lmp, "SiC.gw", "GW");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairGW::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairGW::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairGW::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ TEST_F(PotentialFileReaderTest, GWZBL)
|
||||
PotentialFileReader reader(lmp, "SiC.gw.zbl", "GW/ZBL");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairGWZBL::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairGWZBL::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ TEST_F(PotentialFileReaderTest, Nb3bHarmonic)
|
||||
PotentialFileReader reader(lmp, "MOH.nb3b.harmonic", "NB3B Harmonic");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairNb3bHarmonic::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ TEST_F(PotentialFileReaderTest, Vashishta)
|
||||
PotentialFileReader reader(lmp, "SiC.vashishta", "Vashishta");
|
||||
END_HIDE_OUTPUT();
|
||||
|
||||
auto line = reader.next_line(PairVashishta::NPARAMS_PER_LINE);
|
||||
auto *line = reader.next_line(PairVashishta::NPARAMS_PER_LINE);
|
||||
ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ protected:
|
||||
|
||||
TEST_F(TextFileReaderTest, nofile)
|
||||
{
|
||||
ASSERT_THROW({ TextFileReader reader("text_reader_noexist.file", "test"); },
|
||||
FileReaderException);
|
||||
ASSERT_THROW(
|
||||
{ TextFileReader reader("text_reader_noexist.file", "test"); }, FileReaderException);
|
||||
}
|
||||
|
||||
// this test cannot work on windows due to its non unix-like permission system
|
||||
@ -76,8 +76,8 @@ TEST_F(TextFileReaderTest, permissions)
|
||||
fputs("word\n", fp);
|
||||
fclose(fp);
|
||||
chmod("text_reader_noperms.file", 0);
|
||||
ASSERT_THROW({ TextFileReader reader("text_reader_noperms.file", "test"); },
|
||||
FileReaderException);
|
||||
ASSERT_THROW(
|
||||
{ TextFileReader reader("text_reader_noperms.file", "test"); }, FileReaderException);
|
||||
platform::unlink("text_reader_noperms.file");
|
||||
}
|
||||
#endif
|
||||
@ -93,8 +93,8 @@ TEST_F(TextFileReaderTest, usefp)
|
||||
FILE *fp = fopen("text_reader_two.file", "r");
|
||||
ASSERT_NE(fp, nullptr);
|
||||
|
||||
auto reader = new TextFileReader(fp, "test");
|
||||
auto line = reader->next_line();
|
||||
auto *reader = new TextFileReader(fp, "test");
|
||||
auto *line = reader->next_line();
|
||||
ASSERT_STREQ(line, "4 ");
|
||||
line = reader->next_line(1);
|
||||
ASSERT_STREQ(line, "4 0.5 ");
|
||||
@ -120,7 +120,7 @@ TEST_F(TextFileReaderTest, comments)
|
||||
test_files();
|
||||
TextFileReader reader("text_reader_two.file", "test");
|
||||
reader.ignore_comments = true;
|
||||
auto line = reader.next_line();
|
||||
auto *line = reader.next_line();
|
||||
ASSERT_STREQ(line, "4 ");
|
||||
line = reader.next_line(1);
|
||||
ASSERT_STREQ(line, "4 0.5 ");
|
||||
@ -141,7 +141,7 @@ TEST_F(TextFileReaderTest, nocomments)
|
||||
test_files();
|
||||
TextFileReader reader("text_reader_one.file", "test");
|
||||
reader.ignore_comments = false;
|
||||
auto line = reader.next_line();
|
||||
auto *line = reader.next_line();
|
||||
ASSERT_STREQ(line, "# test file 1 for text file reader\n");
|
||||
line = reader.next_line(1);
|
||||
ASSERT_STREQ(line, "one\n");
|
||||
|
||||
@ -136,8 +136,8 @@ TEST_F(LAMMPS_configuration, has_package)
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
for (std::size_t i = 0; i < pkg_name.size(); i++)
|
||||
EXPECT_EQ(f_lammps_has_package(pkg_name[i].c_str()), Info::has_package(pkg_name[i]));
|
||||
for (const auto &i : pkg_name)
|
||||
EXPECT_EQ(f_lammps_has_package(i.c_str()), Info::has_package(i));
|
||||
}
|
||||
|
||||
TEST_F(LAMMPS_configuration, package_count)
|
||||
|
||||
@ -34,7 +34,7 @@ TEST(open_no_mpi, no_args)
|
||||
void *handle = f_lammps_no_mpi_no_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->world, MPI_COMM_WORLD);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -51,7 +51,7 @@ TEST(open_no_mpi, with_args)
|
||||
void *handle = f_lammps_no_mpi_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
EXPECT_EQ(lmp->logfile, nullptr);
|
||||
@ -70,10 +70,10 @@ TEST(fortran_open, no_args)
|
||||
void *handle = f_lammps_open_no_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
int f_comm = f_lammps_get_comm();
|
||||
MPI_Comm mycomm = MPI_Comm_f2c(f_comm);
|
||||
int f_comm = f_lammps_get_comm();
|
||||
auto mycomm = MPI_Comm_f2c(f_comm);
|
||||
EXPECT_EQ(lmp->world, mycomm);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
@ -90,10 +90,10 @@ TEST(fortran_open, with_args)
|
||||
void *handle = f_lammps_open_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 6).c_str(), "LAMMPS");
|
||||
LAMMPS_NS::LAMMPS *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
auto *lmp = (LAMMPS_NS::LAMMPS *)handle;
|
||||
|
||||
int f_comm = f_lammps_get_comm();
|
||||
MPI_Comm mycomm = MPI_Comm_f2c(f_comm);
|
||||
int f_comm = f_lammps_get_comm();
|
||||
auto mycomm = MPI_Comm_f2c(f_comm);
|
||||
EXPECT_EQ(lmp->world, mycomm);
|
||||
EXPECT_EQ(lmp->infile, stdin);
|
||||
EXPECT_EQ(lmp->screen, stdout);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
// unit tests for creating atoms in a LAMMPS instance through the Fortran wrapper
|
||||
|
||||
#include "atom.h"
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "atom.h"
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
@ -56,39 +56,39 @@ TEST_F(LAMMPS_create_atoms, create_three)
|
||||
#endif
|
||||
double **x, **v;
|
||||
EXPECT_EQ(lmp->atom->nlocal, 3);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
f_lammps_create_three_atoms();
|
||||
EXPECT_EQ(lmp->atom->nlocal, 6);
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 4) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(1,-1,3));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.0);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],2.718281828);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],-1.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(1, -1, 3));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 2.718281828);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], -1.0);
|
||||
}
|
||||
if (tag[i] == 5) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-2,-2,1));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],-1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],3.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-2, -2, 1));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], -1.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 3.0);
|
||||
}
|
||||
if (tag[i] == 6) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-2,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.6);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],0.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],2.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],-0.2);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-2, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.6);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 0.8);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 2.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.2);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], -0.2);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -106,30 +106,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more)
|
||||
EXPECT_EQ(lmp->atom->nlocal, 6);
|
||||
f_lammps_create_two_more();
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall)
|
||||
@ -149,30 +149,30 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall)
|
||||
f_lammps_create_two_more_small();
|
||||
#endif
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(-1,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(-1, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(1,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(1, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2)
|
||||
@ -192,28 +192,28 @@ TEST_F(LAMMPS_create_atoms, create_two_more_bigsmall2)
|
||||
f_lammps_create_two_more_small2();
|
||||
#endif
|
||||
EXPECT_EQ(lmp->atom->nlocal, 8);
|
||||
tag = lmp->atom->tag;
|
||||
tag = lmp->atom->tag;
|
||||
image = lmp->atom->image;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
x = lmp->atom->x;
|
||||
v = lmp->atom->v;
|
||||
for (int i = 0; i < lmp->atom->nlocal; i++) {
|
||||
if (tag[i] == 7) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 1.2);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 2.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 1.25);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
if (tag[i] == 8) {
|
||||
EXPECT_EQ(image[i],lammps_encode_image_flags(0,0,0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0],0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1],1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2],3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1],0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2],0.0);
|
||||
EXPECT_EQ(image[i], lammps_encode_image_flags(0, 0, 0));
|
||||
EXPECT_DOUBLE_EQ(x[i][0], 0.1);
|
||||
EXPECT_DOUBLE_EQ(x[i][1], 1.9);
|
||||
EXPECT_DOUBLE_EQ(x[i][2], 3.8);
|
||||
EXPECT_DOUBLE_EQ(v[i][0], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][1], 0.0);
|
||||
EXPECT_DOUBLE_EQ(v[i][2], 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -51,7 +51,7 @@ protected:
|
||||
TEST_F(LAMMPS_extract_fix, global_scalar)
|
||||
{
|
||||
f_lammps_setup_extract_fix();
|
||||
double *scalar =
|
||||
auto *scalar =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, -1, -1);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_scalar(), *scalar);
|
||||
lammps_free(scalar);
|
||||
@ -60,11 +60,11 @@ TEST_F(LAMMPS_extract_fix, global_scalar)
|
||||
TEST_F(LAMMPS_extract_fix, global_vector)
|
||||
{
|
||||
f_lammps_setup_extract_fix();
|
||||
double *x =
|
||||
auto *x =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 0, -1);
|
||||
double *y =
|
||||
auto *y =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 1, -1);
|
||||
double *z =
|
||||
auto *z =
|
||||
(double *)lammps_extract_fix(lmp, "recenter", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, 2, -1);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(1), *x);
|
||||
EXPECT_DOUBLE_EQ(f_lammps_extract_fix_global_vector(2), *y);
|
||||
|
||||
@ -18,7 +18,7 @@ void f_lammps_close();
|
||||
void f_lammps_setup_fix_external_callback();
|
||||
void f_lammps_setup_fix_external_array();
|
||||
void f_lammps_set_fix_external_callbacks();
|
||||
void f_lammps_get_force(int, double*);
|
||||
void f_lammps_get_force(int, double *);
|
||||
void f_lammps_reverse_direction();
|
||||
void f_lammps_find_forces();
|
||||
void f_lammps_add_energy();
|
||||
@ -59,11 +59,11 @@ TEST_F(LAMMPS_fixexternal, callback)
|
||||
f_lammps_set_fix_external_callbacks();
|
||||
lammps_command(lmp, "run 0");
|
||||
double f[3];
|
||||
f_lammps_get_force(1,f);
|
||||
f_lammps_get_force(1, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], 3.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], -3.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], 3.75);
|
||||
f_lammps_get_force(2,f);
|
||||
f_lammps_get_force(2, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], -3.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], 3.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], -3.75);
|
||||
@ -71,11 +71,11 @@ TEST_F(LAMMPS_fixexternal, callback)
|
||||
f_lammps_reverse_direction();
|
||||
f_lammps_set_fix_external_callbacks();
|
||||
lammps_command(lmp, "run 0");
|
||||
f_lammps_get_force(1,f);
|
||||
f_lammps_get_force(1, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], 1.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], -1.25);
|
||||
f_lammps_get_force(2,f);
|
||||
f_lammps_get_force(2, f);
|
||||
EXPECT_DOUBLE_EQ(f[0], 1.0);
|
||||
EXPECT_DOUBLE_EQ(f[1], -1.0);
|
||||
EXPECT_DOUBLE_EQ(f[2], 1.25);
|
||||
@ -85,7 +85,7 @@ TEST_F(LAMMPS_fixexternal, array)
|
||||
{
|
||||
f_lammps_setup_fix_external_array();
|
||||
double **f;
|
||||
f = (double**) lammps_extract_atom(lmp, "f");
|
||||
f = (double **)lammps_extract_atom(lmp, "f");
|
||||
f_lammps_find_forces();
|
||||
lammps_command(lmp, "run 0");
|
||||
EXPECT_DOUBLE_EQ(f[0][0], 14.0);
|
||||
@ -112,19 +112,19 @@ TEST_F(LAMMPS_fixexternal, virial_global)
|
||||
double virial[6], volume;
|
||||
f_lammps_set_virial();
|
||||
lammps_command(lmp, "run 0");
|
||||
volume = lammps_get_thermo(lmp, "vol");
|
||||
volume = lammps_get_thermo(lmp, "vol");
|
||||
virial[0] = lammps_get_thermo(lmp, "pxx");
|
||||
virial[1] = lammps_get_thermo(lmp, "pyy");
|
||||
virial[2] = lammps_get_thermo(lmp, "pzz");
|
||||
virial[3] = lammps_get_thermo(lmp, "pxy");
|
||||
virial[4] = lammps_get_thermo(lmp, "pxz");
|
||||
virial[5] = lammps_get_thermo(lmp, "pyz");
|
||||
EXPECT_DOUBLE_EQ(virial[0], 1.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[1], 2.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 2.5/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[3], -1.0/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -2.25/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[5], -3.02/volume);
|
||||
EXPECT_DOUBLE_EQ(virial[0], 1.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[1], 2.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 2.5 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[3], -1.0 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -2.25 / volume);
|
||||
EXPECT_DOUBLE_EQ(virial[5], -3.02 / volume);
|
||||
};
|
||||
|
||||
TEST_F(LAMMPS_fixexternal, energy_peratom)
|
||||
@ -135,13 +135,12 @@ TEST_F(LAMMPS_fixexternal, energy_peratom)
|
||||
double energy;
|
||||
lammps_command(lmp, "run 0");
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
for (int i = 1; i <= nlocal; i++)
|
||||
{
|
||||
for (int i = 1; i <= nlocal; i++) {
|
||||
energy = f_lammps_find_peratom_energy(i);
|
||||
if (i == 1)
|
||||
EXPECT_DOUBLE_EQ(energy, 1.0);
|
||||
EXPECT_DOUBLE_EQ(energy, 1.0);
|
||||
else
|
||||
EXPECT_DOUBLE_EQ(energy, 10.0);
|
||||
EXPECT_DOUBLE_EQ(energy, 10.0);
|
||||
}
|
||||
};
|
||||
|
||||
@ -153,26 +152,22 @@ TEST_F(LAMMPS_fixexternal, virial_peratom)
|
||||
double virial[6];
|
||||
lammps_command(lmp, "run 0");
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
for (int i = 1; i <= nlocal; i++)
|
||||
{
|
||||
for (int i = 1; i <= nlocal; i++) {
|
||||
f_lammps_find_peratom_virial(virial, i);
|
||||
if (i == 1)
|
||||
{
|
||||
EXPECT_DOUBLE_EQ(virial[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -3.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 3.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
EXPECT_DOUBLE_EQ(virial[0], -10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -30.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 30.0);
|
||||
if (i == 1) {
|
||||
EXPECT_DOUBLE_EQ(virial[0], -1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 1.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 2.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -3.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 3.0);
|
||||
} else {
|
||||
EXPECT_DOUBLE_EQ(virial[0], -10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[1], -20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[2], 10.0);
|
||||
EXPECT_DOUBLE_EQ(virial[3], 20.0);
|
||||
EXPECT_DOUBLE_EQ(virial[4], -30.0);
|
||||
EXPECT_DOUBLE_EQ(virial[5], 30.0);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -184,11 +179,9 @@ TEST_F(LAMMPS_fixexternal, vector)
|
||||
f_lammps_fixexternal_set_vector();
|
||||
lammps_command(lmp, "run 0");
|
||||
double *v;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
v = (double*) lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL,
|
||||
LMP_TYPE_VECTOR, i, 1);
|
||||
EXPECT_DOUBLE_EQ(i+1, *v);
|
||||
std::free(v);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
v = (double *)lammps_extract_fix(lmp, "ext2", LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR, i, 1);
|
||||
EXPECT_DOUBLE_EQ(i + 1, *v);
|
||||
std::free(v);
|
||||
}
|
||||
};
|
||||
|
||||
@ -277,7 +277,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute)
|
||||
lammps_command(lmp, "run 0");
|
||||
int natoms = lmp->atom->natoms;
|
||||
int *tag = lmp->atom->tag;
|
||||
double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
for (int i = 0; i < natoms; i++)
|
||||
EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]);
|
||||
#endif
|
||||
@ -292,7 +292,7 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_concat)
|
||||
lammps_command(lmp, "run 0");
|
||||
int natoms = lmp->atom->natoms;
|
||||
int *tag = lmp->atom->tag;
|
||||
double *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
auto *pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
for (int i = 0; i < natoms; i++)
|
||||
EXPECT_DOUBLE_EQ(f_lammps_gather_pe_atom(tag[i]), pe[i]);
|
||||
#endif
|
||||
@ -305,11 +305,11 @@ TEST_F(LAMMPS_gather_scatter, gather_compute_subset)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
lammps_command(lmp, "run 0");
|
||||
int ids[2] = {3, 1};
|
||||
int *tag = lmp->atom->tag;
|
||||
double pe[2] = {0.0, 0.0};
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
double *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
int ids[2] = {3, 1};
|
||||
int *tag = lmp->atom->tag;
|
||||
double pe[2] = {0.0, 0.0};
|
||||
int nlocal = lammps_extract_setting(lmp, "nlocal");
|
||||
auto *pa_pe = (double *)lammps_extract_compute(lmp, "pe", LMP_STYLE_ATOM, LMP_TYPE_VECTOR);
|
||||
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
if (tag[i] == ids[0]) pe[0] = pa_pe[i];
|
||||
@ -330,10 +330,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_compute)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
int natoms = lmp->atom->natoms;
|
||||
double *pe = new double[natoms];
|
||||
auto *pe = new double[natoms];
|
||||
lammps_command(lmp, "run 0");
|
||||
lammps_gather(lmp, "c_pe", 1, 1, pe);
|
||||
double *old_pe = new double[natoms];
|
||||
auto *old_pe = new double[natoms];
|
||||
for (int i = 0; i < natoms; i++)
|
||||
old_pe[i] = pe[i];
|
||||
EXPECT_DOUBLE_EQ(pe[0], old_pe[0]);
|
||||
@ -356,10 +356,10 @@ TEST_F(LAMMPS_gather_scatter, scatter_subset_compute)
|
||||
#else
|
||||
f_lammps_setup_gather_scatter();
|
||||
int natoms = lmp->atom->natoms;
|
||||
double *pe = new double[natoms];
|
||||
auto *pe = new double[natoms];
|
||||
lammps_command(lmp, "run 0");
|
||||
lammps_gather(lmp, "c_pe", 1, 1, pe);
|
||||
double *old_pe = new double[natoms];
|
||||
auto *old_pe = new double[natoms];
|
||||
for (int i = 0; i < natoms; i++)
|
||||
old_pe[i] = pe[i];
|
||||
EXPECT_DOUBLE_EQ(pe[0], old_pe[0]);
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
// unit tests for accessing neighbor lists in a LAMMPS instance through the Fortran wrapper
|
||||
|
||||
#include "force.h"
|
||||
#include "info.h"
|
||||
#include "lammps.h"
|
||||
#include "library.h"
|
||||
#include "force.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "info.h"
|
||||
//#include <cstdint>
|
||||
//#include <cstdlib>
|
||||
#include "neighbor.h"
|
||||
// #include <cstdint>
|
||||
// #include <cstdlib>
|
||||
#include <mpi.h>
|
||||
#include <string>
|
||||
|
||||
@ -33,13 +33,15 @@ protected:
|
||||
LAMMPS_neighbors() = default;
|
||||
~LAMMPS_neighbors() override = default;
|
||||
|
||||
void SetUp() override {
|
||||
void SetUp() override
|
||||
{
|
||||
::testing::internal::CaptureStdout();
|
||||
lmp = (LAMMPS_NS::LAMMPS *)f_lammps_with_args();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ(output.substr(0, 8).c_str(), "LAMMPS (");
|
||||
}
|
||||
void TearDown() override {
|
||||
void TearDown() override
|
||||
{
|
||||
::testing::internal::CaptureStdout();
|
||||
f_lammps_close();
|
||||
std::string output = ::testing::internal::GetCapturedStdout();
|
||||
@ -52,14 +54,13 @@ TEST_F(LAMMPS_neighbors, pair)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
int pair_neighlist = f_lammps_pair_neighlist_test();
|
||||
Pair *pair = lmp->force->pair_match("lj/cut",1,0);
|
||||
int index = -2;
|
||||
Pair *pair = lmp->force->pair_match("lj/cut", 1, 0);
|
||||
int index = -2;
|
||||
if (pair != nullptr) {
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ((list->requestor_type == NeighList::PAIR)
|
||||
and (pair == list->requestor)
|
||||
and (list->id == 0)) {
|
||||
if ((list->requestor_type == NeighList::PAIR) and (pair == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
@ -72,16 +73,16 @@ TEST_F(LAMMPS_neighbors, fix)
|
||||
{
|
||||
if (not Info::has_package("REPLICA")) GTEST_SKIP();
|
||||
f_lammps_setup_neigh_tests();
|
||||
auto fix = lmp->modify->get_fix_by_id("f");
|
||||
auto *fix = lmp->modify->get_fix_by_id("f");
|
||||
EXPECT_NE(fix, nullptr);
|
||||
int ilist = -2;
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ( (list->requestor_type == NeighList::FIX)
|
||||
and (fix == list->requestor) and (list->id == 0) ) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ((list->requestor_type == NeighList::FIX) and (fix == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(ilist, f_lammps_fix_neighlist_test());
|
||||
};
|
||||
@ -89,13 +90,13 @@ TEST_F(LAMMPS_neighbors, fix)
|
||||
TEST_F(LAMMPS_neighbors, compute)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
auto compute = lmp->modify->get_compute_by_id("c");
|
||||
EXPECT_NE(compute,nullptr);
|
||||
auto *compute = lmp->modify->get_compute_by_id("c");
|
||||
EXPECT_NE(compute, nullptr);
|
||||
int ilist = -2;
|
||||
for (int i=0; i < lmp->neighbor->nlist; i++) {
|
||||
for (int i = 0; i < lmp->neighbor->nlist; i++) {
|
||||
NeighList *list = lmp->neighbor->lists[i];
|
||||
if ( (list->requestor_type == NeighList::COMPUTE)
|
||||
and (compute == list->requestor) and (list->id == 0) ) {
|
||||
if ((list->requestor_type == NeighList::COMPUTE) and (compute == list->requestor) and
|
||||
(list->id == 0)) {
|
||||
ilist = i;
|
||||
break;
|
||||
}
|
||||
@ -107,17 +108,17 @@ TEST_F(LAMMPS_neighbors, numelements)
|
||||
{
|
||||
f_lammps_setup_neigh_tests();
|
||||
int num_neigh = 0;
|
||||
int pair_id = f_lammps_pair_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(pair_id);
|
||||
int pair_id = f_lammps_pair_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(pair_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, pair_id));
|
||||
if (Info::has_package("REPLICA")) {
|
||||
int fix_id = f_lammps_fix_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(fix_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id));
|
||||
int fix_id = f_lammps_fix_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(fix_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, fix_id));
|
||||
}
|
||||
int compute_id = f_lammps_compute_neighlist_test();
|
||||
num_neigh = f_lammps_neighlist_num_elements(compute_id);
|
||||
num_neigh = f_lammps_neighlist_num_elements(compute_id);
|
||||
EXPECT_EQ(num_neigh, lammps_neighlist_num_elements(lmp, compute_id));
|
||||
};
|
||||
|
||||
} // LAMMPS_NS
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -342,7 +342,7 @@ TEST_F(FixPythonInvokeTest, post_force)
|
||||
if (line == "PYTHON_POST_FORCE") ++count;
|
||||
}
|
||||
|
||||
ASSERT_EQ(count, 5);
|
||||
ASSERT_EQ(count, 6);
|
||||
}
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
protected:
|
||||
std::string testbinary = "LAMMPSTest";
|
||||
LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"};
|
||||
LAMMPS::argv args = {"-log", "none", "-echo", "screen", "-nocite"};
|
||||
LAMMPS *lmp;
|
||||
Info *info;
|
||||
|
||||
|
||||
@ -130,7 +130,10 @@ TEST(LeptonCustomFunction, zbl)
|
||||
|
||||
class ExampleFunction : public Lepton::CustomFunction {
|
||||
int getNumArguments() const override { return 2; }
|
||||
double evaluate(const double *arguments) const override { return 2.0 * arguments[0] * arguments[1]; }
|
||||
double evaluate(const double *arguments) const override
|
||||
{
|
||||
return 2.0 * arguments[0] * arguments[1];
|
||||
}
|
||||
double evaluateDerivative(const double *arguments, const int *derivOrder) const override
|
||||
{
|
||||
if (derivOrder[0] == 1) {
|
||||
|
||||
@ -24,7 +24,7 @@ TEST(Types, ubuf)
|
||||
{
|
||||
double buf[3];
|
||||
double d1 = 0.1;
|
||||
int i1 = -10;
|
||||
int i1 = -10;
|
||||
#if defined(LAMMPS_SMALLSMALL)
|
||||
bigint b1 = 2048;
|
||||
#else
|
||||
@ -43,14 +43,14 @@ TEST(Types, multitype)
|
||||
{
|
||||
multitype m[7];
|
||||
int64_t b1 = (3L << 48) - 1;
|
||||
int i1 = 20;
|
||||
double d1 = 0.1;
|
||||
int i1 = 20;
|
||||
double d1 = 0.1;
|
||||
|
||||
m[0] = b1;
|
||||
m[1] = i1;
|
||||
m[2] = d1;
|
||||
|
||||
m[3] = (bigint) -((1L << 40) + (1L << 50));
|
||||
m[3] = (bigint) - ((1L << 40) + (1L << 50));
|
||||
m[4] = -1023;
|
||||
m[5] = -2.225;
|
||||
|
||||
@ -72,7 +72,7 @@ TEST(Types, multitype)
|
||||
EXPECT_EQ(m[2].data.d, d1);
|
||||
|
||||
#if !defined(LAMMPS_SMALLSMALL)
|
||||
EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50)));
|
||||
EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50)));
|
||||
#endif
|
||||
EXPECT_EQ(m[4].data.i, -1023);
|
||||
EXPECT_EQ(m[5].data.d, -2.225);
|
||||
|
||||
@ -385,9 +385,9 @@ void TestJacobi(int n, //<! matrix size
|
||||
Alloc2D(n, n, &M);
|
||||
Alloc2D(n, n, &evecs);
|
||||
Alloc2D(n, n, &evecs_known);
|
||||
Scalar *evals = new Scalar[n];
|
||||
Scalar *evals_known = new Scalar[n];
|
||||
Scalar *test_evec = new Scalar[n];
|
||||
auto *evals = new Scalar[n];
|
||||
auto *evals_known = new Scalar[n];
|
||||
auto *test_evec = new Scalar[n];
|
||||
|
||||
#endif
|
||||
|
||||
@ -464,7 +464,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_INCREASING_ABS_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_INCREASING_ABS_EVALS);
|
||||
#endif
|
||||
|
||||
@ -488,7 +488,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_DECREASING_ABS_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_DECREASING_ABS_EVALS);
|
||||
#endif
|
||||
|
||||
@ -511,7 +511,7 @@ void TestJacobi(int n, //<! matrix size
|
||||
Scalar const(*)[NF]>::SORT_INCREASING_EVALS);
|
||||
#else
|
||||
ecalc.Diagonalize(M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Jacobi<Scalar, Scalar *, Scalar **,
|
||||
Scalar const *const *>::SORT_INCREASING_EVALS);
|
||||
#endif
|
||||
for (int i = 1; i < n; i++)
|
||||
@ -533,8 +533,8 @@ void TestJacobi(int n, //<! matrix size
|
||||
Jacobi<Scalar, Scalar *, Scalar(*)[NF], Scalar const(*)[NF]>::DO_NOT_SORT);
|
||||
#else
|
||||
ecalc.Diagonalize(
|
||||
M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
||||
M, evals, evecs,
|
||||
Jacobi<Scalar, Scalar *, Scalar **, Scalar const *const *>::DO_NOT_SORT);
|
||||
#endif
|
||||
|
||||
} // if (test_code_coverage)
|
||||
|
||||
@ -173,6 +173,49 @@ TEST(Tokenizer, default_separators)
|
||||
ASSERT_EQ(t.count(), 2);
|
||||
}
|
||||
|
||||
TEST(Tokenizer, contains)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_TRUE(values.contains("test"));
|
||||
ASSERT_TRUE(values.contains("word"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_TRUE(values.contains("angles"));
|
||||
ASSERT_TRUE(values.contains("Triangles"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, not_contains)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_FALSE(values.contains("test2"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, matches)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_TRUE(values.matches("test"));
|
||||
ASSERT_TRUE(values.matches("^test"));
|
||||
ASSERT_TRUE(values.matches("word"));
|
||||
ASSERT_TRUE(values.matches("word$"));
|
||||
ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$"));
|
||||
values = Tokenizer("\t20\tatoms");
|
||||
ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, not_matches)
|
||||
{
|
||||
Tokenizer values("test word");
|
||||
ASSERT_FALSE(values.matches("test2"));
|
||||
ASSERT_FALSE(values.matches("^word"));
|
||||
ASSERT_FALSE(values.matches("^ "));
|
||||
ASSERT_FALSE(values.matches(" $"));
|
||||
values = Tokenizer("Triangles");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles"));
|
||||
values = Tokenizer("\t0x20\tatoms");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(Tokenizer, as_vector1)
|
||||
{
|
||||
Tokenizer t(" \r\n test \t word \f");
|
||||
@ -338,6 +381,9 @@ TEST(ValueTokenizer, contains)
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_TRUE(values.contains("test"));
|
||||
ASSERT_TRUE(values.contains("word"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_TRUE(values.contains("angles"));
|
||||
ASSERT_TRUE(values.contains("Triangles"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, not_contains)
|
||||
@ -346,6 +392,33 @@ TEST(ValueTokenizer, not_contains)
|
||||
ASSERT_FALSE(values.contains("test2"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, matches)
|
||||
{
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_TRUE(values.matches("test"));
|
||||
ASSERT_TRUE(values.matches("^test"));
|
||||
ASSERT_TRUE(values.matches("word"));
|
||||
ASSERT_TRUE(values.matches("word$"));
|
||||
ASSERT_TRUE(values.matches("^\\s*\\S+\\s+word"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_TRUE(values.matches("^\\s*Triangles\\s*$"));
|
||||
values = ValueTokenizer("\t20\tatoms");
|
||||
ASSERT_TRUE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, not_matches)
|
||||
{
|
||||
ValueTokenizer values("test word");
|
||||
ASSERT_FALSE(values.matches("test2"));
|
||||
ASSERT_FALSE(values.matches("^word"));
|
||||
ASSERT_FALSE(values.matches("^ "));
|
||||
ASSERT_FALSE(values.matches(" $"));
|
||||
values = ValueTokenizer("Triangles");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\S+\\s+angles"));
|
||||
values = ValueTokenizer("\t0x20\tatoms");
|
||||
ASSERT_FALSE(values.matches("^\\s*\\d+\\s+atoms\\s*$"));
|
||||
}
|
||||
|
||||
TEST(ValueTokenizer, missing_int)
|
||||
{
|
||||
ValueTokenizer values("10");
|
||||
|
||||
Reference in New Issue
Block a user