Merge branch 'master' into parse-logical-keyword

This commit is contained in:
Axel Kohlmeyer
2021-09-20 20:41:48 -04:00
414 changed files with 2159 additions and 2576 deletions

View File

@ -1,6 +1,6 @@
message(STATUS "Downloading and building OpenCL loader library") message(STATUS "Downloading and building OpenCL loader library")
set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.06.30.tar.gz" CACHE STRING "URL for OpenCL loader tarball") set(OPENCL_LOADER_URL "${LAMMPS_THIRDPARTY_URL}/opencl-loader-2021.09.18.tar.gz" CACHE STRING "URL for OpenCL loader tarball")
set(OPENCL_LOADER_MD5 "f9e55dd550cfbf77f46507adf7cb8fd2" CACHE STRING "MD5 checksum of OpenCL loader tarball") set(OPENCL_LOADER_MD5 "3b3882627964bd02e5c3b02065daac3c" CACHE STRING "MD5 checksum of OpenCL loader tarball")
mark_as_advanced(OPENCL_LOADER_URL) mark_as_advanced(OPENCL_LOADER_URL)
mark_as_advanced(OPENCL_LOADER_MD5) mark_as_advanced(OPENCL_LOADER_MD5)

View File

@ -71,6 +71,11 @@ if(GPU_API STREQUAL "CUDA")
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}") set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}")
# apply the following to build "fat" CUDA binaries only for known CUDA toolkits
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
message(WARNING "Untested CUDA Toolkit version. Use at your own risk")
else()
# Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0 # Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0
if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0")) if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0"))
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20] ") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20] ")
@ -107,8 +112,6 @@ if(GPU_API STREQUAL "CUDA")
if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1")
string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]")
endif() endif()
if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0")
message(WARNING "Unsupported CUDA version. Use at your own risk.")
endif() endif()
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC}

View File

@ -38,7 +38,7 @@ if(DOWNLOAD_QUIP)
set(temp "${temp}HAVE_LOCAL_E_MIX=0\nHAVE_QC=0\nHAVE_GAP=1\nHAVE_DESCRIPTORS_NONCOMMERCIAL=1\n") set(temp "${temp}HAVE_LOCAL_E_MIX=0\nHAVE_QC=0\nHAVE_GAP=1\nHAVE_DESCRIPTORS_NONCOMMERCIAL=1\n")
set(temp "${temp}HAVE_TURBOGAP=0\nHAVE_QR=1\nHAVE_THIRDPARTY=0\nHAVE_FX=0\nHAVE_SCME=0\nHAVE_MTP=0\n") set(temp "${temp}HAVE_TURBOGAP=0\nHAVE_QR=1\nHAVE_THIRDPARTY=0\nHAVE_FX=0\nHAVE_SCME=0\nHAVE_MTP=0\n")
set(temp "${temp}HAVE_MBD=0\nHAVE_TTM_NF=0\nHAVE_CH4=0\nHAVE_NETCDF4=0\nHAVE_MDCORE=0\nHAVE_ASAP=0\n") set(temp "${temp}HAVE_MBD=0\nHAVE_TTM_NF=0\nHAVE_CH4=0\nHAVE_NETCDF4=0\nHAVE_MDCORE=0\nHAVE_ASAP=0\n")
set(temp "${temp}HAVE_CGAL=0\nHAVE_METIS=0\nHAVE_LMTO_TBE=0\n") set(temp "${temp}HAVE_CGAL=0\nHAVE_METIS=0\nHAVE_LMTO_TBE=0\nHAVE_SCALAPACK=0\n")
file(WRITE ${CMAKE_BINARY_DIR}/quip.config "${temp}") file(WRITE ${CMAKE_BINARY_DIR}/quip.config "${temp}")
message(STATUS "QUIP download via git requested - we will build our own") message(STATUS "QUIP download via git requested - we will build our own")

View File

@ -1,7 +1,28 @@
[ [
{ include: [ "<bits/types/struct_rusage.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/exception.h>", public, "<exception>", public ] },
{ include: [ "@<Eigen/.*>", private, "<Eigen/Eigen>", public ] }, { include: [ "@<Eigen/.*>", private, "<Eigen/Eigen>", public ] },
{ include: [ "@<gtest/.*>", private, "\"gtest/gtest.h\"", public ] }, { include: [ "@<gtest/.*>", private, "\"gtest/gtest.h\"", public ] },
{ include: [ "@<gmock/.*>", private, "\"gmock/gmock.h\"", public ] }, { include: [ "@<gmock/.*>", private, "\"gmock/gmock.h\"", public ] },
{ include: [ "@<gmock/.*>", private, "\"gmock/gmock.h\"", public ] },
{ include: [ "@<(cell|c_loops|container).hh>", private, "<voro++.hh>", public ] },
{ include: [ "@\"atom_vec_.*.h\"", public, "\"style_atom.h\"", public ] },
{ include: [ "@\"body_.*.h\"", public, "\"style_body.h\"", public ] },
{ include: [ "@\"compute_.*.h\"", public, "\"style_compute.h\"", public ] },
{ include: [ "@\"fix_.*.h\"", public, "\"style_fix.h\"", public ] },
{ include: [ "@\"dump_.*.h\"", public, "\"style_dump.h\"", public ] },
{ include: [ "@\"min_.*.h\"", public, "\"style_minimize.h\"", public ] },
{ include: [ "@\"reader_.*.h\"", public, "\"style_reader.h\"", public ] },
{ include: [ "@\"region_.*.h\"", public, "\"style_region.h\"", public ] },
{ include: [ "@\"pair_.*.h\"", public, "\"style_pair.h\"", public ] },
{ include: [ "@\"angle_.*.h\"", public, "\"style_angle.h\"", public ] },
{ include: [ "@\"bond_.*.h\"", public, "\"style_bond.h\"", public ] },
{ include: [ "@\"dihedral_.*.h\"", public, "\"style_dihedral.h\"", public ] },
{ include: [ "@\"improper_.*.h\"", public, "\"style_improper.h\"", public ] },
{ include: [ "@\"kspace_.*.h\"", public, "\"style_kspace.h\"", public ] },
{ include: [ "@\"nbin_.*.h\"", public, "\"style_nbin.h\"", public ] },
{ include: [ "@\"npair_.*.h\"", public, "\"style_npair.h\"", public ] },
{ include: [ "@\"nstenci_.*.h\"", public, "\"style_nstencil.h\"", public ] },
{ include: [ "@\"ntopo_.*.h\"", public, "\"style_ntopo.h\"", public ] },
{ include: [ "<float.h>", public, "<cfloat>", public ] },
{ include: [ "<limits.h>", public, "<climits>", public ] },
{ include: [ "<bits/types/struct_tm.h>", private, "<ctime>", public ] },
] ]

View File

@ -24,6 +24,7 @@ set(ALL_PACKAGES
DRUDE DRUDE
EFF EFF
EXTRA-COMPUTE EXTRA-COMPUTE
EXTRA-DUMP
EXTRA-FIX EXTRA-FIX
EXTRA-MOLECULE EXTRA-MOLECULE
EXTRA-PAIR EXTRA-PAIR

View File

@ -1,4 +1,4 @@
.TH LAMMPS "31 August 2021" "2021-08-31" .TH LAMMPS "20 September 2021" "2021-09-20"
.SH NAME .SH NAME
.B LAMMPS .B LAMMPS
\- Molecular Dynamics Simulator. \- Molecular Dynamics Simulator.

View File

@ -58,13 +58,16 @@ Report missing and unneeded '#include' statements (CMake only)
The conventions for how and when to use and order include statements in The conventions for how and when to use and order include statements in
LAMMPS are documented in :doc:`Modify_style`. To assist with following LAMMPS are documented in :doc:`Modify_style`. To assist with following
these conventions one can use the `Include What You Use tool <https://include-what-you-use.org/>`_. these conventions one can use the `Include What You Use tool <https://include-what-you-use.org/>`_.
This is still under development and for large and complex projects like LAMMPS This tool is still under development and for large and complex projects like LAMMPS
there are some false positives, so suggested changes need to be verified manually. there are some false positives, so suggested changes need to be verified manually.
It is recommended to use at least version 0.14, which has much fewer incorrect It is recommended to use at least version 0.16, which has much fewer incorrect
reports than earlier versions. reports than earlier versions. To install the IWYU toolkit, you need to have
the clang compiler **and** its development package installed. Download the IWYU
version that matches the version of the clang compiler, configure, build, and
install it.
The necessary steps to generate the report can be enabled via a The necessary steps to generate the report can be enabled via a CMake variable
CMake variable: during CMake configuration.
.. code-block:: bash .. code-block:: bash

View File

@ -209,6 +209,9 @@ Convenience functions
.. doxygenfunction:: date2num .. doxygenfunction:: date2num
:project: progguide :project: progguide
.. doxygenfunction:: current_date
:project: progguide
Customized standard functions Customized standard functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -40,11 +40,10 @@ We use it to show how to identify the origin of a segmentation fault.
After recompiling LAMMPS and running the input you should get something like this: After recompiling LAMMPS and running the input you should get something like this:
.. code-block: .. code-block::
$ ./lmp -in in.melt $ ./lmp -in in.melt
LAMMPS (19 Mar 2020) LAMMPS (19 Mar 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:94)
using 1 OpenMP thread(s) per MPI task using 1 OpenMP thread(s) per MPI task
Lattice spacing in x,y,z = 1.6796 1.6796 1.6796 Lattice spacing in x,y,z = 1.6796 1.6796 1.6796
Created orthogonal box = (0 0 0) to (16.796 16.796 16.796) Created orthogonal box = (0 0 0) to (16.796 16.796 16.796)

View File

@ -26,7 +26,7 @@ available online are listed below.
* `Tutorials <https://www.lammps.org/tutorials.html>`_ * `Tutorials <https://www.lammps.org/tutorials.html>`_
* `Pre- and post-processing tools for LAMMPS <https://www.lammps.org/prepost.html>`_ * `Pre- and post-processing tools for LAMMPS <https://www.lammps.org/prepost.html>`_
* `Other software usable with LAMMPS <https://www.lammps.org/offsite.html>`_ * `Other software usable with LAMMPS <https://www.lammps.org/external.html>`_
* `Viz tools usable with LAMMPS <https://www.lammps.org/viz.html>`_ * `Viz tools usable with LAMMPS <https://www.lammps.org/viz.html>`_
* `Benchmark performance <https://www.lammps.org/bench.html>`_ * `Benchmark performance <https://www.lammps.org/bench.html>`_

View File

@ -115,8 +115,8 @@ External contributions
If you prefer to do so, you can also develop and support your add-on If you prefer to do so, you can also develop and support your add-on
feature **without** having it included in the LAMMPS distribution, for feature **without** having it included in the LAMMPS distribution, for
example as a download from a website of your own. See the `Offsite example as a download from a website of your own. See the `External
LAMMPS packages and tools <https://www.lammps.org/offsite.html>`_ page LAMMPS packages and tools <https://www.lammps.org/external.html>`_ page
of the LAMMPS website for examples of groups that do this. We are happy of the LAMMPS website for examples of groups that do this. We are happy
to advertise your package and website from that page. Simply email the to advertise your package and website from that page. Simply email the
`developers <https://www.lammps.org/authors.html>`_ with info about your `developers <https://www.lammps.org/authors.html>`_ with info about your

View File

@ -305,19 +305,22 @@ you are uncertain, please ask.
FILE pointers and only be done on MPI rank 0. Use the :cpp:func:`utils::logmesg` FILE pointers and only be done on MPI rank 0. Use the :cpp:func:`utils::logmesg`
convenience function where possible. convenience function where possible.
- header files should only include the absolute minimum number of - Header files, especially those defining a "style", should only use
include files and **must not** contain any ``using`` statements; the absolute minimum number of include files and **must not** contain
rather the include statements should be put into the corresponding any ``using`` statements. Typically that would be only the header for
implementation files. For implementation files, the the base class. Instead any include statements should be put into the
"include-what-you-use" principle should be employed. However, when corresponding implementation files and forward declarations be used.
including the ``pointers.h`` header (or one of the base classes For implementation files, the "include what you use" principle should
derived from it) certain headers will be included and thus need to be be employed. However, there is the notable exception that when the
specified. These are: `mpi.h`, `cstddef`, `cstdio`, `cstdlib`, ``pointers.h`` header is included (or one of the base classes derived
`string`, `utils.h`, `fmt/format.h`, `climits`, `cinttypes`. This also from it) certain headers will always be included and thus do not need
means any header can assume that `FILE`, `NULL`, and `INT_MAX` are to be explicitly specified.
defined. These are: `mpi.h`, `cstddef`, `cstdio`, `cstdlib`, `string`, `utils.h`,
`vector`, `fmt/format.h`, `climits`, `cinttypes`.
This also means any such file can assume that `FILE`, `NULL`, and
`INT_MAX` are defined.
- header files that define a new LAMMPS style (i.e. that have a - Header files that define a new LAMMPS style (i.e. that have a
``SomeStyle(some/name,SomeName);`` macro in them) should only use the ``SomeStyle(some/name,SomeName);`` macro in them) should only use the
include file for the base class and otherwise use forward declarations include file for the base class and otherwise use forward declarations
and pointers; when interfacing to a library use the PIMPL (pointer and pointers; when interfacing to a library use the PIMPL (pointer
@ -325,7 +328,7 @@ you are uncertain, please ask.
that contains all library specific data (and thus requires the library that contains all library specific data (and thus requires the library
header) but use a forward declaration and define the struct only in header) but use a forward declaration and define the struct only in
the implementation file. This is a **strict** requirement since this the implementation file. This is a **strict** requirement since this
is where type clashes between packages and hard to fine bugs have is where type clashes between packages and hard to find bugs have
regularly manifested in the past. regularly manifested in the past.
- Please use clang-format only to reformat files that you have - Please use clang-format only to reformat files that you have

View File

@ -7,7 +7,7 @@ steps are often necessary to setup and analyze a simulation. A list
of such tools can be found on the `LAMMPS webpage <lws_>`_ at these links: of such tools can be found on the `LAMMPS webpage <lws_>`_ at these links:
* `Pre/Post processing <https://www.lammps.org/prepost.html>`_ * `Pre/Post processing <https://www.lammps.org/prepost.html>`_
* `Offsite LAMMPS packages & tools <https://www.lammps.org/offsite.html>`_ * `External LAMMPS packages & tools <https://www.lammps.org/external.html>`_
* `Pizza.py toolkit <pizza_>`_ * `Pizza.py toolkit <pizza_>`_
The last link for `Pizza.py <pizza_>`_ is a Python-based tool developed at The last link for `Pizza.py <pizza_>`_ is a Python-based tool developed at

View File

@ -8,9 +8,8 @@ fix brownian command
fix brownian/sphere command fix brownian/sphere command
=========================== ===========================
fix brownian/sphere command fix brownian/asphere command
=========================== ============================
Syntax Syntax
"""""" """"""

View File

@ -27,7 +27,7 @@ Syntax
on = set Newton pairwise flag on (currently not allowed) on = set Newton pairwise flag on (currently not allowed)
*pair/only* = *off* or *on* *pair/only* = *off* or *on*
off = apply "gpu" suffix to all available styles in the GPU package (default) off = apply "gpu" suffix to all available styles in the GPU package (default)
on - apply "gpu" suffix only pair styles on = apply "gpu" suffix only pair styles
*binsize* value = size *binsize* value = size
size = bin size for neighbor list construction (distance units) size = bin size for neighbor list construction (distance units)
*split* = fraction *split* = fraction

View File

@ -198,8 +198,8 @@ same:
Coefficients must be defined for each pair of atoms types via the Coefficients must be defined for each pair of atoms types via the
:doc:`pair_coeff <pair_coeff>` command as described above, or in the :doc:`pair_coeff <pair_coeff>` command as described above, or in the
data file read by the :doc:`read_data <read_data>` commands, or by "Pair Coeffs" or "PairIJ Coeffs" section of the data file read by the
mixing as described below. :doc:`read_data <read_data>` command, or by mixing as described below.
For all of the *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles, For all of the *hybrid*, *hybrid/overlay*, and *hybrid/scaled* styles,
every atom type pair I,J (where I <= J) must be assigned to at least one every atom type pair I,J (where I <= J) must be assigned to at least one
@ -208,14 +208,21 @@ examples above, or in the data file read by the :doc:`read_data
<read_data>`, or by mixing as described below. Also all sub-styles <read_data>`, or by mixing as described below. Also all sub-styles
must be used at least once in a :doc:`pair_coeff <pair_coeff>` command. must be used at least once in a :doc:`pair_coeff <pair_coeff>` command.
.. note::
LAMMPS never performs mixing of parameters from different sub-styles,
**even** if they use the same type of coefficients, e.g. contain
a Lennard-Jones potential variant. Those parameters must be provided
explicitly.
If you want there to be no interactions between a particular pair of If you want there to be no interactions between a particular pair of
atom types, you have 3 choices. You can assign the type pair to some atom types, you have 3 choices. You can assign the pair of atom types
sub-style and use the :doc:`neigh_modify exclude type <neigh_modify>` to some sub-style and use the :doc:`neigh_modify exclude type <neigh_modify>`
command. You can assign it to some sub-style and set the coefficients command. You can assign it to some sub-style and set the coefficients
so that there is effectively no interaction (e.g. epsilon = 0.0 in a LJ so that there is effectively no interaction (e.g. epsilon = 0.0 in a LJ
potential). Or, for *hybrid*, *hybrid/overlay*, or *hybrid/scaled* potential). Or, for *hybrid*, *hybrid/overlay*, or *hybrid/scaled*
simulations, you can use this form of the pair_coeff command in your simulations, you can use this form of the pair_coeff command in your
input script: input script or the "PairIJ Coeffs" section of your data file:
.. code-block:: LAMMPS .. code-block:: LAMMPS
@ -238,19 +245,20 @@ styles with different requirements.
---------- ----------
Different force fields (e.g. CHARMM vs AMBER) may have different rules Different force fields (e.g. CHARMM vs. AMBER) may have different rules
for applying weightings that change the strength of pairwise for applying exclusions or weights that change the strength of pairwise
interactions between pairs of atoms that are also 1-2, 1-3, and 1-4 non-bonded interactions between pairs of atoms that are also 1-2, 1-3,
neighbors in the molecular bond topology, as normally set by the and 1-4 neighbors in the molecular bond topology. This is normally a
:doc:`special_bonds <special_bonds>` command. Different weights can be global setting defined the :doc:`special_bonds <special_bonds>` command.
assigned to different pair hybrid sub-styles via the :doc:`pair_modify However, different weights can be assigned to different hybrid
special <pair_modify>` command. This allows multiple force fields to be sub-styles via the :doc:`pair_modify special <pair_modify>` command.
used in a model of a hybrid system, however, there is no consistent This allows multiple force fields to be used in a model of a hybrid
approach to determine parameters automatically for the interactions system, however, there is no consistent approach to determine parameters
between the two force fields, this is only recommended when particles automatically for the interactions **between** atoms of the two force
fields, thus this approach this is only recommended when particles
described by the different force fields do not mix. described by the different force fields do not mix.
Here is an example for mixing CHARMM and AMBER: The global *amber* Here is an example for combining CHARMM and AMBER: The global *amber*
setting sets the 1-4 interactions to non-zero scaling factors and setting sets the 1-4 interactions to non-zero scaling factors and
then overrides them with 0.0 only for CHARMM: then overrides them with 0.0 only for CHARMM:
@ -260,7 +268,7 @@ then overrides them with 0.0 only for CHARMM:
pair_style hybrid lj/charmm/coul/long 8.0 10.0 lj/cut/coul/long 10.0 pair_style hybrid lj/charmm/coul/long 8.0 10.0 lj/cut/coul/long 10.0
pair_modify pair lj/charmm/coul/long special lj/coul 0.0 0.0 0.0 pair_modify pair lj/charmm/coul/long special lj/coul 0.0 0.0 0.0
The this input achieves the same effect: This input achieves the same effect:
.. code-block:: LAMMPS .. code-block:: LAMMPS
@ -270,9 +278,9 @@ The this input achieves the same effect:
pair_modify pair lj/cut/coul/long special coul 0.0 0.0 0.83333333 pair_modify pair lj/cut/coul/long special coul 0.0 0.0 0.83333333
pair_modify pair lj/charmm/coul/long special lj/coul 0.0 0.0 0.0 pair_modify pair lj/charmm/coul/long special lj/coul 0.0 0.0 0.0
Here is an example for mixing Tersoff with OPLS/AA based on Here is an example for combining Tersoff with OPLS/AA based on
a data file that defines bonds for all atoms where for the a data file that defines bonds for all atoms where - for the
Tersoff part of the system the force constants for the bonded Tersoff part of the system - the force constants for the bonded
interactions have been set to 0. Note the global settings are interactions have been set to 0. Note the global settings are
effectively *lj/coul 0.0 0.0 0.5* as required for OPLS/AA: effectively *lj/coul 0.0 0.0 0.5* as required for OPLS/AA:

View File

@ -619,7 +619,7 @@ of analysis.
* - bond * - bond
- atom-ID molecule-ID atom-type x y z - atom-ID molecule-ID atom-type x y z
* - charge * - charge
- atom-type q x y z - atom-ID atom-type q x y z
* - dipole * - dipole
- atom-ID atom-type q x y z mux muy muz - atom-ID atom-type q x y z mux muy muz
* - dpd * - dpd

View File

@ -418,6 +418,7 @@ html_context['current_version'] = os.environ.get('LAMMPS_WEBSITE_BUILD_VERSION',
html_context['git_commit'] = git_commit html_context['git_commit'] = git_commit
html_context['versions'] = [ html_context['versions'] = [
('latest', 'https://docs.lammps.org/latest/'), ('latest', 'https://docs.lammps.org/latest/'),
('stable', 'https://docs.lammps.org/stable/'),
(version, 'https://docs.lammps.org/') (version, 'https://docs.lammps.org/')
] ]
html_context['downloads'] = [('PDF', 'Manual.pdf')] html_context['downloads'] = [('PDF', 'Manual.pdf')]

View File

@ -2441,6 +2441,7 @@ packings
padua padua
Padua Padua
pafi pafi
PairIJ
palegoldenrod palegoldenrod
palegreen palegreen
paleturquoise paleturquoise

View File

@ -1,3 +1,9 @@
IMPORTANT NOTE: This example has not been updated since 2014,
so it is not likely to work anymore out of the box. There have
been changes to LAMMPS and its library interface that would need
to be applied. Please see the manual for the documentation of
the library interface.
This directory has an application that runs classical MD via LAMMPS, This directory has an application that runs classical MD via LAMMPS,
but uses quantum forces calculated by the Quest DFT (density but uses quantum forces calculated by the Quest DFT (density
functional) code in place of the usual classical MD forces calculated functional) code in place of the usual classical MD forces calculated

View File

@ -1,3 +1,9 @@
IMPORTANT NOTE: This example has not been updated since 2013,
so it is not likely to work anymore out of the box. There have
been changes to LAMMPS and its library interface that would need
to be applied. Please see the manual for the documentation of
the library interface.
This directory has an application that models grain growth in the This directory has an application that models grain growth in the
presence of strain. presence of strain.

View File

@ -28,13 +28,9 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "lammps.h" // these are LAMMPS include files #define LAMMPS_LIB_MPI // to make lammps_open() visible
#include "input.h"
#include "atom.h"
#include "library.h" #include "library.h"
using namespace LAMMPS_NS;
int main(int narg, char **arg) int main(int narg, char **arg)
{ {
// setup MPI and various communicators // setup MPI and various communicators
@ -74,7 +70,7 @@ int main(int narg, char **arg)
char str1[32],str2[32],str3[32]; char str1[32],str2[32],str3[32];
char **lmparg = new char*[8]; char **lmparg = new char*[8];
lmparg[0] = NULL; // required placeholder for program name lmparg[0] = (char *) "LAMMPS"; // required placeholder for program name
lmparg[1] = (char *) "-screen"; lmparg[1] = (char *) "-screen";
sprintf(str1,"screen.%d",instance); sprintf(str1,"screen.%d",instance);
lmparg[2] = str1; lmparg[2] = str1;
@ -86,13 +82,9 @@ int main(int narg, char **arg)
sprintf(str3,"%g",temperature + instance*tdelta); sprintf(str3,"%g",temperature + instance*tdelta);
lmparg[7] = str3; lmparg[7] = str3;
// open N instances of LAMMPS // create N instances of LAMMPS
// either of these methods will work
LAMMPS *lmp = new LAMMPS(8,lmparg,comm_lammps); void *lmp = lammps_open(8,lmparg,comm_lammps,NULL);
//LAMMPS *lmp;
//lammps_open(8,lmparg,comm_lammps,(void **) &lmp);
delete [] lmparg; delete [] lmparg;
@ -103,7 +95,7 @@ int main(int narg, char **arg)
// query final temperature and print result for each instance // query final temperature and print result for each instance
double *ptr = (double *) double *ptr = (double *)
lammps_extract_compute(lmp,(char *) "thermo_temp",0,0); lammps_extract_compute(lmp,"thermo_temp",LMP_STYLE_GLOBAL,LMP_TYPE_SCALAR);
double finaltemp = *ptr; double finaltemp = *ptr;
double *temps = new double[ninstance]; double *temps = new double[ninstance];
@ -125,7 +117,7 @@ int main(int narg, char **arg)
// delete LAMMPS instances // delete LAMMPS instances
delete lmp; lammps_close(lmp);
// close down MPI // close down MPI

View File

@ -13,7 +13,7 @@ like below.
mpicc -c -O -Wall -g -I$HOME/lammps/src liblammpsplugin.c mpicc -c -O -Wall -g -I$HOME/lammps/src liblammpsplugin.c
mpicc -c -O -Wall -g simple.c mpicc -c -O -Wall -g simple.c
mpicc simple.o liblammsplugin.o -ldl -o simpleC mpicc simple.o liblammpsplugin.o -ldl -o simpleC
You also need to build LAMMPS as a shared library You also need to build LAMMPS as a shared library
(see examples/COUPLE/README), e.g. (see examples/COUPLE/README), e.g.

View File

@ -38,44 +38,98 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
#define ADDSYM(symbol) lmp->symbol = dlsym(handle,"lammps_" #symbol) #define ADDSYM(symbol) lmp->symbol = dlsym(handle,"lammps_" #symbol)
ADDSYM(open); ADDSYM(open);
ADDSYM(open_no_mpi); ADDSYM(open_no_mpi);
ADDSYM(open_fortran);
ADDSYM(close); ADDSYM(close);
ADDSYM(version);
ADDSYM(mpi_init);
ADDSYM(mpi_finalize);
ADDSYM(kokkos_finalize);
ADDSYM(python_finalize);
ADDSYM(file); ADDSYM(file);
ADDSYM(command); ADDSYM(command);
ADDSYM(commands_list); ADDSYM(commands_list);
ADDSYM(commands_string); ADDSYM(commands_string);
ADDSYM(free);
ADDSYM(extract_setting); ADDSYM(get_natoms);
ADDSYM(extract_global); ADDSYM(get_thermo);
ADDSYM(extract_box); ADDSYM(extract_box);
ADDSYM(reset_box);
ADDSYM(memory_usage);
ADDSYM(get_mpi_comm);
ADDSYM(extract_setting);
ADDSYM(extract_global_datatype);
ADDSYM(extract_global);
ADDSYM(extract_atom_datatype);
ADDSYM(extract_atom); ADDSYM(extract_atom);
ADDSYM(extract_compute); ADDSYM(extract_compute);
ADDSYM(extract_fix); ADDSYM(extract_fix);
ADDSYM(extract_variable); ADDSYM(extract_variable);
ADDSYM(get_thermo);
ADDSYM(get_natoms);
ADDSYM(set_variable); ADDSYM(set_variable);
ADDSYM(reset_box);
ADDSYM(gather_atoms); ADDSYM(gather_atoms);
ADDSYM(gather_atoms_concat); ADDSYM(gather_atoms_concat);
ADDSYM(gather_atoms_subset); ADDSYM(gather_atoms_subset);
ADDSYM(scatter_atoms); ADDSYM(scatter_atoms);
ADDSYM(scatter_atoms_subset); ADDSYM(scatter_atoms_subset);
ADDSYM(gather_bonds);
ADDSYM(set_fix_external_callback); ADDSYM(create_atoms);
ADDSYM(config_has_package); ADDSYM(find_pair_neighlist);
ADDSYM(config_package_count); ADDSYM(find_fix_neighlist);
ADDSYM(config_package_name); ADDSYM(find_compute_neighlist);
ADDSYM(neighlist_num_elements);
ADDSYM(neighlist_element_neighbors);
ADDSYM(version);
ADDSYM(get_os_info);
ADDSYM(config_has_mpi_support);
ADDSYM(config_has_gzip_support); ADDSYM(config_has_gzip_support);
ADDSYM(config_has_png_support); ADDSYM(config_has_png_support);
ADDSYM(config_has_jpeg_support); ADDSYM(config_has_jpeg_support);
ADDSYM(config_has_ffmpeg_support); ADDSYM(config_has_ffmpeg_support);
ADDSYM(config_has_exceptions); ADDSYM(config_has_exceptions);
ADDSYM(create_atoms);
ADDSYM(config_has_package);
ADDSYM(config_package_count);
ADDSYM(config_package_name);
ADDSYM(config_accelerator);
ADDSYM(has_gpu_device);
ADDSYM(get_gpu_device_info);
ADDSYM(has_style);
ADDSYM(style_count);
ADDSYM(style_name);
ADDSYM(has_id);
ADDSYM(id_count);
ADDSYM(id_name);
ADDSYM(plugin_count);
ADDSYM(plugin_name);
ADDSYM(set_fix_external_callback);
ADDSYM(fix_external_get_force);
ADDSYM(fix_external_set_energy_global);
ADDSYM(fix_external_set_energy_peratom);
ADDSYM(fix_external_set_virial_global);
ADDSYM(fix_external_set_virial_peratom);
ADDSYM(fix_external_set_vector_length);
ADDSYM(fix_external_set_vector);
ADDSYM(free);
ADDSYM(is_running);
ADDSYM(force_timeout);
#ifdef LAMMPS_EXCEPTIONS #ifdef LAMMPS_EXCEPTIONS
lmp->has_exceptions = 1; lmp->has_exceptions = 1;
ADDSYM(has_error); ADDSYM(has_error);

View File

@ -39,75 +39,121 @@ extern "C" {
#if defined(LAMMPS_BIGBIG) #if defined(LAMMPS_BIGBIG)
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **);
#elif defined(LAMMPS_SMALLBIG) #elif defined(LAMMPS_SMALLSMALL)
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **);
#else
typedef void (*FixExternalFnPtr)(void *, int, int, int *, double **, double **); typedef void (*FixExternalFnPtr)(void *, int, int, int *, double **, double **);
#else
typedef void (*FixExternalFnPtr)(void *, int64_t, int, int *, double **, double **);
#endif #endif
struct _liblammpsplugin { struct _liblammpsplugin {
int abiversion; int abiversion;
int has_exceptions; int has_exceptions;
void *handle; void *handle;
void (*open)(int, char **, MPI_Comm, void **); void *(*open)(int, char **, MPI_Comm, void **);
void (*open_no_mpi)(int, char **, void **); void *(*open_no_mpi)(int, char **, void **);
void *(*open_fortran)(int, char **, void **, int);
void (*close)(void *); void (*close)(void *);
int (*version)(void *);
void (*mpi_init)();
void (*mpi_finalize)();
void (*kokkos_finalize)();
void (*python_finalize)();
void (*file)(void *, char *); void (*file)(void *, char *);
char *(*command)(void *, char *); char *(*command)(void *, const char *);
void (*commands_list)(void *, int, char **); void (*commands_list)(void *, int, const char **);
void (*commands_string)(void *, char *); void (*commands_string)(void *, const char *);
void (*free)(void *);
int (*extract_setting)(void *, char *); double (*get_natoms)(void *);
void *(*extract_global)(void *, char *); double (*get_thermo)(void *, char *);
void (*extract_box)(void *, double *, double *, void (*extract_box)(void *, double *, double *,
double *, double *, double *, int *, int *); double *, double *, double *, int *, int *);
void *(*extract_atom)(void *, char *);
void *(*extract_compute)(void *, char *, int, int);
void *(*extract_fix)(void *, char *, int, int, int, int);
void *(*extract_variable)(void *, char *, char *);
double (*get_thermo)(void *, char *);
int (*get_natoms)(void *);
int (*set_variable)(void *, char *, char *);
void (*reset_box)(void *, double *, double *, double, double, double); void (*reset_box)(void *, double *, double *, double, double, double);
void (*memory_usage)(void *, double *);
int (*get_mpi_comm)(void *);
int (*extract_setting)(void *, const char *);
int *(*extract_global_datatype)(void *, const char *);
void *(*extract_global)(void *, const char *);
void *(*extract_atom_datatype)(void *, const char *);
void *(*extract_atom)(void *, const char *);
void *(*extract_compute)(void *, const char *, int, int);
void *(*extract_fix)(void *, const char *, int, int, int, int);
void *(*extract_variable)(void *, const char *, char *);
int (*set_variable)(void *, char *, char *);
void (*gather_atoms)(void *, char *, int, int, void *); void (*gather_atoms)(void *, char *, int, int, void *);
void (*gather_atoms_concat)(void *, char *, int, int, void *); void (*gather_atoms_concat)(void *, char *, int, int, void *);
void (*gather_atoms_subset)(void *, char *, int, int, int, int *, void *); void (*gather_atoms_subset)(void *, char *, int, int, int, int *, void *);
void (*scatter_atoms)(void *, char *, int, int, void *); void (*scatter_atoms)(void *, char *, int, int, void *);
void (*scatter_atoms_subset)(void *, char *, int, int, int, int *, void *); void (*scatter_atoms_subset)(void *, char *, int, int, int, int *, void *);
void (*set_fix_external_callback)(void *, char *, FixExternalFnPtr, void*); void (*gather_bonds)(void *, void *);
int (*config_has_package)(char * package_name); // lammps_create_atoms() takes tagint and imageint as args
int (*config_package_count)(); // ifdef insures they are compatible with rest of LAMMPS
int (*config_package_name)(int index, char * buffer, int max_size); // caller must match to how LAMMPS library is built
#ifndef LAMMPS_BIGBIG
void (*create_atoms)(void *, int, int *, int *, double *,
double *, int *, int);
#else
void (*create_atoms)(void *, int, int64_t *, int *, double *,
double *, int64_t *, int);
#endif
int (*find_pair_neighlist)(void *, const char *, int, int, int);
int (*find_fix_neighlist)(void *, const char *, int);
int (*find_compute_neighlist)(void *, char *, int);
int (*neighlist_num_elements)(void *, int);
void (*neighlist_element_neighbors)(void *, int, int, int *, int *, int **);
int (*version)(void *);
void (*get_os_info)(char *, int);
int (*config_has_mpi_support)();
int (*config_has_gzip_support)(); int (*config_has_gzip_support)();
int (*config_has_png_support)(); int (*config_has_png_support)();
int (*config_has_jpeg_support)(); int (*config_has_jpeg_support)();
int (*config_has_ffmpeg_support)(); int (*config_has_ffmpeg_support)();
int (*config_has_exceptions)(); int (*config_has_exceptions)();
int (*find_pair_neighlist)(void* ptr, char * style, int exact, int nsub, int request); int (*config_has_package)(const char *);
int (*find_fix_neighlist)(void* ptr, char * id, int request); int (*config_package_count)();
int (*find_compute_neighlist)(void* ptr, char * id, int request); int (*config_package_name)(int, char *, int);
int (*neighlist_num_elements)(void* ptr, int idx);
void (*neighlist_element_neighbors)(void * ptr, int idx, int element, int * iatom, int * numneigh, int ** neighbors);
// lammps_create_atoms() takes tagint and imageint as args int (*config_accelerator)(const char *, const char *, const char *);
// ifdef insures they are compatible with rest of LAMMPS int (*has_gpu_device)();
// caller must match to how LAMMPS library is built void (*get_gpu_device_info)(char *, int);
#ifdef LAMMPS_BIGBIG int (*has_style)(void *, const char *, const char *);
void (*create_atoms)(void *, int, int64_t *, int *, int (*style_count)(void *, const char *);
double *, double *, int64_t *, int); int (*style_name)(void *, const char *, int, char *, int);
#else
void (*create_atoms)(void *, int, int *, int *, int (*has_id)(void *, const char *, const char *);
double *, double *, int *, int); int (*id_count)(void *, const char *);
#endif int (*id_name)(void *, const char *, int, char *, int);
int (*plugin_count)();
int (*plugin_name)(int, char *, char *, int);
void (*set_fix_external_callback)(void *, const char *, FixExternalFnPtr, void*);
void (*fix_external_get_force)(void *, const char *);
void (*fix_external_set_energy_global)(void *, const char *, double);
void (*fix_external_set_energy_peratom)(void *, const char *, double *);
void (*fix_external_set_virial_global)(void *, const char *, double *);
void (*fix_external_set_virial_peratom)(void *, const char *, double **);
void (*fix_external_set_vector_length)(void *, const char *, int);
void (*fix_external_set_vector)(void *, const char *, int, double);
void (*free)(void *);
void (*is_running)(void *);
void (*force_timeout)(void *);
int (*has_error)(void *); int (*has_error)(void *);
int (*get_last_error_message)(void *, char *, int); int (*get_last_error_message)(void *, char *, int);

View File

@ -1,9 +1,12 @@
LAMMPS (18 Feb 2020) LAMMPS (31 Aug 2021)
Lattice spacing in x,y,z = 1.6796 1.6796 1.6796 OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
Created orthogonal box = (0 0 0) to (6.71838 6.71838 6.71838) using 1 OpenMP thread(s) per MPI task
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (6.7183848 6.7183848 6.7183848)
1 by 1 by 1 MPI processor grid 1 by 1 by 1 MPI processor grid
Created 256 atoms Created 256 atoms
create_atoms CPU = 0.000297844 secs using lattice units in orthogonal box = (0.0000000 0.0000000 0.0000000) to (6.7183848 6.7183848 6.7183848)
create_atoms CPU = 0.001 seconds
Neighbor list info ... Neighbor list info ...
update every 20 steps, delay 0 steps, check no update every 20 steps, delay 0 steps, check no
max neighbors/atom: 2000, page size: 100000 max neighbors/atom: 2000, page size: 100000
@ -14,108 +17,108 @@ Neighbor list info ...
(1) pair lj/cut, perpetual (1) pair lj/cut, perpetual
attributes: half, newton on attributes: half, newton on
pair build: half/bin/atomonly/newton pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton stencil: half/bin/3d
bin: standard bin: standard
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 0 Current step : 0
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
0 1.44 -6.7733681 0 -4.6218056 -5.0244179 0 1.44 -6.7733681 0 -4.6218056 -5.0244179
10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175 10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175
Loop time of 0.00164276 on 1 procs for 10 steps with 256 atoms Loop time of 0.00239712 on 1 procs for 10 steps with 256 atoms
Performance: 2629719.113 tau/day, 6087.313 timesteps/s Performance: 1802163.347 tau/day, 4171.674 timesteps/s
93.7% CPU use with 1 MPI tasks x no OpenMP threads 97.2% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0014956 | 0.0014956 | 0.0014956 | 0.0 | 91.04 Pair | 0.0020572 | 0.0020572 | 0.0020572 | 0.0 | 85.82
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 8.045e-05 | 8.045e-05 | 8.045e-05 | 0.0 | 4.90 Comm | 0.00018731 | 0.00018731 | 0.00018731 | 0.0 | 7.81
Output | 1.1399e-05 | 1.1399e-05 | 1.1399e-05 | 0.0 | 0.69 Output | 4.478e-05 | 4.478e-05 | 4.478e-05 | 0.0 | 1.87
Modify | 3.7431e-05 | 3.7431e-05 | 3.7431e-05 | 0.0 | 2.28 Modify | 6.3637e-05 | 6.3637e-05 | 6.3637e-05 | 0.0 | 2.65
Other | | 1.789e-05 | | | 1.09 Other | | 4.419e-05 | | | 1.84
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1431 ave 1431 max 1431 min Nghost: 1431.00 ave 1431 max 1431 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9984 ave 9984 max 9984 min Neighs: 9984.00 ave 9984 max 9984 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9984 Total # of neighbors = 9984
Ave neighs/atom = 39 Ave neighs/atom = 39.000000
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 10 Current step : 10
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175 10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175
20 0.6239063 -5.557644 0 -4.6254403 0.97451173 20 0.6239063 -5.557644 0 -4.6254403 0.97451173
Loop time of 0.00199768 on 1 procs for 10 steps with 256 atoms Loop time of 0.00329271 on 1 procs for 10 steps with 256 atoms
Performance: 2162504.180 tau/day, 5005.797 timesteps/s Performance: 1311987.619 tau/day, 3037.008 timesteps/s
99.8% CPU use with 1 MPI tasks x no OpenMP threads 96.4% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0018518 | 0.0018518 | 0.0018518 | 0.0 | 92.70 Pair | 0.0029015 | 0.0029015 | 0.0029015 | 0.0 | 88.12
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 7.9768e-05 | 7.9768e-05 | 7.9768e-05 | 0.0 | 3.99 Comm | 0.00021807 | 0.00021807 | 0.00021807 | 0.0 | 6.62
Output | 1.1433e-05 | 1.1433e-05 | 1.1433e-05 | 0.0 | 0.57 Output | 4.9163e-05 | 4.9163e-05 | 4.9163e-05 | 0.0 | 1.49
Modify | 3.6904e-05 | 3.6904e-05 | 3.6904e-05 | 0.0 | 1.85 Modify | 7.0573e-05 | 7.0573e-05 | 7.0573e-05 | 0.0 | 2.14
Other | | 1.773e-05 | | | 0.89 Other | | 5.339e-05 | | | 1.62
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1431 ave 1431 max 1431 min Nghost: 1431.00 ave 1431 max 1431 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9952 ave 9952 max 9952 min Neighs: 9952.00 ave 9952 max 9952 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9952 Total # of neighbors = 9952
Ave neighs/atom = 38.875 Ave neighs/atom = 38.875000
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 20 Current step : 20
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
20 0.6239063 -5.5404291 0 -4.6082254 1.0394285 20 0.6239063 -5.5404291 0 -4.6082254 1.0394285
21 0.63845863 -5.5628733 0 -4.6089263 0.99398278 21 0.63845863 -5.5628733 0 -4.6089263 0.99398278
Loop time of 0.000304321 on 1 procs for 1 steps with 256 atoms Loop time of 0.000638039 on 1 procs for 1 steps with 256 atoms
Performance: 1419553.695 tau/day, 3286.004 timesteps/s Performance: 677074.599 tau/day, 1567.302 timesteps/s
98.9% CPU use with 1 MPI tasks x no OpenMP threads 98.9% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00027815 | 0.00027815 | 0.00027815 | 0.0 | 91.40 Pair | 0.00042876 | 0.00042876 | 0.00042876 | 0.0 | 67.20
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 8.321e-06 | 8.321e-06 | 8.321e-06 | 0.0 | 2.73 Comm | 5.2872e-05 | 5.2872e-05 | 5.2872e-05 | 0.0 | 8.29
Output | 1.0513e-05 | 1.0513e-05 | 1.0513e-05 | 0.0 | 3.45 Output | 0.00012218 | 0.00012218 | 0.00012218 | 0.0 | 19.15
Modify | 3.968e-06 | 3.968e-06 | 3.968e-06 | 0.0 | 1.30 Modify | 1.3762e-05 | 1.3762e-05 | 1.3762e-05 | 0.0 | 2.16
Other | | 3.365e-06 | | | 1.11 Other | | 2.047e-05 | | | 3.21
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1431 ave 1431 max 1431 min Nghost: 1431.00 ave 1431 max 1431 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9705 ave 9705 max 9705 min Neighs: 9705.00 ave 9705 max 9705 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9705 Total # of neighbors = 9705
Ave neighs/atom = 37.9102 Ave neighs/atom = 37.910156
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Force on 1 atom via extract_atom: 26.9581 Force on 1 atom via extract_atom: 26.9581
@ -124,136 +127,136 @@ Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 21 Current step : 21
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
21 0.63845863 -5.5628733 0 -4.6089263 0.99398278 21 0.63845863 -5.5628733 0 -4.6089263 0.99398278
31 0.7494946 -5.7306417 0 -4.6107913 0.41043597 31 0.7494946 -5.7306417 0 -4.6107913 0.41043597
Loop time of 0.00196027 on 1 procs for 10 steps with 256 atoms Loop time of 0.00281277 on 1 procs for 10 steps with 256 atoms
Performance: 2203779.175 tau/day, 5101.341 timesteps/s Performance: 1535852.558 tau/day, 3555.214 timesteps/s
99.7% CPU use with 1 MPI tasks x no OpenMP threads 92.6% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0018146 | 0.0018146 | 0.0018146 | 0.0 | 92.57 Pair | 0.0024599 | 0.0024599 | 0.0024599 | 0.0 | 87.45
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 8.0268e-05 | 8.0268e-05 | 8.0268e-05 | 0.0 | 4.09 Comm | 0.00020234 | 0.00020234 | 0.00020234 | 0.0 | 7.19
Output | 1.0973e-05 | 1.0973e-05 | 1.0973e-05 | 0.0 | 0.56 Output | 3.6436e-05 | 3.6436e-05 | 3.6436e-05 | 0.0 | 1.30
Modify | 3.6913e-05 | 3.6913e-05 | 3.6913e-05 | 0.0 | 1.88 Modify | 6.7542e-05 | 6.7542e-05 | 6.7542e-05 | 0.0 | 2.40
Other | | 1.756e-05 | | | 0.90 Other | | 4.655e-05 | | | 1.65
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1431 ave 1431 max 1431 min Nghost: 1431.00 ave 1431 max 1431 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9688 ave 9688 max 9688 min Neighs: 9688.00 ave 9688 max 9688 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9688 Total # of neighbors = 9688
Ave neighs/atom = 37.8438 Ave neighs/atom = 37.843750
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 31 Current step : 31
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
31 0.7494946 -5.7306417 0 -4.6107913 0.41043597 31 0.7494946 -5.7306417 0 -4.6107913 0.41043597
51 0.71349216 -5.6772387 0 -4.6111811 0.52117681 51 0.71349216 -5.6772387 0 -4.6111811 0.52117681
Loop time of 0.00433063 on 1 procs for 20 steps with 256 atoms Loop time of 0.00560916 on 1 procs for 20 steps with 256 atoms
Performance: 1995088.941 tau/day, 4618.261 timesteps/s Performance: 1540338.414 tau/day, 3565.598 timesteps/s
99.3% CPU use with 1 MPI tasks x no OpenMP threads 99.2% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0035121 | 0.0035121 | 0.0035121 | 0.0 | 81.10 Pair | 0.0044403 | 0.0044403 | 0.0044403 | 0.0 | 79.16
Neigh | 0.00050258 | 0.00050258 | 0.00050258 | 0.0 | 11.61 Neigh | 0.00056186 | 0.00056186 | 0.00056186 | 0.0 | 10.02
Comm | 0.00019444 | 0.00019444 | 0.00019444 | 0.0 | 4.49 Comm | 0.00036797 | 0.00036797 | 0.00036797 | 0.0 | 6.56
Output | 1.2092e-05 | 1.2092e-05 | 1.2092e-05 | 0.0 | 0.28 Output | 3.676e-05 | 3.676e-05 | 3.676e-05 | 0.0 | 0.66
Modify | 7.2917e-05 | 7.2917e-05 | 7.2917e-05 | 0.0 | 1.68 Modify | 0.00011282 | 0.00011282 | 0.00011282 | 0.0 | 2.01
Other | | 3.647e-05 | | | 0.84 Other | | 8.943e-05 | | | 1.59
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1421 ave 1421 max 1421 min Nghost: 1421.00 ave 1421 max 1421 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9700 ave 9700 max 9700 min Neighs: 9700.00 ave 9700 max 9700 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9700 Total # of neighbors = 9700
Ave neighs/atom = 37.8906 Ave neighs/atom = 37.890625
Neighbor list builds = 1 Neighbor list builds = 1
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 51 Current step : 51
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
51 0.71349216 -5.6772387 0 -4.6111811 0.52117681 51 0.71349216 -5.6772387 0 -4.6111811 0.52117681
61 0.78045421 -5.7781094 0 -4.6120011 0.093808941 61 0.78045421 -5.7781094 0 -4.6120011 0.093808941
Loop time of 0.00196567 on 1 procs for 10 steps with 256 atoms Loop time of 0.00373815 on 1 procs for 10 steps with 256 atoms
Performance: 2197727.285 tau/day, 5087.332 timesteps/s Performance: 1155650.623 tau/day, 2675.117 timesteps/s
99.7% CPU use with 1 MPI tasks x no OpenMP threads 98.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0018222 | 0.0018222 | 0.0018222 | 0.0 | 92.70 Pair | 0.0030908 | 0.0030908 | 0.0030908 | 0.0 | 82.68
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 7.8285e-05 | 7.8285e-05 | 7.8285e-05 | 0.0 | 3.98 Comm | 0.00038189 | 0.00038189 | 0.00038189 | 0.0 | 10.22
Output | 1.0862e-05 | 1.0862e-05 | 1.0862e-05 | 0.0 | 0.55 Output | 4.1615e-05 | 4.1615e-05 | 4.1615e-05 | 0.0 | 1.11
Modify | 3.6719e-05 | 3.6719e-05 | 3.6719e-05 | 0.0 | 1.87 Modify | 0.00013851 | 0.00013851 | 0.00013851 | 0.0 | 3.71
Other | | 1.764e-05 | | | 0.90 Other | | 8.533e-05 | | | 2.28
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1421 ave 1421 max 1421 min Nghost: 1421.00 ave 1421 max 1421 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9700 ave 9700 max 9700 min Neighs: 9700.00 ave 9700 max 9700 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9700 Total # of neighbors = 9700
Ave neighs/atom = 37.8906 Ave neighs/atom = 37.890625
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 61 Current step : 61
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
61 0.78045421 -5.7781094 0 -4.6120011 0.093808941 61 0.78045421 -5.7781094 0 -4.6120011 0.093808941
81 0.77743907 -5.7735004 0 -4.6118971 0.090822641 81 0.77743907 -5.7735004 0 -4.6118971 0.090822641
Loop time of 0.00430528 on 1 procs for 20 steps with 256 atoms Loop time of 0.00612177 on 1 procs for 20 steps with 256 atoms
Performance: 2006838.581 tau/day, 4645.460 timesteps/s Performance: 1411356.519 tau/day, 3267.029 timesteps/s
99.8% CPU use with 1 MPI tasks x no OpenMP threads 98.6% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0034931 | 0.0034931 | 0.0034931 | 0.0 | 81.13 Pair | 0.0047211 | 0.0047211 | 0.0047211 | 0.0 | 77.12
Neigh | 0.00050437 | 0.00050437 | 0.00050437 | 0.0 | 11.72 Neigh | 0.00083088 | 0.00083088 | 0.00083088 | 0.0 | 13.57
Comm | 0.0001868 | 0.0001868 | 0.0001868 | 0.0 | 4.34 Comm | 0.00032716 | 0.00032716 | 0.00032716 | 0.0 | 5.34
Output | 1.1699e-05 | 1.1699e-05 | 1.1699e-05 | 0.0 | 0.27 Output | 3.9891e-05 | 3.9891e-05 | 3.9891e-05 | 0.0 | 0.65
Modify | 7.3308e-05 | 7.3308e-05 | 7.3308e-05 | 0.0 | 1.70 Modify | 0.00010926 | 0.00010926 | 0.00010926 | 0.0 | 1.78
Other | | 3.604e-05 | | | 0.84 Other | | 9.346e-05 | | | 1.53
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1405 ave 1405 max 1405 min Nghost: 1405.00 ave 1405 max 1405 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9701 ave 9701 max 9701 min Neighs: 9701.00 ave 9701 max 9701 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9701 Total # of neighbors = 9701
Ave neighs/atom = 37.8945 Ave neighs/atom = 37.894531
Neighbor list builds = 1 Neighbor list builds = 1
Dangerous builds not checked Dangerous builds not checked
Deleted 256 atoms, new total = 0 Deleted 256 atoms, new total = 0
@ -261,34 +264,34 @@ Setting up Verlet run ...
Unit style : lj Unit style : lj
Current step : 81 Current step : 81
Time step : 0.005 Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 2.63 | 2.63 | 2.63 Mbytes Per MPI rank memory allocation (min/avg/max) = 2.630 | 2.630 | 2.630 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
81 0.6239063 -5.5404291 0 -4.6082254 1.0394285 81 0.6239063 -5.5404291 0 -4.6082254 1.0394285
91 0.75393007 -5.7375259 0 -4.6110484 0.39357367 91 0.75393007 -5.7375259 0 -4.6110484 0.39357367
Loop time of 0.00195843 on 1 procs for 10 steps with 256 atoms Loop time of 0.00319065 on 1 procs for 10 steps with 256 atoms
Performance: 2205851.941 tau/day, 5106.139 timesteps/s Performance: 1353954.393 tau/day, 3134.154 timesteps/s
99.7% CPU use with 1 MPI tasks x no OpenMP threads 99.2% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0018143 | 0.0018143 | 0.0018143 | 0.0 | 92.64 Pair | 0.0027828 | 0.0027828 | 0.0027828 | 0.0 | 87.22
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 7.8608e-05 | 7.8608e-05 | 7.8608e-05 | 0.0 | 4.01 Comm | 0.00023286 | 0.00023286 | 0.00023286 | 0.0 | 7.30
Output | 1.0786e-05 | 1.0786e-05 | 1.0786e-05 | 0.0 | 0.55 Output | 4.0459e-05 | 4.0459e-05 | 4.0459e-05 | 0.0 | 1.27
Modify | 3.7106e-05 | 3.7106e-05 | 3.7106e-05 | 0.0 | 1.89 Modify | 7.3576e-05 | 7.3576e-05 | 7.3576e-05 | 0.0 | 2.31
Other | | 1.762e-05 | | | 0.90 Other | | 6.094e-05 | | | 1.91
Nlocal: 256 ave 256 max 256 min Nlocal: 256.000 ave 256 max 256 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 1431 ave 1431 max 1431 min Nghost: 1431.00 ave 1431 max 1431 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 9705 ave 9705 max 9705 min Neighs: 9705.00 ave 9705 max 9705 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9705 Total # of neighbors = 9705
Ave neighs/atom = 37.9102 Ave neighs/atom = 37.910156
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Total wall time: 0:00:00 Total wall time: 0:00:00

View File

@ -1,9 +1,12 @@
LAMMPS (18 Feb 2020) LAMMPS (31 Aug 2021)
Lattice spacing in x,y,z = 1.6796 1.6796 1.6796 OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
Created orthogonal box = (0 0 0) to (6.71838 6.71838 6.71838) using 1 OpenMP thread(s) per MPI task
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (6.7183848 6.7183848 6.7183848)
1 by 1 by 2 MPI processor grid 1 by 1 by 2 MPI processor grid
Created 256 atoms Created 256 atoms
create_atoms CPU = 0.000265157 secs using lattice units in orthogonal box = (0.0000000 0.0000000 0.0000000) to (6.7183848 6.7183848 6.7183848)
create_atoms CPU = 0.003 seconds
Neighbor list info ... Neighbor list info ...
update every 20 steps, delay 0 steps, check no update every 20 steps, delay 0 steps, check no
max neighbors/atom: 2000, page size: 100000 max neighbors/atom: 2000, page size: 100000
@ -14,7 +17,7 @@ Neighbor list info ...
(1) pair lj/cut, perpetual (1) pair lj/cut, perpetual
attributes: half, newton on attributes: half, newton on
pair build: half/bin/atomonly/newton pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton stencil: half/bin/3d
bin: standard bin: standard
Setting up Verlet run ... Setting up Verlet run ...
Unit style : lj Unit style : lj
@ -24,30 +27,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
0 1.44 -6.7733681 0 -4.6218056 -5.0244179 0 1.44 -6.7733681 0 -4.6218056 -5.0244179
10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175 10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175
Loop time of 0.00115264 on 2 procs for 10 steps with 256 atoms Loop time of 0.00330899 on 2 procs for 10 steps with 256 atoms
Performance: 3747912.946 tau/day, 8675.724 timesteps/s Performance: 1305535.501 tau/day, 3022.073 timesteps/s
94.5% CPU use with 2 MPI tasks x no OpenMP threads 75.7% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00074885 | 0.00075021 | 0.00075156 | 0.0 | 65.09 Pair | 0.0013522 | 0.0013813 | 0.0014104 | 0.1 | 41.74
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00031829 | 0.00031943 | 0.00032056 | 0.0 | 27.71 Comm | 0.00049139 | 0.00054241 | 0.00059342 | 0.0 | 16.39
Output | 9.306e-06 | 2.6673e-05 | 4.4041e-05 | 0.0 | 2.31 Output | 3.6986e-05 | 0.00056588 | 0.0010948 | 0.0 | 17.10
Modify | 2.0684e-05 | 2.0891e-05 | 2.1098e-05 | 0.0 | 1.81 Modify | 4.3909e-05 | 4.3924e-05 | 4.3939e-05 | 0.0 | 1.33
Other | | 3.544e-05 | | | 3.07 Other | | 0.0007755 | | | 23.44
Nlocal: 128 ave 128 max 128 min Nlocal: 128.000 ave 128 max 128 min
Histogram: 2 0 0 0 0 0 0 0 0 0 Histogram: 2 0 0 0 0 0 0 0 0 0
Nghost: 1109 ave 1109 max 1109 min Nghost: 1109.00 ave 1109 max 1109 min
Histogram: 2 0 0 0 0 0 0 0 0 0 Histogram: 2 0 0 0 0 0 0 0 0 0
Neighs: 4992 ave 4992 max 4992 min Neighs: 4992.00 ave 4992 max 4992 min
Histogram: 2 0 0 0 0 0 0 0 0 0 Histogram: 2 0 0 0 0 0 0 0 0 0
Total # of neighbors = 9984 Total # of neighbors = 9984
Ave neighs/atom = 39 Ave neighs/atom = 39.000000
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
@ -58,30 +61,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175 10 1.1298532 -6.3095502 0 -4.6213906 -2.6058175
20 0.6239063 -5.557644 0 -4.6254403 0.97451173 20 0.6239063 -5.557644 0 -4.6254403 0.97451173
Loop time of 0.00120443 on 2 procs for 10 steps with 256 atoms Loop time of 0.00648485 on 2 procs for 10 steps with 256 atoms
Performance: 3586761.860 tau/day, 8302.689 timesteps/s Performance: 666168.017 tau/day, 1542.056 timesteps/s
95.5% CPU use with 2 MPI tasks x no OpenMP threads 44.3% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00087798 | 0.00091359 | 0.0009492 | 0.0 | 75.85 Pair | 0.0022373 | 0.0024405 | 0.0026437 | 0.4 | 37.63
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00016739 | 0.00020368 | 0.00023997 | 0.0 | 16.91 Comm | 0.0024446 | 0.0026464 | 0.0028481 | 0.4 | 40.81
Output | 1.0124e-05 | 3.0513e-05 | 5.0901e-05 | 0.0 | 2.53 Output | 3.9069e-05 | 0.00059734 | 0.0011556 | 0.0 | 9.21
Modify | 1.89e-05 | 1.9812e-05 | 2.0725e-05 | 0.0 | 1.64 Modify | 4.869e-05 | 4.912e-05 | 4.9551e-05 | 0.0 | 0.76
Other | | 3.683e-05 | | | 3.06 Other | | 0.0007515 | | | 11.59
Nlocal: 128 ave 134 max 122 min Nlocal: 128.000 ave 134 max 122 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1109 ave 1115 max 1103 min Nghost: 1109.00 ave 1115 max 1103 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4976 ave 5205 max 4747 min Neighs: 4976.00 ave 5205 max 4747 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9952 Total # of neighbors = 9952
Ave neighs/atom = 38.875 Ave neighs/atom = 38.875000
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
@ -92,34 +95,34 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
20 0.6239063 -5.5404291 0 -4.6082254 1.0394285 20 0.6239063 -5.5404291 0 -4.6082254 1.0394285
21 0.63845863 -5.5628733 0 -4.6089263 0.99398278 21 0.63845863 -5.5628733 0 -4.6089263 0.99398278
Loop time of 0.000206062 on 2 procs for 1 steps with 256 atoms Loop time of 0.00128072 on 2 procs for 1 steps with 256 atoms
Performance: 2096456.406 tau/day, 4852.908 timesteps/s Performance: 337310.921 tau/day, 780.812 timesteps/s
94.1% CPU use with 2 MPI tasks x no OpenMP threads 60.2% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00012947 | 0.00013524 | 0.00014101 | 0.0 | 65.63 Pair | 0.00047351 | 0.00049064 | 0.00050777 | 0.0 | 38.31
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 1.858e-05 | 2.4113e-05 | 2.9647e-05 | 0.0 | 11.70 Comm | 7.6767e-05 | 9.3655e-05 | 0.00011054 | 0.0 | 7.31
Output | 8.699e-06 | 2.4204e-05 | 3.9708e-05 | 0.0 | 11.75 Output | 5.4217e-05 | 0.00026297 | 0.00047172 | 0.0 | 20.53
Modify | 2.34e-06 | 2.3705e-06 | 2.401e-06 | 0.0 | 1.15 Modify | 1.1554e-05 | 1.2026e-05 | 1.2498e-05 | 0.0 | 0.94
Other | | 2.013e-05 | | | 9.77 Other | | 0.0004214 | | | 32.91
Nlocal: 128 ave 135 max 121 min Nlocal: 128.000 ave 135 max 121 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1109 ave 1116 max 1102 min Nghost: 1109.00 ave 1116 max 1102 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4852.5 ave 5106 max 4599 min Neighs: 4852.50 ave 5106 max 4599 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9705 Total # of neighbors = 9705
Ave neighs/atom = 37.9102 Ave neighs/atom = 37.910156
Force on 1 atom via extract_atom: -18.109
Force on 1 atom via extract_variable: -18.109
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Force on 1 atom via extract_atom: -18.109
Force on 1 atom via extract_variable: -18.109
Force on 1 atom via extract_atom: 26.9581 Force on 1 atom via extract_atom: 26.9581
Force on 1 atom via extract_variable: 26.9581 Force on 1 atom via extract_variable: 26.9581
Setting up Verlet run ... Setting up Verlet run ...
@ -130,30 +133,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
21 0.63845863 -5.5628733 0 -4.6089263 0.99398278 21 0.63845863 -5.5628733 0 -4.6089263 0.99398278
31 0.7494946 -5.7306417 0 -4.6107913 0.41043597 31 0.7494946 -5.7306417 0 -4.6107913 0.41043597
Loop time of 0.00119048 on 2 procs for 10 steps with 256 atoms Loop time of 0.00784933 on 2 procs for 10 steps with 256 atoms
Performance: 3628802.105 tau/day, 8400.005 timesteps/s Performance: 550365.761 tau/day, 1273.995 timesteps/s
98.0% CPU use with 2 MPI tasks x no OpenMP threads 59.6% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00085276 | 0.00089699 | 0.00094123 | 0.0 | 75.35 Pair | 0.0019235 | 0.0033403 | 0.0047572 | 2.5 | 42.56
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00016896 | 0.00021444 | 0.00025992 | 0.0 | 18.01 Comm | 0.0016948 | 0.003118 | 0.0045411 | 2.5 | 39.72
Output | 9.413e-06 | 2.5939e-05 | 4.2465e-05 | 0.0 | 2.18 Output | 3.6445e-05 | 0.00064636 | 0.0012563 | 0.0 | 8.23
Modify | 1.8977e-05 | 2.0009e-05 | 2.1042e-05 | 0.0 | 1.68 Modify | 6.2842e-05 | 6.3209e-05 | 6.3577e-05 | 0.0 | 0.81
Other | | 3.31e-05 | | | 2.78 Other | | 0.0006814 | | | 8.68
Nlocal: 128 ave 135 max 121 min Nlocal: 128.000 ave 135 max 121 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1109 ave 1116 max 1102 min Nghost: 1109.00 ave 1116 max 1102 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4844 ave 5096 max 4592 min Neighs: 4844.00 ave 5096 max 4592 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9688 Total # of neighbors = 9688
Ave neighs/atom = 37.8438 Ave neighs/atom = 37.843750
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
@ -164,30 +167,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
31 0.7494946 -5.7306417 0 -4.6107913 0.41043597 31 0.7494946 -5.7306417 0 -4.6107913 0.41043597
51 0.71349216 -5.6772387 0 -4.6111811 0.52117681 51 0.71349216 -5.6772387 0 -4.6111811 0.52117681
Loop time of 0.00252603 on 2 procs for 20 steps with 256 atoms Loop time of 0.00696051 on 2 procs for 20 steps with 256 atoms
Performance: 3420382.192 tau/day, 7917.551 timesteps/s Performance: 1241287.730 tau/day, 2873.351 timesteps/s
99.2% CPU use with 2 MPI tasks x no OpenMP threads 79.2% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0016245 | 0.0017014 | 0.0017784 | 0.2 | 67.36 Pair | 0.0028267 | 0.0036088 | 0.004391 | 1.3 | 51.85
Neigh | 0.00025359 | 0.0002563 | 0.00025901 | 0.0 | 10.15 Neigh | 0.00040272 | 0.00040989 | 0.00041707 | 0.0 | 5.89
Comm | 0.00036863 | 0.00045124 | 0.00053385 | 0.0 | 17.86 Comm | 0.00081061 | 0.0015825 | 0.0023544 | 1.9 | 22.74
Output | 9.839e-06 | 2.8031e-05 | 4.6223e-05 | 0.0 | 1.11 Output | 3.6006e-05 | 0.00062106 | 0.0012061 | 0.0 | 8.92
Modify | 3.7027e-05 | 3.9545e-05 | 4.2063e-05 | 0.0 | 1.57 Modify | 6.8937e-05 | 7.1149e-05 | 7.336e-05 | 0.0 | 1.02
Other | | 4.948e-05 | | | 1.96 Other | | 0.0006671 | | | 9.58
Nlocal: 128 ave 132 max 124 min Nlocal: 128.000 ave 132 max 124 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1100 ave 1101 max 1099 min Nghost: 1100.00 ave 1101 max 1099 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4850 ave 4953 max 4747 min Neighs: 4850.00 ave 4953 max 4747 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9700 Total # of neighbors = 9700
Ave neighs/atom = 37.8906 Ave neighs/atom = 37.890625
Neighbor list builds = 1 Neighbor list builds = 1
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
@ -198,30 +201,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
51 0.71349216 -5.6772387 0 -4.6111811 0.52117681 51 0.71349216 -5.6772387 0 -4.6111811 0.52117681
61 0.78045421 -5.7781094 0 -4.6120011 0.093808941 61 0.78045421 -5.7781094 0 -4.6120011 0.093808941
Loop time of 0.00115444 on 2 procs for 10 steps with 256 atoms Loop time of 0.00155862 on 2 procs for 10 steps with 256 atoms
Performance: 3742065.976 tau/day, 8662.190 timesteps/s Performance: 2771678.197 tau/day, 6415.922 timesteps/s
96.5% CPU use with 2 MPI tasks x no OpenMP threads 95.0% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.00087346 | 0.00089311 | 0.00091275 | 0.0 | 77.36 Pair | 0.0012369 | 0.001266 | 0.001295 | 0.1 | 81.22
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00016192 | 0.0001823 | 0.00020269 | 0.0 | 15.79 Comm | 0.00019462 | 0.00022315 | 0.00025169 | 0.0 | 14.32
Output | 9.49e-06 | 2.6234e-05 | 4.2978e-05 | 0.0 | 2.27 Output | 2.0217e-05 | 2.1945e-05 | 2.3673e-05 | 0.0 | 1.41
Modify | 1.9095e-05 | 1.9843e-05 | 2.0591e-05 | 0.0 | 1.72 Modify | 2.562e-05 | 2.5759e-05 | 2.5898e-05 | 0.0 | 1.65
Other | | 3.296e-05 | | | 2.85 Other | | 2.181e-05 | | | 1.40
Nlocal: 128 ave 132 max 124 min Nlocal: 128.000 ave 132 max 124 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1100 ave 1101 max 1099 min Nghost: 1100.00 ave 1101 max 1099 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4850 ave 4953 max 4747 min Neighs: 4850.00 ave 4953 max 4747 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9700 Total # of neighbors = 9700
Ave neighs/atom = 37.8906 Ave neighs/atom = 37.890625
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Setting up Verlet run ... Setting up Verlet run ...
@ -232,30 +235,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
61 0.78045421 -5.7781094 0 -4.6120011 0.093808941 61 0.78045421 -5.7781094 0 -4.6120011 0.093808941
81 0.77743907 -5.7735004 0 -4.6118971 0.090822641 81 0.77743907 -5.7735004 0 -4.6118971 0.090822641
Loop time of 0.00244325 on 2 procs for 20 steps with 256 atoms Loop time of 0.00351607 on 2 procs for 20 steps with 256 atoms
Performance: 3536279.919 tau/day, 8185.833 timesteps/s Performance: 2457288.612 tau/day, 5688.168 timesteps/s
99.0% CPU use with 2 MPI tasks x no OpenMP threads 97.9% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0016916 | 0.0017038 | 0.001716 | 0.0 | 69.73 Pair | 0.0023896 | 0.0024147 | 0.0024397 | 0.1 | 68.67
Neigh | 0.00025229 | 0.00025512 | 0.00025795 | 0.0 | 10.44 Neigh | 0.00037331 | 0.00040456 | 0.0004358 | 0.0 | 11.51
Comm | 0.00035772 | 0.00036918 | 0.00038064 | 0.0 | 15.11 Comm | 0.00050571 | 0.00051343 | 0.00052116 | 0.0 | 14.60
Output | 1.0858e-05 | 2.7875e-05 | 4.4891e-05 | 0.0 | 1.14 Output | 2.6424e-05 | 5.6547e-05 | 8.667e-05 | 0.0 | 1.61
Modify | 3.817e-05 | 3.9325e-05 | 4.048e-05 | 0.0 | 1.61 Modify | 5.0287e-05 | 5.1071e-05 | 5.1856e-05 | 0.0 | 1.45
Other | | 4.796e-05 | | | 1.96 Other | | 7.58e-05 | | | 2.16
Nlocal: 128 ave 128 max 128 min Nlocal: 128.000 ave 128 max 128 min
Histogram: 2 0 0 0 0 0 0 0 0 0 Histogram: 2 0 0 0 0 0 0 0 0 0
Nghost: 1088.5 ave 1092 max 1085 min Nghost: 1088.50 ave 1092 max 1085 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4850.5 ave 4851 max 4850 min Neighs: 4850.50 ave 4851 max 4850 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9701 Total # of neighbors = 9701
Ave neighs/atom = 37.8945 Ave neighs/atom = 37.894531
Neighbor list builds = 1 Neighbor list builds = 1
Dangerous builds not checked Dangerous builds not checked
Deleted 256 atoms, new total = 0 Deleted 256 atoms, new total = 0
@ -267,30 +270,30 @@ Per MPI rank memory allocation (min/avg/max) = 2.624 | 2.624 | 2.624 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
81 0.6239063 -5.5404291 0 -4.6082254 1.0394285 81 0.6239063 -5.5404291 0 -4.6082254 1.0394285
91 0.75393007 -5.7375259 0 -4.6110484 0.39357367 91 0.75393007 -5.7375259 0 -4.6110484 0.39357367
Loop time of 0.00118092 on 2 procs for 10 steps with 256 atoms Loop time of 0.0109747 on 2 procs for 10 steps with 256 atoms
Performance: 3658158.625 tau/day, 8467.960 timesteps/s Performance: 393631.731 tau/day, 911.185 timesteps/s
98.6% CPU use with 2 MPI tasks x no OpenMP threads 53.5% CPU use with 2 MPI tasks x 1 OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.0008476 | 0.00089265 | 0.00093771 | 0.0 | 75.59 Pair | 0.0012057 | 0.0012732 | 0.0013407 | 0.2 | 11.60
Neigh | 0 | 0 | 0 | 0.0 | 0.00 Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.00016335 | 0.00020946 | 0.00025557 | 0.0 | 17.74 Comm | 0.00018882 | 0.00025686 | 0.00032489 | 0.0 | 2.34
Output | 8.87e-06 | 2.5733e-05 | 4.2595e-05 | 0.0 | 2.18 Output | 2.1943e-05 | 0.0047067 | 0.0093915 | 6.8 | 42.89
Modify | 1.8755e-05 | 1.9814e-05 | 2.0872e-05 | 0.0 | 1.68 Modify | 2.4614e-05 | 2.5439e-05 | 2.6264e-05 | 0.0 | 0.23
Other | | 3.326e-05 | | | 2.82 Other | | 0.004712 | | | 42.94
Nlocal: 128 ave 135 max 121 min Nlocal: 128.000 ave 135 max 121 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Nghost: 1109 ave 1116 max 1102 min Nghost: 1109.00 ave 1116 max 1102 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Neighs: 4852.5 ave 5106 max 4599 min Neighs: 4852.50 ave 5106 max 4599 min
Histogram: 1 0 0 0 0 0 0 0 0 1 Histogram: 1 0 0 0 0 0 0 0 0 1
Total # of neighbors = 9705 Total # of neighbors = 9705
Ave neighs/atom = 37.9102 Ave neighs/atom = 37.910156
Neighbor list builds = 0 Neighbor list builds = 0
Dangerous builds not checked Dangerous builds not checked
Total wall time: 0:00:00 Total wall time: 0:00:00

View File

@ -87,7 +87,7 @@ int main(int narg, char **arg)
MPI_Abort(MPI_COMM_WORLD,1); MPI_Abort(MPI_COMM_WORLD,1);
} }
} }
if (lammps == 1) plugin->open(0,NULL,comm_lammps,&lmp); if (lammps == 1) lmp = plugin->open(0,NULL,comm_lammps,NULL);
while (1) { while (1) {
if (me == 0) { if (me == 0) {
@ -139,7 +139,7 @@ int main(int narg, char **arg)
cmds[0] = (char *)"run 10"; cmds[0] = (char *)"run 10";
cmds[1] = (char *)"run 20"; cmds[1] = (char *)"run 20";
if (lammps == 1) plugin->commands_list(lmp,2,cmds); if (lammps == 1) plugin->commands_list(lmp,2,(const char **)cmds);
/* delete all atoms /* delete all atoms
create_atoms() to create new ones with old coords, vels create_atoms() to create new ones with old coords, vels
@ -164,12 +164,13 @@ int main(int narg, char **arg)
if (lammps == 1) { if (lammps == 1) {
plugin->close(lmp); plugin->close(lmp);
MPI_Barrier(comm_lammps);
MPI_Comm_free(&comm_lammps);
liblammpsplugin_release(plugin); liblammpsplugin_release(plugin);
} }
/* close down MPI */ /* close down MPI */
if (lammps == 1) MPI_Comm_free(&comm_lammps);
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize(); MPI_Finalize();
} }

View File

@ -462,7 +462,6 @@ int UCL_Device::set_platform(int pid) {
_num_devices = 0; _num_devices = 0;
for (int i=0; i<num_unpart; i++) { for (int i=0; i<num_unpart; i++) {
cl_uint num_subdevices = 1; cl_uint num_subdevices = 1;
cl_device_id *subdevice_list = device_list + i;
#ifdef CL_VERSION_1_2 #ifdef CL_VERSION_1_2
cl_device_affinity_domain adomain; cl_device_affinity_domain adomain;
@ -479,19 +478,21 @@ int UCL_Device::set_platform(int pid) {
CL_SAFE_CALL(clCreateSubDevices(device_list[i], props, 0, NULL, CL_SAFE_CALL(clCreateSubDevices(device_list[i], props, 0, NULL,
&num_subdevices)); &num_subdevices));
if (num_subdevices > 1) { if (num_subdevices > 1) {
subdevice_list = new cl_device_id[num_subdevices]; cl_device_id *subdevice_list = new cl_device_id[num_subdevices];
CL_SAFE_CALL(clCreateSubDevices(device_list[i], props, num_subdevices, CL_SAFE_CALL(clCreateSubDevices(device_list[i], props, num_subdevices,
subdevice_list, &num_subdevices)); subdevice_list, &num_subdevices));
for (int j=0; j<num_subdevices; j++) {
_cl_devices.push_back(device_list[i]);
add_properties(device_list[i]);
_num_devices++;
}
delete[] subdevice_list;
} else {
_cl_devices.push_back(device_list[i]);
add_properties(device_list[i]);
_num_devices++;
} }
#endif #endif
for (int j=0; j<num_subdevices; j++) {
_num_devices++;
_cl_devices.push_back(subdevice_list[j]);
add_properties(subdevice_list[j]);
}
if (num_subdevices > 1) delete[] subdevice_list;
} // for i } // for i
#endif #endif

View File

@ -38,8 +38,10 @@ namespace ucl_opencl {
/// Class for timing OpenCL events /// Class for timing OpenCL events
class UCL_Timer { class UCL_Timer {
public: public:
inline UCL_Timer() : _total_time(0.0f), _initialized(false), has_measured_time(false) { } inline UCL_Timer() : start_event(nullptr), stop_event(nullptr), _total_time(0.0f),
inline UCL_Timer(UCL_Device &dev) : _total_time(0.0f), _initialized(false), has_measured_time(false) _initialized(false), has_measured_time(false) { }
inline UCL_Timer(UCL_Device &dev) : start_event(nullptr), stop_event(nullptr), _total_time(0.0f),
_initialized(false), has_measured_time(false)
{ init(dev); } { init(dev); }
inline ~UCL_Timer() { clear(); } inline ~UCL_Timer() { clear(); }

View File

@ -127,9 +127,8 @@ class Answer {
/// Add forces and torques from the GPU into a LAMMPS pointer /// Add forces and torques from the GPU into a LAMMPS pointer
void get_answers(double **f, double **tor); void get_answers(double **f, double **tor);
inline double get_answers(double **f, double **tor, double *eatom, inline double get_answers(double **f, double **tor, double *eatom, double **vatom,
double **vatom, double *virial, double &ecoul, double *virial, double &ecoul, int &error_flag_in) {
int &error_flag_in) {
double ta=MPI_Wtime(); double ta=MPI_Wtime();
time_answer.sync_stop(); time_answer.sync_stop();
_time_cpu_idle+=MPI_Wtime()-ta; _time_cpu_idle+=MPI_Wtime()-ta;

View File

@ -348,7 +348,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int ngpu,
} }
template <class numtyp, class acctyp> template <class numtyp, class acctyp>
int DeviceT::set_ocl_params(std::string s_config, std::string extra_args) { int DeviceT::set_ocl_params(std::string s_config, const std::string &extra_args) {
#ifdef USE_OPENCL #ifdef USE_OPENCL
#include "lal_pre_ocl_config.h" #include "lal_pre_ocl_config.h"
@ -368,7 +368,7 @@ int DeviceT::set_ocl_params(std::string s_config, std::string extra_args) {
int token_count=0; int token_count=0;
std::string params[18]; std::string params[18];
char ocl_config[2048]; char ocl_config[2048];
strcpy(ocl_config,s_config.c_str()); strncpy(ocl_config,s_config.c_str(),2047);
char *pch = strtok(ocl_config,","); char *pch = strtok(ocl_config,",");
_ocl_config_name=pch; _ocl_config_name=pch;
pch = strtok(nullptr,","); pch = strtok(nullptr,",");
@ -992,10 +992,8 @@ int DeviceT::compile_kernels() {
static_cast<size_t>(_block_cell_2d) > gpu->group_size_dim(0) || static_cast<size_t>(_block_cell_2d) > gpu->group_size_dim(0) ||
static_cast<size_t>(_block_cell_2d) > gpu->group_size_dim(1) || static_cast<size_t>(_block_cell_2d) > gpu->group_size_dim(1) ||
static_cast<size_t>(_block_cell_id) > gpu->group_size_dim(0) || static_cast<size_t>(_block_cell_id) > gpu->group_size_dim(0) ||
static_cast<size_t>(_max_shared_types*_max_shared_types* static_cast<size_t>(_max_shared_types*_max_shared_types*sizeof(numtyp)*17 > gpu->slm_size()) ||
sizeof(numtyp)*17 > gpu->slm_size()) || static_cast<size_t>(_max_bio_shared_types*2*sizeof(numtyp) > gpu->slm_size()))
static_cast<size_t>(_max_bio_shared_types*2*sizeof(numtyp) >
gpu->slm_size()))
return -13; return -13;
if (_block_pair % _simd_size != 0 || _block_bio_pair % _simd_size != 0 || if (_block_pair % _simd_size != 0 || _block_bio_pair % _simd_size != 0 ||
@ -1071,9 +1069,8 @@ void lmp_clear_device() {
global_device.clear_device(); global_device.clear_device();
} }
double lmp_gpu_forces(double **f, double **tor, double *eatom, double lmp_gpu_forces(double **f, double **tor, double *eatom, double **vatom,
double **vatom, double *virial, double &ecoul, double *virial, double &ecoul, int &error_flag) {
int &error_flag) {
return global_device.fix_gpu(f,tor,eatom,vatom,virial,ecoul,error_flag); return global_device.fix_gpu(f,tor,eatom,vatom,virial,ecoul,error_flag);
} }

View File

@ -163,17 +163,15 @@ class Device {
{ ans_queue.push(ans); } { ans_queue.push(ans); }
/// Add "answers" (force,energies,etc.) into LAMMPS structures /// Add "answers" (force,energies,etc.) into LAMMPS structures
inline double fix_gpu(double **f, double **tor, double *eatom, inline double fix_gpu(double **f, double **tor, double *eatom, double **vatom,
double **vatom, double *virial, double &ecoul, double *virial, double &ecoul, int &error_flag) {
int &error_flag) {
error_flag=0; error_flag=0;
atom.data_unavail(); atom.data_unavail();
if (ans_queue.empty()==false) { if (ans_queue.empty()==false) {
stop_host_timer(); stop_host_timer();
double evdw=0.0; double evdw=0.0;
while (ans_queue.empty()==false) { while (ans_queue.empty()==false) {
evdw+=ans_queue.front()->get_answers(f,tor,eatom,vatom,virial,ecoul, evdw += ans_queue.front()->get_answers(f,tor,eatom,vatom,virial,ecoul,error_flag);
error_flag);
ans_queue.pop(); ans_queue.pop();
} }
return evdw; return evdw;
@ -350,7 +348,7 @@ class Device {
int _data_in_estimate, _data_out_estimate; int _data_in_estimate, _data_out_estimate;
std::string _ocl_config_name, _ocl_config_string, _ocl_compile_string; std::string _ocl_config_name, _ocl_config_string, _ocl_compile_string;
int set_ocl_params(std::string, std::string); int set_ocl_params(std::string, const std::string &);
}; };
} }

View File

@ -39,7 +39,7 @@ bool Neighbor::init(NeighborShared *shared, const int inum,
const int block_cell_2d, const int block_cell_id, const int block_cell_2d, const int block_cell_id,
const int block_nbor_build, const int threads_per_atom, const int block_nbor_build, const int threads_per_atom,
const int simd_size, const bool time_device, const int simd_size, const bool time_device,
const std::string compile_flags, const bool ilist_map) { const std::string &compile_flags, const bool ilist_map) {
clear(); clear();
_ilist_map = ilist_map; _ilist_map = ilist_map;
@ -743,7 +743,7 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum,
mn = _max_nbors; mn = _max_nbors;
const numtyp i_cell_size=static_cast<numtyp>(1.0/_cell_size); const numtyp i_cell_size=static_cast<numtyp>(1.0/_cell_size);
const int neigh_block=_block_cell_id; const int neigh_block=_block_cell_id;
const int GX=(int)ceil((float)nall/neigh_block); const int GX=(int)ceil((double)nall/neigh_block);
const numtyp sublo0=static_cast<numtyp>(sublo[0]); const numtyp sublo0=static_cast<numtyp>(sublo[0]);
const numtyp sublo1=static_cast<numtyp>(sublo[1]); const numtyp sublo1=static_cast<numtyp>(sublo[1]);
const numtyp sublo2=static_cast<numtyp>(sublo[2]); const numtyp sublo2=static_cast<numtyp>(sublo[2]);

View File

@ -71,7 +71,7 @@ class Neighbor {
const int block_cell_2d, const int block_cell_id, const int block_cell_2d, const int block_cell_id,
const int block_nbor_build, const int threads_per_atom, const int block_nbor_build, const int threads_per_atom,
const int simd_size, const bool time_device, const int simd_size, const bool time_device,
const std::string compile_flags, const bool ilist_map); const std::string &compile_flags, const bool ilist_map);
/// Set the cutoff+skin /// Set the cutoff+skin
inline void set_cutoff(const double cutoff) { inline void set_cutoff(const double cutoff) {

View File

@ -89,7 +89,7 @@ double NeighborShared::best_cell_size(const double subx, const double suby,
} }
void NeighborShared::compile_kernels(UCL_Device &dev, const int gpu_nbor, void NeighborShared::compile_kernels(UCL_Device &dev, const int gpu_nbor,
const std::string flags) { const std::string &flags) {
if (_compiled) if (_compiled)
return; return;

View File

@ -87,7 +87,7 @@ class NeighborShared {
/// Compile kernels for neighbor lists /// Compile kernels for neighbor lists
void compile_kernels(UCL_Device &dev, const int gpu_nbor, void compile_kernels(UCL_Device &dev, const int gpu_nbor,
const std::string flags); const std::string &flags);
// ----------------------------- Kernels // ----------------------------- Kernels
UCL_Program *nbor_program, *build_program; UCL_Program *nbor_program, *build_program;

View File

@ -69,14 +69,14 @@ grdtyp * PPPMT::init(const int nlocal, const int nall, FILE *_screen,
flag=device->init(*ans,nlocal,nall); flag=device->init(*ans,nlocal,nall);
if (flag!=0) if (flag!=0)
return 0; return nullptr;
if (sizeof(grdtyp)==sizeof(double) && device->double_precision()==false) { if (sizeof(grdtyp)==sizeof(double) && device->double_precision()==false) {
flag=-15; flag=-15;
return 0; return nullptr;
} }
if (device->ptx_arch()>0.0 && device->ptx_arch()<1.1) { if (device->ptx_arch()>0.0 && device->ptx_arch()<1.1) {
flag=-4; flag=-4;
return 0; return nullptr;
} }
ucl_device=device->gpu; ucl_device=device->gpu;
@ -168,7 +168,7 @@ grdtyp * PPPMT::init(const int nlocal, const int nall, FILE *_screen,
UCL_READ_WRITE)==UCL_SUCCESS); UCL_READ_WRITE)==UCL_SUCCESS);
if (!success) { if (!success) {
flag=-3; flag=-3;
return 0; return nullptr;
} }
error_flag.device.zero(); error_flag.device.zero();
@ -342,13 +342,15 @@ void PPPMT::interp(const grdtyp qqrd2e_scale) {
vd_brick.update_device(true); vd_brick.update_device(true);
time_in.stop(); time_in.stop();
int ainum=this->ans->inum();
if (ainum==0)
return;
time_interp.start(); time_interp.start();
// Compute the block size and grid size to keep all cores busy // Compute the block size and grid size to keep all cores busy
int BX=this->block_size(); int BX=this->block_size();
int GX=static_cast<int>(ceil(static_cast<double>(this->ans->inum())/BX)); int GX=static_cast<int>(ceil(static_cast<double>(this->ans->inum())/BX));
int ainum=this->ans->inum();
k_interp.set_size(GX,BX); k_interp.set_size(GX,BX);
k_interp.run(&atom->x, &atom->q, &ainum, &vd_brick, &d_rho_coeff, k_interp.run(&atom->x, &atom->q, &ainum, &vd_brick, &d_rho_coeff,
&_npts_x, &_npts_yx, &_brick_x, &_brick_y, &_brick_z, &_delxinv, &_npts_x, &_npts_yx, &_brick_x, &_brick_y, &_brick_z, &_delxinv,

View File

@ -92,8 +92,12 @@ class numpy_wrapper:
if dim == LAMMPS_AUTODETECT: if dim == LAMMPS_AUTODETECT:
if dtype in (LAMMPS_INT_2D, LAMMPS_DOUBLE_2D, LAMMPS_INT64_2D): if dtype in (LAMMPS_INT_2D, LAMMPS_DOUBLE_2D, LAMMPS_INT64_2D):
# TODO add other fields # TODO add other fields
if name in ("x", "v", "f", "angmom", "torque", "csforce", "vforce"): if name in ("x", "v", "f", "x0", "omega", "angmom", "torque", "vforce", "vest"):
dim = 3 dim = 3
elif name == "smd_data_9":
dim = 9
elif name == "smd_stress":
dim = 6
else: else:
dim = 2 dim = 2
else: else:
@ -386,6 +390,9 @@ class numpy_wrapper:
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def iarray(self, c_int_type, raw_ptr, nelem, dim=1): def iarray(self, c_int_type, raw_ptr, nelem, dim=1):
if raw_ptr is None:
return None
import numpy as np import numpy as np
np_int_type = self._ctype_to_numpy_int(c_int_type) np_int_type = self._ctype_to_numpy_int(c_int_type)
@ -405,7 +412,11 @@ class numpy_wrapper:
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def darray(self, raw_ptr, nelem, dim=1): def darray(self, raw_ptr, nelem, dim=1):
if raw_ptr is None:
return None
import numpy as np import numpy as np
if dim == 1: if dim == 1:
ptr = cast(raw_ptr, POINTER(c_double * nelem)) ptr = cast(raw_ptr, POINTER(c_double * nelem))
else: else:

View File

@ -301,8 +301,7 @@ void PairLineLJ::compute(int eflag, int vflag)
} }
} }
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
evdwl,0.0,fpair,delx,dely,delz);
} }
} }

View File

@ -375,8 +375,7 @@ void PairTriLJ::compute(int eflag, int vflag)
} }
} }
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
evdwl,0.0,fpair,delx,dely,delz);
} }
} }

View File

@ -39,7 +39,6 @@
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <utility> #include <utility>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -37,7 +37,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -337,8 +337,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/)
num_contacts = 0; num_contacts = 0;
facc[0] = facc[1] = facc[2] = 0; facc[0] = facc[1] = facc[2] = 0;
vertex_against_wall(i, wall_pos, x, f, torque, side, vertex_against_wall(i, wall_pos, x, f, torque, side, contact_list, num_contacts, facc);
contact_list, num_contacts, facc);
if (num_contacts >= 2) { if (num_contacts >= 2) {

View File

@ -324,8 +324,7 @@ void PairBodyNparticle::compute(int eflag, int vflag)
} }
} }
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
evdwl,0.0,fpair,delx,dely,delz);
} }
} }

View File

@ -207,8 +207,7 @@ void PairBodyRoundedPolygon::compute(int eflag, int vflag)
if (r > radi + radj + cut_inner) continue; if (r > radi + radj + cut_inner) continue;
if (npi == 1 && npj == 1) { if (npi == 1 && npj == 1) {
sphere_against_sphere(i, j, delx, dely, delz, rsq, sphere_against_sphere(i, j, delx, dely, delz, rsq, k_nij, k_naij, x, v, f, evflag);
k_nij, k_naij, x, v, f, evflag);
continue; continue;
} }

View File

@ -20,17 +20,11 @@
#include "fix_brownian.h" #include "fix_brownian.h"
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "math_extra.h"
#include "memory.h"
#include "random_mars.h" #include "random_mars.h"
#include "update.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -21,17 +21,10 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_ellipsoid.h" #include "atom_vec_ellipsoid.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "math_extra.h" #include "math_extra.h"
#include "memory.h"
#include "random_mars.h" #include "random_mars.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -17,15 +17,12 @@
Contributing author: Sam Cameron (University of Bristol) Contributing author: Sam Cameron (University of Bristol)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_brownian.h" #include "fix_brownian_base.h"
#include "atom.h"
#include "comm.h" #include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "math_extra.h"
#include "memory.h"
#include "random_mars.h" #include "random_mars.h"
#include "update.h" #include "update.h"

View File

@ -20,17 +20,12 @@
#include "fix_brownian_sphere.h" #include "fix_brownian_sphere.h"
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "math_extra.h" #include "math_extra.h"
#include "memory.h"
#include "random_mars.h" #include "random_mars.h"
#include "update.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -23,14 +23,11 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_ellipsoid.h" #include "atom_vec_ellipsoid.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "math_extra.h" #include "math_extra.h"
#include "memory.h"
#include "update.h"
#include <cmath>
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -14,7 +14,6 @@
#include "atom_vec_oxdna.h" #include "atom_vec_oxdna.h"
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_ellipsoid.h" #include "atom_vec_ellipsoid.h"
#include "atom_vec_oxdna.h"
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
@ -30,7 +29,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <utility>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MFOxdna; using namespace MFOxdna;

View File

@ -17,8 +17,6 @@
#include "pair_oxrna2_excv.h" #include "pair_oxrna2_excv.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_ellipsoid.h" #include "atom_vec_ellipsoid.h"
#include "atom_vec_oxdna.h"
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
@ -31,7 +30,6 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <utility>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -18,13 +18,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_lj_sdk_coul_msm.h" #include "pair_lj_sdk_coul_msm.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "error.h"
#include "force.h" #include "force.h"
#include "kspace.h" #include "kspace.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "error.h"
#include <cmath>
#include <cstring>
#include "lj_sdk_common.h" #include "lj_sdk_common.h"

View File

@ -25,7 +25,6 @@
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h" #include "neighbor.h"
#include "update.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>

View File

@ -25,7 +25,6 @@
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h" #include "neighbor.h"
#include "update.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>

View File

@ -397,8 +397,7 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
fpair = factor_lj*forcelj*r2inv; fpair = factor_lj*forcelj*r2inv;
} }
if (evflag) ev_tally(i,j,nlocal,newton_pair, if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
evdwl,0.0,fpair,delx,dely,delz);
} }
} }
} }

View File

@ -18,10 +18,11 @@
#include "fix_wall_colloid.h" #include "fix_wall_colloid.h"
#include <cmath>
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -10,13 +10,6 @@
#include "colvarproxy_lammps.h" #include "colvarproxy_lammps.h"
#include <mpi.h>
#include <sys/stat.h>
#include <cerrno>
#include <cstring>
#include <iostream>
#include <memory>
#include <string>
#include "lammps.h" #include "lammps.h"
#include "error.h" #include "error.h"
@ -26,6 +19,12 @@
#include "colvarmodule.h" #include "colvarmodule.h"
#include "colvarproxy.h" #include "colvarproxy.h"
#include <sys/stat.h>
#include <cerrno>
#include <cstring>
#include <iostream>
#include <memory>
#define HASH_FAIL -1 #define HASH_FAIL -1
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

View File

@ -12,11 +12,6 @@
#include "colvarproxy_lammps_version.h" // IWYU pragma: export #include "colvarproxy_lammps_version.h" // IWYU pragma: export
#include <cstddef>
#include <mpi.h>
#include <string>
#include <vector>
#include "colvarmodule.h" #include "colvarmodule.h"
#include "colvarproxy.h" #include "colvarproxy.h"
#include "colvartypes.h" #include "colvartypes.h"

View File

@ -44,7 +44,6 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <vector>
static const char colvars_pub[] = static const char colvars_pub[] =
"fix colvars command:\n\n" "fix colvars command:\n\n"
@ -1000,7 +999,7 @@ double FixColvars::compute_scalar()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* local memory usage. approximately. */ /* local memory usage. approximately. */
double FixColvars::memory_usage(void) double FixColvars::memory_usage()
{ {
double bytes = (double) (num_coords * (2*sizeof(int)+3*sizeof(double))); double bytes = (double) (num_coords * (2*sizeof(int)+3*sizeof(double)));
bytes += (double)(double) (nmax*size_one) + sizeof(this); bytes += (double)(double) (nmax*size_one) + sizeof(this);

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -12,27 +11,25 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "domain.h"
#include "dump_atom_gz.h" #include "dump_atom_gz.h"
#include "domain.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg)
DumpAtom(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump atom/gz only writes compressed files");
error->all(FLERR,"Dump atom/gz only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpAtomGZ::~DumpAtomGZ() DumpAtomGZ::~DumpAtomGZ() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -58,8 +55,7 @@ void DumpAtomGZ::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -109,9 +105,7 @@ void DumpAtomGZ::write_header(bigint ndump)
header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style);
} }
if (time_flag) { if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); }
header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time());
}
header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep);
header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump);
@ -145,14 +139,14 @@ void DumpAtomGZ::write_data(int n, double *mybuf)
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
int written = 0; int written = 0;
if (image_flag == 1) { if (image_flag == 1) {
written = snprintf(vbuffer, VBUFFER_SIZE, format, written = snprintf(vbuffer, VBUFFER_SIZE, format, static_cast<tagint>(mybuf[m]),
static_cast<tagint> (mybuf[m]), static_cast<int> (mybuf[m+1]), static_cast<int>(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4],
mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast<int> (mybuf[m+5]), static_cast<int>(mybuf[m + 5]), static_cast<int>(mybuf[m + 6]),
static_cast<int> (mybuf[m+6]), static_cast<int> (mybuf[m+7])); static_cast<int>(mybuf[m + 7]));
} else { } else {
written = snprintf(vbuffer, VBUFFER_SIZE, format, written =
static_cast<tagint> (mybuf[m]), static_cast<int> (mybuf[m+1]), snprintf(vbuffer, VBUFFER_SIZE, format, static_cast<tagint>(mybuf[m]),
mybuf[m+2],mybuf[m+3],mybuf[m+4]); static_cast<int>(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]);
} }
if (written > 0) { if (written > 0) {
writer.write(vbuffer, written); writer.write(vbuffer, written);
@ -174,9 +168,7 @@ void DumpAtomGZ::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,6 +18,7 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "domain.h" #include "domain.h"
#include "dump_atom_zstd.h" #include "dump_atom_zstd.h"
#include "error.h" #include "error.h"
#include "file_writer.h" #include "file_writer.h"
@ -26,21 +26,16 @@
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpAtomZstd::DumpAtomZstd(LAMMPS *lmp, int narg, char **arg) : DumpAtomZstd::DumpAtomZstd(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg)
DumpAtom(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump atom/zstd only writes compressed files");
error->all(FLERR,"Dump atom/zstd only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpAtomZstd::~DumpAtomZstd() DumpAtomZstd::~DumpAtomZstd() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -66,8 +61,7 @@ void DumpAtomZstd::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -117,9 +111,7 @@ void DumpAtomZstd::write_header(bigint ndump)
header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style);
} }
if (time_flag) { if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); }
header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time());
}
header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep);
header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump);
@ -153,14 +145,14 @@ void DumpAtomZstd::write_data(int n, double *mybuf)
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
int written = 0; int written = 0;
if (image_flag == 1) { if (image_flag == 1) {
written = snprintf(vbuffer, VBUFFER_SIZE, format, written = snprintf(vbuffer, VBUFFER_SIZE, format, static_cast<tagint>(mybuf[m]),
static_cast<tagint> (mybuf[m]), static_cast<int> (mybuf[m+1]), static_cast<int>(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4],
mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast<int> (mybuf[m+5]), static_cast<int>(mybuf[m + 5]), static_cast<int>(mybuf[m + 6]),
static_cast<int> (mybuf[m+6]), static_cast<int> (mybuf[m+7])); static_cast<int>(mybuf[m + 7]));
} else { } else {
written = snprintf(vbuffer, VBUFFER_SIZE, format, written =
static_cast<tagint> (mybuf[m]), static_cast<int> (mybuf[m+1]), snprintf(vbuffer, VBUFFER_SIZE, format, static_cast<tagint>(mybuf[m]),
mybuf[m+2],mybuf[m+3],mybuf[m+4]); static_cast<int>(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]);
} }
if (written > 0) { if (written > 0) {
writer.write(vbuffer, written); writer.write(vbuffer, written);
@ -182,9 +174,7 @@ void DumpAtomZstd::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }
@ -198,9 +188,12 @@ int DumpAtomZstd::modify_param(int narg, char **arg)
try { try {
if (strcmp(arg[0], "checksum") == 0) { if (strcmp(arg[0], "checksum") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); if (strcmp(arg[1], "yes") == 0)
else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); writer.setChecksum(true);
else error->all(FLERR,"Illegal dump_modify command"); else if (strcmp(arg[1], "no") == 0)
writer.setChecksum(false);
else
error->all(FLERR, "Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0], "compression_level") == 0) { } else if (strcmp(arg[0], "compression_level") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -12,10 +11,12 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "dump_cfg_gz.h"
#include "atom.h" #include "atom.h"
#include "domain.h" #include "domain.h"
#include "dump_cfg_gz.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
@ -23,18 +24,14 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define UNWRAPEXPAND 10.0 #define UNWRAPEXPAND 10.0
DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg)
DumpCFG(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump cfg/gz only writes compressed files");
error->all(FLERR,"Dump cfg/gz only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpCFGGZ::~DumpCFGGZ() DumpCFGGZ::~DumpCFGGZ() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -60,8 +57,7 @@ void DumpCFGGZ::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -111,8 +107,10 @@ void DumpCFGGZ::write_header(bigint n)
// so molecules are not split across periodic box boundaries // so molecules are not split across periodic box boundaries
double scale = 1.0; double scale = 1.0;
if (atom->peri_flag) scale = atom->pdscale; if (atom->peri_flag)
else if (unwrapflag == 1) scale = UNWRAPEXPAND; scale = atom->pdscale;
else if (unwrapflag == 1)
scale = UNWRAPEXPAND;
std::string header = fmt::format("Number of particles = {}\n", n); std::string header = fmt::format("Number of particles = {}\n", n);
header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale);
@ -127,8 +125,7 @@ void DumpCFGGZ::write_header(bigint n)
header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd); header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd);
header += fmt::format(".NO_VELOCITY.\n"); header += fmt::format(".NO_VELOCITY.\n");
header += fmt::format("entry_count = {}\n", nfield - 2); header += fmt::format("entry_count = {}\n", nfield - 2);
for (int i = 0; i < nfield-5; i++) for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]);
header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]);
writer.write(header.c_str(), header.length()); writer.write(header.c_str(), header.length());
} }
@ -214,9 +211,7 @@ void DumpCFGGZ::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -18,10 +17,12 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "dump_cfg_zstd.h"
#include "atom.h" #include "atom.h"
#include "domain.h" #include "domain.h"
#include "dump_cfg_zstd.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
@ -29,20 +30,14 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define UNWRAPEXPAND 10.0 #define UNWRAPEXPAND 10.0
DumpCFGZstd::DumpCFGZstd(LAMMPS *lmp, int narg, char **arg) : DumpCFGZstd::DumpCFGZstd(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg)
DumpCFG(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump cfg/zstd only writes compressed files");
error->all(FLERR,"Dump cfg/zstd only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpCFGZstd::~DumpCFGZstd() DumpCFGZstd::~DumpCFGZstd() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -68,8 +63,7 @@ void DumpCFGZstd::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -95,9 +89,7 @@ void DumpCFGZstd::openfile()
// each proc with filewriter = 1 opens a file // each proc with filewriter = 1 opens a file
if (filewriter) { if (filewriter) {
if (append_flag) { if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); }
error->one(FLERR, "dump cfg/zstd currently doesn't support append");
}
try { try {
writer.open(filecurrent); writer.open(filecurrent);
@ -123,8 +115,10 @@ void DumpCFGZstd::write_header(bigint n)
// so molecules are not split across periodic box boundaries // so molecules are not split across periodic box boundaries
double scale = 1.0; double scale = 1.0;
if (atom->peri_flag) scale = atom->pdscale; if (atom->peri_flag)
else if (unwrapflag == 1) scale = UNWRAPEXPAND; scale = atom->pdscale;
else if (unwrapflag == 1)
scale = UNWRAPEXPAND;
std::string header = fmt::format("Number of particles = {}\n", n); std::string header = fmt::format("Number of particles = {}\n", n);
header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale);
@ -139,8 +133,7 @@ void DumpCFGZstd::write_header(bigint n)
header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd); header += fmt::format("H0(3,3) = {0:g} A\n", domain->zprd);
header += fmt::format(".NO_VELOCITY.\n"); header += fmt::format(".NO_VELOCITY.\n");
header += fmt::format("entry_count = {}\n", nfield - 2); header += fmt::format("entry_count = {}\n", nfield - 2);
for (int i = 0; i < nfield-5; i++) for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]);
header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]);
writer.write(header.c_str(), header.length()); writer.write(header.c_str(), header.length());
} }
@ -226,9 +219,7 @@ void DumpCFGZstd::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }
@ -242,9 +233,12 @@ int DumpCFGZstd::modify_param(int narg, char **arg)
try { try {
if (strcmp(arg[0], "checksum") == 0) { if (strcmp(arg[0], "checksum") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); if (strcmp(arg[1], "yes") == 0)
else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); writer.setChecksum(true);
else error->all(FLERR,"Illegal dump_modify command"); else if (strcmp(arg[1], "no") == 0)
writer.setChecksum(false);
else
error->all(FLERR, "Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0], "compression_level") == 0) { } else if (strcmp(arg[0], "compression_level") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -12,27 +11,25 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "domain.h"
#include "dump_custom_gz.h" #include "dump_custom_gz.h"
#include "domain.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg)
DumpCustom(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump custom/gz only writes compressed files");
error->all(FLERR,"Dump custom/gz only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpCustomGZ::~DumpCustomGZ() DumpCustomGZ::~DumpCustomGZ() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -58,8 +55,7 @@ void DumpCustomGZ::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -107,9 +103,7 @@ void DumpCustomGZ::write_header(bigint ndump)
header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style);
} }
if (time_flag) { if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); }
header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time());
}
header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep);
header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump);
@ -174,9 +168,7 @@ void DumpCustomGZ::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }

View File

@ -18,8 +18,10 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "domain.h"
#include "dump_custom_zstd.h" #include "dump_custom_zstd.h"
#include "file_writer.h"
#include "domain.h"
#include "error.h" #include "error.h"
#include "update.h" #include "update.h"

View File

@ -28,7 +28,6 @@ DumpStyle(custom/zstd,DumpCustomZstd);
#include "dump_custom.h" #include "dump_custom.h"
#include "zstd_file_writer.h" #include "zstd_file_writer.h"
#include <stdio.h>
namespace LAMMPS_NS { namespace LAMMPS_NS {

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -12,27 +11,25 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "domain.h"
#include "dump_local_gz.h" #include "dump_local_gz.h"
#include "domain.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg)
DumpLocal(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump local/gz only writes compressed files");
error->all(FLERR,"Dump local/gz only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpLocalGZ::~DumpLocalGZ() DumpLocalGZ::~DumpLocalGZ() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -58,8 +55,7 @@ void DumpLocalGZ::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -107,9 +103,7 @@ void DumpLocalGZ::write_header(bigint ndump)
header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style);
} }
if (time_flag) { if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); }
header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time());
}
header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep);
header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump);
@ -174,9 +168,7 @@ void DumpLocalGZ::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -18,28 +17,25 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "domain.h"
#include "dump_local_zstd.h" #include "dump_local_zstd.h"
#include "domain.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg)
DumpLocal(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump local/zstd only writes compressed files");
error->all(FLERR,"Dump local/zstd only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpLocalZstd::~DumpLocalZstd() DumpLocalZstd::~DumpLocalZstd() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -65,8 +61,7 @@ void DumpLocalZstd::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -92,9 +87,7 @@ void DumpLocalZstd::openfile()
// each proc with filewriter = 1 opens a file // each proc with filewriter = 1 opens a file
if (filewriter) { if (filewriter) {
if (append_flag) { if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); }
error->one(FLERR, "dump cfg/zstd currently doesn't support append");
}
try { try {
writer.open(filecurrent); writer.open(filecurrent);
@ -118,9 +111,7 @@ void DumpLocalZstd::write_header(bigint ndump)
header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style); header = fmt::format("ITEM: UNITS\n{}\n", update->unit_style);
} }
if (time_flag) { if (time_flag) { header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); }
header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time());
}
header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep);
header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump);
@ -185,9 +176,7 @@ void DumpLocalZstd::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }
@ -201,9 +190,12 @@ int DumpLocalZstd::modify_param(int narg, char **arg)
try { try {
if (strcmp(arg[0], "checksum") == 0) { if (strcmp(arg[0], "checksum") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); if (strcmp(arg[1], "yes") == 0)
else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); writer.setChecksum(true);
else error->all(FLERR,"Illegal dump_modify command"); else if (strcmp(arg[1], "no") == 0)
writer.setChecksum(false);
else
error->all(FLERR, "Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0], "compression_level") == 0) { } else if (strcmp(arg[0], "compression_level") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -13,26 +12,23 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "dump_xyz_gz.h" #include "dump_xyz_gz.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg)
DumpXYZ(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump xyz/gz only writes compressed files");
error->all(FLERR,"Dump xyz/gz only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpXYZGZ::~DumpXYZGZ() DumpXYZGZ::~DumpXYZGZ() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -58,8 +54,7 @@ void DumpXYZGZ::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -117,8 +112,8 @@ void DumpXYZGZ::write_data(int n, double *mybuf)
char vbuffer[VBUFFER_SIZE]; char vbuffer[VBUFFER_SIZE];
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
int written = snprintf(vbuffer, VBUFFER_SIZE, format, int written =
typenames[static_cast<int> (mybuf[m+1])], snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast<int>(mybuf[m + 1])],
mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]);
if (written > 0) { if (written > 0) {
writer.write(vbuffer, written); writer.write(vbuffer, written);
@ -139,9 +134,7 @@ void DumpXYZGZ::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }

View File

@ -1,4 +1,3 @@
// clang-format off
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,27 +18,23 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "dump_xyz_zstd.h" #include "dump_xyz_zstd.h"
#include "error.h" #include "error.h"
#include "file_writer.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
DumpXYZZstd::DumpXYZZstd(LAMMPS *lmp, int narg, char **arg) : DumpXYZZstd::DumpXYZZstd(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg)
DumpXYZ(lmp, narg, arg)
{ {
if (!compressed) if (!compressed) error->all(FLERR, "Dump xyz/zstd only writes compressed files");
error->all(FLERR,"Dump xyz/zstd only writes compressed files");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
DumpXYZZstd::~DumpXYZZstd() DumpXYZZstd::~DumpXYZZstd() {}
{
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
generic opening of a dump file generic opening of a dump file
@ -65,8 +60,7 @@ void DumpXYZZstd::openfile()
char *ptr = strchr(filestar, '*'); char *ptr = strchr(filestar, '*');
*ptr = '\0'; *ptr = '\0';
if (padflag == 0) if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", sprintf(filecurrent, "%s" BIGINT_FORMAT "%s", filestar, update->ntimestep, ptr + 1);
filestar,update->ntimestep,ptr+1);
else { else {
char bif[8], pad[16]; char bif[8], pad[16];
strcpy(bif, BIGINT_FORMAT); strcpy(bif, BIGINT_FORMAT);
@ -92,9 +86,7 @@ void DumpXYZZstd::openfile()
// each proc with filewriter = 1 opens a file // each proc with filewriter = 1 opens a file
if (filewriter) { if (filewriter) {
if (append_flag) { if (append_flag) { error->one(FLERR, "dump cfg/zstd currently doesn't support append"); }
error->one(FLERR, "dump cfg/zstd currently doesn't support append");
}
try { try {
writer.open(filecurrent); writer.open(filecurrent);
@ -128,8 +120,8 @@ void DumpXYZZstd::write_data(int n, double *mybuf)
char vbuffer[VBUFFER_SIZE]; char vbuffer[VBUFFER_SIZE];
int m = 0; int m = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
int written = snprintf(vbuffer, VBUFFER_SIZE, format, int written =
typenames[static_cast<int> (mybuf[m+1])], snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast<int>(mybuf[m + 1])],
mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]);
if (written > 0) { if (written > 0) {
writer.write(vbuffer, written); writer.write(vbuffer, written);
@ -150,9 +142,7 @@ void DumpXYZZstd::write()
if (multifile) { if (multifile) {
writer.close(); writer.close();
} else { } else {
if (flush_flag && writer.isopen()) { if (flush_flag && writer.isopen()) { writer.flush(); }
writer.flush();
}
} }
} }
} }
@ -166,9 +156,12 @@ int DumpXYZZstd::modify_param(int narg, char **arg)
try { try {
if (strcmp(arg[0], "checksum") == 0) { if (strcmp(arg[0], "checksum") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");
if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); if (strcmp(arg[1], "yes") == 0)
else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); writer.setChecksum(true);
else error->all(FLERR,"Illegal dump_modify command"); else if (strcmp(arg[1], "no") == 0)
writer.setChecksum(false);
else
error->all(FLERR, "Illegal dump_modify command");
return 2; return 2;
} else if (strcmp(arg[0], "compression_level") == 0) { } else if (strcmp(arg[0], "compression_level") == 0) {
if (narg < 2) error->all(FLERR, "Illegal dump_modify command"); if (narg < 2) error->all(FLERR, "Illegal dump_modify command");

View File

@ -1,4 +1,3 @@
// clang-format off
/* -*- c++ -*- ---------------------------------------------------------- /* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -17,22 +16,18 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "gz_file_writer.h" #include "gz_file_writer.h"
#include <stdio.h>
#include "fmt/format.h" #include "fmt/format.h"
#include <cstdio>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
GzFileWriter::GzFileWriter() : FileWriter(), GzFileWriter::GzFileWriter() : FileWriter(), compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
compression_level(Z_BEST_COMPRESSION),
gzFp(nullptr)
{
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
GzFileWriter::~GzFileWriter() GzFileWriter::~GzFileWriter()
{ {
close(); GzFileWriter::close();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -50,8 +45,7 @@ void GzFileWriter::open(const std::string &path, bool append)
gzFp = gzopen(path.c_str(), mode.c_str()); gzFp = gzopen(path.c_str(), mode.c_str());
if (gzFp == nullptr) if (gzFp == nullptr) throw FileWriterException(fmt::format("Could not open file '{}'", path));
throw FileWriterException(fmt::format("Could not open file '{}'", path));
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -76,7 +70,7 @@ void GzFileWriter::flush()
void GzFileWriter::close() void GzFileWriter::close()
{ {
if (!isopen()) return; if (!GzFileWriter::isopen()) return;
gzclose(gzFp); gzclose(gzFp);
gzFp = nullptr; gzFp = nullptr;
@ -100,7 +94,8 @@ void GzFileWriter::setCompressionLevel(int level)
const int max_level = Z_BEST_COMPRESSION; const int max_level = Z_BEST_COMPRESSION;
if (level < min_level || level > max_level) if (level < min_level || level > max_level)
throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level)); throw FileWriterException(
fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
compression_level = level; compression_level = level;
} }

View File

@ -20,7 +20,6 @@
#include "file_writer.h" #include "file_writer.h"
#include <exception>
#include <string> #include <string>
#include <zlib.h> #include <zlib.h>

View File

@ -1,4 +1,3 @@
// clang-format off
/* -*- c++ -*- ---------------------------------------------------------- /* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories https://www.lammps.org/, Sandia National Laboratories
@ -19,16 +18,13 @@
#ifdef LAMMPS_ZSTD #ifdef LAMMPS_ZSTD
#include "zstd_file_writer.h" #include "zstd_file_writer.h"
#include <stdio.h>
#include "fmt/format.h" #include "fmt/format.h"
#include <cstdio>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
ZstdFileWriter::ZstdFileWriter() : FileWriter(), ZstdFileWriter::ZstdFileWriter() :
compression_level(0), FileWriter(), compression_level(0), checksum_flag(1), cctx(nullptr), fp(nullptr)
checksum_flag(1),
cctx(nullptr),
fp(nullptr)
{ {
out_buffer_size = ZSTD_CStreamOutSize(); out_buffer_size = ZSTD_CStreamOutSize();
out_buffer = new char[out_buffer_size]; out_buffer = new char[out_buffer_size];
@ -38,7 +34,7 @@ ZstdFileWriter::ZstdFileWriter() : FileWriter(),
ZstdFileWriter::~ZstdFileWriter() ZstdFileWriter::~ZstdFileWriter()
{ {
close(); ZstdFileWriter::close();
delete[] out_buffer; delete[] out_buffer;
out_buffer = nullptr; out_buffer = nullptr;
@ -57,9 +53,7 @@ void ZstdFileWriter::open(const std::string &path, bool append)
fp = fopen(path.c_str(), "wb"); fp = fopen(path.c_str(), "wb");
} }
if (!fp) { if (!fp) { throw FileWriterException(fmt::format("Could not open file '{}'", path)); }
throw FileWriterException(fmt::format("Could not open file '{}'", path));
}
cctx = ZSTD_createCCtx(); cctx = ZSTD_createCCtx();
@ -114,7 +108,7 @@ void ZstdFileWriter::flush()
void ZstdFileWriter::close() void ZstdFileWriter::close()
{ {
if (!isopen()) return; if (!ZstdFileWriter::isopen()) return;
size_t remaining; size_t remaining;
ZSTD_inBuffer input = {nullptr, 0, 0}; ZSTD_inBuffer input = {nullptr, 0, 0};
@ -150,7 +144,8 @@ void ZstdFileWriter::setCompressionLevel(int level)
const int max_level = ZSTD_maxCLevel(); const int max_level = ZSTD_maxCLevel();
if (level < min_level || level > max_level) if (level < min_level || level > max_level)
throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level)); throw FileWriterException(
fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
compression_level = level; compression_level = level;
} }
@ -159,8 +154,7 @@ void ZstdFileWriter::setCompressionLevel(int level)
void ZstdFileWriter::setChecksum(bool enabled) void ZstdFileWriter::setChecksum(bool enabled)
{ {
if (isopen()) if (isopen()) throw FileWriterException("Checksum flag can not be changed while file is open");
throw FileWriterException("Checksum flag can not be changed while file is open");
checksum_flag = enabled ? 1 : 0; checksum_flag = enabled ? 1 : 0;
} }

View File

@ -18,13 +18,14 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_born_coul_dsf_cs.h" #include "pair_born_coul_dsf_cs.h"
#include <cmath>
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "force.h" #include "force.h"
#include "neigh_list.h"
#include "math_const.h" #include "math_const.h"
#include "math_special.h" #include "math_special.h"
#include "neigh_list.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -14,12 +14,13 @@
#include "pair_born_coul_wolf_cs.h" #include "pair_born_coul_wolf_cs.h"
#include <cmath>
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "force.h" #include "force.h"
#include "neigh_list.h"
#include "math_const.h" #include "math_const.h"
#include "neigh_list.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -13,13 +13,14 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "pair_coul_wolf_cs.h" #include "pair_coul_wolf_cs.h"
#include <cmath>
#include "atom.h" #include "atom.h"
#include "comm.h"
#include "force.h" #include "force.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "math_const.h" #include "math_const.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -17,6 +17,9 @@
#include "atom.h" #include "atom.h"
#include "citeme.h" #include "citeme.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static const char cite_user_dielectric_package[] = static const char cite_user_dielectric_package[] =

View File

@ -33,12 +33,14 @@
#include "pppm_dielectric.h" #include "pppm_dielectric.h"
#include "update.h" #include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) : ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), efield(NULL) Compute(lmp, narg, arg), efield(nullptr)
{ {
if (narg < 3) error->all(FLERR,"Illegal compute efield/atom command"); if (narg < 3) error->all(FLERR,"Illegal compute efield/atom command");

View File

@ -41,11 +41,9 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "group.h"
#include "kspace.h" #include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "modify.h"
#include "msm_dielectric.h" #include "msm_dielectric.h"
#include "pair_coul_cut_dielectric.h" #include "pair_coul_cut_dielectric.h"
#include "pair_coul_long_dielectric.h" #include "pair_coul_long_dielectric.h"
@ -54,7 +52,6 @@
#include "pair_lj_cut_coul_msm_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h"
#include "pppm_dielectric.h" #include "pppm_dielectric.h"
#include "random_park.h" #include "random_park.h"
#include "timer.h"
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
@ -69,8 +66,8 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) : FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), q_backup(NULL), c(NULL), g(NULL), h(NULL), r(NULL), s(NULL), v(NULL), Fix(lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr), s(nullptr), v(nullptr),
y(NULL) y(nullptr)
{ {
if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command"); if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command");
@ -110,7 +107,7 @@ FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
if (atom->torque_flag) torqueflag = 1; if (atom->torque_flag) torqueflag = 1;
if (atom->avec->forceclearflag) extraflag = 1; if (atom->avec->forceclearflag) extraflag = 1;
grow_arrays(atom->nmax); FixPolarizeBEMGMRES::grow_arrays(atom->nmax);
atom->add_callback(0); // to ensure to work with atom->sort() atom->add_callback(0); // to ensure to work with atom->sort()
// output the residual and actual number of iterations // output the residual and actual number of iterations
@ -133,7 +130,7 @@ FixPolarizeBEMGMRES::~FixPolarizeBEMGMRES()
memory->destroy(mat2tag); memory->destroy(mat2tag);
memory->destroy(tag2mat); memory->destroy(tag2mat);
if (allocated) deallocate(); if (allocated) FixPolarizeBEMGMRES::deallocate();
atom->delete_callback(id, 0); atom->delete_callback(id, 0);
} }

View File

@ -33,7 +33,6 @@
#include "group.h" #include "group.h"
#include "kspace.h" #include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h"
#include "msm_dielectric.h" #include "msm_dielectric.h"
#include "pair_coul_cut_dielectric.h" #include "pair_coul_cut_dielectric.h"
#include "pair_coul_long_dielectric.h" #include "pair_coul_long_dielectric.h"

View File

@ -33,13 +33,11 @@
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "group.h"
#include "kspace.h" #include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "math_extra.h" #include "math_extra.h"
#include "math_special.h" #include "math_special.h"
#include "memory.h" #include "memory.h"
#include "modify.h"
#include "msm_dielectric.h" #include "msm_dielectric.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "neigh_request.h" #include "neigh_request.h"
@ -50,8 +48,6 @@
#include "pair_lj_cut_coul_long_dielectric.h" #include "pair_lj_cut_coul_long_dielectric.h"
#include "pair_lj_cut_coul_msm_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h"
#include "pppm_dielectric.h" #include "pppm_dielectric.h"
#include "random_park.h"
#include "timer.h"
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
@ -131,7 +127,7 @@ FixPolarizeFunctional::FixPolarizeFunctional(LAMMPS *lmp, int narg, char **arg)
cg_r = cg_p = cg_Ap = nullptr; cg_r = cg_p = cg_Ap = nullptr;
cg_A = nullptr; cg_A = nullptr;
grow_arrays(atom->nmax); FixPolarizeFunctional::grow_arrays(atom->nmax);
atom->add_callback(0); // to ensure to work with atom->sort() atom->add_callback(0); // to ensure to work with atom->sort()
} }

View File

@ -23,15 +23,9 @@
#include "comm.h" #include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "gridcomm.h" #include "gridcomm.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h"
#include "pair.h"
#include <cstring>
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "math_const.h" #include "math_const.h"
@ -29,7 +28,6 @@
#include "neighbor.h" #include "neighbor.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "kspace.h" #include "kspace.h"
@ -30,7 +29,6 @@
#include "neighbor.h" #include "neighbor.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
@ -221,10 +219,10 @@ void PairCoulLongDielectric::init_style()
// insure use of KSpace long-range solver, set g_ewald // insure use of KSpace long-range solver, set g_ewald
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style"); if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald; g_ewald = force->kspace->g_ewald;
// setup force tables // setup force tables
if (ncoultablebits) init_tables(cut_coul, NULL); if (ncoultablebits) init_tables(cut_coul, nullptr);
} }

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "math_const.h" #include "math_const.h"

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "math_const.h" #include "math_const.h"
@ -29,7 +28,6 @@
#include "neighbor.h" #include "neighbor.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
@ -40,8 +38,8 @@ using namespace MathConst;
PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *lmp) : PairLJCutCoulDebye(lmp) PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *lmp) : PairLJCutCoulDebye(lmp)
{ {
efield = NULL; efield = nullptr;
epot = NULL; epot = nullptr;
nmax = 0; nmax = 0;
} }

View File

@ -19,7 +19,6 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "kspace.h" #include "kspace.h"
@ -257,7 +256,7 @@ void PairLJCutCoulLongDielectric::init_style()
// insure use of KSpace long-range solver, set g_ewald // insure use of KSpace long-range solver, set g_ewald
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style"); if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald; g_ewald = force->kspace->g_ewald;
// setup force tables // setup force tables

View File

@ -19,10 +19,8 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "integrate.h"
#include "kspace.h" #include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
@ -31,6 +29,7 @@
#include "neighbor.h" #include "neighbor.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
@ -365,7 +364,7 @@ void PairLJCutCoulMSMDielectric::init_style()
// insure use of KSpace long-range solver, set g_ewald // insure use of KSpace long-range solver, set g_ewald
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style"); if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
g_ewald = force->kspace->g_ewald; g_ewald = force->kspace->g_ewald;
// setup force tables // setup force tables
@ -382,5 +381,5 @@ void *PairLJCutCoulMSMDielectric::extract(const char *str, int &dim)
dim = 2; dim = 2;
if (strcmp(str, "epsilon") == 0) return (void *) epsilon; if (strcmp(str, "epsilon") == 0) return (void *) epsilon;
if (strcmp(str, "sigma") == 0) return (void *) sigma; if (strcmp(str, "sigma") == 0) return (void *) sigma;
return NULL; return nullptr;
} }

View File

@ -19,19 +19,14 @@
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "integrate.h"
#include "kspace.h"
#include "math_const.h" #include "math_const.h"
#include "math_extra.h" #include "math_extra.h"
#include "memory.h" #include "memory.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "neigh_request.h" #include "neigh_request.h"
#include "neighbor.h" #include "neighbor.h"
#include "respa.h"
#include "update.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>

View File

@ -23,15 +23,11 @@
#include "comm.h" #include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fft3d_wrap.h"
#include "force.h" #include "force.h"
#include "gridcomm.h" #include "gridcomm.h"
#include "math_const.h" #include "math_const.h"
#include "math_special.h" #include "math_special.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h"
#include "pair.h"
#include "remap_wrap.h"
#include <cmath> #include <cmath>

View File

@ -21,21 +21,14 @@
#include "angle.h" #include "angle.h"
#include "atom.h" #include "atom.h"
#include "atom_vec_dielectric.h" #include "atom_vec_dielectric.h"
#include "bond.h"
#include "comm.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fft3d_wrap.h"
#include "force.h" #include "force.h"
#include "gridcomm.h" #include "gridcomm.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "neighbor.h"
#include "pair.h"
#include "remap_wrap.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -31,7 +31,6 @@
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
#include <ctime>
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -34,7 +34,6 @@
#include <cfloat> // DBL_EPSILON #include <cfloat> // DBL_EPSILON
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector> // std::vector<>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -59,7 +58,7 @@ namespace /* anonymous */
{ {
typedef double TimerType; typedef double TimerType;
TimerType getTimeStamp(void) { return MPI_Wtime(); } TimerType getTimeStamp() { return MPI_Wtime(); }
double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; } double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; }
} // end namespace } // end namespace
@ -1246,7 +1245,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/,
return (iter + 1); return (iter + 1);
} }
void FixRX::odeDiagnostics(void) void FixRX::odeDiagnostics()
{ {
TimerType timer_start = getTimeStamp(); TimerType timer_start = getTimeStamp();

View File

@ -224,7 +224,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) :
// perform initial allocation of atom-based array // perform initial allocation of atom-based array
// register with Atom class // register with Atom class
grow_arrays(atom->nmax); FixMesoMove::grow_arrays(atom->nmax);
atom->add_callback(Atom::GROW); atom->add_callback(Atom::GROW);
atom->add_callback(Atom::RESTART); atom->add_callback(Atom::RESTART);

View File

@ -25,7 +25,6 @@
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <set> #include <set>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -55,7 +54,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) :
} }
drudeid = nullptr; drudeid = nullptr;
grow_arrays(atom->nmax); FixDrude::grow_arrays(atom->nmax);
atom->add_callback(Atom::GROW); atom->add_callback(Atom::GROW);
atom->add_callback(Atom::RESTART); atom->add_callback(Atom::RESTART);
atom->add_callback(Atom::BORDER); atom->add_callback(Atom::BORDER);
@ -516,7 +515,8 @@ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) {
* ----------------------------------------------------------------------*/ * ----------------------------------------------------------------------*/
void FixDrude::set_arrays(int i) { void FixDrude::set_arrays(int i) {
if (drudetype[atom->type[i]] != NOPOL_TYPE) { if (drudetype[atom->type[i]] != NOPOL_TYPE) {
if (atom->nspecial[i] ==0) error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template"); if (atom->nspecial[i] == nullptr)
error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template");
drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list
} else { } else {
drudeid[i] = 0; drudeid[i] = 0;

View File

@ -24,6 +24,7 @@
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fix_deform.h" #include "fix_deform.h"
#include "fix_drude.h"
#include "force.h" #include "force.h"
#include "irregular.h" #include "irregular.h"
#include "kspace.h" #include "kspace.h"

Some files were not shown because too many files have changed in this diff Show More