diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2686011281..f99a336dbb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -67,6 +67,7 @@ src/EXTRA-COMPUTE/compute_born_matrix.* @Bibobu @athomps src/MISC/*_tracker.* @jtclemm src/MC/fix_gcmc.* @athomps src/MC/fix_sgcmc.* @athomps +src/REPLICA/fix_pimd_langevin.* @Yi-FanLi # core LAMMPS classes src/lammps.* @sjplimp diff --git a/bench/in.chain b/bench/in.chain index 3993357140..d079f8d99f 100644 --- a/bench/in.chain +++ b/bench/in.chain @@ -1,25 +1,25 @@ # FENE beadspring benchmark -units lj -atom_style bond +units lj +atom_style bond special_bonds fene -read_data data.chain +read_data data.chain -neighbor 0.4 bin -neigh_modify every 1 delay 1 +neighbor 0.4 bin +neigh_modify every 1 delay 1 bond_style fene -bond_coeff 1 30.0 1.5 1.0 1.0 +bond_coeff 1 30.0 1.5 1.0 1.0 -pair_style lj/cut 1.12 -pair_modify shift yes -pair_coeff 1 1 1.0 1.0 1.12 +pair_style lj/cut 1.12 +pair_modify shift yes +pair_coeff 1 1 1.0 1.0 1.12 -fix 1 all nve -fix 2 all langevin 1.0 1.0 10.0 904297 +fix 1 all nve +fix 2 all langevin 1.0 1.0 10.0 904297 thermo 100 -timestep 0.012 +timestep 0.012 -run 100 +run 100 diff --git a/bench/in.chain.scaled b/bench/in.chain.scaled index c2648cc0e8..a56a2788ef 100644 --- a/bench/in.chain.scaled +++ b/bench/in.chain.scaled @@ -1,32 +1,32 @@ # FENE beadspring benchmark -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -units lj -atom_style bond -atom_modify map hash +units lj +atom_style bond +atom_modify map hash special_bonds fene -read_data data.chain +read_data data.chain -replicate $x $y $z +replicate $x $y $z -neighbor 0.4 bin -neigh_modify every 1 delay 1 +neighbor 0.4 bin +neigh_modify every 1 delay 1 bond_style fene -bond_coeff 1 30.0 1.5 1.0 1.0 +bond_coeff 1 30.0 1.5 1.0 1.0 -pair_style lj/cut 1.12 -pair_modify shift yes -pair_coeff 1 1 1.0 1.0 1.12 +pair_style lj/cut 1.12 +pair_modify shift yes +pair_coeff 1 1 1.0 1.0 1.12 -fix 1 all nve -fix 2 all langevin 1.0 1.0 10.0 904297 +fix 1 all nve +fix 2 all langevin 1.0 1.0 10.0 904297 thermo 100 -timestep 0.012 +timestep 0.012 -run 100 +run 100 diff --git a/bench/in.chute b/bench/in.chute index 9f7c28ada3..2478e98c96 100644 --- a/bench/in.chute +++ b/bench/in.chute @@ -1,33 +1,33 @@ # LAMMPS benchmark of granular flow # chute flow of 32000 atoms with frozen base at 26 degrees -units lj -atom_style sphere -boundary p p fs -newton off -comm_modify vel yes +units lj +atom_style sphere +boundary p p fs +newton off +comm_modify vel yes -read_data data.chute +read_data data.chute -pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0 -pair_coeff * * +pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0 +pair_coeff * * -neighbor 0.1 bin -neigh_modify every 1 delay 0 +neighbor 0.1 bin +neigh_modify every 1 delay 0 -timestep 0.0001 +timestep 0.0001 -group bottom type 2 -group active subtract all bottom -neigh_modify exclude group bottom bottom +group bottom type 2 +group active subtract all bottom +neigh_modify exclude group bottom bottom -fix 1 all gravity 1.0 chute 26.0 -fix 2 bottom freeze -fix 3 active nve/sphere +fix 1 all gravity 1.0 chute 26.0 +fix 2 bottom freeze +fix 3 active nve/sphere -compute 1 all erotate/sphere -thermo_style custom step atoms ke c_1 vol -thermo_modify norm no -thermo 100 +compute 1 all erotate/sphere +thermo_style custom step atoms ke c_1 vol +thermo_modify norm no +thermo 100 -run 100 +run 100 diff --git a/bench/in.chute.scaled b/bench/in.chute.scaled index 7bac8fe12d..09a6921145 100644 --- a/bench/in.chute.scaled +++ b/bench/in.chute.scaled @@ -1,38 +1,38 @@ # LAMMPS benchmark of granular flow # chute flow of 32000 atoms with frozen base at 26 degrees -variable x index 1 -variable y index 1 +variable x index 1 +variable y index 1 -units lj -atom_style sphere -boundary p p fs -newton off -comm_modify vel yes +units lj +atom_style sphere +boundary p p fs +newton off +comm_modify vel yes -read_data data.chute +read_data data.chute -replicate $x $y 1 +replicate $x $y 1 -pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0 -pair_coeff * * +pair_style gran/hooke/history 200000.0 NULL 50.0 NULL 0.5 0 +pair_coeff * * -neighbor 0.1 bin -neigh_modify every 1 delay 0 +neighbor 0.1 bin +neigh_modify every 1 delay 0 -timestep 0.0001 +timestep 0.0001 -group bottom type 2 -group active subtract all bottom -neigh_modify exclude group bottom bottom +group bottom type 2 +group active subtract all bottom +neigh_modify exclude group bottom bottom -fix 1 all gravity 1.0 chute 26.0 -fix 2 bottom freeze -fix 3 active nve/sphere +fix 1 all gravity 1.0 chute 26.0 +fix 2 bottom freeze +fix 3 active nve/sphere -compute 1 all erotate/sphere -thermo_style custom step atoms ke c_1 vol -thermo_modify norm no -thermo 100 +compute 1 all erotate/sphere +thermo_style custom step atoms ke c_1 vol +thermo_modify norm no +thermo 100 -run 100 +run 100 diff --git a/bench/in.eam b/bench/in.eam index 1dc0e1a646..b681ab9163 100644 --- a/bench/in.eam +++ b/bench/in.eam @@ -1,32 +1,32 @@ # bulk Cu lattice -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -units metal -atom_style atomic +units metal +atom_style atomic -lattice fcc 3.615 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box +lattice fcc 3.615 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box -pair_style eam -pair_coeff 1 1 Cu_u3.eam +pair_style eam +pair_coeff 1 1 Cu_u3.eam -velocity all create 1600.0 376847 loop geom +velocity all create 1600.0 376847 loop geom -neighbor 1.0 bin +neighbor 1.0 bin neigh_modify every 1 delay 5 check yes -fix 1 all nve +fix 1 all nve -timestep 0.005 -thermo 50 +timestep 0.005 +thermo 50 -run 100 +run 100 diff --git a/bench/in.lj b/bench/in.lj index 01e12ef8a9..7945e67fa5 100644 --- a/bench/in.lj +++ b/bench/in.lj @@ -1,30 +1,30 @@ # 3d Lennard-Jones melt -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -variable xx equal 20*$x -variable yy equal 20*$y -variable zz equal 20*$z +variable xx equal 20*$x +variable yy equal 20*$y +variable zz equal 20*$z -units lj -atom_style atomic +units lj +atom_style atomic -lattice fcc 0.8442 -region box block 0 ${xx} 0 ${yy} 0 ${zz} -create_box 1 box -create_atoms 1 box -mass 1 1.0 +lattice fcc 0.8442 +region box block 0 ${xx} 0 ${yy} 0 ${zz} +create_box 1 box +create_atoms 1 box +mass 1 1.0 -velocity all create 1.44 87287 loop geom +velocity all create 1.44 87287 loop geom -pair_style lj/cut 2.5 -pair_coeff 1 1 1.0 1.0 2.5 +pair_style lj/cut 2.5 +pair_coeff 1 1 1.0 1.0 2.5 -neighbor 0.3 bin -neigh_modify delay 0 every 20 check no +neighbor 0.3 bin +neigh_modify delay 0 every 20 check no -fix 1 all nve +fix 1 all nve -run 100 +run 100 diff --git a/bench/in.rhodo b/bench/in.rhodo index bd7e3df7f5..2f34b2721b 100644 --- a/bench/in.rhodo +++ b/bench/in.rhodo @@ -1,27 +1,27 @@ # Rhodopsin model -units real -neigh_modify delay 5 every 1 +units real +neigh_modify delay 5 every 1 -atom_style full -bond_style harmonic -angle_style charmm -dihedral_style charmm -improper_style harmonic -pair_style lj/charmm/coul/long 8.0 10.0 -pair_modify mix arithmetic -kspace_style pppm 1e-4 +atom_style full +bond_style harmonic +angle_style charmm +dihedral_style charmm +improper_style harmonic +pair_style lj/charmm/coul/long 8.0 10.0 +pair_modify mix arithmetic +kspace_style pppm 1e-4 read_data data.rhodo fix 1 all shake 0.0001 5 0 m 1.0 a 232 fix 2 all npt temp 300.0 300.0 100.0 & - z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1 + z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1 special_bonds charmm - + thermo 50 -thermo_style multi +thermo_style multi timestep 2.0 -run 100 +run 100 diff --git a/bench/in.rhodo.scaled b/bench/in.rhodo.scaled index 3debe44867..49a0864fb9 100644 --- a/bench/in.rhodo.scaled +++ b/bench/in.rhodo.scaled @@ -1,34 +1,34 @@ # Rhodopsin model -variable x index 1 -variable y index 1 -variable z index 1 +variable x index 1 +variable y index 1 +variable z index 1 -units real -neigh_modify delay 5 every 1 +units real +neigh_modify delay 5 every 1 -atom_style full -atom_modify map hash -bond_style harmonic -angle_style charmm -dihedral_style charmm -improper_style harmonic -pair_style lj/charmm/coul/long 8.0 10.0 -pair_modify mix arithmetic -kspace_style pppm 1e-4 +atom_style full +atom_modify map hash +bond_style harmonic +angle_style charmm +dihedral_style charmm +improper_style harmonic +pair_style lj/charmm/coul/long 8.0 10.0 +pair_modify mix arithmetic +kspace_style pppm 1e-4 read_data data.rhodo -replicate $x $y $z +replicate $x $y $z fix 1 all shake 0.0001 5 0 m 1.0 a 232 fix 2 all npt temp 300.0 300.0 100.0 & - z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1 + z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1 special_bonds charmm - + thermo 50 -thermo_style multi +thermo_style multi timestep 2.0 -run 100 +run 100 diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 1c05e32d0c..f9c5b74589 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -435,7 +435,7 @@ if(BUILD_OMP) target_link_libraries(lmp PRIVATE OpenMP::OpenMP_CXX) endif() -if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE) +if(PKG_MSCG OR PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS) enable_language(C) if (NOT USE_INTERNAL_LINALG) find_package(LAPACK) diff --git a/cmake/Modules/CodingStandard.cmake b/cmake/Modules/CodingStandard.cmake index 6bb607be12..4efd373d22 100644 --- a/cmake/Modules/CodingStandard.cmake +++ b/cmake/Modules/CodingStandard.cmake @@ -5,6 +5,10 @@ if(CMAKE_VERSION VERSION_LESS 3.12) set(Python3_VERSION ${PYTHON_VERSION_STRING}) endif() else() + # use default (or custom) Python executable, if version is sufficient + if(Python_VERSION VERSION_GREATER_EQUAL 3.5) + set(Python3_EXECUTABLE ${Python_EXECUTABLE}) + endif() find_package(Python3 COMPONENTS Interpreter QUIET) endif() diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 46295feea3..0b01407cd9 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -4,14 +4,18 @@ option(BUILD_DOC "Build LAMMPS HTML documentation" OFF) if(BUILD_DOC) - # Sphinx 3.x requires at least Python 3.5 + # Current Sphinx versions require at least Python 3.8 if(CMAKE_VERSION VERSION_LESS 3.12) - find_package(PythonInterp 3.5 REQUIRED) + find_package(PythonInterp 3.8 REQUIRED) set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv) else() + # use default (or custom) Python executable, if version is sufficient + if(Python_VERSION VERSION_GREATER_EQUAL 3.8) + set(Python3_EXECUTABLE ${Python_EXECUTABLE}) + endif() find_package(Python3 REQUIRED COMPONENTS Interpreter) - if(Python3_VERSION VERSION_LESS 3.5) - message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation") + if(Python3_VERSION VERSION_LESS 3.8) + message(FATAL_ERROR "Python 3.8 and up is required to build the HTML documentation") endif() set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) endif() diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index aa93e0cd7c..8b695667ae 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -49,8 +49,8 @@ if(DOWNLOAD_KOKKOS) list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}") list(APPEND KOKKOS_LIB_BUILD_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") include(ExternalProject) - set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.01.tar.gz" CACHE STRING "URL for KOKKOS tarball") - set(KOKKOS_MD5 "f140e02b826223b1045207d9bc10d404" CACHE STRING "MD5 checksum of KOKKOS tarball") + set(KOKKOS_URL "https://github.com/kokkos/kokkos/archive/3.7.02.tar.gz" CACHE STRING "URL for KOKKOS tarball") + set(KOKKOS_MD5 "34d7860d548c06a4040236d959c9f99a" CACHE STRING "MD5 checksum of KOKKOS tarball") mark_as_advanced(KOKKOS_URL) mark_as_advanced(KOKKOS_MD5) GetFallbackURL(KOKKOS_URL KOKKOS_FALLBACK) @@ -75,7 +75,7 @@ if(DOWNLOAD_KOKKOS) add_dependencies(LAMMPS::KOKKOSCORE kokkos_build) add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build) elseif(EXTERNAL_KOKKOS) - find_package(Kokkos 3.7.01 REQUIRED CONFIG) + find_package(Kokkos 3.7.02 REQUIRED CONFIG) target_link_libraries(lammps PRIVATE Kokkos::kokkos) else() set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos) diff --git a/cmake/Modules/Tools.cmake b/cmake/Modules/Tools.cmake index bc3372f2ae..81d6d66aff 100644 --- a/cmake/Modules/Tools.cmake +++ b/cmake/Modules/Tools.cmake @@ -33,6 +33,8 @@ if(BUILD_TOOLS) endif() install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + + add_subdirectory(${LAMMPS_TOOLS_DIR}/phonon ${CMAKE_BINARY_DIR}/phana_build) endif() if(BUILD_LAMMPS_SHELL) diff --git a/doc/lammps.1 b/doc/lammps.1 index b1be867e60..9bc107624f 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,7 +1,7 @@ -.TH LAMMPS "1" "28 March 2023" "2023-03-28" +.TH LAMMPS "1" "15 June 2023" "2023-06-15" .SH NAME .B LAMMPS -\- Molecular Dynamics Simulator. Version 28 March 2023 +\- Molecular Dynamics Simulator. Version 15 June 2023 .SH SYNOPSIS .B lmp diff --git a/doc/src/Build_make.rst b/doc/src/Build_make.rst index f1e34bbc55..f6764100e0 100644 --- a/doc/src/Build_make.rst +++ b/doc/src/Build_make.rst @@ -117,8 +117,8 @@ their settings may become outdated, too: .. code-block:: bash - make mac # build serial LAMMPS on a Mac - make mac_mpi # build parallel LAMMPS on a Mac + make mac # build serial LAMMPS on macOS + make mac_mpi # build parallel LAMMPS on macOS make intel_cpu # build with the INTEL package optimized for CPUs make knl # build with the INTEL package optimized for KNLs make opt # build with the OPT package optimized for CPUs diff --git a/doc/src/Build_manual.rst b/doc/src/Build_manual.rst index d86ad85827..4b4bfa5a45 100644 --- a/doc/src/Build_manual.rst +++ b/doc/src/Build_manual.rst @@ -53,10 +53,10 @@ incorporates programmer documentation extracted from the LAMMPS C++ sources through the `Doxygen `_ program. Currently the translation to HTML, PDF (via LaTeX), ePUB (for many e-book readers) and MOBI (for Amazon Kindle readers) are supported. For that to work a -Python 3 interpreter, the ``doxygen`` tools and internet access to -download additional files and tools are required. This download is -usually only required once or after the documentation folder is returned -to a pristine state with ``make clean-all``. +Python interpreter version 3.8 or later, the ``doxygen`` tools and +internet access to download additional files and tools are required. +This download is usually only required once or after the documentation +folder is returned to a pristine state with ``make clean-all``. For the documentation build a python virtual environment is set up in the folder ``doc/docenv`` and various python packages are installed into diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index 2f9c8b03fb..9066531459 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -46,6 +46,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`com/chunk ` * :doc:`contact/atom ` * :doc:`coord/atom (k) ` + * :doc:`count/type ` * :doc:`damage/atom ` * :doc:`dihedral ` * :doc:`dihedral/local ` @@ -152,11 +153,11 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`sph/t/atom ` * :doc:`spin ` * :doc:`stress/atom ` - * :doc:`stress/cartesian ` - * :doc:`stress/cylinder ` + * :doc:`stress/cartesian ` + * :doc:`stress/cylinder ` * :doc:`stress/mop ` * :doc:`stress/mop/profile ` - * :doc:`stress/spherical ` + * :doc:`stress/spherical ` * :doc:`stress/tally ` * :doc:`tdpd/cc/atom ` * :doc:`temp (k) ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index c74b1fd037..6fe321e3c9 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -171,6 +171,7 @@ OPT. * :doc:`pafi ` * :doc:`pair ` * :doc:`phonon ` + * :doc:`pimd/langevin ` * :doc:`pimd/nvt ` * :doc:`planeforce ` * :doc:`plumed ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 5f79015aaf..c45a1d778c 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -37,6 +37,7 @@ OPT. * * :doc:`adp (ko) ` * :doc:`agni (o) ` + * :doc:`aip/water/2dm (t) ` * :doc:`airebo (io) ` * :doc:`airebo/morse (io) ` * :doc:`amoeba (g) ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index d50eab3a41..1848a28024 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -41,7 +41,7 @@ warning. LATTE package ------------- -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The LATTE package with the fix latte command was removed from LAMMPS. This functionality has been superseded by :doc:`fix mdi/qm ` diff --git a/doc/src/Developer.rst b/doc/src/Developer.rst index 406dd26f59..b0cfcc14fc 100644 --- a/doc/src/Developer.rst +++ b/doc/src/Developer.rst @@ -13,6 +13,7 @@ of time and requests from the LAMMPS user community. Developer_org Developer_code_design Developer_parallel + Developer_atom Developer_comm_ops Developer_flow Developer_write diff --git a/doc/src/Developer_atom.rst b/doc/src/Developer_atom.rst new file mode 100644 index 0000000000..8bc187ae7f --- /dev/null +++ b/doc/src/Developer_atom.rst @@ -0,0 +1,88 @@ +Accessing per-atom data +----------------------- + +This page discusses how per-atom data is managed in LAMMPS, how it can +be accessed, what communication patters apply, and some of the utility +functions that exist for a variety of purposes. + + +Owned and ghost atoms +^^^^^^^^^^^^^^^^^^^^^ + +As described on the :doc:`parallel partitioning algorithms +` page, LAMMPS uses a domain decomposition of the +simulation domain, either in a *brick* or *tiled* manner. Each MPI +process *owns* exactly one subdomain and the atoms within it. To compute +forces for tuples of atoms that are spread across sub-domain boundaries, +also a "halo" of *ghost* atoms are maintained within a the communication +cutoff distance of its subdomain. + +The total number of atoms is stored in `Atom::natoms` (within any +typical class this can be referred to at `atom->natoms`. The number of +*owned* (or "local" atoms) are stored in `Atom::nlocal`; the number of +*ghost* atoms is stored in `Atom::nghost`. The sum of `Atom::nlocal` +over all MPI processes should be `Atom::natoms`. This is by default +regularly checked by the Thermo class, and if the sum does not match, +LAMMPS stops with a "lost atoms" error. For convenience also the +property `Atom::nmax` is available, this is the maximum of +`Atom::nlocal + Atom::nghost` across all MPI processes. + +Per-atom properties are either managed by the atom style, or individual +classes. or as custom arrays by the individual classes. If only access +to *owned* atoms is needed, they are usually allocated to be of size +`Atom::nlocal`, otherwise of size `Atom::nmax`. Please note that not all +per-atom properties are available or updated on *ghost* atoms. For +example, per-atom velocities are only updated with :doc:`comm_modify vel +yes `. + + +Atom indexing +^^^^^^^^^^^^^ + +When referring to individual atoms, they may be indexed by their local +*index*, their index in their `Atom::x` array. This is densely populated +containing first all *owned* atoms (index < `Atom::nlocal`) and then all +*ghost* atoms. The order of atoms in these arrays can change due to +atoms migrating between between subdomains, atoms being added or +deleted, or atoms being sorted for better cache efficiency. Atoms are +globally uniquely identified by their *atom ID*. There may be multiple +atoms with the same atom ID present, but only one of them may be an +*owned* atom. + +To find the local *index* of an atom, when the *atom ID* is known, the +`Atom::map()` function may be used. It will return the local atom index +or -1. If the returned value is between 0 (inclusive) and `Atom::nlocal` +(exclusive) it is an *owned* or "local" atom; for larger values the atom +is present as a ghost atom; for a value of -1, the atom is not present +on the current subdomain at all. + +If multiple atoms with the same tag exist in the same subdomain, they +can be found via the `Atom::sametag` array. It points to the next atom +index with the same tag or -1 if there are no more atoms with the same +tag. The list will be exhaustive when starting with an index of an +*owned* atom, since the atom IDs are unique, so there can only be one +such atom. Example code to count atoms with same atom ID in subdomain: + +.. code-block:: c++ + + for (int i = 0; i < atom->nlocal; ++i) { + int count = 0; + while (sametag[i] >= 0) { + i = sametag[i]; + ++count; + } + printf("Atom ID: %ld is present %d times\n", atom->tag[i], count); + } + +Atom class versus AtomVec classes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The `Atom` class contains all kinds of flags and counters about atoms in +the system and that includes pointers to **all** per-atom properties +available for atoms. However, only a subset of these pointers are +non-NULL and which those are depends on the atom style. For each atom +style there is a corresponding `AtomVecXXX` class derived from the +`AtomVec` base class, where the XXX indicates the atom style. This +`AtomVecXXX` class will update the counters and per-atom pointers if +atoms are added or removed to the system or migrate between subdomains. + diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst index 42840c62ee..913c31842e 100644 --- a/doc/src/Fortran.rst +++ b/doc/src/Fortran.rst @@ -56,17 +56,6 @@ C++ in the ``examples/COUPLE/simple`` folder of the LAMMPS distribution. and Ubuntu 18.04 LTS and not compatible. Either newer compilers need to be installed or the Linux updated. -.. versionchanged:: 8Feb2023 - -.. note:: - - A contributed Fortran interface is available in the - ``examples/COUPLE/fortran2`` folder. However, since the completion - of the :f:mod:`LIBLAMMPS` module, this interface is now deprecated, - no longer actively maintained and will likely be removed in the - future. Please see the ``README`` file in that folder for more - information about it and how to contact its author and maintainer. - ---------- Creating or deleting a LAMMPS object @@ -203,40 +192,62 @@ Below is an example demonstrating some of the possible uses. .. code-block:: fortran - PROGRAM testprop - USE LIBLAMMPS - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t - USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT - TYPE(lammps) :: lmp - INTEGER(KIND=c_int64_t), POINTER :: natoms - REAL(KIND=c_double), POINTER :: dt - INTEGER(KIND=c_int64_t), POINTER :: ntimestep - REAL(KIND=c_double) :: pe, ke + PROGRAM testprop + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : OUTPUT_UNIT + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: natoms, ntimestep, bval + REAL(KIND=c_double), POINTER :: dt, dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + REAL(KIND=c_double) :: pe, ke - lmp = lammps() - CALL lmp%file('in.sysinit') - natoms = lmp%extract_global('natoms') - WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' - WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & - ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & - lmp%extract_setting('ntypes'), ' atom types' + lmp = lammps() + CALL lmp%file('in.sysinit') + natoms = lmp%extract_global('natoms') + WRITE(OUTPUT_UNIT,'(A,I0,A)') 'Running a simulation with ', natoms, ' atoms' + WRITE(OUTPUT_UNIT,'(I0,A,I0,A,I0,A)') lmp%extract_setting('nlocal'), & + ' local and ', lmp%extract_setting('nghost'), ' ghost atoms. ', & + lmp%extract_setting('ntypes'), ' atom types' - CALL lmp%command('run 2 post no') - dt = lmp%extract_global('dt') - ntimestep = lmp%extract_global('ntimestep') - WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & - ' Changing timestep from', dt, ' to 0.5' - dt = 0.5_c_double - CALL lmp%command('run 2 post no') + CALL lmp%command('run 2 post no') - WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep - pe = lmp%get_thermo('pe') - ke = lmp%get_thermo('ke') - PRINT*, 'PE = ', pe - PRINT*, 'KE = ', ke + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + WRITE(OUTPUT_UNIT,'(A,I0,A,I0)') 'Last thermo output on step: ', ntimestep, & + ', number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + WRITE(OUTPUT_UNIT,*) key, ':', dval + END IF + END DO - CALL lmp%close(.TRUE.) - END PROGRAM testprop + dt = lmp%extract_global('dt') + ntimestep = lmp%extract_global('ntimestep') + WRITE(OUTPUT_UNIT,'(A,I0,A,F4.1,A)') 'At step: ', ntimestep, & + ' Changing timestep from', dt, ' to 0.5' + dt = 0.5_c_double + CALL lmp%command('run 2 post no') + + WRITE(OUTPUT_UNIT,'(A,I0)') 'At step: ', ntimestep + pe = lmp%get_thermo('pe') + ke = lmp%get_thermo('ke') + WRITE(OUTPUT_UNIT,*) 'PE = ', pe + WRITE(OUTPUT_UNIT,*) 'KE = ', ke + + CALL lmp%close(.TRUE.) + END PROGRAM testprop --------------- @@ -262,6 +273,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype style: type(lammps_style) :f type: derived type to access lammps type constants :ftype type: type(lammps_type) + :f dtype: derived type to access lammps data type constants + :ftype dtype: type(lammps_dtype) :f close: :f:subr:`close` :ftype close: subroutine :f subroutine error: :f:subr:`error` @@ -278,6 +291,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS. :ftype get_natoms: function :f get_thermo: :f:func:`get_thermo` :ftype get_thermo: function + :f last_thermo: :f:func:`last_thermo` + :ftype last_thermo: function :f extract_box: :f:subr:`extract_box` :ftype extract_box: subroutine :f reset_box: :f:subr:`reset_box` @@ -587,6 +602,96 @@ Procedures Bound to the :f:type:`lammps` Derived Type -------- +.. f:function:: last_thermo(what, index) + + This function will call :cpp:func:`lammps_last_thermo` and returns + either a string or a pointer to a cached copy of LAMMPS last thermodynamic + output, depending on the data requested through *what*. Note that *index* + uses 1-based indexing to access thermo output columns. + + .. versionadded:: 15Jun2023 + + Note that this function actually does not return a value, but rather + associates the pointer on the left side of the assignment to point to + internal LAMMPS data (with the exception of string data, which are + copied and returned as ordinary Fortran strings). Pointers must be + of the correct data type to point to said data (typically + ``INTEGER(c_int)``, ``INTEGER(c_int64_t)``, or ``REAL(c_double)``). + The pointer being associated with LAMMPS data is type-checked at + run-time via an overloaded assignment operator. The pointers + returned by this function point to temporary, read-only data that may + be overwritten at any time, so their target values need to be copied + to local storage if they are supposed to persist. + + For example, + + .. code-block:: fortran + + PROGRAM thermo + USE LIBLAMMPS + USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_double, c_int64_t, c_int + TYPE(lammps) :: lmp + INTEGER(KIND=c_int64_t), POINTER :: ntimestep, bval + REAL(KIND=c_double), POINTER :: dval + INTEGER(KIND=c_int), POINTER :: nfield, typ, ival + INTEGER(KIND=c_int) :: i + CHARACTER(LEN=11) :: key + + lmp = lammps() + CALL lmp%file('in.sysinit') + + ntimestep = lmp%last_thermo('step', 0) + nfield = lmp%last_thermo('num', 0) + PRINT*, 'Last thermo output on step: ', ntimestep, ' Number of fields: ', nfield + DO i=1, nfield + key = lmp%last_thermo('keyword',i) + typ = lmp%last_thermo('type',i) + IF (typ == lmp%dtype%i32) THEN + ival = lmp%last_thermo('data',i) + PRINT*, key, ':', ival + ELSE IF (typ == lmp%dtype%i64) THEN + bval = lmp%last_thermo('data',i) + PRINT*, key, ':', bval + ELSE IF (typ == lmp%dtype%r64) THEN + dval = lmp%last_thermo('data',i) + PRINT*, key, ':', dval + END IF + END DO + CALL lmp%close(.TRUE.) + END PROGRAM thermo + + would extract the last timestep where thermo output was done and the number + of columns it printed. Then it loops over the columns to print out column + header keywords and the corresponding data. + + .. note:: + + If :f:func:`last_thermo` returns a string, the string must have a length + greater than or equal to the length of the string (not including the + terminal ``NULL`` character) that LAMMPS returns. If the variable's + length is too short, the string will be truncated. As usual in Fortran, + strings are padded with spaces at the end. If you use an allocatable + string, the string **must be allocated** prior to calling this function. + + :p character(len=\*) what: string with the name of the thermo keyword + :p integer(c_int) index: 1-based column index + :to: :cpp:func:`lammps_last_thermo` + :r pointer [polymorphic]: pointer to LAMMPS data. The left-hand side of the + assignment should be either a string (if expecting string data) or a + C-compatible pointer (e.g., ``INTEGER(c_int), POINTER :: nlocal``) to the + extracted property. + + .. warning:: + + Modifying the data in the location pointed to by the returned pointer + may lead to inconsistent internal data and thus may cause failures, + crashes, or bogus simulations. In general, it is much better + to use a LAMMPS input command that sets or changes these parameters. + Using an input command will take care of all side effects and necessary + updates of settings derived from such settings. + +-------- + .. f:subroutine:: extract_box([boxlo][, boxhi][, xy][, yz][, xz][, pflags][, boxflag]) This subroutine will call :cpp:func:`lammps_extract_box`. All @@ -764,13 +869,14 @@ Procedures Bound to the :f:type:`lammps` Derived Type .. note:: - If :f:func:`extract_global` returns a string, the string must have length - greater than or equal to the length of the string (not including the - terminal ``NULL`` character) that LAMMPS returns. If the variable's - length is too short, the string will be truncated. As usual in Fortran, - strings are padded with spaces at the end. If you use an allocatable - string, the string **must be allocated** prior to calling this function, - but you can automatically reallocate it to the correct length after the + If :f:func:`extract_global` returns a string, the string must have + a length greater than or equal to the length of the string (not + including the terminal ``NULL`` character) that LAMMPS returns. If + the variable's length is too short, the string will be + truncated. As usual in Fortran, strings are padded with spaces at + the end. If you use an allocatable string, the string **must be + allocated** prior to calling this function, but you can + automatically reallocate it to the correct length after the function returns, viz., .. code-block :: fortran diff --git a/doc/src/Howto_broken_bonds.rst b/doc/src/Howto_broken_bonds.rst index 88c8acb87f..2eb9f4bdf4 100644 --- a/doc/src/Howto_broken_bonds.rst +++ b/doc/src/Howto_broken_bonds.rst @@ -1,48 +1,56 @@ Broken Bonds ============ -Typically, bond interactions persist for the duration of a simulation in -LAMMPS. However, there are some exceptions that allow for bonds to -break, including the :doc:`quartic bond style ` and the -bond styles in the :doc:`BPM package ` which contains the -:doc:`bpm/spring ` and :doc:`bpm/rotational -` bond styles. In these cases, a bond can be broken -if it is stretched beyond a user-defined threshold. LAMMPS accomplishes -this by setting the bond type to 0, such that the bond force is no -longer computed. +Typically, molecular bond interactions persist for the duration of a +simulation in LAMMPS. However, some commands break bonds dynamically, +including the following: -Users are normally able to weight the contribution of pair forces to atoms -that are bonded using the :doc:`special_bonds command `. -When bonds break, this is not always the case. For the quartic bond style, -pair forces are always turned off between bonded particles. LAMMPS does -this via a computational sleight-of-hand. It subtracts the pairwise -interaction as part of the bond computation. When the bond breaks, the -subtraction stops. For this to work, the pairwise interaction must always -be computed by the :doc:`pair_style ` command, whether the bond -is broken or not. This means that :doc:`special_bonds ` must -be set to 1,1,1. After the bond breaks, the pairwise interaction between the -two atoms is turned on, since they are no longer bonded. +* :doc:`bond_style quartic ` +* :doc:`fix bond/break ` +* :doc:`fix bond/react ` +* :doc:`BPM package ` bond styles -In the BPM package, one can either turn off all pair interactions between -bonded particles or leave them on, overlaying pair forces on top of bond -forces. To remove pair forces, the special bond list is dynamically -updated. More details can be found on the :doc:`Howto BPM ` -page. +A bond can break if it is stretched beyond a user-defined threshold or +more generally if other criteria are met. -Bonds can also be broken by fixes which change bond topology, including -:doc:`fix bond/break ` and -:doc:`fix bond/react `. These fixes will automatically -trigger a rebuild of the neighbor list and update special bond data structures -when bonds are broken. +For the quartic bond style, when a bond is broken its bond type is set +to 0 to effectively break it and pairwise forces between the two atoms +in the broken bond are "turned on". Angles, dihedrals, etc cannot be +defined for a system when :doc:`bond_style quartic ` is +used. -Note that when bonds are dumped to a file via the :doc:`dump local ` command, bonds with type 0 are not included. The -:doc:`delete_bonds ` command can also be used to query the -status of broken bonds or permanently delete them, e.g.: +Similarly, bond styles in the BPM package are also incompatible with +angles, dihedrals, etc. and when a bond breaks its type is set to zero. +However, in the BPM package one can either turn off all pair interactions +between bonded particles or leave them on, overlaying pair forces on +top of bond forces. To remove pair forces, the special bond list is +dynamically updated. More details can be found on the :doc:`Howto BPM +` page. + +The :doc:`fix bond/break ` and :doc:`fix bond/react +` commands allow breaking of bonds within a molecular +topology with may also define angles, dihedrals, etc. These commands +update internal topology data structures to remove broken bonds, as +well as the appropriate angle, dihedral, etc interactions which +include the bond. They also trigger a rebuild of the neighbor list +when this occurs, to turn on the appropriate pairwise forces. + +Note that when bonds are dumped to a file via the :doc:`dump local +` command, bonds with type 0 are not included. + +The :doc:`delete_bonds ` command can be used to query +the status of broken bonds with type = 0 or permanently delete them, +e.g.: .. code-block:: LAMMPS delete_bonds all stats delete_bonds all bond 0 remove -The compute :doc:`nbond/atom ` can also be used -to tally the current number of bonds per atom, excluding broken bonds. +The compute :doc:`count/type ` command tallies the +current number of bonds (or angles, etc) for each bond (angle, etc) +type. It also tallies broken bonds with type = 0. + +The compute :doc:`nbond/atom ` command tallies the +current number of bonds each atom is part of, excluding broken bonds +with type = 0. diff --git a/doc/src/Howto_spc.rst b/doc/src/Howto_spc.rst index 6414d3b846..6dedfe40c4 100644 --- a/doc/src/Howto_spc.rst +++ b/doc/src/Howto_spc.rst @@ -69,15 +69,13 @@ SPC/E with rigid bonds. timestep 1.0 fix rigid all shake 0.0001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no - reset_timestep 0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300.0 300.0 1.0 + fix integrate all nvt temp 300.0 300.0 100.0 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 upto - write_data tip4p.data nocoeff + write_data spce.data nocoeff .. _spce_molecule: .. code-block:: diff --git a/doc/src/Howto_tip3p.rst b/doc/src/Howto_tip3p.rst index 682c7f2640..5419b9ba1b 100644 --- a/doc/src/Howto_tip3p.rst +++ b/doc/src/Howto_tip3p.rst @@ -128,11 +128,11 @@ TIP3P with rigid bonds. fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe diff --git a/doc/src/Howto_tip4p.rst b/doc/src/Howto_tip4p.rst index 7775d43e76..4d9b514e0d 100644 --- a/doc/src/Howto_tip4p.rst +++ b/doc/src/Howto_tip4p.rst @@ -180,17 +180,17 @@ file changed): fix rigid all shake 0.001 10 10000 b 1 a 1 minimize 0.0 0.0 1000 10000 - run 0 post no reset_timestep 0 + timestep 1.0 velocity all create 300.0 5463576 - fix integrate all nvt temp 300 300 1.0 + fix integrate all nvt temp 300 300 100.0 thermo_style custom step temp press etotal pe thermo 1000 run 20000 - write_data tip3p.data nocoeff + write_data tip4p-implicit.data nocoeff Below is the code for a LAMMPS input file using the explicit method and a TIP4P molecule file. Because of using :doc:`fix rigid/nvt/small @@ -203,6 +203,7 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -219,14 +220,14 @@ rigid/nvt/small can identify rigid bodies by their molecule ID: molecule water tip4p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.1 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 velocity all create 300.0 5463576 thermo_style custom step temp press etotal density pe ke thermo 1000 run 20000 - write_data tip4p.data nocoeff + write_data tip4p-explicit.data nocoeff .. _tip4p_molecule: .. code-block:: diff --git a/doc/src/Howto_tip5p.rst b/doc/src/Howto_tip5p.rst index 21cc78a684..10674a04b6 100644 --- a/doc/src/Howto_tip5p.rst +++ b/doc/src/Howto_tip5p.rst @@ -91,6 +91,7 @@ ID: units real atom_style charge + atom_modify map array region box block -5 5 -5 5 -5 5 create_box 3 box @@ -107,8 +108,8 @@ ID: molecule water tip5p.mol create_atoms 0 random 33 34564 NULL mol water 25367 overlap 1.33 - timestep 0.20 - fix integrate all rigid/nvt/small molecule temp 300.0 300.0 1.0 + timestep 0.5 + fix integrate all rigid/nvt/small molecule temp 300.0 300.0 100.0 reset_timestep 0 velocity all create 300.0 5463576 diff --git a/doc/src/Install_conda.rst b/doc/src/Install_conda.rst index 5140e4e17d..a1a7213609 100644 --- a/doc/src/Install_conda.rst +++ b/doc/src/Install_conda.rst @@ -1,13 +1,13 @@ -Download an executable for Linux or Mac via Conda -------------------------------------------------- +Download an executable for Linux or macOS via Conda +--------------------------------------------------- Pre-compiled LAMMPS binaries are available for macOS and Linux via the `Conda `_ package management system. -First, one must set up the Conda package manager on your system. Follow the -instructions to install `Miniconda `_, then create a conda -environment (named `my-lammps-env` or whatever you prefer) for your LAMMPS -install: +First, one must set up the Conda package manager on your system. Follow +the instructions to install `Miniconda `_, then +create a conda environment (named `my-lammps-env` or whatever you +prefer) for your LAMMPS install: .. code-block:: bash diff --git a/doc/src/Install_mac.rst b/doc/src/Install_mac.rst index 8228b5a4e5..880ddca7a2 100644 --- a/doc/src/Install_mac.rst +++ b/doc/src/Install_mac.rst @@ -1,12 +1,12 @@ -Download an executable for Mac ------------------------------- +Download an executable for macOS +-------------------------------- -LAMMPS can be downloaded, built, and configured for OS X on a Mac with -`Homebrew `_. (Alternatively, see the installation -instructions for :doc:`downloading an executable via Conda -`.) The following LAMMPS packages are unavailable at -this time because of additional requirements not yet met: GPU, KOKKOS, -MSCG, MPIIO, POEMS, VORONOI. +LAMMPS can be downloaded, built, and configured for macOS with `Homebrew +`_. (Alternatively, see the installation instructions for +:doc:`downloading an executable via Conda `.) The +following LAMMPS packages are unavailable at this time because of +additional requirements not yet met: GPU, KOKKOS, MSCG, MPIIO, POEMS, +VORONOI. After installing Homebrew, you can install LAMMPS on your system with the following commands: @@ -15,8 +15,9 @@ the following commands: brew install lammps -This will install the executables "lammps_serial" and "lammps_mpi", as well as -the LAMMPS "doc", "potentials", "tools", "bench", and "examples" directories. +This will install the executables "lammps_serial" and "lammps_mpi", as +well as the LAMMPS "doc", "potentials", "tools", "bench", and "examples" +directories. Once LAMMPS is installed, you can test the installation with the Lennard-Jones benchmark file: diff --git a/doc/src/Install_tarball.rst b/doc/src/Install_tarball.rst index 64d73ee356..90dd27fa67 100644 --- a/doc/src/Install_tarball.rst +++ b/doc/src/Install_tarball.rst @@ -2,7 +2,7 @@ Download source and documentation as a tarball ---------------------------------------------- You can download a current LAMMPS tarball from the `download page `_ -of the `LAMMPS website `_. +of the `LAMMPS website `_ or from GitHub (see below). .. _download: https://www.lammps.org/download.html .. _bug: https://www.lammps.org/bug.html @@ -17,21 +17,21 @@ tarball occasionally updated. Feature releases occur every 4 to 8 weeks. The new contents in all feature releases are listed on the `bug and feature page `_ of the LAMMPS homepage. -Both tarballs include LAMMPS documentation (HTML and PDF files) -corresponding to that version. - Tarballs of older LAMMPS versions can also be downloaded from `this page `_. -Once you have a tarball, unzip and untar it with the following +Tarballs downloaded from the LAMMPS homepage include the pre-translated +LAMMPS documentation (HTML and PDF files) corresponding to that version. + +Once you have a tarball, uncompress and untar it with the following command: .. code-block:: bash tar -xzvf lammps*.tar.gz -This will create a LAMMPS directory with the version date -in its name, e.g. lammps-23Jun18. +This will create a LAMMPS directory with the version date in its name, +e.g. lammps-28Mar23. ---------- @@ -45,7 +45,8 @@ with the following command, to create a lammps- directory: unzip lammps*.zip This version corresponds to the selected LAMMPS feature or stable -release. +release (as indicated by the matching git tag) and will only contain the +source code and no pre-built documentation. .. _git: https://github.com/lammps/lammps/releases diff --git a/doc/src/Library_properties.rst b/doc/src/Library_properties.rst index 21e5609fc0..005bfaeea5 100644 --- a/doc/src/Library_properties.rst +++ b/doc/src/Library_properties.rst @@ -5,6 +5,7 @@ This section documents the following functions: - :cpp:func:`lammps_get_natoms` - :cpp:func:`lammps_get_thermo` +- :cpp:func:`lammps_last_thermo` - :cpp:func:`lammps_extract_box` - :cpp:func:`lammps_reset_box` - :cpp:func:`lammps_memory_usage` @@ -81,6 +82,11 @@ subdomains and processors. ----------------------- +.. doxygenfunction:: lammps_last_thermo + :project: progguide + +----------------------- + .. doxygenfunction:: lammps_extract_box :project: progguide diff --git a/doc/src/Modify.rst b/doc/src/Modify.rst index 8ea7850fc5..0d7d4d6b97 100644 --- a/doc/src/Modify.rst +++ b/doc/src/Modify.rst @@ -1,23 +1,30 @@ Modifying & extending LAMMPS **************************** -LAMMPS is designed in a modular fashion and to be easy to modify or -extend with new functionality. In fact, about 95% of its source code -are optional. The following pages give basic instructions on what -is required when adding new styles of different kinds to LAMMPS. +LAMMPS has a modular design, so that it is easy to modify or extend with +new functionality. In fact, about 95% of its source code is optional. +The following pages give basic instructions on adding new features to +LAMMPS. More in-depth explanations and documentation of individual +functions and classes are given in :doc:`Developer`. If you add a new feature to LAMMPS and think it will be of general interest to other users, we encourage you to submit it for inclusion in -LAMMPS as a pull request on our `GitHub site -`_, after reading about :doc:`how to -prepare your code for submission ` and :doc:`the -style requirements and recommendations `. +LAMMPS. This process is explained in the following three pages: + +* :doc:`how to prepare and submit your code ` +* :doc:`requirements for submissions ` +* :doc:`style guidelines ` + +A summary description of various types of styles in LAMMPS follows. +A discussion of implementing specific styles from scratch is given +in :doc:`writing new styles `. .. toctree:: :maxdepth: 1 Modify_overview Modify_contribute + Modify_requirements Modify_style .. toctree:: diff --git a/doc/src/Modify_contribute.rst b/doc/src/Modify_contribute.rst index d3d270fe3b..8992e63c00 100644 --- a/doc/src/Modify_contribute.rst +++ b/doc/src/Modify_contribute.rst @@ -2,74 +2,59 @@ Submitting new features for inclusion in LAMMPS =============================================== We encourage LAMMPS users to submit new features they wrote for LAMMPS -to be included into the LAMMPS distribution and thus become easily -accessible to all LAMMPS users. The LAMMPS source code is managed with -git and public development is hosted on `GitHub -`_. You can monitor the repository to -be notified of releases, follow the ongoing development, and comment on -topics of interest to you. +to be included in the LAMMPS distribution and thus become easily +accessible to all LAMMPS users. The LAMMPS source code is managed +with git and public development is hosted on `GitHub +`_. You can monitor the repository +to be notified of releases, follow the ongoing development, and +comment on topics of interest to you. + +This section contains general information regarding the preparation +and submission of new features to LAMMPS. If you are new to +development in LAMMPS, we recommend you read one of the tutorials on +developing a new :doc:`pair style ` or :doc:`fix +style ` which provide a friendly introduction to +what LAMMPS development entails and common vocabulary used on this +section. + Communication with the LAMMPS developers ---------------------------------------- -For any larger modifications or programming project, you are encouraged -to contact the LAMMPS developers ahead of time in order to discuss -implementation strategies and coding guidelines. That will make it -easier to integrate your contribution and results in less work for -everybody involved. You are also encouraged to search through the list -of `open issues on GitHub `_ -and submit a new issue for a planned feature, so you would not duplicate -the work of others (and possibly get scooped by them) or have your work -duplicated by others. +For any larger modifications or programming project, you are +encouraged to contact the LAMMPS developers ahead of time to discuss +implementation strategies. That will make it easier to integrate your +contribution and typically results in less work for everyone involved. +You are also encouraged to search through the list of `open issues on +GitHub `_ and submit a new +issue for a planned feature, to avoid duplicating work (and possibly +being scooped). -For informal communication with the LAMMPS developers you may ask to -join the `LAMMPS developers on Slack `_. This -slack work space is by invitation only. Thus for access, please send an -e-mail to ``slack@lammps.org`` explaining what part of LAMMPS you are -working on. Only discussions related to LAMMPS development are -tolerated in that work space, so this is **NOT** for people that look +For informal communication with the LAMMPS developers, you may ask to +join the `LAMMPS developers on Slack `_. +This slack work space is by invitation only. For access, please send +an e-mail to ``slack@lammps.org`` explaining what part of LAMMPS you +are working on. Only discussions related to LAMMPS development are +tolerated in that work space, so this is **NOT** for people looking for help with compiling, installing, or using LAMMPS. Please post a message to the `LAMMPS forum `_ for those purposes. -Packages versus individual files --------------------------------- - -The remainder of this chapter describes how to add new "style" files of -various kinds to LAMMPS. Packages are simply collections of one or more -such new class files which are invoked as a new style within a LAMMPS -input script. In some cases collections of supporting functions or -classes are also included as separate files in a package, especially when -they can be shared between multiple styles. If designed correctly, these -additions typically do not require any changes to the core code of -LAMMPS; they are simply add-on files that are compiled with the rest of -LAMMPS. To make those styles work, you may need some trivial changes to -the core code; an example of a trivial change is making a parent-class -method "virtual" when you derive a new child class from it. - -If you think your new feature or package requires some non-trivial -changes in core LAMMPS files, you should communicate with the LAMMPS -developers `on Slack `_, `on GitHub -`_, or `via email -`_, since we may have -recommendations about what changes to do where, or may not want to -include certain changes for some reason and thus you would need to look -for alternatives. Time and effort required ------------------------ -How quickly your contribution will be integrated can vary a lot. It -depends largely on how much effort it will cause the LAMMPS developers -to integrate and test it, how many and what kind of changes to the core -code are required, how quickly you can address them and of how much -interest it is to the larger LAMMPS community. Please see the section -on :doc:`LAMMPS programming style and requirements ` for -instructions, recommendations, and formal requirements. A small, -modular, well written contribution may be integrated within hours, but a -complex change that will require a redesign of some core functionality -in LAMMPS for a clean integration can take many months until it is -considered ready for inclusion (though this is rare). +How quickly your contribution will be integrated can vary widely. It +depends largely on how much effort is required by the LAMMPS +developers to integrate and test it, if any and what kind of changes +to the core code are required, how quickly you can address them, and +how much interest the contribution is to the larger LAMMPS +community. This process can be streamlined by following the +:doc:`requirements ` and :doc:`style +guidelines`. A small, modular, well written +contribution may be integrated within hours, but a complex change that +requires a re-design of a core functionality in LAMMPS can take months +before inclusion (though this is rare). Submission procedure @@ -78,36 +63,24 @@ Submission procedure All changes to LAMMPS (including those from LAMMPS developers) are integrated via pull requests on GitHub and cannot be merged without passing the automated testing and an approving review by a LAMMPS core -developer. Thus before submitting your contribution, you should first -make certain, that your added or modified code compiles and works -correctly with the latest development version of LAMMPS and contains all -bug fixes from it. +developer. Before submitting your contribution, you should therefore +first ensure that your added or modified code compiles and works +correctly with the latest development version of LAMMPS and contains +all bug fixes from it. -Once you have prepared everything, see the :doc:`LAMMPS GitHub Tutorial -` page for instructions on how to submit your changes or -new files through a GitHub pull request yourself. If you are unable or -unwilling to submit via GitHub yourself, you may also submit patch files -or full files to the LAMMPS developers and ask them to submit a pull -request on GitHub on your behalf. If this is the case, create a gzipped -tar file of all new or changed files or a corresponding patch file using -'diff -u' or 'diff -c' format and compress it with gzip. Please only -use gzip compression, as this works well and is available on all platforms. +Once you have prepared everything, see the :doc:`LAMMPS GitHub +Tutorial ` page for instructions on how to submit your +changes or new files through a GitHub pull request. If you are unable +or unwilling to submit via GitHub yourself, you may also send patch +files or full files to the `LAMMPS developers +`_ and ask them to submit a pull +request on GitHub on your behalf. If this is the case, create a +gzipped tar file of all new or changed files or a corresponding patch +file using 'diff -u' or 'diff -c' format and compress it with gzip. +Please only use gzip compression, as this works well and is available +on all platforms. This mode of submission may delay the integration +as it depends more on the LAMMPS developers. -If the new features/files are broadly useful we may add them as core -files to LAMMPS or as part of a :doc:`package `. All -packages are listed and described on the :doc:`Packages details -` doc page. - -Licensing ---------- - -Note that by providing us files to release, you agree to make them -open-source, i.e. we can release them under the terms of the GPL -(version 2) with the rest of LAMMPS. And similarly as part of a LGPL -(version 2.1) distribution of LAMMPS that we make available to -developers on request only and with files that are not authorized for -that kind of distribution removed (e.g. interface to FFTW). See the -:doc:`LAMMPS license ` page for details. External contributions ---------------------- @@ -115,11 +88,42 @@ External contributions 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 example as a download from a website of your own. See the `External -LAMMPS packages and tools `_ page -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 -`developers `_ with info about your -package and we will post it there. We recommend to name external -packages USER-\ so they can be easily distinguished from bundled -packages that do not have the USER- prefix. +LAMMPS packages and tools `_ +page 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 `developers `_ +with info about your package, and we will post it there. We recommend +naming external packages USER-\ so they can be easily +distinguished from packages in the LAMMPS distribution which do not +have the USER- prefix. + +Location of files: individual files and packages +------------------------------------------------ + +We rarely accept new styles in the core src folder. Thus, please +review the list of :doc:`available Packages ` to see +if your contribution should be added to one of them. It should fit +into the general purpose of that package. If it does not fit well, it +may be added to one of the EXTRA- packages or the MISC package. + +However, if your project includes many related features that are not +covered by one of the existing packages or is dependent on a library +(bundled or external), it is best to create a new package with its own +directory (with a name like FOO). In addition to your new files, the +directory should contain a README text file containing your name and +contact information and a brief description of what your new package +does. + + +Changes to core LAMMPS files +-------------------------------- + +If designed correctly, most additions do not require any changes to +the core code of LAMMPS; they are simply add-on files that are +compiled with the rest of LAMMPS. To make those styles work, you may +need some trivial changes to the core code. An example of a trivial +change is making a parent-class method "virtual" when you derive a new +child class from it. If your features involve more substantive +changes to the core LAMMPS files, it is particularly encouraged that +you communicate with the LAMMPS developers early in development. diff --git a/doc/src/Modify_overview.rst b/doc/src/Modify_overview.rst index ed7ff1a8ac..ab1fa43ed4 100644 --- a/doc/src/Modify_overview.rst +++ b/doc/src/Modify_overview.rst @@ -1,42 +1,44 @@ Overview ======== -The best way to add a new feature to LAMMPS is to find a similar feature -and look at the corresponding source and header files to figure out what -it does. You will need some knowledge of C++ to be able to understand -the high-level structure of LAMMPS and its class organization, but -functions (class methods) that do actual computations are mostly written -in C-style code and operate on simple C-style data structures (vectors -and arrays). A high-level overview of the programming style choices in -LAMMPS is :doc:`given elsewhere `. +The best way to add a new feature to LAMMPS is to find a similar +feature and look at the corresponding source and header files to +figure out what it does. You will need some knowledge of C++ to +understand the high-level structure of LAMMPS and its class +organization. Functions (class methods) that do actual computations +are mostly written in C-style code and operate on simple C-style data +structures (vectors and arrays). A high-level overview of the +programming style choices in LAMMPS is :doc:`given elsewhere +`. Most of the new features described on the :doc:`Modify ` doc -page require you to write a new C++ derived class (except for exceptions -described below, where you can make small edits to existing files). -Creating a new class requires 2 files, a source code file (\*.cpp) and a -header file (\*.h). The derived class must provide certain methods to -work as a new option. Depending on how different your new feature is -compared to existing features, you can either derive from the base class -itself, or from a derived class that already exists. Enabling LAMMPS to -invoke the new class is as simple as putting the two source files in the -src directory and re-building LAMMPS. +page require you to write a new C++ derived class (except for +exceptions described below, where you can make small edits to existing +files). Creating a new class requires 2 files, a source code file +(\*.cpp) and a header file (\*.h). The derived class must provide +certain methods to work as a new option. Depending on how different +your new feature is compared to existing features, you can either +derive from the base class itself, or from a derived class that +already exists. Enabling LAMMPS to invoke the new class is as simple +as putting the two source files in the src directory and re-building +LAMMPS. The advantage of C++ and its object-orientation is that all the code and variables needed to define the new feature are in the 2 files you -write, and thus should not make the rest of LAMMPS more complex or -cause side-effect bugs. +write. Thus, it should not make the rest of LAMMPS more complex or +cause bugs through unwanted side effects. -Here is a concrete example. Suppose you write 2 files pair_foo.cpp -and pair_foo.h that define a new class PairFoo that computes pairwise -potentials described in the classic 1997 :ref:`paper ` by Foo, et al. -If you wish to invoke those potentials in a LAMMPS input script with a -command like +Here is a concrete example. Suppose you write 2 files +``pair_foo.cpp`` and ``pair_foo.h`` that define a new class +``PairFoo`` which computes pairwise potentials described in the +classic 1997 :ref:`paper ` by Foo, *et al.* If you wish to invoke +those potentials in a LAMMPS input script with a command like: .. code-block:: LAMMPS pair_style foo 0.1 3.5 -then your pair_foo.h file should be structured as follows: +then your ``pair_foo.h`` file should be structured as follows: .. code-block:: c++ @@ -51,28 +53,27 @@ then your pair_foo.h file should be structured as follows: #endif where "foo" is the style keyword in the pair_style command, and -PairFoo is the class name defined in your pair_foo.cpp and pair_foo.h -files. +``PairFoo`` is the class name defined in your ``pair_foo.cpp`` and +``pair_foo.h`` files. When you re-build LAMMPS, your new pairwise potential becomes part of the executable and can be invoked with a pair_style command like the example above. Arguments like 0.1 and 3.5 can be defined and processed by your new class. -As illustrated by this example pair style, many kinds of options are -referred to in the LAMMPS documentation as the "style" of a particular -command. +As illustrated by this example, many features referred to in the +LAMMPS documentation are called a "style" of a particular command. The :doc:`Modify page ` lists all the common styles in LAMMPS, -and discusses the header file for the base class that these styles are -derived from. Public variables in that file are ones used and set by -the derived classes which are also used by the base class. Sometimes -they are also used by the rest of LAMMPS. Pure functions, which means -functions declared as virtual in the base class header file which are -also set to 0, are functions you **must** implement in your new derived -class to give it the functionality LAMMPS expects. Virtual functions -that are not set to 0 are functions you may override or not. Those -are usually defined with an empty function body. +and discusses the header file for the base class that these styles +derive from. Public variables in that file can be used and set by the +derived classes, and may also be used by the base class. Sometimes +they are also accessed by the rest of LAMMPS. Pure functions, which +means functions declared as virtual in the base class header file and +which are also set to 0, are functions you **must** implement in your +new derived class to give it the functionality LAMMPS expects. Virtual +functions that are not set to 0 are functions you may override or not. +Those are usually defined with an empty function body. Additionally, new output options can be added directly to the thermo.cpp, dump_custom.cpp, and variable.cpp files. These are also @@ -85,9 +86,9 @@ functionality: post-processing step. Many computations are more easily and more quickly done that way. * Do not try to do anything within the timestepping of a run that is not - parallel. For example do not accumulate a bunch of data on a single - processor and analyze it. You run the risk of seriously degrading - the parallel efficiency this way. + parallel. For example, do not accumulate a bunch of data on a single + processor and analyze it. That would run the risk of seriously degrading + the parallel efficiency. * If your new feature reads arguments or writes output, make sure you follow the unit conventions discussed by the :doc:`units ` command. diff --git a/doc/src/Modify_requirements.rst b/doc/src/Modify_requirements.rst new file mode 100644 index 0000000000..0637c860ab --- /dev/null +++ b/doc/src/Modify_requirements.rst @@ -0,0 +1,384 @@ +Requirements for contributions to LAMMPS +======================================== + +The following is a summary of the current requirements and +recommendations for including contributed source code or documentation +into the LAMMPS software distribution. + +Motivation +---------- + +The LAMMPS developers are committed to provide a software package that +is versatile, reliable, high-quality, efficient, portable, and easy to +maintain and modify. Achieving all of these goals is challenging +since a large part of LAMMPS consists of contributed code from many +different authors who may not be professionally trained programmers or +familiar with the idiosyncrasies of maintaining a large software +package. In addition, changes that interfere with the parallel +efficiency of the core code must be avoided. As LAMMPS continues to +grow and more features and functionality are added, it is necessary to +follow established guidelines when accepting new contributions while +also working at the same time to improve the existing code. + +The following requirements and recommendations are provided as a +guide. They indicate which individual requirements are strict, and +which represent a preference and thus are negotiable or optional. +Please feel free to contact the LAMMPS core developers in case you +need additional explanations or clarifications, or you need assistance +in implementing the (strict) requirements for your contributions. +Requirements include: + +* :ref:`Licensing requirements ` (strict) +* :ref:`Integration testing ` (strict) +* :ref:`Documentation ` (strict) +* :ref:`Programming language standards ` (strict) +* :ref:`Build system ` (strict) +* :ref:`Command or style names ` (strict) +* :ref:`Programming style requirements ` (varied) +* :ref:`Examples ` (preferred) +* :ref:`Error or warning messages and explanations ` (preferred) +* :ref:`Citation reminder ` (optional) +* :ref:`Testing ` (optional) + +.. _ReqLicense: + +Licensing requirements (strict) +------------------------------- + +Contributing authors agree when submitting a pull request that their +contributions can be distributed under the LAMMPS license conditions. +This is the GNU public license in version 2 (not 3 or later) for the +publicly distributed versions, e.g. on the LAMMPS homepage or on +GitHub. We also have a version of LAMMPS under LGPL 2.1 terms which +is available on request; this will usually be the latest available or +a previous stable version with a few LGPL 2.1 incompatible files +removed. More details are found on the :doc:`LAMMPS open-source +license page `. + +Your new source files should have the LAMMPS copyright and GPL notice, +followed by your name and email address at the top, like other +user-contributed LAMMPS source files. + +Contributions may be under a different license as long as that license +does not conflict with the aforementioned terms. Contributions that +use code with a conflicting license can be split into two parts: + +1. the core parts (i.e. parts that must be in the `src` tree) that are + licensed under compatible terms and bundled with the LAMMPS sources +2. an external library that must be downloaded and compiled (either + separately or as part of the LAMMPS compilation) + +Please note, that this split licensing mode may complicate including +the contribution in binary packages. + +.. _ReqIntegrationTesting: + +Integration testing (strict) +---------------------------- + +Where possible we use available continuous integration tools to search +for common programming mistakes, portability limitations, incompatible +formatting, and undesired side effects. Contributed code must pass the +automated tests on GitHub before it can be merged with the LAMMPS +distribution. These tests compile LAMMPS in a variety of environments +and settings and run the bundled unit tests. At the discretion of the +LAMMPS developer managing the pull request, additional tests may be +activated that test for "side effects" on running a collection of +input decks and create consistent results. The translation of the +documentation to HTML and PDF is also tested. + +This means that contributed source code **must** compile with the most +current version of LAMMPS with ``-DLAMMPS_BIGBIG`` in addition to the +default setting of ``-DLAMMPS_SMALLBIG``. The code needs to work +correctly in both cases, and also in serial and parallel using MPI. + +Some "disruptive" changes may break tests and require updates to the +testing tools or scripts or tests themselves. This is rare. If in +doubt, contact the LAMMPS developer that is assigned to the pull +request. + +.. _ReqDocumentation: + +Documentation (strict) +---------------------- + +Contributions that add new styles or commands or augment existing ones +must include the corresponding new or modified documentation in +`ReStructuredText format `_ (.rst files in the ``doc/src/`` +folder). The documentation should be written in American English and the +.rst file must only use ASCII characters, so it can be cleanly +translated to PDF files (via `sphinx `_ and +PDFLaTeX). Special characters may be included via embedded math +expression typeset in a LaTeX subset. + +.. _rst: https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html + +When adding new commands, they need to be integrated into the sphinx +documentation system, and the corresponding command tables and lists +updated. When translating the documentation into html files there +should be no warnings. When adding a new package, some lists +describing packages must also be updated as well as a package specific +description added. Likewise, if necessary, some package specific +build instructions should be included. + +As appropriate, the text files with the documentation can include +inline mathematical expressions or figures (see ``doc/JPG`` for +examples). Additional PDF files with further details may also be +included; see ``doc/PDF`` for examples. The page should also include +literature citations as appropriate; see the bottom of +``doc/fix_nh.rst`` for examples and the earlier part of the same file +for how to format the cite itself. Citation labels must be unique +across **all** .rst files. The "Restrictions" section of the page +should indicate if your command is only available if LAMMPS is built +with the appropriate package. See other command doc files for +examples of how to do this. + +Please run at least "make html" and "make spelling" from within the +doc/src directory, and carefully inspect and proofread the resulting +HTML format doc page before submitting your code. Upon submission of +a pull request, checks for error free completion of the HTML and PDF +build will be performed and also a spell check, a check for correct +anchors and labels, and a check for completeness of references to all +styles in their corresponding tables and lists is run. In case the +spell check reports false positives, they can be added to the file +``doc/utils/sphinx-config/false_positives.txt`` + +Contributions that add or modify the library interface or "public" +APIs from the C++ code or the Fortran module must include suitable +doxygen comments in the source and corresponding changes to the +documentation sources for the "Programmer Guide" guide section of the +LAMMPS manual. + +If your feature requires some more complex steps and explanations to +be used correctly or some external or bundled tools or scripts, we +recommend that you also contribute a :doc:`Howto document ` +providing some more background information and some tutorial material. +This can also be used to provide more in-depth explanations of models +that require use of multiple commands. + +As a rule-of-thumb, the more clear and self-explanatory you make your +documentation, README files and examples, and the easier you make it +for people to get started, the more likely it is that users will try +out your new feature. + +.. _ReqProgrammingStandards: + +Programming language standards (strict) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The core of LAMMPS is written in C++11 in a style that can be mostly +described as "C with classes". Advanced C++ features like operator +overloading or excessive use of templates are avoided with the intent to +keep the code readable to programmers that have limited C++ programming +experience. C++ constructs are acceptable when they help improve the +readability and reliability of the code, e.g. when using the +`std::string` class instead of manipulating pointers and calling the +string functions of the C library. In addition, a collection of +convenient :doc:`utility functions and classes ` for +recurring tasks and a collection of :doc:`platform neutral functions +` for improved portability are provided. +Contributions with code requiring more recent C++ standards are only +accepted as packages with the post C++11 standard code confined to the +package so that it is optional. + +Included Fortran code has to be compatible with the Fortran 2003 +standard. Since not all platforms supported by LAMMPS provide good +support for compiling Fortran files, it should be considered to rewrite +these parts as C++ code, if possible and thus allow for a wider adoption +of the contribution. As of January 2023, all previously included +Fortran code for the LAMMPS executable has been replaced by equivalent +C++ code. + +Python code must be compatible with Python 3.5 and later. Large parts +of LAMMPS (including the :ref:`PYTHON package `) are also +compatible with Python 2.7. Compatibility with Python 2.7 is desirable, +but compatibility with Python 3.5 is **required**. + +Compatibility with older programming language standards is very +important to maintain portability and availability of LAMMPS on many +platforms. This applies especially to HPC cluster environments, which +tend to be running older software stacks and where LAMMPS users may be +required to use those older tools for access to advanced hardware +features or not have the option to install newer compilers or libraries. + +.. _ReqBuildSystem: + +Build system (strict) +--------------------- + +LAMMPS currently supports two build systems: one that is based on +:doc:`traditional Makefiles ` and one that is based on +:doc:`CMake `. Therefore, your contribution must be +compatible with and support both build systems. + +For a single pair of header and implementation files that are an +independent feature, it is usually only required to add them to +``src/.gitignore``. + +For traditional make, if your contributed files or package depend on +other LAMMPS style files or packages also being installed +(e.g. because your file is a derived class from the other LAMMPS +class), then an ``Install.sh`` file is also needed to check for those +dependencies and modifications to ``src/Depend.sh`` to trigger the checks. +See other README and Install.sh files in other directories as +examples. + +Similarly, for CMake support, changes may need to be made to +``cmake/CMakeLists.txt``, some of the files in ``cmake/presets``, and +possibly a file with specific instructions needs to be added to +``cmake/Modules/Packages/``. Please check out how this is handled for +existing packages and ask the LAMMPS developers if you need assistance. + +.. _ReqNaming: + +Command or style names, file names, and keywords (strict) +--------------------------------------------------------- + +All user-visible command or style names should be all lower case and +should only use letters, numbers, or forward slashes. They should be +descriptive and initialisms should be avoided unless they are well +established (e.g. lj for Lennard-Jones). For a compute style +"some/name" the source files must be called ``compute_some_name.h`` and +``compute_some_name.cpp``. The "include guard" in the header file would +then be ``LMP_COMPUTE_SOME_NAME_H`` and the class name +``ComputeSomeName``. + +.. _ReqProgrammingStyle: + +Programming style requirements (varied) +--------------------------------------- + +To maintain source code consistency across contributions from many +people, there are various programming style requirements for +contributions to LAMMPS. Some of these requirements are strict and +must be followed, while others are only preferred and thus may be +skipped. An in-depth discussion of the style guidelines is provided +in the :doc:`programming style doc page `. + +.. _ReqExamples: + +Examples (preferred) +-------------------- + +For many new features, it is preferred that example scripts (simple, +small, fast to complete on 1 CPU) are included that demonstrate the +use of new or extended functionality. These are typically include +under the examples or examples/PACKAGES directory and are further +described on the :doc:`examples page `. Guidelines for +input scripts include: + +- commands that generate output should be commented out (except when the + output is the sole purpose or the feature, e.g. for a new compute) + +- commands like :doc:`log `, :doc:`echo `, :doc:`package + `, :doc:`processors `, :doc:`suffix ` may + **not** be used in the input file (exception: "processors * * 1" or + similar is acceptable when used to avoid unwanted domain decomposition + of empty volumes) + +- outside of the log files, no generated output should be included + +- custom thermo_style settings may not include output measuring CPU or other + time as it complicates comparisons between different runs + +- input files should be named ``in.name``, data files should be named + ``data.name`` and log files should be named ``log.version.name..`` + +- the total file size of all the inputs and outputs should be small + +- where possible, potential files from the "potentials" folder or data + file from other folders should be re-used through symbolic links + +.. _ReqErrorMessages: + +Error or warning messages and explanations (preferred) +------------------------------------------------------ + +.. versionchanged:: 4May2022 + +Starting with LAMMPS version 4 May 2022, the LAMMPS developers have +agreed on a new policy for error and warning messages. + +Previously, all error and warning strings were supposed to be listed in +the class header files with an explanation. Those would then be +regularly "harvested" and transferred to alphabetically sorted lists in +the manual. To avoid excessively long lists and to reduce effort, this +came with a requirement to have rather generic error messages (e.g. +"Illegal ... command"). To identify the specific cause, the name of the +source file and the line number of the error location would be printed, +so that one could look up the cause by reading the source code. + +The new policy encourages more specific error messages that ideally +indicate the cause directly, and requiring no further lookup. This is +aided by the `{fmt} library `_ enabling Error class +methods that take a variable number of arguments and an error text that +will be treated like a {fmt} syntax format string. Error messages should +still preferably be kept to a single line or two lines at most. + +For more complex explanations or errors that have multiple possible +reasons, a paragraph should be added to the `Error_details` page with an +error code reference (e.g. ``.. _err0001:``) then the utility function +:cpp:func:`utils::errorurl() ` can be used +to generate a URL that will directly lead to that paragraph. An error +for missing arguments can be easily generated using the +:cpp:func:`utils::missing_cmd_args() +` convenience function. +An example for this approach would be the +``src/read_data.cpp`` and ``src/atom.cpp`` files that implement the +:doc:`read_data ` and :doc:`atom_modify ` +commands and that may create :ref:`"Unknown identifier in data file" ` +errors that may have multiple possible reasons which complicates debugging, +and thus require some additional explanation. + +The transformation of existing LAMMPS code to this new scheme is +ongoing. Given the size of the LAMMPS code base, it will take a +significant amount of time to complete. For new code, however, +following the new approach is strongly preferred. The expectation is +that the new scheme will make understanding errors easier for LAMMPS +users, developers, and maintainers. + +.. _ReqCitation: + +Citation reminder (optional) +----------------------------- + +If there is a paper of yours describing your feature (either the +algorithm/science behind the feature itself, or its initial usage, or +its implementation in LAMMPS), you can add the citation to the \*.cpp +source file. See ``src/DIFFRACTION/compute_saed.cpp`` for an example. +A BibTeX format citation is stored in a string variable at the top of +the file, and a single line of code registering this variable is added +to the constructor of the class. When your feature is used, then +LAMMPS (by default) will print the brief info and the DOI in the first +line to the screen and the full citation to the log file. + +If there is additional functionality (which may have been added later) +described in a different publication, additional citation descriptions +may be added so long as they are only registered when the +corresponding keyword activating this functionality is used. + +With these options, it is possible to have LAMMPS output a specific +citation reminder whenever a user invokes your feature from their +input script. Please note that you should *only* use this for the +*most* relevant paper for a feature and a publication that you or your +group authored. E.g. adding a citation in the source code for a paper +by Nose and Hoover if you write a fix that implements their integrator +is not the intended usage. That kind of citation should just be +included in the documentation page you provide describing your +contribution. If you are not sure what the best option would be, +please contact the LAMMPS developers for advice. + +.. _ReqUnitTesting: + +Testing (optional) +------------------ + +If your contribution contains new utility functions or a supporting +class (i.e. anything that does not depend on a LAMMPS object), new +unit tests should be added to a suitable folder in the ``unittest`` +tree. When adding a new LAMMPS style computing forces or selected +fixes, a ``.yaml`` file with a test configuration and reference data +should be added for the styles where a suitable tester program already +exists (e.g. pair styles, bond styles, etc.). Please see :ref:`this +section in the manual ` for more information on how to +enable, run, and expand testing. diff --git a/doc/src/Modify_style.rst b/doc/src/Modify_style.rst index 2feffe56c2..c5aef71597 100644 --- a/doc/src/Modify_style.rst +++ b/doc/src/Modify_style.rst @@ -1,351 +1,58 @@ -LAMMPS programming style and requirements for contributions -=========================================================== - -The following is a summary of the current requirements and -recommendations for including contributed source code or documentation -into the LAMMPS software distribution. - -Motivation ----------- - -The LAMMPS developers are committed to providing a software package that -is versatile, reliable, high-quality, efficient, portable, and easy to -maintain and modify. Achieving all of these goals is challenging since -a large part of LAMMPS consists of contributed code from many different -authors and not many of them are professionally trained programmers and -familiar with the idiosyncrasies of maintaining a large software -package. In addition, changes that interfere with the parallel -efficiency of the core code must be avoided. As LAMMPS continues to -grow and more features and functionality are added, it becomes a -necessity to be more discriminating with new contributions while also -working at the same time to improve the existing code. - -The following requirements and recommendations are provided to help -maintaining or improving that status. Where possible we utilize -available continuous integration tools to search for common programming -mistakes, portability limitations, incompatible formatting, and -undesired side effects. It is indicated which requirements are strict, -and which represent a preference and thus are negotiable or optional. - -Please feel free to contact the LAMMPS core developers in case you need -additional explanations or clarifications or in case you need assistance -in realizing the (strict) requirements for your contributions. - -Licensing requirements (strict) -------------------------------- - -Contributing authors agree when submitting a pull request that their -contributions can be distributed under the LAMMPS license -conditions. This is the GNU public license in version 2 (not 3 or later) -for the publicly distributed versions, e.g. on the LAMMPS homepage or on -GitHub. On request we also make a version of LAMMPS available under -LGPL 2.1 terms; this will usually be the latest available or a previous -stable version with a few LGPL 2.1 incompatible files removed. More details -are found on the :doc:`LAMMPS open-source license page `. - -Your new source files should have the LAMMPS copyright, GPL notice, and -your name and email address at the top, like other user-contributed -LAMMPS source files. - -Contributions may be under a different license as long as that -license does not conflict with the aforementioned terms. Contributions -that use code with a conflicting license can be split into two parts: - -1. the core parts (i.e. parts that must be in the `src` tree) that are - licensed under compatible terms and bundled with the LAMMPS sources -2. an external library that must be downloaded and compiled (either - separately or as part of the LAMMPS compilation) - -Please note, that this split licensed mode may complicate including the -contribution in binary packages. - -Using pull requests on GitHub (preferred) ------------------------------------------ - -All contributions to LAMMPS are processed as pull requests on GitHub -(this also applies to the work of the core LAMMPS developers). A -:doc:`tutorial for submitting pull requests on GitHub ` is -provided. If this is still problematic, contributors may contact any of -the core LAMMPS developers for help or to create a pull request on their -behalf. This latter way of submission may delay the integration as it -depends on the amount of time required to prepare the pull request and -free time available by the LAMMPS developer in question to spend on this -task. - -Integration testing (strict) ----------------------------- - -Contributed code, like all pull requests, must pass the automated -tests on GitHub before it can be merged with the LAMMPS distribution. -These tests compile LAMMPS in a variety of environments and settings and -run the bundled unit tests. At the discretion of the LAMMPS developer -managing the pull request, additional tests may be activated that test -for "side effects" on running a collection of input decks and create -consistent results. Also, the translation of the documentation to HTML -and PDF is tested for. - -More specifically, this means that contributed source code **must** -compile with the most current version of LAMMPS with ``-DLAMMPS_BIGBIG`` -in addition to the default setting of ``-DLAMMPS_SMALLBIG``. The code -needs to work correctly in both cases and also in serial and parallel -using MPI. - -Some "disruptive" changes may break tests and require updates to the -testing tools or scripts or tests themselves. This is rare. If in -doubt, contact the LAMMPS developer that is assigned to the pull request -for further details and explanations and suggestions of what needs to be -done. - -Documentation (strict) ----------------------- - -Contributions that add new styles or commands or augment existing ones -must include the corresponding new or modified documentation in -`ReStructuredText format `_ (.rst files in the ``doc/src/`` -folder). The documentation shall be written in American English and the -.rst file must use only ASCII characters so it can be cleanly translated -to PDF files (via `sphinx `_ and PDFLaTeX). -Special characters may be included via embedded math expression typeset -in a LaTeX subset. - -.. _rst: https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html - -When adding new commands, they need to be integrated into the sphinx -documentation system, and the corresponding command tables and lists -updated. When translating the documentation into html files there should -be no warnings. When adding a new package also some lists describing -packages must be updated as well as a package specific description added -and, if necessary, some package specific build instructions included. - -As appropriate, the text files with the documentation can include inline -mathematical expression or figures (see ``doc/JPG`` for examples). -Additional PDF files with further details (see ``doc/PDF`` for examples) may -also be included. The page should also include literature citations as -appropriate; see the bottom of ``doc/fix_nh.rst`` for examples and the -earlier part of the same file for how to format the cite itself. -Citation labels must be unique across **all** .rst files. The -"Restrictions" section of the page should indicate if your command is -only available if LAMMPS is built with the appropriate FOO package. See -other package doc files for examples of how to do this. - -Please run at least "make html" and "make spelling" and carefully -inspect and proofread the resulting HTML format doc page before -submitting your code. Upon submission of a pull request, checks for -error free completion of the HTML and PDF build will be performed and -also a spell check, a check for correct anchors and labels, and a check -for completeness of references all styles in their corresponding tables -and lists is run. In case the spell check reports false positives they -can be added to the file ``doc/utils/sphinx-config/false_positives.txt`` - -Contributions that add or modify the library interface or "public" APIs -from the C++ code or the Fortran module must include suitable doxygen -comments in the source and corresponding changes to the documentation -sources for the "Programmer Guide" guide section of the LAMMPS manual. - -Examples (preferred) --------------------- - -In most cases, it is preferred that example scripts (simple, small, fast -to complete on 1 CPU) are included that demonstrate the use of new or -extended functionality. These are typically under the examples or -examples/PACKAGES directory. A few guidelines for such example input -decks. - -- commands that generate output should be commented out (except when the - output is the sole purpose or the feature, e.g. for a new compute). - -- commands like :doc:`log `, :doc:`echo `, :doc:`package - `, :doc:`processors `, :doc:`suffix ` may - **not** be used in the input file (exception: "processors * * 1" or - similar is acceptable when used to avoid unwanted domain decomposition - of empty volumes). - -- outside of the log files, no generated output should be included - -- custom thermo_style settings may not include output measuring CPU or other time - as that makes comparing the thermo output between different runs more complicated. - -- input files should be named ``in.name``, data files should be named - ``data.name`` and log files should be named ``log.version.name..`` - -- the total file size of all the inputs and outputs should be small - -- where possible, potential files from the "potentials" folder or data - file from other folders should be re-used through symbolic links - -Howto document (optional) -------------------------- - -If your feature requires some more complex steps and explanations to be -used correctly or some external or bundled tools or scripts, we -recommend that you also contribute a :doc:`Howto document ` -providing some more background information and some tutorial material. -This can also be used to provide more in-depth explanations for bundled -examples. - -As a general rule-of-thumb, the more clear and self-explanatory you make -your documentation, README files and examples, and the easier you make -it for people to get started, the more likely it is that users will try -out your new feature. - -Programming style requirements (varied) ---------------------------------------- - -The LAMMPS developers aim to employ a consistent programming style and -naming conventions across the entire code base, as this helps with -maintenance, debugging, and understanding the code, both for developers -and users. - -The files `pair_lj_cut.h`, `pair_lj_cut.cpp`, `utils.h`, and `utils.cpp` -may serve as representative examples. - -Command or Style names, file names, and keywords (mostly strict) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -All user-visible command or style names should be all lower case and -should only use letters, numbers, or forward slashes. They should be -descriptive and initialisms should be avoided unless they are well -established (e.g. lj for Lennard-Jones). For a compute style -"some/name" the source files must be called `compute_some_name.h` and -`compute_some_name.cpp`. The "include guard" would then be -`LMP_COMPUTE_SOME_NAME_H` and the class name `ComputeSomeName`. - -Whitespace and permissions (preferred) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Source files should not contain TAB characters unless required by the -syntax (e.g. in makefiles) and no trailing whitespace. Text files -should be added with Unix-style line endings (LF-only). Git will -automatically convert those in both directions when running on Windows; -use dos2unix on Linux machines to convert files. Text files should have -a line ending on the last line. - -All files should have 0644 permissions, i.e writable to the user only -and readable by all and no executable permissions. Executable -permissions (0755) should only be on shell scripts or python or similar -scripts for interpreted script languages. - -You can check for these issues with the python scripts in the -:ref:`"tools/coding_standard" ` folder. When run -normally with a source file or a source folder as argument, they will -list all non-conforming lines. By adding the `-f` flag to the command -line, they will modify the flagged files to try removing the detected -issues. - -Indentation and placement of braces (strongly preferred) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -LAMMPS uses 2 characters per indentation level and lines should be -kept within 100 characters wide. - -For new files added to the "src" tree, a `clang-format -`_ configuration file is -provided under the name `.clang-format`. This file is compatible with -clang-format version 8 and later. With that file present, files can be -reformatted according to the configuration with a command like: -`clang-format -i new-file.cpp`. Ideally, this is done while writing the -code or before a pull request is submitted. Blocks of code where the -reformatting from clang-format yields undesirable output may be -protected with placing a pair `// clang-format off` and `// clang-format -on` comments around that block. - -Error or warning messages and explanations (preferred) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. versionchanged:: 4May2022 - -Starting with LAMMPS version 4 May 2022 the LAMMPS developers have -agreed on a new policy for error and warning messages. - -Previously, all error and warning strings were supposed to be listed in -the class header files with an explanation. Those would then be -regularly "harvested" and transferred to alphabetically sorted lists in -the manual. To avoid excessively long lists and to reduce effort, this -came with a requirement to have rather generic error messages (e.g. -"Illegal ... command"). To identify the specific cause, the name of the -source file and the line number of the error location would be printed, -so that one could look up the cause by reading the source code. - -The new policy encourages more specific error messages that ideally -indicate the cause directly and no further lookup would be needed. -This is aided by using the `{fmt} library `_ to convert -the Error class commands so that they take a variable number of arguments -and error text will be treated like a {fmt} syntax format string. -Error messages should still kept to a single line or two lines at the most. - -For more complex explanations or errors that have multiple possible -reasons, a paragraph should be added to the `Error_details` page with an -error code reference (e.g. ``.. _err0001:``) then the utility function -:cpp:func:`utils::errorurl() ` can be used -to generate an URL that will directly lead to that paragraph. An error -for missing arguments can be easily generated using the -:cpp:func:`utils::missing_cmd_args() -` convenience function. - -The transformation of existing LAMMPS code to this new scheme is ongoing -and - given the size of the LAMMPS source code - will take a significant -amount of time until completion. However, for new code following the -new approach is strongly preferred. The expectation is that the new -scheme will make it easier for LAMMPS users, developers, and -maintainers. - -An example for this approach would be the -``src/read_data.cpp`` and ``src/atom.cpp`` files that implement the -:doc:`read_data ` and :doc:`atom_modify ` -commands and that may create :ref:`"Unknown identifier in data file" ` -errors that seem difficult to debug for users because they may have -one of multiple possible reasons, and thus require some additional explanations. - -Programming language standards (required) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The core of LAMMPS is written in C++11 in a style that can be mostly -described as "C with classes". Advanced C++ features like operator -overloading or excessive use of templates are avoided with the intent to -keep the code readable to programmers that have limited C++ programming -experience. C++ constructs are acceptable when they help improve the -readability and reliability of the code, e.g. when using the -`std::string` class instead of manipulating pointers and calling the -string functions of the C library. In addition a collection of -convenient :doc:`utility functions and classes ` for -recurring tasks and a collection of -:doc:`platform neutral functions ` for improved -portability are provided. - -Included Fortran code has to be compatible with the Fortran 2003 -standard. Python code must be compatible with Python 3.5. Large parts -of LAMMPS (including the :ref:`PYTHON package `) are also -compatible with Python 2.7. Compatibility with Python 2.7 is -desirable, but compatibility with Python 3.5 is **required**. - -Compatibility with these older programming language standards is very -important to maintain portability and availability of LAMMPS on many -platforms. This applies especially to HPC cluster environments, which -tend to be running older software stacks and LAMMPS users may be -required to use those older tools for access to advanced hardware -features or not have the option to install newer compilers or libraries. - -Programming conventions (varied) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The following is a collection of conventions that should be applied when -writing code for LAMMPS. Following these steps will make it much easier -to integrate your contribution. Please have a look at the existing files -in packages in the src directory for examples. As a demonstration for -how can be adapted to these conventions you may compare the REAXFF -package with the what it looked like when it was called USER-REAXC. If -you are uncertain, please ask. - -- system headers or from installed libraries are include with angular - brackets (example: ``#include ``), while local include file - use double quotes (example: ``#include "atom.h"``). - -- when including system header files from the C library use the - C++-style names (```` or ````) instead of the - C-style names (```` or ````) - -- the order of ``#include`` statements in a file ``some_name.cpp`` that - implements a class ``SomeName`` defined in a header file +LAMMPS programming style +======================== + +The aim of the LAMMPS developers is to use a consistent programming +style and naming conventions across the entire code base, as this +helps with maintenance, debugging, and understanding the code, both +for developers and users. This page provides a list of standard style +choices used in LAMMPS. Some of these standards are required, while +others are just preferred. Following these conventions will make it +much easier to integrate your contribution. If you are uncertain, +please ask. + +The files `pair_lj_cut.h`, `pair_lj_cut.cpp`, `utils.h`, and +`utils.cpp` may serve as representative examples. + +Include files (varied) +^^^^^^^^^^^^^^^^^^^^^^ + +- Header files that define a new LAMMPS style (i.e. that have a + ``SomeStyle(some/name,SomeName);`` macro in them) should only use + the include file for the base class and otherwise use forward + declarations and pointers; when interfacing to a library use the + PIMPL (pointer to implementation) approach where you have a pointer + to a struct that contains all library specific data (and thus + requires the library header) but use a forward declaration and + define the struct only in the implementation file. This is a + **strict** requirement since this is where type clashes between + packages and hard-to-find bugs have regularly manifested in the + past. + +- Header files, especially those defining a "style", should only use + the absolute minimum number of include files and **must not** + contain any ``using`` statements. Typically, that would only be the + header for the base class. Instead, any include statements should + be put in the corresponding implementation files and forward + declarations be used. For implementation files, the "include what + you use" principle should be employed. However, there is the + notable exception that when the ``pointers.h`` header is included + (or one of the base classes derived from it) certain headers will + always be included and thus do not need to be explicitly specified. + 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. + +- System headers or headers from installed libraries are included with + angular brackets (example: ``#include ``), while local + include files use double quotes (example: ``#include "atom.h"``) + +- When including system header files from the C library use the + C++-style names (```` or ````) instead of the + C-style names (```` or ````) + +- The order of ``#include`` statements in a file ``some_name.cpp`` + that implements a class ``SomeName`` defined in a header file ``some_name.h`` should be as follows: - ``#include "some_name.h"`` followed by an empty line @@ -353,34 +60,70 @@ you are uncertain, please ask. - LAMMPS include files e.g. ``#include "comm.h"`` or ``#include "modify.h"`` in alphabetical order followed by an empty line - - system header files from the C++ or C standard library followed by + - System header files from the C++ or C standard library followed by an empty line - ``using namespace LAMMPS_NS`` or other namespace imports. +Whitespace (preferred) +^^^^^^^^^^^^^^^^^^^^^^ + +Source files should not contain TAB characters unless required by the +syntax (e.g. in makefiles) and no trailing whitespace. Text files +should have Unix-style line endings (LF-only). Git will automatically +convert those in both directions when running on Windows; use dos2unix +on Linux machines to convert files to Unix-style line endings. The +last line of text files include a line ending. + +You can check for these issues with the python scripts in the +:ref:`"tools/coding_standard" ` folder. When run +normally with a source file or a source folder as argument, they will +list all non-conforming lines. By adding the `-f` flag to the command +line, they will modify the flagged files to try to remove the detected +issues. + +Placement of braces (strongly preferred) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For new files added to the "src" tree, a `clang-format +`_ configuration file is +provided under the name `.clang-format`. This file is compatible with +clang-format version 8 and later. With that file present, files can be +reformatted according to the configuration with a command like: +`clang-format -i new-file.cpp`. Ideally, this is done while writing +the code or before a pull request is submitted. Blocks of code where +the reformatting from clang-format yields hard-to-read or otherwise +undesirable output may be protected with placing a pair `// +clang-format off` and `// clang-format on` comments around that block. + +Miscellaneous standards (varied) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + - I/O is done via the C-style stdio library and **not** iostreams. - Do not use so-called "alternative tokens" like ``and``, ``or``, ``not`` and similar, but rather use the corresponding operators ``&&``, ``||``, and ``!``. The alternative tokens are not available - by default on all compilers, and also we want to maintain a consistent - programming style. + by default on all compilers. -- Output to the screen and the logfile should be using the corresponding - FILE pointers and only be done on MPI rank 0. Use the :cpp:func:`utils::logmesg` - convenience function where possible. +- Output to the screen and the logfile should use the corresponding + FILE pointers and only be done on MPI rank 0. Use the + :cpp:func:`utils::logmesg` convenience function where possible. -- Usage of C++11 `virtual`, `override`, `final` keywords: Please follow the - `C++ Core Guideline C.128 `_. +- Usage of C++11 `virtual`, `override`, `final` keywords: Please + follow the `C++ Core Guideline C.128 + `_. That means, you should only use `virtual` to declare a new virtual - function, `override` to indicate you are overriding an existing virtual - function, and `final` to prevent any further overriding. + function, `override` to indicate you are overriding an existing + virtual function, and `final` to prevent any further overriding. -- Trivial destructors: Prefer not writing destructors when they are empty and `default`. +- Trivial destructors: Do not write destructors when they are empty + and `default`. .. code-block:: c++ // don't write destructors for A or B like this + class A : protected Pointers { public: A(); @@ -394,6 +137,7 @@ you are uncertain, please ask. }; // instead, let the compiler create the implicit default destructor by not writing it + class A : protected Pointers { public: A(); @@ -404,37 +148,11 @@ you are uncertain, please ask. B(); }; -- Header files, especially those defining a "style", should only use - the absolute minimum number of include files and **must not** contain - any ``using`` statements. Typically that would be only the header for - the base class. Instead any include statements should be put into the - corresponding implementation files and forward declarations be used. - For implementation files, the "include what you use" principle should - be employed. However, there is the notable exception that when the - ``pointers.h`` header is included (or one of the base classes derived - from it) certain headers will always be included and thus do not need - to be explicitly specified. - 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 - ``SomeStyle(some/name,SomeName);`` macro in them) should only use the - include file for the base class and otherwise use forward declarations - and pointers; when interfacing to a library use the PIMPL (pointer - to implementation) approach where you have a pointer to a struct - that contains all library specific data (and thus requires the library - header) but use a forward declaration and define the struct only in - the implementation file. This is a **strict** requirement since this - is where type clashes between packages and hard to find bugs have - regularly manifested in the past. - - Please use clang-format only to reformat files that you have contributed. For header files containing a ``SomeStyle(keyword, - ClassName)`` macros it is required to have this macro embedded with a - pair of ``// clang-format off``, ``// clang-format on`` comments and - the line must be terminated with a semi-colon (;). Example: + ClassName)`` macros it is required to have this macro embedded with + a pair of ``// clang-format off``, ``// clang-format on`` comments + and the line must be terminated with a semicolon (;). Example: .. code-block:: c++ @@ -447,92 +165,10 @@ you are uncertain, please ask. #ifndef LMP_RUN_H [...] - You may also use ``// clang-format on/off`` throughout your files - to protect individual sections from being reformatted. + You may also use ``// clang-format on/off`` throughout your files to + protect individual sections from being reformatted. -- We rarely accept new styles in the core src folder. Thus please - review the list of :doc:`available Packages ` to see - if your contribution could be added to be added to one of them. It - should fit into the general purposed of that package. If it does not - fit well, it may be added to one of the EXTRA- packages or the MISC - package. - - -Contributing a package ----------------------- - -If your contribution has several related features that are not covered -by one of the existing packages or is dependent on a library (bundled or -external), it is best to make it a package directory with a name like -FOO. In addition to your new files, the directory should contain a -README text file. The README should contain your name and contact -information and a brief description of what your new package does. - - -Build system (strongly preferred) ---------------------------------- - -LAMMPS currently supports two build systems: one that is based on -:doc:`traditional Makefiles ` and one that is based on -:doc:`CMake `. Thus your contribution must be compatible -with and support both. - -For a single pair of header and implementation files that are an -independent feature, it is usually only required to add them to -`src/.gitignore``. - -For traditional make, if your contributed files or package depend on -other LAMMPS style files or packages also being installed (e.g. because -your file is a derived class from the other LAMMPS class), then an -Install.sh file is also needed to check for those dependencies and -modifications to src/Depend.sh to trigger the checks. See other README -and Install.sh files in other directories as examples. - -Similarly for CMake support, changes may need to be made to -cmake/CMakeLists.txt, some of the files in cmake/presets, and possibly a -file with specific instructions needs to be added to -cmake/Modules/Packages/. Please check out how this is handled for -existing packages and ask the LAMMPS developers if you need assistance. - - -Citation reminder (suggested) ------------------------------ - -If there is a paper of yours describing your feature (either the -algorithm/science behind the feature itself, or its initial usage, or -its implementation in LAMMPS), you can add the citation to the \*.cpp -source file. See ``src/DIFFRACTION/compute_saed.cpp`` for an example. -A BibTeX format citation is stored in a string variable at the top -of the file and a single line of code registering this variable is -added to the constructor of the class. When your feature is used, -by default, LAMMPS will print the brief info and the DOI -in the first line to the screen and the full citation to the log file. - -If there is additional functionality (which may have been added later) -described in a different publication, additional citation descriptions -may be added for as long as they are only registered when the -corresponding keyword activating this functionality is used. With these -options it is possible to have LAMMPS output a specific citation -reminder whenever a user invokes your feature from their input script. -Please note that you should *only* use this for the *most* relevant -paper for a feature and a publication that you or your group authored. -E.g. adding a citation in the code for a paper by Nose and Hoover if you -write a fix that implements their integrator is not the intended usage. -That latter kind of citation should just be included in the -documentation page you provide describing your contribution. If you are -not sure what the best option would be, please contact the LAMMPS -developers for advice. - - -Testing (optional) ------------------- - -If your contribution contains new utility functions or a supporting class -(i.e. anything that does not depend on a LAMMPS object), new unit tests -should be added to a suitable folder in the ``unittest`` tree. -When adding a new LAMMPS style computing forces or selected fixes, -a ``.yaml`` file with a test configuration and reference data should be -added for the styles where a suitable tester program already exists -(e.g. pair styles, bond styles, etc.). Please see -:ref:`this section in the manual ` for more information on -how to enable, run, and expand testing. +- All files should have 0644 permissions, i.e. writable by the user + only and readable by all and no executable permissions. Executable + permissions (0755) should only be for shell scripts or python or + similar scripts for interpreted script languages. diff --git a/doc/src/PDF/colvars-refman-lammps.pdf b/doc/src/PDF/colvars-refman-lammps.pdf index 59d12f9253..4f85537b35 100644 Binary files a/doc/src/PDF/colvars-refman-lammps.pdf and b/doc/src/PDF/colvars-refman-lammps.pdf differ diff --git a/doc/src/Python_properties.rst b/doc/src/Python_properties.rst index d8e772379c..031461660a 100644 --- a/doc/src/Python_properties.rst +++ b/doc/src/Python_properties.rst @@ -53,6 +53,7 @@ against invalid accesses. * :py:meth:`version() `: return the numerical version id, e.g. LAMMPS 2 Sep 2015 -> 20150902 * :py:meth:`get_thermo() `: return current value of a thermo keyword + * :py:meth:`last_thermo() `: return a dictionary of the last thermodynamic output * :py:meth:`get_natoms() `: total # of atoms as int * :py:meth:`reset_box() `: reset the simulation box size * :py:meth:`extract_setting() `: return a global setting @@ -60,6 +61,10 @@ against invalid accesses. * :py:meth:`extract_box() `: extract box info * :py:meth:`create_atoms() `: create N atoms with IDs, types, x, v, and image flags + **Properties**: + + * :py:attr:`last_thermo_step `: the last timestep thermodynamic output was computed + .. tab:: PyLammps/IPyLammps API In addition to the functions provided by :py:class:`lammps `, :py:class:`PyLammps ` objects diff --git a/doc/src/Speed_kokkos.rst b/doc/src/Speed_kokkos.rst index 569a24f1c2..8161e69a1c 100644 --- a/doc/src/Speed_kokkos.rst +++ b/doc/src/Speed_kokkos.rst @@ -285,6 +285,16 @@ one or more nodes, each with two GPUs: settings. Experimenting with its options can provide a speed-up for specific calculations. For example: +.. note:: + + The default binsize for :doc:`atom sorting ` on GPUs + is equal to the default CPU neighbor binsize (i.e. 2x smaller than the + default GPU neighbor binsize). When running simple pair-wise + potentials like Lennard Jones on GPUs, using a 2x larger binsize for + atom sorting (equal to the default GPU neighbor binsize) and a more + frequent sorting than default (e.g. sorting every 100 time steps + instead of 1000) may improve performance. + .. code-block:: bash mpirun -np 2 lmp_kokkos_cuda_openmpi -k on g 2 -sf kk -pk kokkos newton on neigh half binsize 2.8 -in in.lj # Newton on, half neighbor list, set binsize = neighbor ghost cutoff diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 2eae1aabc7..bccb9abe73 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -883,9 +883,9 @@ dependencies and redirects the download to the local cache. phonon tool ------------------------ -The phonon subdirectory contains a post-processing tool useful for -analyzing the output of the :doc:`fix phonon ` command in -the PHONON package. +The phonon subdirectory contains a post-processing tool, *phana*, useful +for analyzing the output of the :doc:`fix phonon ` command +in the PHONON package. See the README file for instruction on building the tool and what library it needs. And see the examples/PACKAGES/phonon directory diff --git a/doc/src/atom_modify.rst b/doc/src/atom_modify.rst index 9049a24fde..1e5a3d49ff 100644 --- a/doc/src/atom_modify.rst +++ b/doc/src/atom_modify.rst @@ -153,6 +153,13 @@ cache locality will be undermined. order of atoms in a :doc:`dump ` file will also typically change if sorting is enabled. +.. note:: + + When running simple pair-wise potentials like Lennard Jones on GPUs + with the KOKKOS package, using a larger binsize (e.g. 2x larger than + default) and a more frequent reordering than default (e.g. every 100 + time steps) may improve performance. + Restrictions """""""""""" diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index ba93d679ba..ca12d86ccc 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -24,14 +24,17 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* smooths bond forces near the breaking point - *break/no* - indicates that bonds should not break during a run + *normalize* value = *yes* or *no* + normalizes normal and shear forces by the reference length + + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -136,16 +139,19 @@ or :doc:`read_restart ` commands: * :math:`\gamma_r` (force*distance/velocity units) * :math:`\gamma_t` (force*distance/velocity units) +However, the *normalize* option will normalize the radial and shear forces +by :math:`r_0` such that :math:`k_r` and :math:`k_s` are unit less. + By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +the *overlay/pair* option. These settings require specific :doc:`special_bonds ` settings described in the restrictions. Further details can be found in the `:doc: how to ` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* option is used, then LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. However, if a bond does break, it will trigger an error. @@ -251,7 +257,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 5762dbe208..d89035dcad 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -24,14 +24,17 @@ Syntax *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) - *overlay/pair* value = none + *overlay/pair* value = *yes* or *no* bonded particles will still interact with pair forces *smooth* value = *yes* or *no* smooths bond forces near the breaking point - *break/no* - indicates that bonds should not break during a run + *normalize* value = *yes* or *no* + normalizes bond forces by the reference length + + *break* value = *yes* or *no* + indicates whether bonds break during a run Examples """""""" @@ -66,7 +69,7 @@ particles based on a model described by Clemmer and Robbins F = k (r - r_0) w -where :math:`k_r` is a stiffness, :math:`r` is the current distance +where :math:`k` is a stiffness, :math:`r` is the current distance and :math:`r_0` is the initial distance between the two particles, and :math:`w` is an optional smoothing factor discussed below. Bonds will break at a strain of :math:`\epsilon_c`. This is done by setting by @@ -102,16 +105,19 @@ the data file or restart files read by the :doc:`read_data * :math:`\epsilon_c` (unit less) * :math:`\gamma` (force/velocity units) +However, the *normalize* option will normalize the elastic bond force by +:math:`r_0` such that :math:`k` is unit less. + By default, pair forces are not calculated between bonded particles. Pair forces can alternatively be overlaid on top of bond forces using -the *overlay/pair* keyword. These settings require specific +the *overlay/pair* option. These settings require specific :doc:`special_bonds ` settings described in the restrictions. Further details can be found in the `:doc: how to ` page on BPMs. .. versionadded:: 28Mar2023 -If the *break/no* keyword is used, then LAMMPS assumes bonds should not break +If the *break* option is used, then LAMMPS assumes bonds should not break during a simulation run. This will prevent some unnecessary calculation. However, if a bond does break, it will trigger an error. @@ -206,7 +212,7 @@ Related commands Default """"""" -The option defaults are *smooth* = *yes* +The option defaults are *overlay/pair* = *no*, *smooth* = *yes*, *normalize* = *no*, and *break* = *yes* ---------- diff --git a/doc/src/bond_style.rst b/doc/src/bond_style.rst index b33d0a9e9a..95f463e695 100644 --- a/doc/src/bond_style.rst +++ b/doc/src/bond_style.rst @@ -32,13 +32,13 @@ Set the formula(s) LAMMPS uses to compute bond interactions between pairs of atoms. In LAMMPS, a bond differs from a pairwise interaction, which are set via the :doc:`pair_style ` command. Bonds are defined between specified pairs of atoms and -remain in force for the duration of the simulation (unless the bond -breaks which is possible in some bond potentials). The list of bonded -atoms is read in by a :doc:`read_data ` or -:doc:`read_restart ` command from a data or restart file. -By contrast, pair potentials are typically defined between all pairs -of atoms within a cutoff distance and the set of active interactions -changes over time. +remain in force for the duration of the simulation (unless new bonds +are created or existing bonds break, which is possible in some fixes +and bond potentials). The list of bonded atoms is read in by a +:doc:`read_data ` or :doc:`read_restart ` +command from a data or restart file. By contrast, pair potentials are +typically defined between all pairs of atoms within a cutoff distance +and the set of active interactions changes over time. Hybrid models where bonds are computed using different bond potentials can be setup using the *hybrid* bond style. diff --git a/doc/src/compute.rst b/doc/src/compute.rst index 880f60a8a6..4e5d8e6cb4 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -200,6 +200,7 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`com/chunk ` - center of mass for each chunk * :doc:`contact/atom ` - contact count for each spherical particle * :doc:`coord/atom ` - coordination number for each atom +* :doc:`count/type ` - count of atoms or bonds by type * :doc:`damage/atom ` - Peridynamic damage for each atom * :doc:`dihedral ` - energy of each dihedral sub-style * :doc:`dihedral/local ` - angle of each dihedral @@ -306,11 +307,11 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`sph/t/atom ` - per-atom internal temperature of Smooth-Particle Hydrodynamics atoms * :doc:`spin ` - magnetic quantities for a system of atoms having spins * :doc:`stress/atom ` - stress tensor for each atom -* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates -* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates +* :doc:`stress/cartesian ` - stress tensor in cartesian coordinates +* :doc:`stress/cylinder ` - stress tensor in cylindrical coordinates * :doc:`stress/mop ` - normal components of the local stress tensor using the method of planes * :doc:`stress/mop/profile ` - profile of the normal components of the local stress tensor using the method of planes -* :doc:`stress/spherical ` - stress tensor in spherical coordinates +* :doc:`stress/spherical ` - stress tensor in spherical coordinates * :doc:`stress/tally ` - stress between two groups of atoms via the tally callback mechanism * :doc:`tdpd/cc/atom ` - per-atom chemical concentration of a specified species for each tDPD particle * :doc:`temp ` - temperature of group of atoms diff --git a/doc/src/compute_bond_local.rst b/doc/src/compute_bond_local.rst index f3fb752ebe..10e86bbe44 100644 --- a/doc/src/compute_bond_local.rst +++ b/doc/src/compute_bond_local.rst @@ -76,7 +76,10 @@ The value *force* is the magnitude of the force acting between the pair of atoms in the bond. The values *fx*, *fy*, and *fz* are the xyz components of -*force* between the pair of atoms in the bond. +*force* between the pair of atoms in the bond. For bond styles that apply +non-central forces, such as :doc:`bond_style bpm/rotational +`, these values only include the :math:`(x,y,z)` +components of the normal force component. The remaining properties are all computed for motion of the two atoms relative to the center of mass (COM) velocity of the 2 atoms in the diff --git a/doc/src/compute_count_type.rst b/doc/src/compute_count_type.rst new file mode 100644 index 0000000000..ca3b02ecdb --- /dev/null +++ b/doc/src/compute_count_type.rst @@ -0,0 +1,130 @@ +.. index:: compute count/type + +compute count/type command +========================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + compute ID group-ID count/type mode + +* ID, group-ID are documented in :doc:`compute ` command +* count/type = style name of this compute command +* mode = {atom} or {bond} or {angle} or {dihedral} or {improper} + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all count/type atom + compute 1 flowmols count/type bond + +Description +""""""""""" + +.. versionadded:: 15Jun2023 + +Define a computation that counts the current number of atoms for each +atom type. Or the number of bonds (angles, dihedrals, impropers) for +each bond (angle, dihedral, improper) type. + +The former can be useful if atoms are added to or deleted from the +system in random ways, e.g. via the :doc:`fix deposit `, +:doc:`fix pour `, or :doc:`fix evaporate ` +commands. The latter can be useful in reactive simulations where +molecular bonds are broken or created, as well as angles, dihedrals, +impropers. + +Note that for this command, bonds (angles, etc) are the topological +kind enumerated in a data file, initially read by the :doc:`read_data +` command or defined by the :doc:`molecule ` +command. They do not refer to implicit bonds defined on-the-fly by +bond-order or reactive pair styles based on the current conformation +of small clusters of atoms. + +These commands can turn off topological bonds (angles, etc) by setting +their bond (angle, etc) types to negative values. This command +includes the turned-off bonds (angles, etc) in the count for each +type: + +* :doc:`fix shake ` +* :doc:`delete_bonds ` + +These commands can create and/or break topological bonds (angles, +etc). In the case of breaking, they remove the bond (angle, etc) from +the system, so that they no longer exist (:doc:`bond_style quartic +` and :doc:`BPM bond styles ` are exceptions, +see the discussion below). Thus they are not included in the counts +for each type: + +* :doc:`delete_bonds remove ` +* :doc:`bond_style quartic ` +* :doc:`fix bond/react ` +* :doc:`fix bond/create ` +* :doc:`fix bond/break ` +* :doc:`BPM package ` bond styles + +---------- + +If the {mode} setting is {atom} then the count of atoms for each atom +type is tallied. Only atoms in the specified group are counted. + +If the {mode} setting is {bond} then the count of bonds for each bond +type is tallied. Only bonds with both atoms in the specified group +are counted. + +For {mode} = {bond}, broken bonds with a bond type of zero are also +counted. The :doc:`bond_style quartic ` and :doc:`BPM +bond styles ` break bonds by doing this. See the :doc:` +Howto broken bonds ` doc page for more details. +Note that the group setting is ignored for broken bonds; all broken +bonds in the system are counted. + +If the {mode} setting is {angle} then the count of angles for each +angle type is tallied. Only angles with all 3 atoms in the specified +group are counted. + +If the {mode} setting is {dihedral} then the count of dihedrals for +each dihedral type is tallied. Only dihedrals with all 4 atoms in the +specified group are counted. + +If the {mode} setting is {improper} then the count of impropers for +each improper type is tallied. Only impropers with all 4 atoms in the +specified group are counted. + +---------- + +Output info +""""""""""" + +This compute calculates a global vector of counts. If the mode is +{atom} or {bond} or {angle} or {dihedral} or {improper}, then the +vector length is the number of atom types or bond types or angle types +or dihedral types or improper types, respectively. + +If the mode is {bond} this compute also calculates a global scalar +which is the number of broken bonds with type = 0, as explained above. + +These values can be used by any command that uses global scalar or +vector values from a compute as input. See the :doc:`Howto output +` page for an overview of LAMMPS output options. + +The scalar and vector values calculated by this compute are "extensive". + +Restrictions +"""""""""""" + +none + +Related commands +"""""""""""""""" + +none + +Default +""""""" + +none diff --git a/doc/src/compute_fabric.rst b/doc/src/compute_fabric.rst index f1a5d3d7f9..b38ffafa48 100644 --- a/doc/src/compute_fabric.rst +++ b/doc/src/compute_fabric.rst @@ -146,13 +146,13 @@ m to :math:`M` (inclusive). A middle asterisk means all types from m to n Output info """"""""""" -This compute calculates a local vector of doubles and a scalar. The vector -stores the unique components of the first requested tensor in the order -:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz` -followed by the same components for all subsequent tensors. +This compute calculates a global vector of doubles and a global scalar. The +vector stores the unique components of the first requested tensor in the +order :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, +:math:`yz` followed by the same components for all subsequent tensors. The length of the vector is therefore six times the number of requested -tensors. The scalar output is the number of pairwise interactions included in -the calculation of the fabric tensor. +tensors. The scalar output is the number of pairwise interactions included +in the calculation of the fabric tensor. Restrictions """""""""""" diff --git a/doc/src/compute_pair_local.rst b/doc/src/compute_pair_local.rst index dace280dee..31209f63f4 100644 --- a/doc/src/compute_pair_local.rst +++ b/doc/src/compute_pair_local.rst @@ -66,7 +66,9 @@ The value *eng* is the interaction energy for the pair of atoms. The value *force* is the force acting between the pair of atoms, which is positive for a repulsive force and negative for an attractive force. The values *fx*, *fy*, and *fz* are the :math:`(x,y,z)` components of -*force* on atom I. +*force* on atom I. For pair styles that apply non-central forces, +such as :doc:`granular pair styles `, these values only include +the :math:`(x,y,z)` components of the normal force component. A pair style may define additional pairwise quantities which can be accessed as *p1* to *pN*, where :math:`N` is defined by the pair style. diff --git a/doc/src/compute_stress_cartesian.rst b/doc/src/compute_stress_cartesian.rst new file mode 100644 index 0000000000..bf019a9d6b --- /dev/null +++ b/doc/src/compute_stress_cartesian.rst @@ -0,0 +1,123 @@ +.. index:: compute stress/cartesian + +compute stress/cartesian command +================================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + compute ID group-ID stress/cartesian args + +* ID, group-ID are documented in :doc:`compute ` command +* args = argument specific to the compute style + +.. parsed-literal:: + + *stress/cartesian* args = dim1 bin_width1 dim2 bin_width2 keyword + dim1 = *x* or *y* or *z* + bin_width1 = width of the bin + dim2 = *x* or *y* or *z* or *NULL* + bin_width2 = width of the bin + keyword = *ke* or *pair* or *bond* + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all stress/cartesian x 0.1 NULL 0 + compute 1 all stress/cartesian y 0.1 z 0.1 + compute 1 all stress/cartesian x 0.1 NULL 0 ke pair + +Description +""""""""""" + +Compute *stress/cartesian* defines computations that calculate profiles of the +diagonal components of the local stress tensor over one or two Cartesian +dimensions, as described in :ref:`(Ikeshoji)`. The stress tensor is +split into a kinetic contribution :math:`P^k` and a virial contribution +:math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. +This compute obeys momentum balance through fluid interfaces. They use the +Irving--Kirkwood contour, which is the straight line between particle pairs. + +.. versionadded:: 15Jun2023 + + Added support for bond styles + +This compute only supports pair and bond (no angle, dihedral, improper, +or kspace) forces. By default, if no extra keywords are specified, all +supported contributions to the stress are included (ke, pair, bond). If any +keywords are specified, then only those components are summed. + +Output info +""""""""""" + +The output columns for *stress/cartesian* are the position of the +center of the local volume in the first and second dimensions, number +density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, +:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 +columns when one dimension is specified and 9 columns when two +dimensions are specified. The number of bins (rows) is +:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths +of the simulation box in the specified dimensions and :math:`b_1` and +:math:`b_2` are the specified bin widths. When only one dimension is +specified, the number of bins (rows) is :math:`L_1/b_1`. + +This array can be output with :doc:`fix ave/time `, + +.. code-block:: LAMMPS + + compute p all stress/cartesian x 0.1 + fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector + +The values calculated by this compute are "intensive". The stress +values will be in pressure :doc:`units `. The number density +values are in inverse volume :doc:`units `. + +NOTE 1: The local stress does not include any Lennard-Jones tail +corrections to the stress added by the +:doc:`pair_modify tail yes ` +command, since those are contributions to the global system pressure. + +NOTE 2: The local stress profiles generated by these computes are +similar to those obtained by the +:doc:`method-of-planes (MOP) `. +A key difference is that compute +:doc:`stress/mop/profile ` +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set of small volumes. +Moreover, this compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +*stress/mop/profile* computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. + +More information on the similarities and differences can be found in +:ref:`(Ikeshoji)`. + +Restrictions +"""""""""""" + +These computes calculate the stress tensor contributions for pair and bond +forces only (no angle, dihedral, improper, or kspace force). +It requires pairwise force calculations not available for most +many-body pair styles. + +These computes are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS was built with that package. See the :doc:`Build +package ` doc page for more info. + +Related commands +"""""""""""""""" + +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/spherical `, +:doc:`compute stress/cylinder ` + +---------- + +.. _Ikeshoji2: + +**(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_profile.rst b/doc/src/compute_stress_curvilinear.rst similarity index 63% rename from doc/src/compute_stress_profile.rst rename to doc/src/compute_stress_curvilinear.rst index cb4628bd5d..022a87058f 100644 --- a/doc/src/compute_stress_profile.rst +++ b/doc/src/compute_stress_curvilinear.rst @@ -1,11 +1,6 @@ -.. index:: compute stress/cartesian .. index:: compute stress/cylinder .. index:: compute stress/spherical - -compute stress/cartesian command -================================== - compute stress/cylinder command ================================= @@ -20,15 +15,11 @@ Syntax compute ID group-ID style args * ID, group-ID are documented in :doc:`compute ` command -* style = stress/cartesian or stress/spherical or stress/cylinder +* style = stress/spherical or stress/cylinder * args = argument specific to the compute style .. parsed-literal:: - *stress/cartesian* args = dim bin_width - dim = *x* or *y* or *z* - bin_width = width of the bin - one or two dim/bin_width pairs may be appended *stress/cylinder* args = zlo zh Rmax bin_width keyword zlo = minimum z-boundary for cylinder zhi = maximum z-boundary for cylinder @@ -46,8 +37,6 @@ Examples .. code-block:: LAMMPS - compute 1 all stress/cartesian x 0.1 - compute 1 all stress/cartesian y 0.25 z 0.1 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 compute 1 all stress/cylinder -10.0 10.0 15.0 0.25 ke no compute 1 all stress/spherical 0 0 0 0.1 10 @@ -55,41 +44,28 @@ Examples Description """"""""""" -Compute *stress/cartesian*, compute *stress/cylinder*, and compute +Compute *stress/cylinder*, and compute *stress/spherical* define computations that calculate profiles of the diagonal components of the local stress tensor in the specified coordinate system. The stress tensor is split into a kinetic contribution :math:`P^k` and a virial contribution :math:`P^v`. The sum gives the total stress tensor :math:`P = P^k+P^v`. These computes can for example be used to calculate the diagonal components of the local -stress tensor of interfaces with flat, cylindrical, or spherical +stress tensor of surfaces with cylindrical or spherical symmetry. These computes obeys momentum balance through fluid interfaces. They use the Irving--Kirkwood contour, which is the straight line between particle pairs. -The *stress/cartesian* computes the stress profile along one or two -Cartesian coordinates, as described in :ref:`(Ikeshoji)`. The -compute *stress/cylinder* computes the stress profile along the +The compute *stress/cylinder* computes the stress profile along the radial direction in cylindrical coordinates, as described in :ref:`(Addington)`. The compute *stress/spherical* computes the stress profile along the radial direction in spherical -coordinates, as described in :ref:`(Ikeshoji)`. +coordinates, as described in :ref:`(Ikeshoji)`. Output info """"""""""" -The output columns for *stress/cartesian* are the position of the -center of the local volume in the first and second dimensions, number -density, :math:`P^k_{xx}`, :math:`P^k_{yy}`, :math:`P^k_{zz}`, -:math:`P^v_{xx}`, :math:`P^v_{yy}`, and :math:`P^v_{zz}`. There are 8 -columns when one dimension is specified and 9 columns when two -dimensions are specified. The number of bins (rows) is -:math:`(L_1/b_1)(L_2/b_2)`, where :math:`L_1` and :math:`L_2` are the lengths -of the simulation box in the specified dimensions and :math:`b_1` and -:math:`b_2` are the specified bin widths. When only one dimension is -specified, the number of bins (rows) is :math:`L_1/b_1`. - The default output columns for *stress/cylinder* are the radius to the center of the cylindrical shell, number density, :math:`P^k_{rr}`, :math:`P^k_{\phi\phi}`, :math:`P^k_{zz}`, :math:`P^v_{rr}`, @@ -111,7 +87,7 @@ This array can be output with :doc:`fix ave/time `, .. code-block:: LAMMPS - compute p all stress/cartesian x 0.1 + compute 1 all stress/spherical 0 0 0 0.1 10 fix 2 all ave/time 100 1 100 c_p[*] file dump_p.out mode vector The values calculated by this compute are "intensive". The stress @@ -123,25 +99,15 @@ corrections to the stress added by the :doc:`pair_modify tail yes ` command, since those are contributions to the global system pressure. -NOTE 2: The local stress profiles generated by these computes are -similar to those obtained by the -:doc:`method-of-planes (MOP) `. -A key difference -is that compute `stress/mop/profile ` -considers particles crossing a set of planes, while -*stress/cartesian* computes averages for a set of small volumes. -More information on the similarities and differences can be found in -:ref:`(Ikeshoji)`. - Restrictions """""""""""" -These computes calculate the stress tensor contributions for pair -styles only (i.e., no bond, angle, dihedral, etc. contributions, and in -the presence of bonded interactions, the result will be incorrect due to -exclusions for special bonds) and requires pairwise force calculations -not available for most many-body pair styles. -Note that :math:`k`-space calculations are also excluded. +These computes calculate the stress tensor contributions for pair styles +only (i.e., no bond, angle, dihedral, etc. contributions, and in the +presence of bonded interactions, the result may be incorrect due to +exclusions for :doc:`special bonds ` excluding pairs of atoms +completely). It requires pairwise force calculations not available for most +many-body pair styles. Note that :math:`k`-space calculations are also excluded. These computes are part of the EXTRA-COMPUTE package. They are only enabled if LAMMPS was built with that package. See the :doc:`Build @@ -150,7 +116,8 @@ package ` doc page for more info. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/mop/profile ` +:doc:`compute stress/atom `, :doc:`compute pressure `, +:doc:`compute stress/mop/profile `, :doc:`compute stress/cartesian ` Default """"""" @@ -159,7 +126,7 @@ The keyword default for ke in style *stress/cylinder* is yes. ---------- -.. _Ikeshoji2: +.. _Ikeshoji4: **(Ikeshoji)** Ikeshoji, Hafskjold, Furuholt, Mol Sim, 29, 101-109, (2003). diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 4ad2261bb0..21c2963545 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -18,7 +18,7 @@ Syntax * style = *stress/mop* or *stress/mop/profile* * dir = *x* or *y* or *z* is the direction normal to the plane * args = argument specific to the compute style -* keywords = *kin* or *conf* or *total* (one of more can be specified) +* keywords = *kin* or *conf* or *total* or *pair* or *bond* or *angle* (one or more can be specified) .. parsed-literal:: @@ -45,85 +45,112 @@ Examples Description """"""""""" -Compute *stress/mop* and compute *stress/mop/profile* define computations that -calculate components of the local stress tensor using the method of -planes :ref:`(Todd) `. Specifically in compute *stress/mop* calculates 3 -components are computed in directions *dir*,\ *x*\ ; *dir*,\ *y*\ ; and -*dir*,\ *z*\ ; where *dir* is the direction normal to the plane, while -in compute *stress/mop/profile* the profile of the stress is computed. +Compute *stress/mop* and compute *stress/mop/profile* define +computations that calculate components of the local stress tensor using +the method of planes :ref:`(Todd) `. Specifically in compute +*stress/mop* calculates 3 components are computed in directions *dir*,\ +*x*\ ; *dir*,\ *y*\ ; and *dir*,\ *z*\ ; where *dir* is the direction +normal to the plane, while in compute *stress/mop/profile* the profile +of the stress is computed. Contrary to methods based on histograms of atomic stress (i.e., using -:doc:`compute stress/atom `), the method of planes is -compatible with mechanical balance in heterogeneous systems and at +:doc:`compute stress/atom `), the method of planes +is compatible with mechanical balance in heterogeneous systems and at interfaces :ref:`(Todd) `. The stress tensor is the sum of a kinetic term and a configurational term, which are given respectively by Eq. (21) and Eq. (16) in -:ref:`(Todd) `. For the kinetic part, the algorithm considers that -atoms have crossed the plane if their positions at times :math:`t-\Delta t` -and :math:`t` are one on either side of the plane, and uses the velocity at -time :math:`t-\Delta t/2` given by the velocity Verlet algorithm. +:ref:`(Todd) `. For the kinetic part, the algorithm considers +that atoms have crossed the plane if their positions at times +:math:`t-\Delta t` and :math:`t` are one on either side of the plane, +and uses the velocity at time :math:`t-\Delta t/2` given by the velocity +Verlet algorithm. -Between one and three keywords can be used to indicate which -contributions to the stress must be computed: kinetic stress (kin), -configurational stress (conf), and/or total stress (total). +.. versionadded:: 15Jun2023 -NOTE 1: The configurational stress is computed considering all pairs of atoms where at least one atom belongs to group group-ID. + contributions from bond and angle potentials + +Between one and six keywords can be used to indicate which contributions +to the stress must be computed: total stress (total), kinetic stress +(kin), configurational stress (conf), stress due to bond stretching +(bond), stress due to angle bending (angle) and/or due to pairwise +non-bonded interactions (pair). The angle keyword is currently +available only for the *stress/mop* command and **not** the +*stress/mop/profile* command. + +NOTE 1: The configurational stress is computed considering all pairs of +atoms where at least one atom belongs to group group-ID. NOTE 2: The local stress does not include any Lennard-Jones tail -corrections to the stress added by the :doc:`pair_modify tail yes ` -command, since those are contributions to the global system pressure. +corrections to the stress added by the :doc:`pair_modify tail yes +` command, since those are contributions to the global +system pressure. -NOTE 3: The local stress profile generated by compute *stress/mop/profile* -is similar to that obtained by compute -:doc:`stress/cartesian `. -A key difference is that compute *stress/mop/profile* considers particles -crossing a set of planes, while compute *stress/cartesian* computes averages -for a set of small volumes. More information -on the similarities and differences can be found in -:ref:`(Ikeshoji)`. +NOTE 3: The local stress profile generated by compute +*stress/mop/profile* is similar to that obtained by compute +:doc:`stress/cartesian `. +A key difference is that compute *stress/mop/profile* +considers particles crossing a set of planes, while +*stress/cartesian* computes averages for a set +of small volumes. +Moreover, *stress/cartesian* compute computes the diagonal components of the stress +tensor :math:`P_{xx}`, :math:`P_{yy}`, and :math:`P_{zz}`, while +*stress/mop/profile* computes the components +:math:`P_{ix}`, :math:`P_{iy}`, and :math:`P_{iz}`, where :math:`i` is the +direction normal to the plane. Output info """"""""""" -Compute *stress/mop* calculates a global vector (indices starting at 1), with 3 -values for each declared keyword (in the order the keywords have been -declared). For each keyword, the stress tensor components are ordered as -follows: stress_dir,x, stress_dir,y, and stress_dir,z. +Compute *stress/mop* calculates a global vector (indices starting at 1), +with 3 values for each declared keyword (in the order the keywords have +been declared). For each keyword, the stress tensor components are +ordered as follows: stress_dir,x, stress_dir,y, and stress_dir,z. -Compute *stress/mop/profile* instead calculates a global array, with 1 column -giving the position of the planes where the stress tensor was computed, -and with 3 columns of values for each declared keyword (in the order the -keywords have been declared). For each keyword, the profiles of stress -tensor components are ordered as follows: stress_dir,x; stress_dir,y; -and stress_dir,z. +Compute *stress/mop/profile* instead calculates a global array, with 1 +column giving the position of the planes where the stress tensor was +computed, and with 3 columns of values for each declared keyword (in the +order the keywords have been declared). For each keyword, the profiles +of stress tensor components are ordered as follows: stress_dir,x; +stress_dir,y; and stress_dir,z. The values are in pressure :doc:`units `. -The values produced by this compute can be accessed by various :doc:`output commands `. -For instance, the results can be written to a file using the -:doc:`fix ave/time ` command. Please see the example -in the examples/PACKAGES/mop folder. +The values produced by this compute can be accessed by various +:doc:`output commands `. For instance, the results can be +written to a file using the :doc:`fix ave/time ` +command. Please see the example in the examples/PACKAGES/mop folder. Restrictions """""""""""" -These styles are part of the EXTRA-COMPUTE package. They are only enabled if -LAMMPS is built with that package. See the :doc:`Build package ` -doc page on for more info. +These styles are part of the EXTRA-COMPUTE package. They are only +enabled if LAMMPS is built with that package. See the :doc:`Build +package ` doc page on for more info. The method is only implemented for 3d orthogonal simulation boxes whose size does not change in time, and axis-aligned planes. The method only works with two-body pair interactions, because it -requires the class method pair->single() to be implemented. In -particular, it does not work with more than two-body pair interactions, -intra-molecular interactions, and long range (kspace) interactions. +requires the class method ``Pair::single()`` to be implemented, which is +not possible for manybody potentials. In particular, compute +*stress/mop/profile* does not work with more than two-body pair +interactions, long range (kspace) interactions and +angle/dihedral/improper intramolecular interactions. Similarly, compute +*stress/mop* does not work with more than two-body pair interactions, +long range (kspace) interactions and dihedral/improper intramolecular +interactions but works with all bond interactions with the class method +single() implemented and all angle interactions with the class method +born_matrix() implemented. Related commands """""""""""""""" -:doc:`compute stress/atom `, :doc:`compute pressure `, :doc:`compute stress/cartesian `, :doc:`compute stress/cylinder `, :doc:`compute stress/spherical ` +:doc:`compute stress/atom `, +:doc:`compute pressure `, +:doc:`compute stress/cartesian `, +:doc:`compute stress/cylinder `, +:doc:`compute stress/spherical ` Default """"""" diff --git a/doc/src/compute_tally.rst b/doc/src/compute_tally.rst index 6eff1e186e..fe2cbe7cca 100644 --- a/doc/src/compute_tally.rst +++ b/doc/src/compute_tally.rst @@ -187,16 +187,22 @@ Both the scalar and vector values calculated by this compute are Restrictions """""""""""" -This compute is part of the TALLY package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +This compute is part of the TALLY package. It is only enabled if LAMMPS +was built with that package. See the :doc:`Build package +` page for more info. Not all pair styles can be evaluated in a pairwise mode as required by -this compute. For example, 3-body and other many-body potentials, -such as :doc:`Tersoff ` and -:doc:`Stillinger-Weber ` cannot be used. :doc:`EAM ` -potentials only include the pair potential portion of the EAM -interaction when used by this compute, not the embedding term. Also -bonded or Kspace interactions do not contribute to this compute. +this compute. For example, 3-body and other many-body potentials, such +as :doc:`Tersoff ` and :doc:`Stillinger-Weber ` +cannot be used. :doc:`EAM ` potentials only include the pair +potential portion of the EAM interaction when used by this compute, not +the embedding term. Also bonded or Kspace interactions do not +contribute to this compute. + +These computes are not compatible with accelerated pair styles from the +GPU, INTEL, KOKKOS, or OPENMP packages. They will either create an error +or print a warning when required data was not tallied in the required way +and thus the data acquisition functions from these computes not called. When used with dynamic groups, a :doc:`run 0 ` command needs to be inserted in order to initialize the dynamic groups before accessing diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index f00cc339cc..0ac2afbeee 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -753,9 +753,13 @@ run, this option is ignored since the output is already balanced. ---------- The *thermo* keyword only applies the dump styles *netcdf* and *yaml*. -It triggers writing of :doc:`thermo ` information to the dump file -alongside per-atom data. The values included in the dump file are -identical to the values specified by :doc:`thermo_style `. +It triggers writing of :doc:`thermo ` information to the dump +file alongside per-atom data. The values included in the dump file are +cached values from the last thermo output and include the exact same the +values as specified by the :doc:`thermo_style ` command. +Because these are cached values, they are only up-to-date when dump +output is on a timestep that also has thermo output. Dump style *yaml* +will skip thermo output on incompatible steps. ---------- diff --git a/doc/src/dump_molfile.rst b/doc/src/dump_molfile.rst index f8cc06d039..ffc0b443e0 100644 --- a/doc/src/dump_molfile.rst +++ b/doc/src/dump_molfile.rst @@ -63,7 +63,7 @@ like element names. The *path* keyword determines which in directories. This is a "path" like other search paths, i.e. it can contain multiple directories -separated by a colon (or semi-colon on windows). This keyword is +separated by a colon (or semicolon on Windows). This keyword is optional and default to ".", the current directory. The *unwrap* option of the :doc:`dump_modify ` command allows diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 8cee9dd687..cdf6be866b 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -323,7 +323,8 @@ accelerated styles exist. * :doc:`pafi ` - constrained force averages on hyper-planes to compute free energies (PAFI) * :doc:`pair ` - access per-atom info from pair styles * :doc:`phonon ` - calculate dynamical matrix from MD simulations -* :doc:`pimd/nvt ` - Feynman path integral molecular dynamics with Nose-Hoover thermostat +* :doc:`pimd/langevin ` - Feynman path-integral molecular dynamics with stochastic thermostat +* :doc:`pimd/nvt ` - Feynman path-integral molecular dynamics with Nose-Hoover thermostat * :doc:`planeforce ` - constrain atoms to move in a plane * :doc:`plumed ` - wrapper on PLUMED free energy library * :doc:`poems ` - constrain clusters of atoms to move as coupled rigid bodies diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index e26e9d3c28..86eec3eadb 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -163,6 +163,8 @@ formulas for the meaning of these parameters: +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ | :doc:`harmonic/cut ` | k, cutoff | type pairs | +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ +| :doc:`kim ` | scale | type global | ++------------------------------------------------------------------------------+--------------------------------------------------+-------------+ | :doc:`lennard/mdf ` | A,B | type pairs | +------------------------------------------------------------------------------+--------------------------------------------------+-------------+ | :doc:`lj/class2 ` | epsilon,sigma | type pairs | diff --git a/doc/src/fix_dpd_source.rst b/doc/src/fix_dpd_source.rst index ade9659d00..71894161f1 100644 --- a/doc/src/fix_dpd_source.rst +++ b/doc/src/fix_dpd_source.rst @@ -61,7 +61,7 @@ heat conduction with a source term (see Fig.12 in :ref:`(Li2014) `) or diffusion with a source term (see Fig.1 in :ref:`(Li2015) `), as an analog of a periodic Poiseuille flow problem. -.. deprecated:: TBD +.. deprecated:: 15Jun2023 The *sphere* and *cuboid* keywords will be removed in a future version of LAMMPS. The same functionality and more can be achieved with a region. diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index e72510e4da..e38e1e6894 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -19,7 +19,7 @@ Syntax * ex,ey,ez = E-field component values (electric field units) * any of ex,ey,ez can be a variable (see below) * zero or more keyword/value pairs may be appended to args -* keyword = *region* or *energy* +* keyword = *region* or *energy* or *potential* .. parsed-literal:: @@ -27,6 +27,8 @@ Syntax region-ID = ID of region atoms must be in to have added force *energy* value = v_name v_name = variable with name that calculates the potential energy of each atom in the added E-field + *potential* value = v_name + v_name = variable with name that calculates the electric potential of each atom in the added E-field Examples """""""" @@ -112,7 +114,8 @@ one or more variables, and if you are performing dynamics via the :doc:`run ` command. If the keyword is not used, LAMMPS will set the energy to 0.0, which is typically fine for dynamics. -The *energy* keyword is required if the added force is defined with +The *energy* keyword (or *potential* keyword, described below) +is required if the added force is defined with one or more variables, and you are performing energy minimization via the "minimize" command for charged particles. It is not required for point-dipoles, but a warning is issued since the minimizer in LAMMPS @@ -122,7 +125,7 @@ minimize the orientation of dipoles in an applied electric field. The *energy* keyword specifies the name of an atom-style :doc:`variable ` which is used to compute the energy of each atom as function of its position. Like variables used for *ex*, -*ey*, *ez*, the energy variable is specified as v_name, where name +*ey*, *ez*, the energy variable is specified as "v_name", where "name" is the variable name. Note that when the *energy* keyword is used during an energy @@ -133,6 +136,27 @@ due to the electric field were a spring-like F = kx, then the energy formula should be E = -0.5kx\^2. If you don't do this correctly, the minimization will not converge properly. +.. versionadded:: 15Jun2023 + +The *potential* keyword can be used as an alternative to the *energy* keyword +to specify the name of an atom-style variable, which is used to compute the +added electric potential to each atom as a function of its position. The +variable should have units of electric field multiplied by distance (that is, +in `units real`, the potential should be in volts). As with the *energy* +keyword, the variable name is specified as "v_name". The energy added by this +fix is then calculated as the electric potential multiplied by charge. + +The *potential* keyword is mainly intended for correct charge +equilibration in simulations with :doc:`fix qeq/reaxff`, +since with variable charges the electric potential can be known +beforehand but the energy cannot. A small additional benefit is that +the *energy* keyword requires an additional conversion to energy units +which the *potential* keyword avoids. Thus, when the *potential* +keyword is specified, the *energy* keyword must not be used. As with +*energy*, the *potential* keyword is not allowed if the added field is a +constant vector. The *potential* keyword is not supported by *fix +efield/tip4p*. + ---------- Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/fix_pair.rst b/doc/src/fix_pair.rst index 44c91f18ee..07e934d1c0 100644 --- a/doc/src/fix_pair.rst +++ b/doc/src/fix_pair.rst @@ -85,7 +85,7 @@ columns 4-6 will store the "uinp" values. .. code-block:: LAMMPS pair_style amoeba - fix ex all pair amoeba 10 uind 0 uinp 0 + fix ex all pair 10 amoeba uind 0 uinp 0 Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/fix_pimd.rst b/doc/src/fix_pimd.rst index eae14e9e86..c08a4005f5 100644 --- a/doc/src/fix_pimd.rst +++ b/doc/src/fix_pimd.rst @@ -1,5 +1,9 @@ +.. index:: fix pimd/langevin .. index:: fix pimd/nvt +fix pimd/langevin command +========================= + fix pimd/nvt command ==================== @@ -8,72 +12,107 @@ Syntax .. parsed-literal:: - fix ID group-ID pimd/nvt keyword value ... + fix ID group-ID style keyword value ... * ID, group-ID are documented in :doc:`fix ` command -* pimd/nvt = style name of this fix command +* style = *pimd/langevin* or *pimd/nvt* = style name of this fix command * zero or more keyword/value pairs may be appended -* keyword = *method* or *fmass* or *sp* or *temp* or *nhc* +* keywords for style *pimd/nvt* .. parsed-literal:: - + *keywords* = *method* or *fmass* or *sp* or *temp* or *nhc* *method* value = *pimd* or *nmpimd* or *cmd* *fmass* value = scaling factor on mass *sp* value = scaling factor on Planck constant - *temp* value = temperature (temperarate units) + *temp* value = temperature (temperature units) *nhc* value = Nc = number of chains in Nose-Hoover thermostat +* keywords for style *pimd/langevin* + + .. parsed-literal:: + *keywords* = *method* or *integrator* or *ensemble* or *fmmode* or *fmass* or *scale* or *temp* or *thermostat* or *tau* or *iso* or *aniso* or *barostat* or *taup* or *fixcom* or *lj* + *method* value = *nmpimd* + *integrator* value = *obabo* or *baoab* + *fmmode* value = *physical* or *normal* + *fmass* value = scaling factor on mass + *temp* value = temperature (temperature unit) + temperature = target temperature of the thermostat + *thermostat* values = style seed + style value = *PILE_L* + seed = random number generator seed + *tau* value = thermostat damping parameter (time unit) + *scale* value = scaling factor of the damping times of non-centroid modes of PILE_L thermostat + *iso* or *aniso* values = pressure (pressure unit) + pressure = scalar external pressure of the barostat + *barostat* value = *BZP* or *MTTK* + *taup* value = barostat damping parameter (time unit) + *fixcom* value = *yes* or *no* + *lj* values = epsilon sigma mass planck mvv2e + epsilon = energy scale for reduced units (energy units) + sigma = length scale for reduced units (length units) + mass = mass scale for reduced units (mass units) + planck = Planck's constant for other unit style + mvv2e = mass * velocity^2 to energy conversion factor for other unit style + Examples """""""" .. code-block:: LAMMPS fix 1 all pimd/nvt method nmpimd fmass 1.0 sp 2.0 temp 300.0 nhc 4 + fix 1 all pimd/langevin ensemble npt integrator obabo temp 113.15 thermostat PILE_L 1234 tau 1.0 iso 1.0 barostat BZP taup 1.0 Description """"""""""" .. versionchanged:: 28Mar2023 -Fix pimd was renamed to fix pimd/nvt. +Fix pimd was renamed to fix *pimd/nvt* and fix *pimd/langevin* was added. -This command performs quantum molecular dynamics simulations based on -the Feynman path integral to include effects of tunneling and +These fix commands perform quantum molecular dynamics simulations based +on the Feynman path-integral to include effects of tunneling and zero-point motion. In this formalism, the isomorphism of a quantum partition function for the original system to a classical partition function for a ring-polymer system is exploited, to efficiently sample configurations from the canonical ensemble :ref:`(Feynman) `. + The classical partition function and its components are given by the following equations: .. math:: Z = & \int d{\bf q} d{\bf p} \cdot \textrm{exp} [ -\beta H_{eff} ] \\ - H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2m_i}\bigg) + V_{eff} \\ + H_{eff} = & \bigg(\sum_{i=1}^P \frac{p_i^2}{2M_i}\bigg) + V_{eff} \\ V_{eff} = & \sum_{i=1}^P \bigg[ \frac{mP}{2\beta^2 \hbar^2} (q_i - q_{i+1})^2 + \frac{1}{P} V(q_i)\bigg] +:math:`M_i` is the fictitious mass of the :math:`i`-th mode, and m is the actual mass of the atoms. + The interested user is referred to any of the numerous references on -this methodology, but briefly, each quantum particle in a path -integral simulation is represented by a ring-polymer of P quasi-beads, -labeled from 1 to P. During the simulation, each quasi-bead interacts -with beads on the other ring-polymers with the same imaginary time -index (the second term in the effective potential above). The -quasi-beads also interact with the two neighboring quasi-beads through -the spring potential in imaginary-time space (first term in effective -potential). To sample the canonical ensemble, a Nose-Hoover massive -chain thermostat is applied :ref:`(Tuckerman) `. With the -massive chain algorithm, a chain of NH thermostats is coupled to each -degree of freedom for each quasi-bead. The keyword *temp* sets the -target temperature for the system and the keyword *nhc* sets the -number *Nc* of thermostats in each chain. For example, for a -simulation of N particles with P beads in each ring-polymer, the total -number of NH thermostats would be 3 x N x P x Nc. +this methodology, but briefly, each quantum particle in a path integral +simulation is represented by a ring-polymer of P quasi-beads, labeled +from 1 to P. During the simulation, each quasi-bead interacts with +beads on the other ring-polymers with the same imaginary time index (the +second term in the effective potential above). The quasi-beads also +interact with the two neighboring quasi-beads through the spring +potential in imaginary-time space (first term in effective potential). +To sample the canonical ensemble, any thermostat can be applied. + +Fix *pimd/nvt* applies a Nose-Hoover massive chain thermostat +:ref:`(Tuckerman) `. With the massive chain +algorithm, a chain of NH thermostats is coupled to each degree of +freedom for each quasi-bead. The keyword *temp* sets the target +temperature for the system and the keyword *nhc* sets the number *Nc* of +thermostats in each chain. For example, for a simulation of N particles +with P beads in each ring-polymer, the total number of NH thermostats +would be 3 x N x P x Nc. + +Fix *pimd/langevin* implements a Langevin thermostat in the normal mode +representation, and also provides a barostat to sample the NPH/NPT ensembles. .. note:: - Fix pimd/nvt implements a complete velocity-verlet integrator - combined with NH massive chain thermostat, so no other time - integration fix should be used. + Both these *fix* styles implement a complete velocity-verlet integrator + combined with a thermostat, so no other time integration fix should be used. The *method* keyword determines what style of PIMD is performed. A value of *pimd* is standard PIMD. A value of *nmpimd* is for @@ -81,7 +120,7 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics (CMD). The difference between the styles is as follows. In standard PIMD, the value used for a bead's fictitious mass is - arbitrary. A common choice is to use Mi = m/P, which results in the + arbitrary. A common choice is to use :math:`M_i = m/P`, which results in the mass of the entire ring-polymer being equal to the real quantum particle. But it can be difficult to efficiently integrate the equations of motion for the stiff harmonic interactions in the ring @@ -97,6 +136,10 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics overall translation of the ring-polymer and is assigned the mass of the real particle. +.. note:: + Fix pimd/langevin only supports *method* value *nmpimd*. This should be enough + for most PIMD applications for quantum thermodynamics purpose. + Motion of the centroid can be effectively uncoupled from the other normal modes by scaling the fictitious masses to achieve a partial adiabatic separation. This is called a Centroid Molecular Dynamics @@ -108,17 +151,86 @@ normal-mode PIMD. A value of *cmd* is for centroid molecular dynamics only the k > 0 modes are thermostatted, not the centroid degrees of freedom. +The keyword *integrator* specifies the Trotter splitting method used by *fix pimd/langevin*. +See :ref:`(Liu) ` for a discussion on the OBABO and BAOAB splitting schemes. Typically +either of the two should work fine. + The keyword *fmass* sets a further scaling factor for the fictitious masses of beads, which can be used for the Partial Adiabatic CMD :ref:`(Hone) `, or to be set as P, which results in the fictitious masses to be equal to the real particle masses. +The keyword *fmmode* of *fix pimd/langevin* determines the mode of fictitious +mass preconditioning. There are two options: *physical* and *normal*. If *fmmode* is +*physical*, then the physical mass of the particles are used (and then multiplied by +*fmass*). If *fmmode* is *normal*, then the physical mass is first multiplied by the +eigenvalue of each normal mode, and then multiplied by *fmass*. More precisely, the +fictitious mass of *fix pimd/langevin* is determined by two factors: *fmmode* and *fmass*. +If *fmmode* is *physical*, then the fictitious mass is + +.. math:: + + M_i = \mathrm{fmass} \times m + +If *fmmode* is *normal*, then the fictitious mass is + +.. math:: + + M_i = \mathrm{fmass} \times \lambda_i \times m + +where :math:`\lambda_i` is the eigenvalue of the :math:`i`-th normal mode. + +.. note:: + + Fictitious mass is only used in the momentum of the equation of motion + (:math:`\mathbf{p}_i=M_i\mathbf{v}_i`), and not used in the spring elastic energy + (:math:`\sum_{i=1}^P \frac{1}{2}m\omega_P^2(q_i - q_{i+1})^2`, :math:`m` is always the + actual mass of the particles). + The keyword *sp* is a scaling factor on Planck's constant, which can be useful for debugging or other purposes. The default value of 1.0 is appropriate for most situations. +The keyword *ensemble* for fix style *pimd/langevin* determines which ensemble is it +going to sample. The value can be *nve* (microcanonical), *nvt* (canonical), *nph* (isoenthalpic), +and *npt* (isothermal-isobaric). + +The keyword *temp* specifies temperature parameter for fix styles *pimd/nvt* and *pimd/langevin*. It should read +a positive floating-point number. + +.. note:: + + For pimd simulations, a temperature values should be specified even for nve ensemble. Temperature will make a difference + for nve pimd, since the spring elastic frequency between the beads will be affected by the temperature. + +The keyword *thermostat* reads *style* and *seed* of thermostat for fix style *pimd/langevin*. *style* can only +be *PILE_L* (path integral Langevin equation local thermostat, as described in :ref:`Ceriotti `), and *seed* should a positive integer number, which serves as the seed of the pseudo random number generator. + +.. note:: + The fix style *pimd/langevin* uses the stochastic PILE_L thermostat to control temperature. This thermostat works on the normal modes + of the ring polymer. The *tau* parameter controls the centroid mode, and the *scale* parameter controls the non-centroid modes. + +The keyword *tau* specifies the thermostat damping time parameter for fix style *pimd/langevin*. It is in time unit. It only works on the centroid mode. + +The keyword *scale* specifies a scaling parameter for the damping times of the non-centroid modes for fix style *pimd/langevin*. The default +damping time of the non-centroid mode :math:`i` is :math:`\frac{P}{\beta\hbar}\sqrt{\lambda_i\times\mathrm{fmass}}` (*fmmode* is *physical*) or :math:`\frac{P}{\beta\hbar}\sqrt{\mathrm{fmass}}` (*fmmode* is *normal*). The damping times of all non-centroid modes are the default values divided by *scale*. + +The barostat parameters for fix style *pimd/langevin* with *npt* or *nph* ensemble is specified using one of *iso* and *aniso* +keywords. A *pressure* value should be given with pressure unit. The keyword *iso* means couple all 3 diagonal components together when pressure is computed (hydrostatic pressure), and dilate/contract the dimensions together. The keyword *aniso* means x, y, and z dimensions are controlled independently using the Pxx, Pyy, and Pzz components of the stress tensor as the driving forces, and the specified scalar external pressure. + +The keyword *barostat* reads *style* of barostat for fix style *pimd/langevin*. *style* can +be *BZP* (Bussi-Zykova-Parrinello, as described in :ref:`Bussi `) or *MTTK* (Martyna-Tuckerman-Tobias-Klein, as described in :ref:`Martyna1 ` and :ref:`Martyna2 `). + +The keyword *taup* specifies the barostat damping time parameter for fix style *pimd/langevin*. It is in time unit. + +The keyword *fixcom* specifies whether the center-of-mass of the extended ring-polymer system is fixed during the pimd simulation. +Once *fixcom* is set to be *yes*, the center-of-mass velocity will be distracted from the centroid-mode velocities in each step. + +The keyword *lj* should be used if :doc:`lj units ` is used for *fix pimd/langevin*. Typically one may want to use +reduced units to run the simulation, and then convert the results into some physical units (for example, :doc:`metal units `). In this case, the 5 quantities in the physical mass units are needed: epsilon (energy scale), sigma (length scale), mass, Planck's constant, mvv2e (mass * velocity^2 to energy conversion factor). Planck's constant and mvv2e can be found in src/update.cpp. If there is no need to convert reduced units to physical units, set all these five value to 1. + The PIMD algorithm in LAMMPS is implemented as a hyper-parallel scheme -as described in :ref:`(Calhoun) `. In LAMMPS this is done by using +as described in :ref:`Calhoun `. In LAMMPS this is done by using :doc:`multi-replica feature ` in LAMMPS, where each quasi-particle system is stored and simulated on a separate partition of processors. The following diagram illustrates this approach. The @@ -152,22 +264,49 @@ related tasks for each of the partitions, e.g. .. code-block:: LAMMPS dump dcd all dcd 10 system_${ibead}.dcd + dump 1 all custom 100 ${ibead}.xyz id type x y z vx vy vz ix iy iz fx fy fz restart 1000 system_${ibead}.restart1 system_${ibead}.restart2 read_restart system_${ibead}.restart2 +.. note:: + Fix *pimd/langevin* dumps the Cartesian coordinates, but dumps the velocities and + forces in the normal mode representation. If the Cartesian velocities and forces are + needed, it is easy to perform the transformation when doing post-processing. + + It is recommended to dump the image flags (*ix iy iz*) for fix *pimd/langevin*. It + will be useful if you want to calculate some estimators during post-processing. + +Major differences of *fix pimd/nvt* and *fix pimd/langevin* are: + + #. *Fix pimd/nvt* includes Cartesian pimd, normal mode pimd, and centroid md. *Fix pimd/langevin* only intends to support normal mode pimd, as it is commonly enough for thermodynamic sampling. + #. *Fix pimd/nvt* uses Nose-Hoover chain thermostat. *Fix pimd/langevin* uses Langevin thermostat. + #. *Fix pimd/langevin* provides barostat, so the npt ensemble can be sampled. *Fix pimd/nvt* only support nvt ensemble. + #. *Fix pimd/langevin* provides several quantum estimators in output. + #. *Fix pimd/langevin* allows multiple processes for each bead. For *fix pimd/nvt*, there is a large chance that multi-process tasks for each bead may fail. + #. The dump of *fix pimd/nvt* are all Cartesian. *Fix pimd/langevin* dumps normal-mode velocities and forces, and Cartesian coordinates. + +Initially, the inter-replica communication and normal mode transformation parts of *fix pimd/langevin* are written based on +those of *fix pimd/nvt*, but are significantly revised. + Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -Fix pimd/nvt writes the state of the Nose/Hoover thermostat over all +Fix *pimd/nvt* writes the state of the Nose/Hoover thermostat over all quasi-beads to :doc:`binary restart files `. See the :doc:`read_restart ` command for info on how to re-specify a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. +Fix *pimd/langevin* writes the state of the barostat overall beads to +:doc:`binary restart files `. Since it uses a stochastic thermostat, +the state of the thermostat is not written. However, the state of the system +can be restored by reading the restart file, except that it will re-initialize +the random number generator. + None of the :doc:`fix_modify ` options are relevant to fix pimd/nvt. -Fix pimd/nvt computes a global 3-vector, which can be accessed by +Fix *pimd/nvt* computes a global 3-vector, which can be accessed by various :doc:`output commands `. The three quantities in the global vector are: @@ -176,21 +315,80 @@ the global vector are: #. the current value of the scalar virial estimator for the kinetic energy of the quantum system :ref:`(Herman) `. -The vector values calculated by fix pimd/nvt are "extensive", except for the +The vector values calculated by fix *pimd/nvt* are "extensive", except for the temperature, which is "intensive". -No parameter of fix pimd/nvt can be used with the *start/stop* keywords -of the :doc:`run ` command. Fix pimd/nvt is not invoked during +Fix *pimd/langevin* computes a global vector of quantities, which +can be accessed by various :doc:`output commands `. Note that +it outputs multiple log files, and different log files contain information +about different beads or modes (see detailed explanations below). If *ensemble* +is *nve* or *nvt*, the vector has 10 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + +The first 3 are different for different log files, and the others are the same for different log files. + +If *ensemble* is *nph* or *npt*, the vector stores internal variables of the barostat. If *iso* is used, +the vector has 15 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 12, 13, and 14; conserved if *ensemble* is *nph*) + +If *aniso* or *x* or *y* or *z* is used for the barostat, the vector has 17 values: + + #. kinetic energy of the normal mode + #. spring elastic energy of the normal mode + #. potential energy of the bead + #. total energy of all beads (conserved if *ensemble* is *nve*) + #. primitive kinetic energy estimator + #. virial energy estimator + #. centroid-virial energy estimator + #. primitive pressure estimator + #. thermodynamic pressure estimator + #. centroid-virial pressure estimator + #. x component of barostat velocity + #. y component of barostat velocity + #. z component of barostat velocity + #. barostat kinetic energy + #. barostat potential energy + #. barostat cell Jacobian + #. enthalpy of the extended system (sum of 4, 14, 15, and 16; conserved if *ensemble* is *nph*) + +No parameter of fix *pimd/nvt* or *pimd/langevin* can be used with the *start/stop* keywords +of the :doc:`run ` command. Fix *pimd/nvt* or *pimd/langevin* is not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is part of the REPLICA package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package +These fixes are part of the REPLICA package. They are only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` page for more info. -Fix pimd/nvt cannot be used with :doc:`lj units `. +Fix *pimd/nvt* cannot be used with :doc:`lj units `. +Fix *pimd/langevin* can be used with :doc:`lj units `. See the above part for how to use it. A PIMD simulation can be initialized with a single data file read via the :doc:`read_data ` command. However, this means all @@ -207,7 +405,7 @@ variable, e.g. Default """"""" -The keyword defaults for fix pimd/nvt are method = pimd, fmass = 1.0, sp +The keyword defaults for fix *pimd/nvt* are method = pimd, fmass = 1.0, sp = 1.0, temp = 300.0, and nhc = 2. ---------- @@ -243,3 +441,22 @@ Path Integrals, McGraw-Hill, New York (1965). **(Herman)** M. F. Herman, E. J. Bruskin, B. J. Berne, J Chem Phys, 76, 5150 (1982). +.. _Bussi: + +**(Bussi)** G. Bussi, T. Zykova-Timan, M. Parrinello, J Chem Phys, 130, 074101 (2009). + +.. _Ceriotti3: + +**(Ceriotti)** M. Ceriotti, M. Parrinello, T. Markland, D. Manolopoulos, J. Chem. Phys. 133, 124104 (2010). + +.. _Martyna3: + +**(Martyna1)** G. Martyna, D. Tobias, M. Klein, J. Chem. Phys. 101, 4177 (1994). + +.. _Martyna4: + +**(Martyna2)** G. Martyna, A. Hughes, M. Tuckerman, J. Chem. Phys. 110, 3275 (1999). + +.. _Liujian: + +**(Liu)** J. Liu, D. Li, X. Liu, J. Chem. Phys. 145, 024103 (2016). diff --git a/doc/src/fix_print.rst b/doc/src/fix_print.rst index 545283b4ef..05abbe3c98 100644 --- a/doc/src/fix_print.rst +++ b/doc/src/fix_print.rst @@ -44,6 +44,20 @@ one word. If it contains variables it must be enclosed in double quotes to ensure they are not evaluated when the input script line is read, but will instead be evaluated each time the string is printed. +.. versionadded:: 15Jun2023 + + support for vector style variables + +See the :doc:`variable ` command for a description of +*equal* and *vector* style variables which are typically the most +useful ones to use with the print command. Equal- and vector-style +variables can calculate formulas involving mathematical operations, +atom properties, group properties, thermodynamic properties, global +values calculated by a :doc:`compute ` or :doc:`fix `, +or references to other :doc:`variables `. Vector-style +variables are printed in a bracketed, comma-separated format, +e.g. [1,2,3,4] or [12.5,2,4.6,10.1]. + .. note:: As discussed on the :doc:`Commands parse ` doc @@ -77,15 +91,6 @@ timesteps 10,20,30,100,200,300,1000,2000,etc: The specified group-ID is ignored by this fix. -See the :doc:`variable ` command for a description of -*equal* style variables which are the most useful ones to use with the -fix print command, since they are evaluated afresh each timestep that -the fix print line is output. Equal-style variables calculate -formulas involving mathematical operations, atom properties, group -properties, thermodynamic properties, global values calculated by a -:doc:`compute ` or :doc:`fix `, or references to other -:doc:`variables `. - If the *file* or *append* keyword is used, a filename is specified to which the output generated by this fix will be written. If *file* is used, then the filename is overwritten if it already exists. If diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index db9015f187..00cfb6d3ce 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -128,9 +128,12 @@ periodic cell dimensions less than 10 Angstroms. This fix may be used in combination with :doc:`fix efield ` and will apply the external electric field during charge equilibration, -but there may be only one fix efield instance used, it may only use a -constant electric field, and the electric field vector may only have -components in non-periodic directions. +but there may be only one fix efield instance used and the electric field +vector may only have components in non-periodic directions. Equal-style +variables can be used for electric field vector components without any further +settings. Atom-style variables can be used for spatially-varying electric field +vector components, but the resulting electric potential must be specified +as an atom-style variable using the *potential* keyword for `fix efield`. Related commands """""""""""""""" diff --git a/doc/src/fix_reaxff_species.rst b/doc/src/fix_reaxff_species.rst index 383b8212f9..6a171ede5e 100644 --- a/doc/src/fix_reaxff_species.rst +++ b/doc/src/fix_reaxff_species.rst @@ -25,7 +25,7 @@ Syntax .. parsed-literal:: *cutoff* value = I J Cutoff - I, J = atom types + I, J = atom types (see asterisk form below) Cutoff = Bond-order cutoff value for this pair of atom types *element* value = Element1, Element2, ... *position* value = posfreq filepos @@ -49,7 +49,7 @@ Examples .. code-block:: LAMMPS fix 1 all reaxff/species 10 10 100 species.out - fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2 0.55 + fix 1 all reaxff/species 1 2 20 species.out cutoff 1 1 0.40 cutoff 1 2*3 0.55 fix 1 all reaxff/species 1 100 100 species.out element Au O H position 1000 AuOH.pos fix 1 all reaxff/species 1 100 100 species.out delete species.del masslimit 0 50 @@ -88,13 +88,24 @@ If the filename ends with ".gz", the output file is written in gzipped format. A gzipped dump file will be about 3x smaller than the text version, but will also take longer to write. +.. versionadded:: 15Jun2023 + + Support for wildcards added + Optional keyword *cutoff* can be assigned to change the minimum bond-order values used in identifying chemical bonds between pairs of atoms. Bond-order cutoffs should be carefully chosen, as bond-order -cutoffs that are too small may include too many bonds (which will -result in an error), while cutoffs that are too large will result in -fragmented molecules. The default cutoff of 0.3 usually gives good -results. +cutoffs that are too small may include too many bonds (which will result +in an error), while cutoffs that are too large will result in fragmented +molecules. The default cutoff of 0.3 usually gives good results. A +wildcard asterisk can be used in place of or in conjunction with the I,J +arguments to set the bond-order cutoff for multiple pairs of atom types. +This takes the form "\*" or "\*n" or "n\*" or "m\*n". If :math:`N` is +the number of atom types, then an asterisk with no numeric values means +all types from 1 to :math:`N`. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to +:math:`N` (inclusive). A middle asterisk means all types from m to n +(inclusive). The optional keyword *element* can be used to specify the chemical symbol printed for each LAMMPS atom type. The number of symbols must @@ -148,7 +159,8 @@ formulae). The *specieslist* and *masslimit* keywords cannot both be used in the same *reaxff/species* fix. The *delete_rate_limit* keyword can enforce an upper limit on the overall rate of molecule deletion. The number of deletion occurrences is limited to Nlimit -within an interval of Nsteps timesteps. When using the +within an interval of Nsteps timesteps. Nlimit can be specified with +an equal-style :doc:`variable `. When using the *delete_rate_limit* keyword, no deletions are permitted to occur within the first Nsteps timesteps of the first run (after reading a either a data or restart file). diff --git a/doc/src/fix_wall.rst b/doc/src/fix_wall.rst index 2cf5aeccff..42cd94978d 100644 --- a/doc/src/fix_wall.rst +++ b/doc/src/fix_wall.rst @@ -209,7 +209,7 @@ it as a single keyword. Optionally, the expression may use "rc" to refer to the cutoff distance for the given wall. Further constants in the expression can be defined -in the same string as additional expressions separated by semi-colons. +in the same string as additional expressions separated by semicolons. The expression "k*(r-rc)^2;k=100.0" represents a repulsive-only harmonic spring as in fix *wall/harmonic* with a force constant *K* (same as :math:`\epsilon` above) of 100 energy units. More details on the Lepton diff --git a/doc/src/kspace_modify.rst b/doc/src/kspace_modify.rst index 2d3921e281..351e387c0f 100644 --- a/doc/src/kspace_modify.rst +++ b/doc/src/kspace_modify.rst @@ -142,7 +142,8 @@ the code will stop with an error message. When this option is set to For a typical application, using the automatic parameter generation will provide simulations that are either inaccurate or slow. Using this option is thus not recommended. For guidelines on how to obtain good -parameters, see the :doc:`How-To ` discussion. +parameters, see the :doc:`long-range dispersion howto ` +discussion. ---------- diff --git a/doc/src/package.rst b/doc/src/package.rst index 76bf20a97f..0f28598029 100644 --- a/doc/src/package.rst +++ b/doc/src/package.rst @@ -49,7 +49,7 @@ Syntax *intel* args = NPhi keyword value ... Nphi = # of co-processors per node zero or more keyword/value pairs may be appended - keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *no_affinity* + keywords = *mode* or *omp* or *lrt* or *balance* or *ghost* or *tpc* or *tptask* or *pppm_table* or *no_affinity* *mode* value = *single* or *mixed* or *double* single = perform force calculations in single precision mixed = perform force calculations in mixed precision @@ -68,10 +68,13 @@ Syntax Ntpc = max number of co-processor threads per co-processor core (default = 4) *tptask* value = Ntptask Ntptask = max number of co-processor threads per MPI task (default = 240) + *pppm_table* value = *yes* or *no* + *yes* = Precompute pppm values in table (doesn't change accuracy) + *no* = Compute pppm values on the fly *no_affinity* values = none *kokkos* args = keyword value ... zero or more keyword/value pairs may be appended - keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *neigh/transpose* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* or *comm/pair/forward* or *comm/fix/forward* or *comm/reverse* or *comm/pair/reverse* or *gpu/aware* or *pair/only* + keywords = *neigh* or *neigh/qeq* or *neigh/thread* or *neigh/transpose* or *newton* or *binsize* or *comm* or *comm/exchange* or *comm/forward* or *comm/pair/forward* or *comm/fix/forward* or *comm/reverse* or *comm/pair/reverse* or *sort* or *gpu/aware* or *pair/only* *neigh* value = *full* or *half* full = full neighbor list half = half neighbor list built in thread-safe manner @@ -102,6 +105,9 @@ Syntax *comm/pair/reverse* value = *no* or *device* *no* = perform communication pack/unpack in non-KOKKOS mode *device* = perform pack/unpack on device (e.g. on GPU) + *sort* value = *no* or *device* + *no* = perform atom sorting in non-KOKKOS mode + *device* = perform atom sorting on device (e.g. on GPU) *gpu/aware* = *off* or *on* *off* = do not use GPU-aware MPI *on* = use GPU-aware MPI (default) @@ -389,13 +395,13 @@ is identical to the default *verlet* style aside from supporting the LRT feature. This feature requires setting the pre-processor flag -DLMP_INTEL_USELRT in the makefile when compiling LAMMPS. -The *balance* keyword sets the fraction of :doc:`pair style ` work offloaded to the co-processor for split -values between 0.0 and 1.0 inclusive. While this fraction of work is -running on the co-processor, other calculations will run on the host, -including neighbor and pair calculations that are not offloaded, as -well as angle, bond, dihedral, kspace, and some MPI communications. -If *split* is set to -1, the fraction of work is dynamically adjusted -automatically throughout the run. This typically give performance +The *balance* keyword sets the fraction of :doc:`pair style ` work +offloaded to the co-processor for split values between 0.0 and 1.0 inclusive. +While this fraction of work is running on the co-processor, other calculations +will run on the host, including neighbor and pair calculations that are not +offloaded, as well as angle, bond, dihedral, kspace, and some MPI +communications. If *split* is set to -1, the fraction of work is dynamically +adjusted automatically throughout the run. This typically give performance within 5 to 10 percent of the optimal fixed fraction. The *ghost* keyword determines whether or not ghost atoms, i.e. atoms @@ -427,6 +433,13 @@ with 16 threads, for a total of 128. Note that the default settings for *tpc* and *tptask* are fine for most problems, regardless of how many MPI tasks you assign to a Phi. +.. versionadded:: 15Jun2023 + +The *pppm_table* keyword with the argument yes allows to use a +pre-computed table to efficiently spread the charge to the PPPM grid. +This feature is enabled by default but can be turned off using the +keyword with the argument *no*. + The *no_affinity* keyword will turn off automatic setting of core affinity for MPI tasks and OpenMP threads on the host when using offload to a co-processor. Affinity settings are used when possible @@ -554,6 +567,17 @@ pack/unpack communicated data. When running small systems on a GPU, performing the exchange pack/unpack on the host CPU can give speedup since it reduces the number of CUDA kernel launches. +The *sort* keyword determines whether the host or device performs atom +sorting, see the :doc:`atom_modify sort ` command. The +value options for the *sort* keyword are *no* or *device* similar to the +*comm* keywords above. If a value of *host* is used it will be +automatically be changed to *no* since the *sort* keyword does not +support *host* mode. The value of *no* will also always be used when +running on the CPU, i.e. setting the value to *device* will have no +effect if the simulation is running on the CPU. Not all fix styles with +extra atom data support *device* mode and in that case a warning will be +given and atom sorting will run in *no* mode instead. + The *gpu/aware* keyword chooses whether GPU-aware MPI will be used. When this keyword is set to *on*, buffers in GPU memory are passed directly through MPI send/receive calls. This reduces overhead of first copying @@ -685,39 +709,37 @@ Related commands Default """"""" -For the GPU package, the default is Ngpu = 0 and the option defaults -are neigh = yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 -to Ngpu-1, tpa = 1, omp = 0, and platform=-1. These settings are made -automatically if the "-sf gpu" :doc:`command-line switch ` -is used. If it is not used, you must invoke the package gpu command -in your input script or via the "-pk gpu" :doc:`command-line switch `. +For the GPU package, the default is Ngpu = 0 and the option defaults are neigh += yes, newton = off, binsize = 0.0, split = 1.0, gpuID = 0 to Ngpu-1, tpa = 1, +omp = 0, and platform=-1. These settings are made automatically if the "-sf +gpu" :doc:`command-line switch ` is used. If it is not used, you +must invoke the package gpu command in your input script or via the "-pk gpu" +:doc:`command-line switch `. -For the INTEL package, the default is Nphi = 1 and the option -defaults are omp = 0, mode = mixed, lrt = no, balance = -1, tpc = 4, -tptask = 240. The default ghost option is determined by the pair -style being used. This value is output to the screen in the offload -report at the end of each run. Note that all of these settings, -except "omp" and "mode", are ignored if LAMMPS was not built with Xeon -Phi co-processor support. These settings are made automatically if the -"-sf intel" :doc:`command-line switch ` is used. If it is -not used, you must invoke the package intel command in your input -script or via the "-pk intel" :doc:`command-line switch `. +For the INTEL package, the default is Nphi = 1 and the option defaults are omp += 0, mode = mixed, lrt = no, balance = -1, tpc = 4, tptask = 240, pppm_table = +yes. The default ghost option is determined by the pair style being used. +This value is output to the screen in the offload report at the end of each +run. Note that all of these settings, except "omp" and "mode", are ignored if +LAMMPS was not built with Xeon Phi co-processor support. These settings are +made automatically if the "-sf intel" :doc:`command-line switch ` +is used. If it is not used, you must invoke the package intel command in your +input script or via the "-pk intel" :doc:`command-line switch `. For the KOKKOS package, the option defaults for GPUs are neigh = full, -neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default -value, comm = device, neigh/transpose = off, gpu/aware = on. When -LAMMPS can safely detect that GPU-aware MPI is not available, the -default value of gpu/aware becomes "off". For CPUs or Xeon Phis, the -option defaults are neigh = half, neigh/qeq = half, newton = on, -binsize = 0.0, and comm = no. The option neigh/thread = on when there -are 16K atoms or less on an MPI rank, otherwise it is "off". These -settings are made automatically by the required "-k on" -:doc:`command-line switch `. You can change them by using -the package kokkos command in your input script or via the :doc:`-pk +neigh/qeq = full, newton = off, binsize for GPUs = 2x LAMMPS default value, +comm = device, sort = device, neigh/transpose = off, gpu/aware = on. When +LAMMPS can safely detect that GPU-aware MPI is not available, the default value +of gpu/aware becomes "off". For CPUs or Xeon Phis, the option defaults are +neigh = half, neigh/qeq = half, newton = on, binsize = 0.0, comm = no, and sort += no. The option neigh/thread = on when there are 16K atoms or less on an MPI +rank, otherwise it is "off". These settings are made automatically by the +required "-k on" :doc:`command-line switch `. You can change them +by using the package kokkos command in your input script or via the :doc:`-pk kokkos command-line switch `. -For the OMP package, the default is Nthreads = 0 and the option -defaults are neigh = yes. These settings are made automatically if -the "-sf omp" :doc:`command-line switch ` is used. If it -is not used, you must invoke the package omp command in your input -script or via the "-pk omp" :doc:`command-line switch `. +For the OMP package, the default is Nthreads = 0 and the option defaults are +neigh = yes. These settings are made automatically if the "-sf omp" +:doc:`command-line switch ` is used. If it is not used, you must +invoke the package omp command in your input script or via the "-pk omp" +:doc:`command-line switch `. diff --git a/doc/src/pair_aip_water_2dm.rst b/doc/src/pair_aip_water_2dm.rst new file mode 100644 index 0000000000..5cee40edda --- /dev/null +++ b/doc/src/pair_aip_water_2dm.rst @@ -0,0 +1,167 @@ +.. index:: pair_style aip/water/2dm +.. index:: pair_style aip/water/2dm/opt + +pair_style aip/water/2dm command +=================================== + +Accelerator Variant: *aip/water/2dm/opt* + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style [hybrid/overlay ...] aip/water/2dm cutoff tap_flag + +* cutoff = global cutoff (distance units) +* tap_flag = 0/1 to turn off/on the taper function + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style hybrid/overlay aip/water/2dm 16.0 1 + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw + + pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 + pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O + pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H + pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H + pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw + +Description +""""""""""" + +.. versionadded:: 15Jun2023 + +The *aip/water/2dm* style computes the anisotropic interfacial potential +(AIP) potential for interfaces of water with two-dimensional (2D) +materials as described in :ref:`(Feng) `. + +.. math:: + + E = & \frac{1}{2} \sum_i \sum_{j \neq i} V_{ij} \\ + V_{ij} = & {\rm Tap}(r_{ij})\left \{ e^{-\alpha (r_{ij}/\beta -1)} + \left [ \epsilon + f(\rho_{ij}) + f(\rho_{ji})\right ] - + \frac{1}{1+e^{-d\left [ \left ( r_{ij}/\left (s_R \cdot r^{eff} \right ) \right )-1 \right ]}} + \cdot \frac{C_6}{r^6_{ij}} \right \}\\ + \rho_{ij}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_i)^2 \\ + \rho_{ji}^2 = & r_{ij}^2 - ({\bf r}_{ij} \cdot {\bf n}_j)^2 \\ + f(\rho) = & C e^{ -( \rho / \delta )^2 } \\ + {\rm Tap}(r_{ij}) = & 20\left ( \frac{r_{ij}}{R_{cut}} \right )^7 - + 70\left ( \frac{r_{ij}}{R_{cut}} \right )^6 + + 84\left ( \frac{r_{ij}}{R_{cut}} \right )^5 - + 35\left ( \frac{r_{ij}}{R_{cut}} \right )^4 + 1 + +Where :math:`\mathrm{Tap}(r_{ij})` is the taper function which provides +a continuous cutoff (up to third derivative) for interatomic separations +larger than :math:`r_c` :doc:`pair_style ilp_graphene_hbn +`. + +.. note:: + + This pair style uses the atomic normal vector definition from + :ref:`(Feng) `), where the atomic normal vectors of the + hydrogen atoms are assumed to lie along the corresponding + oxygen-hydrogen bonds and the normal vector of the central oxygen + atom is defined as their average. + +The provided parameter file, ``COH.aip.water.2dm``, is intended for use +with *metal* :doc:`units `, with energies in meV. Two additional +parameters, *S*, and *rcut* are included in the parameter file. *S* is +designed to facilitate scaling of energies; *rcut* is the cutoff for an +internal, short distance neighbor list that is generated for speeding up +the calculation of the normals for all atom pairs. + +.. note:: + + The parameters presented in the provided parameter file, + ``COH.aip.water.2dm``, are fitted with the taper function enabled by + setting the cutoff equal to 16.0 Angstrom. Using a different cutoff + or taper function setting should be carefully checked as they can + lead to significant errors. These parameters provide a good + description in both short- and long-range interaction regimes. This + is essential for simulations in high pressure regime (i.e., the + interlayer distance is smaller than the equilibrium distance). + +This potential must be used in combination with hybrid/overlay. Other +interactions can be set to zero using :doc:`pair_coeff settings +` with the pair style set to *none*\ . + +This pair style tallies a breakdown of the total interlayer potential +energy into sub-categories, which can be accessed via the :doc:`compute +pair ` command as a vector of values of length 2. The 2 +values correspond to the following sub-categories: + +1. *E_vdW* = vdW (attractive) energy +2. *E_Rep* = Repulsive energy + +To print these quantities to the log file (with descriptive column +headings) the following commands could be included in an input script: + +.. code-block:: LAMMPS + + compute 0 all pair aip/water/2dm + variable Evdw equal c_0[1] + variable Erep equal c_0[2] + thermo_style custom step temp epair v_Erep v_Evdw + +---------- + +.. include:: accel_styles.rst + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This pair style does not support the pair_modify mix, shift, table, and +tail options. + +This pair style does not write their information to binary restart +files, since it is stored in potential files. Thus, you need to +re-specify the pair_style and pair_coeff commands in an input script +that reads a restart file. + +Restrictions +"""""""""""" + +This pair style is part of the INTERLAYER package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +This pair style requires the newton setting to be *on* for pair +interactions. + +The ``COH.aip.water.2dm`` potential file provided with LAMMPS is +parameterized for *metal* units. You can use this pair style with any +LAMMPS units, but you would need to create your own potential file with +parameters in the appropriate units, if your simulation does not use +*metal* units. + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, +:doc:`pair_none `, +:doc:`pair_style hybrid/overlay `, +:doc:`pair_style drip `, +:doc:`pair_style ilp_tmd `, +:doc:`pair_style saip_metal `, +:doc:`pair_style ilp_graphene_hbn `, +:doc:`pair_style pair_kolmogorov_crespi_z `, +:doc:`pair_style pair_kolmogorov_crespi_full `, +:doc:`pair_style pair_lebedeva_z `, +:doc:`pair_style pair_coul_shield `. + +Default +""""""" + +tap_flag = 1 + +---------- + +.. _Feng: + +**(Feng)** Z. Feng and W. Ouyang et al., J. Phys. Chem. C. 127, 8704-8713 (2023). diff --git a/doc/src/pair_dpd.rst b/doc/src/pair_dpd.rst index 815fe46cdc..4c8deab152 100644 --- a/doc/src/pair_dpd.rst +++ b/doc/src/pair_dpd.rst @@ -26,8 +26,8 @@ Syntax pair_style dpd T cutoff seed pair_style dpd/tstat Tstart Tstop cutoff seed -* T = temperature (temperature units) -* Tstart,Tstop = desired temperature at start/end of run (temperature units) +* T = temperature (temperature units) (dpd only) +* Tstart,Tstop = desired temperature at start/end of run (temperature units) (dpd/tstat only) * cutoff = global cutoff for DPD interactions (distance units) * seed = random # seed (positive integer) @@ -40,9 +40,9 @@ Examples pair_coeff * * 3.0 1.0 pair_coeff 1 1 3.0 1.0 1.0 - pair_style dpd/tstat 1.0 1.0 2.5 34387 - pair_coeff * * 1.0 - pair_coeff 1 1 1.0 1.0 + pair_style hybrid/overlay lj/cut 2.5 dpd/tstat 1.0 1.0 2.5 34387 + pair_coeff * * lj/cut 1.0 1.0 + pair_coeff * * dpd/tstat 1.0 Description """"""""""" @@ -53,7 +53,7 @@ Style *dpd* computes a force field for dissipative particle dynamics Style *dpd/tstat* invokes a DPD thermostat on pairwise interactions, which is equivalent to the non-conservative portion of the DPD force field. This pairwise thermostat can be used in conjunction with any -:doc:`pair style `, and in leiu of per-particle thermostats +:doc:`pair style `, and instead of per-particle thermostats like :doc:`fix langevin ` or ensemble thermostats like Nose Hoover as implemented by :doc:`fix nvt `. To use *dpd/tstat* as a thermostat for another pair style, use the @@ -105,14 +105,18 @@ commands: * :math:`\gamma` (force/velocity units) * cutoff (distance units) -The last coefficient is optional. If not specified, the global DPD +The cutoff coefficient is optional. If not specified, the global DPD cutoff is used. Note that sigma is set equal to sqrt(2 T gamma), where T is the temperature set by the :doc:`pair_style ` command so it does not need to be specified. For style *dpd/tstat*, the coefficients defined for each pair of -atoms types via the :doc:`pair_coeff ` command is the same, -except that A is not included. +atoms types via the :doc:`pair_coeff ` command are: + +* :math:`\gamma` (force/velocity units) +* cutoff (distance units) + +The cutoff coefficient is optional. The GPU-accelerated versions of these styles are implemented based on the work of :ref:`(Afshar) ` and :ref:`(Phillips) `. @@ -135,6 +139,12 @@ the work of :ref:`(Afshar) ` and :ref:`(Phillips) `. numbers are applied and thus the individual forces and therefore also the virial/pressure. +.. note:: + + For more consistent time integration and force computation you may + consider using :doc:`fix mvv/dpd ` instead of :doc:`fix + nve `. + ---------- .. include:: accel_styles.rst @@ -206,7 +216,9 @@ command for more details. Related commands """""""""""""""" -:doc:`pair_coeff `, :doc:`fix nvt `, :doc:`fix langevin `, :doc:`pair_style srp ` +:doc:`pair_style dpd/ext `, :doc:`pair_coeff `, +:doc:`fix nvt `, :doc:`fix langevin `, +:doc:`pair_style srp `, :doc:`fix mvv/dpd `. Default """"""" diff --git a/doc/src/pair_dpd_ext.rst b/doc/src/pair_dpd_ext.rst index 47c14fa813..1caed4689b 100644 --- a/doc/src/pair_dpd_ext.rst +++ b/doc/src/pair_dpd_ext.rst @@ -18,7 +18,6 @@ Accelerator Variants: dpd/ext/tstat/kk dpd/ext/tstat/omp Syntax """""" - .. code-block:: LAMMPS pair_style dpd/ext T cutoff seed @@ -32,16 +31,15 @@ Syntax Examples """""""" - .. code-block:: LAMMPS pair_style dpd/ext 1.0 2.5 34387 pair_coeff 1 1 25.0 4.5 4.5 0.5 0.5 1.2 pair_coeff 1 2 40.0 4.5 4.5 0.5 0.5 1.2 - pair_style dpd/ext/tstat 1.0 1.0 2.5 34387 - pair_coeff 1 1 4.5 4.5 0.5 0.5 1.2 - pair_coeff 1 2 4.5 4.5 0.5 0.5 1.2 + pair_style hybrid/overlay lj/cut 2.5 dpd/ext/tstat 1.0 1.0 2.5 34387 + pair_coeff * * lj/cut 1.0 1.0 + pair_coeff * * 4.5 4.5 0.5 0.5 1.2 Description """"""""""" @@ -128,20 +126,39 @@ the :doc:`pair_style ` command so it does not need to be specified. For the style *dpd/ext/tstat*, the coefficients defined for each pair of -atoms types via the :doc:`pair_coeff ` command is the same, -except that A is not included. +atoms types via the :doc:`pair_coeff ` command are: + +* :math:`\gamma_{\parallel}` (force/velocity units) +* :math:`\gamma_{\perp}` (force/velocity units) +* :math:`s_{\parallel}` (unitless) +* :math:`s_{\perp}` (unitless) +* :math:`r_c` (distance units) + +The last coefficient is optional. .. note:: If you are modeling DPD polymer chains, you may want to use the :doc:`pair_style srp ` command in conjunction with these pair - styles. It is a soft segmental repulsive potential (SRP) that can + styles. It is a soft segmental repulsive potential (SRP) that can prevent DPD polymer chains from crossing each other. .. note:: - The virial calculation for pressure when using this pair style includes - all the components of force listed above, including the random force. + The virial calculation for pressure when using these pair styles + includes all the components of force listed above, including the + random force. Since the random force depends on random numbers, + everything that changes the order of atoms in the neighbor list + (e.g. different number of MPI ranks or a different neighbor list + skin distance) will also change the sequence in which the random + numbers are applied and thus the individual forces and therefore + also the virial/pressure. + +.. note:: + + For more consistent time integration and force computation you may + consider using :doc:`fix mvv/dpd ` instead of :doc:`fix + nve `. ---------- @@ -207,7 +224,7 @@ Related commands :doc:`pair_style dpd `, :doc:`pair_coeff `, :doc:`fix nvt `, :doc:`fix langevin `, -:doc:`pair_style srp ` +:doc:`pair_style srp `, :doc:`fix mvv/dpd `. **Default:** none diff --git a/doc/src/pair_granular.rst b/doc/src/pair_granular.rst index 21afc1b4fc..37ff8fcbfe 100644 --- a/doc/src/pair_granular.rst +++ b/doc/src/pair_granular.rst @@ -736,7 +736,7 @@ or .. math:: - E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij})} + E_{eff,ij} = \frac{E_{ij}}{2(1-\nu_{ij}^2)} These pair styles write their information to :doc:`binary restart files `, so a pair_style command does not need to be specified in an input script that reads a restart file. diff --git a/doc/src/pair_ilp_graphene_hbn.rst b/doc/src/pair_ilp_graphene_hbn.rst index de088f2926..36e971ef62 100644 --- a/doc/src/pair_ilp_graphene_hbn.rst +++ b/doc/src/pair_ilp_graphene_hbn.rst @@ -155,8 +155,8 @@ interactions. The BNCH.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom BNCH.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands @@ -181,6 +181,14 @@ tap_flag = 1 ---------- +.. _Ouyang1: + +**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). + +.. _Ouyang2: + +**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). + .. _Leven1: **(Leven1)** I. Leven, I. Azuri, L. Kronik and O. Hod, J. Chem. Phys. 140, 104106 (2014). @@ -196,11 +204,3 @@ tap_flag = 1 .. _Kolmogorov2: **(Kolmogorov)** A. N. Kolmogorov, V. H. Crespi, Phys. Rev. B 71, 235415 (2005). - -.. _Ouyang1: - -**(Ouyang1)** W. Ouyang, D. Mandelli, M. Urbakh and O. Hod, Nano Lett. 18, 6009-6016 (2018). - -.. _Ouyang2: - -**(Ouyang2)** W. Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020). diff --git a/doc/src/pair_ilp_tmd.rst b/doc/src/pair_ilp_tmd.rst index 77fa8bbfd5..482d75a100 100644 --- a/doc/src/pair_ilp_tmd.rst +++ b/doc/src/pair_ilp_tmd.rst @@ -135,8 +135,8 @@ interactions. The TMD.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom TMD.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands diff --git a/doc/src/pair_kolmogorov_crespi_full.rst b/doc/src/pair_kolmogorov_crespi_full.rst index 1a33a3f4bb..1a4706dd6f 100644 --- a/doc/src/pair_kolmogorov_crespi_full.rst +++ b/doc/src/pair_kolmogorov_crespi_full.rst @@ -129,7 +129,7 @@ interactions. The CH.KC potential file provided with LAMMPS (see the potentials folder) is parameterized for metal units. You can use this pair style with any LAMMPS units, but you would need to create your own custom -CC.KC potential file with all coefficients converted to the appropriate +CH.KC potential file with all coefficients converted to the appropriate units. Related commands diff --git a/doc/src/pair_lepton.rst b/doc/src/pair_lepton.rst index ffd317af40..21e619a3d9 100644 --- a/doc/src/pair_lepton.rst +++ b/doc/src/pair_lepton.rst @@ -61,9 +61,11 @@ Description .. versionadded:: 8Feb2023 -.. versionchanged:: TBD + added pair styles *lepton* and *lepton/coul* - added pair style lepton/sphere +.. versionchanged:: 15Jun2023 + + added pair style *lepton/sphere* Pair styles *lepton*, *lepton/coul*, *lepton/sphere* compute pairwise interactions between particles which depend on the distance and have a @@ -76,7 +78,7 @@ instead reference the radii of the two atoms of the pair with "radi" and :doc:`data files ` or the :doc:`set command `. Note that further constants in the expressions can be defined in the -same string as additional expressions separated by semi-colons as shown +same string as additional expressions separated by semicolons as shown in the examples above. The expression `"200.0*(r-1.5)^2"` represents a harmonic potential diff --git a/doc/src/pair_lj.rst b/doc/src/pair_lj.rst index 62cdd98cef..1a099e009b 100644 --- a/doc/src/pair_lj.rst +++ b/doc/src/pair_lj.rst @@ -43,8 +43,7 @@ given by .. math:: E = 4 \epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - - \left(\frac{\sigma}{r}\right)^6 \right] - \qquad r < r_c + \left(\frac{\sigma}{r}\right)^6 \right] \qquad r < r_c :math:`r_c` is the cutoff. @@ -64,12 +63,24 @@ file or restart files read by the :doc:`read_data ` or * :math:`\sigma` (distance units) * LJ cutoff (distance units) -Note that :math:`\sigma` is defined in the LJ formula as the zero-crossing -distance for the potential, not as the energy minimum at :math:`2^{\frac{1}{6}} \sigma`. - The last coefficient is optional. If not specified, the global LJ cutoff specified in the pair_style command is used. +Note that :math:`\sigma` is defined in the LJ formula as the +zero-crossing distance for the potential, *not* as the energy minimum at +:math:`r_0 = 2^{\frac{1}{6}} \sigma`. The _same_ potential function becomes: + +.. math:: + + E = \epsilon \left[ \left(\frac{r_0}{r}\right)^{12} - + 2 \left(\frac{r_0}{r}\right)^6 \right] \qquad r < r_c + +When using the minimum as reference width. In the literature both +formulations are used, but the describe the same potential, only the +:math:`\sigma` value must be computed by :math:`\sigma = r_0 / +2^{\frac{1}{6}}` for use with LAMMPS, if this latter formulation is +used. + ---------- A version of these styles with a soft core, *lj/cut/soft*, suitable diff --git a/doc/src/pair_lj_cut_sphere.rst b/doc/src/pair_lj_cut_sphere.rst index 428047d5df..31f84bc40e 100644 --- a/doc/src/pair_lj_cut_sphere.rst +++ b/doc/src/pair_lj_cut_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/cut/sphere* style compute the standard 12/6 Lennard-Jones potential, given by diff --git a/doc/src/pair_lj_expand_sphere.rst b/doc/src/pair_lj_expand_sphere.rst index c60cf160f0..2c01624251 100644 --- a/doc/src/pair_lj_expand_sphere.rst +++ b/doc/src/pair_lj_expand_sphere.rst @@ -33,7 +33,7 @@ Examples Description """"""""""" -.. versionadded:: TBD +.. versionadded:: 15Jun2023 The *lj/expand/sphere* style compute a 12/6 Lennard-Jones potential with a distance shifted by :math:`\Delta = \frac{1}{2} (d_i + d_j)`, the diff --git a/doc/src/pair_saip_metal.rst b/doc/src/pair_saip_metal.rst index 21bfeb0aa9..ed011894c9 100644 --- a/doc/src/pair_saip_metal.rst +++ b/doc/src/pair_saip_metal.rst @@ -134,8 +134,8 @@ interactions. The CHAu.ILP potential file provided with LAMMPS (see the potentials directory) are parameterized for *metal* units. You can use this -potential with any LAMMPS units, but you would need to create your -BNCH.ILP potential file with coefficients listed in the appropriate +potential with any LAMMPS units, but you would need to create your own +custom CHAu.ILP potential file with coefficients listed in the appropriate units, if your simulation does not use *metal* units. Related commands diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index 441313b0b8..494a26aacf 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -114,6 +114,7 @@ accelerated styles exist. * :doc:`adp ` - angular dependent potential (ADP) of Mishin * :doc:`agni ` - AGNI machine-learning potential +* :doc:`aip/water/2dm ` - anisotropic interfacial potential for water in 2d geometries * :doc:`airebo ` - AIREBO potential of Stuart * :doc:`airebo/morse ` - AIREBO with Morse instead of LJ * :doc:`amoeba ` - diff --git a/doc/src/print.rst b/doc/src/print.rst index 1211fdd569..a221ed04b6 100644 --- a/doc/src/print.rst +++ b/doc/src/print.rst @@ -46,6 +46,20 @@ lines of output, the string can be enclosed in triple quotes, as in the last example above. If the text string contains variables, they will be evaluated and their current values printed. +.. versionadded:: 15Jun2023 + + support for vector style variables + +See the :doc:`variable ` command for a description of +*equal* and *vector* style variables which are typically the most +useful ones to use with the print command. Equal- and vector-style +variables can calculate formulas involving mathematical operations, +atom properties, group properties, thermodynamic properties, global +values calculated by a :doc:`compute ` or :doc:`fix `, +or references to other :doc:`variables `. Vector-style +variables are printed in a bracketed, comma-separated format, +e.g. [1,2,3,4] or [12.5,2,4.6,10.1]. + .. note:: As discussed on the :doc:`Commands parse ` doc @@ -60,6 +74,15 @@ will be evaluated and their current values printed. This is also explained on the :doc:`Commands parse ` doc page. +If you want the print command to be executed multiple times (with +changing variable values), there are 3 options. First, consider using +the :doc:`fix print ` command, which will print a string +periodically during a simulation. Second, the print command can be +used as an argument to the *every* option of the :doc:`run ` +command. Third, the print command could appear in a section of the +input script that is looped over (see the :doc:`jump ` and +:doc:`next ` commands). + If the *file* or *append* keyword is used, a filename is specified to which the output will be written. If *file* is used, then the filename is overwritten if it already exists. If *append* is used, @@ -74,23 +97,6 @@ logfile can be turned on or off as desired. In multi-partition calculations, the *screen* option and the corresponding output only apply to the screen and logfile of the individual partition. -If you want the print command to be executed multiple times (with -changing variable values), there are 3 options. First, consider using -the :doc:`fix print ` command, which will print a string -periodically during a simulation. Second, the print command can be -used as an argument to the *every* option of the :doc:`run ` -command. Third, the print command could appear in a section of the -input script that is looped over (see the :doc:`jump ` and -:doc:`next ` commands). - -See the :doc:`variable ` command for a description of *equal* -style variables which are typically the most useful ones to use with -the print command. Equal-style variables can calculate formulas -involving mathematical operations, atom properties, group properties, -thermodynamic properties, global values calculated by a -:doc:`compute ` or :doc:`fix `, or references to other -:doc:`variables `. - Restrictions """""""""""" none diff --git a/doc/src/read_dump.rst b/doc/src/read_dump.rst index c03b3b50de..59d6cca78d 100644 --- a/doc/src/read_dump.rst +++ b/doc/src/read_dump.rst @@ -132,7 +132,7 @@ files can be written by LAMMPS via the :doc:`dump dcd ` command. The *path* value specifies a list of directories which LAMMPS will search for the molfile plugins appropriate to the specified *style*\ . The syntax of the *path* value is like other search paths: it can -contain multiple directories separated by a colon (or semi-colon on +contain multiple directories separated by a colon (or semicolon on windows). The *path* keyword is optional and defaults to ".", i.e. the current directory. diff --git a/doc/src/special_bonds.rst b/doc/src/special_bonds.rst index 61c7976974..b1104d57cf 100644 --- a/doc/src/special_bonds.rst +++ b/doc/src/special_bonds.rst @@ -92,9 +92,24 @@ The Coulomb factors are applied to any Coulomb (charge interaction) term that the potential calculates. The LJ factors are applied to the remaining terms that the potential calculates, whether they represent LJ interactions or not. The weighting factors are a scaling -prefactor on the energy and force between the pair of atoms. A value -of 1.0 means include the full interaction; a value of 0.0 means -exclude it completely. +prefactor on the energy and force between the pair of atoms. + +A value of 1.0 means include the full interaction without flagging the +pair as a "special pair"; a value of 0.0 means exclude the pair +completely from the neighbor list, except for pair styles that require a +:doc:`kspace style ` and pair styles :doc:`amoeba +`, :doc:`hippo `, :doc:`thole `, +:doc:`coul/exclude `, and pair styles that include +"coul/dsf" or "coul/wolf". + +.. note:: + + To include pairs that would otherwise be excluded (so they are + included in the neighbor list for certain analysis compute styles), + you can use a very small but non-zero value like 1.0e-100 instead of + 0.0. Due to using floating-point math, the computed force, energy, + and virial contributions from the pairs will be too small to cause + differences. The first of the 3 coefficients (LJ or Coulombic) is the weighting factor on 1-2 atom pairs, which are pairs of atoms directly bonded to diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 8bd33218ac..67600af62d 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -11,12 +11,19 @@ Syntax variable name style args ... * name = name of variable to define -* style = *delete* or *index* or *loop* or *world* or *universe* or *uloop* or *string* or *format* or *getenv* or *file* or *atomfile* or *python* or *timer* or *internal* or *equal* or *vector* or *atom* +* style = *delete* or *atomfile* or *file* or *format* or *getenv* or *index* or *internal* or *loop* or *python* or *string* or *timer* or *uloop* or *universe* or *world* or *equal* or *vector* or *atom* .. parsed-literal:: *delete* = no args + *atomfile* arg = filename + *file* arg = filename + *format* args = vname fstr + vname = name of equal-style variable to evaluate + fstr = C-style format string + *getenv* arg = one string *index* args = one or more strings + *internal* arg = numeric value *loop* args = N N = integer size of loop, loop from 1 to N inclusive *loop* args = N pad @@ -27,24 +34,18 @@ Syntax *loop* args = N1 N2 pad N1,N2 = loop from N1 to N2 inclusive pad = all values will be same length, e.g. 050, 051, ..., 100 - *world* args = one string for each partition of processors - *universe* args = one or more strings + *python* arg = function + *string* arg = one string + *timer* arg = no arguments *uloop* args = N N = integer size of loop *uloop* args = N pad N = integer size of loop pad = all values will be same length, e.g. 001, 002, ..., 100 - *string* arg = one string - *format* args = vname fstr - vname = name of equal-style variable to evaluate - fstr = C-style format string - *getenv* arg = one string - *file* arg = filename - *atomfile* arg = filename - *python* arg = function - *timer* arg = no arguments - *internal* arg = numeric value - *equal* or *vector* or *atom* args = one formula containing numbers, thermo keywords, math operations, group functions, atom values and vectors, compute/fix/variable references + *universe* args = one or more strings + *world* args = one string for each partition of processors + + *equal* or *vector* or *atom* args = one formula containing numbers, thermo keywords, math operations, built-in functions, atom values and vectors, compute/fix/variable references numbers = 0.0, 100, -5.4, 2.8e-4, etc constants = PI, version, on, off, true, false, yes, no thermo keywords = vol, ke, press, etc from :doc:`thermo_style ` @@ -66,13 +67,14 @@ Syntax bound(group,dir,region), gyration(group,region), ke(group,reigon), angmom(group,dim,region), torque(group,dim,region), inertia(group,dimdim,region), omega(group,dim,region) - special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label) - feature functions = is_active(category,feature), is_available(category,feature), is_defined(category,id) + special functions = sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label), is_typelabel(kind,label) + feature functions = is_available(category,feature), is_active(category,feature), is_defined(category,id) atom value = id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] atom vector = id, mass, type, mol, radius, q, x, y, z, vx, vy, vz, fx, fy, fz compute references = c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] fix references = f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i] variable references = v_name, v_name[i] + vector initialization = [1,3,7,10] (for *vector* variables only) Examples """""""" @@ -95,6 +97,7 @@ Examples variable x universe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 variable x uloop 15 pad variable str format x %.6g + variable myvec vector [1,3,7,10] variable x delete .. code-block:: LAMMPS @@ -252,9 +255,10 @@ commands before the variable would become exhausted. For example, ---------- -This section describes how all the various variable styles are defined -and what they store. Except for the *equal* and *vector* and *atom* -styles, which are explained in the next section. +The next sections describe in how all the various variable styles are +defined and what they store. The styles are listed alphabetically, +except for the *equal* and *vector* and *atom* styles, which are +explained together after all the others. Many of the styles store one or more strings. Note that a single string can contain spaces (multiple words), if it is enclosed in @@ -262,111 +266,7 @@ quotes in the variable command. When the variable is substituted for in another input script command, its returned string will then be interpreted as multiple arguments in the expanded command. -For the *index* style, one or more strings are specified. Initially, -the first string is assigned to the variable. Each time a -:doc:`next ` command is used with the variable name, the next -string is assigned. All processors assign the same string to the -variable. - -Index-style variables with a single string value can also be set by -using the :doc:`command-line switch -var `. - -The *loop* style is identical to the *index* style except that the -strings are the integers from 1 to N inclusive, if only one argument N -is specified. This allows generation of a long list of runs -(e.g. 1000) without having to list N strings in the input script. -Initially, the string "1" is assigned to the variable. Each time a -:doc:`next ` command is used with the variable name, the next -string ("2", "3", etc) is assigned. All processors assign the same -string to the variable. The *loop* style can also be specified with -two arguments N1 and N2. In this case the loop runs from N1 to N2 -inclusive, and the string N1 is initially assigned to the variable. -N1 <= N2 and N2 >= 0 is required. - -For the *world* style, one or more strings are specified. There must -be one string for each processor partition or "world". LAMMPS can be -run with multiple partitions via the :doc:`-partition command-line -switch `. This variable command assigns one string to -each world. All processors in the world are assigned the same string. -The next command cannot be used with equal-style variables, since -there is only one value per world. This style of variable is useful -when you wish to run different simulations on different partitions, or -when performing a parallel tempering simulation (see the :doc:`temper -` command), to assign different temperatures to different -partitions. - -For the *universe* style, one or more strings are specified. There -must be at least as many strings as there are processor partitions or -"worlds". LAMMPS can be run with multiple partitions via the -:doc:`-partition command-line switch `. This variable -command initially assigns one string to each world. When a -:doc:`next ` command is encountered using this variable, the first -processor partition to encounter it, is assigned the next available -string. This continues until all the variable strings are consumed. -Thus, this command can be used to run 50 simulations on 8 processor -partitions. The simulations will be run one after the other on -whatever partition becomes available, until they are all finished. -Universe-style variables are incremented using the files -"tmp.lammps.variable" and "tmp.lammps.variable.lock" which you will -see in your directory during such a LAMMPS run. - -The *uloop* style is identical to the *universe* style except that the -strings are the integers from 1 to N. This allows generation of long -list of runs (e.g. 1000) without having to list N strings in the input -script. - -For the *string* style, a single string is assigned to the variable. -Two differences between this style and using the *index* style exist: -a variable with *string* style can be redefined, e.g. by another command later -in the input script, or if the script is read again in a loop. The other -difference is that *string* performs variable substitution even if the -string parameter is quoted. - -For the *format* style, an equal-style or compatible variable is -specified along with a C-style format string, e.g. "%f" or "%.10g", -which must be appropriate for formatting a double-precision -floating-point value and may not have extra characters. The default -format is "%.15g". This variable style allows an equal-style variable -to be formatted precisely when it is evaluated. - -Note that if you simply wish to print a variable value with desired -precision to the screen or logfile via the :doc:`print ` or -:doc:`fix print ` commands, you can also do this by -specifying an "immediate" variable with a trailing colon and format -string, as part of the string argument of those commands. This is -explained on the :doc:`Commands parse ` doc page. - -For the *getenv* style, a single string is assigned to the variable -which should be the name of an environment variable. When the -variable is evaluated, it returns the value of the environment -variable, or an empty string if it not defined. This style of -variable can be used to adapt the behavior of LAMMPS input scripts via -environment variable settings, or to retrieve information that has -been previously stored with the :doc:`shell putenv ` command. -Note that because environment variable settings are stored by the -operating systems, they persist even if the corresponding *getenv* -style variable is deleted, and also are set for sub-shells executed -by the :doc:`shell ` command. - -For the *file* style, a filename is provided which contains a list of -strings to assign to the variable, one per line. The strings can be -numeric values if desired. See the discussion of the next() function -below for equal-style variables, which will convert the string of a -file-style variable into a numeric value in a formula. - -When a file-style variable is defined, the file is opened and the -string on the first line is read and stored with the variable. This -means the variable can then be evaluated as many times as desired and -will return that string. There are two ways to cause the next string -from the file to be read: use the :doc:`next ` command or the -next() function in an equal- or atom-style variable, as discussed -below. - -The rules for formatting the file are as follows. A comment character -"#" can be used anywhere on a line; text starting with the comment -character is stripped. Blank lines are skipped. The first "word" of -a non-blank line, delimited by white-space, is the "string" assigned -to the variable. +---------- For the *atomfile* style, a filename is provided which contains one or more sets of values, to assign on a per-atom basis to the variable. @@ -406,6 +306,97 @@ will be assigned to that atom. IDs can be listed in any order. atoms is first set to 0.0. Thus values for atoms whose ID does not appear in the set, will remain 0.0. +---------- + +For the *file* style, a filename is provided which contains a list of +strings to assign to the variable, one per line. The strings can be +numeric values if desired. See the discussion of the next() function +below for equal-style variables, which will convert the string of a +file-style variable into a numeric value in a formula. + +When a file-style variable is defined, the file is opened and the +string on the first line is read and stored with the variable. This +means the variable can then be evaluated as many times as desired and +will return that string. There are two ways to cause the next string +from the file to be read: use the :doc:`next ` command or the +next() function in an equal- or atom-style variable, as discussed +below. + +The rules for formatting the file are as follows. A comment character +"#" can be used anywhere on a line; text starting with the comment +character is stripped. Blank lines are skipped. The first "word" of +a non-blank line, delimited by white-space, is the "string" assigned +to the variable. + +---------- + +For the *format* style, an equal-style or compatible variable is +specified along with a C-style format string, e.g. "%f" or "%.10g", +which must be appropriate for formatting a double-precision +floating-point value and may not have extra characters. The default +format is "%.15g". This variable style allows an equal-style variable +to be formatted precisely when it is evaluated. + +Note that if you simply wish to print a variable value with desired +precision to the screen or logfile via the :doc:`print ` or +:doc:`fix print ` commands, you can also do this by +specifying an "immediate" variable with a trailing colon and format +string, as part of the string argument of those commands. This is +explained on the :doc:`Commands parse ` doc page. + +---------- + +For the *getenv* style, a single string is assigned to the variable +which should be the name of an environment variable. When the +variable is evaluated, it returns the value of the environment +variable, or an empty string if it not defined. This style of +variable can be used to adapt the behavior of LAMMPS input scripts via +environment variable settings, or to retrieve information that has +been previously stored with the :doc:`shell putenv ` command. +Note that because environment variable settings are stored by the +operating systems, they persist even if the corresponding *getenv* +style variable is deleted, and also are set for sub-shells executed +by the :doc:`shell ` command. + +---------- + +For the *index* style, one or more strings are specified. Initially, +the first string is assigned to the variable. Each time a +:doc:`next ` command is used with the variable name, the next +string is assigned. All processors assign the same string to the +variable. + +Index-style variables with a single string value can also be set by +using the :doc:`command-line switch -var `. + +---------- + +For the *internal* style a numeric value is provided. This value will +be assigned to the variable until a LAMMPS command sets it to a new +value. There are currently only two LAMMPS commands that require +*internal* variables as inputs, because they reset them: +:doc:`create_atoms ` and :doc:`fix controller +`. As mentioned above, an internal-style variable can +be used in place of an equal-style variable anywhere else in an input +script, e.g. as an argument to another command that allows for +equal-style variables. + +---------- + +The *loop* style is identical to the *index* style except that the +strings are the integers from 1 to N inclusive, if only one argument N +is specified. This allows generation of a long list of runs +(e.g. 1000) without having to list N strings in the input script. +Initially, the string "1" is assigned to the variable. Each time a +:doc:`next ` command is used with the variable name, the next +string ("2", "3", etc) is assigned. All processors assign the same +string to the variable. The *loop* style can also be specified with +two arguments N1 and N2. In this case the loop runs from N1 to N2 +inclusive, and the string N1 is initially assigned to the variable. +N1 <= N2 and N2 >= 0 is required. + +---------- + For the *python* style a Python function name is provided. This needs to match a function name specified in a :doc:`python ` command which returns a value to this variable as defined by its *return* @@ -433,25 +424,52 @@ python-style variable can be used in place of an equal-style variable anywhere in an input script, e.g. as an argument to another command that allows for equal-style variables. -For the *timer* style no additional argument is specified. The value of -the variable is set by querying the current elapsed wall time of the -simulation. This is done at the point in time when the variable is -defined in the input script. If a second timer-style variable is also -defined, then a simple formula can be used to calculate the elapsed time -between the two timers, as in the example at the top of this manual -entry. As mentioned above, timer-style variables can be redefined -elsewhere in the input script, so the same pair of variables can be used -in a loop or to time a series of operations. +---------- -For the *internal* style a numeric value is provided. This value will -be assigned to the variable until a LAMMPS command sets it to a new -value. There are currently only two LAMMPS commands that require -*internal* variables as inputs, because they reset them: -:doc:`create_atoms ` and :doc:`fix controller -`. As mentioned above, an internal-style variable can -be used in place of an equal-style variable anywhere else in an input -script, e.g. as an argument to another command that allows for -equal-style variables. +For the *string* style, a single string is assigned to the variable. +Two differences between this style and using the *index* style exist: +a variable with *string* style can be redefined, e.g. by another command later +in the input script, or if the script is read again in a loop. The other +difference is that *string* performs variable substitution even if the +string parameter is quoted. + +---------- + +The *uloop* style is identical to the *universe* style except that the +strings are the integers from 1 to N. This allows generation of long +list of runs (e.g. 1000) without having to list N strings in the input +script. + +---------- + +For the *universe* style, one or more strings are specified. There +must be at least as many strings as there are processor partitions or +"worlds". LAMMPS can be run with multiple partitions via the +:doc:`-partition command-line switch `. This variable +command initially assigns one string to each world. When a +:doc:`next ` command is encountered using this variable, the first +processor partition to encounter it, is assigned the next available +string. This continues until all the variable strings are consumed. +Thus, this command can be used to run 50 simulations on 8 processor +partitions. The simulations will be run one after the other on +whatever partition becomes available, until they are all finished. +Universe-style variables are incremented using the files +"tmp.lammps.variable" and "tmp.lammps.variable.lock" which you will +see in your directory during such a LAMMPS run. + +---------- + +For the *world* style, one or more strings are specified. There must +be one string for each processor partition or "world". LAMMPS can be +run with multiple partitions via the :doc:`-partition command-line +switch `. This variable command assigns one string to +each world. All processors in the world are assigned the same string. +The next command cannot be used with equal-style variables, since +there is only one value per world. This style of variable is useful +when you wish to run different simulations on different partitions, or +when performing a parallel tempering simulation (see the :doc:`temper +` command), to assign different temperatures to different +partitions. ---------- @@ -495,36 +513,39 @@ is a valid (though strange) variable formula: Specifically, a formula can contain numbers, constants, thermo keywords, math operators, math functions, group functions, region -functions, atom values, atom vectors, compute references, fix -references, and references to other variables. +functions, special functions, feature functions, atom values, atom +vectors, compute references, fix references, and references to other +variables. -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Number | 0.2, 100, 1.0e20, -15.4, etc | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Constant | PI, version, on, off, true, false, yes, no | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Thermo keywords | vol, pe, ebond, etc | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Math operators | (), -x, x+y, x-y, x\*y, x/y, x\^y, x%y, x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x \|\| y, x \|\^ y, !x | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Math functions | sqrt(x), exp(x), ln(x), log(x), abs(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(y,x), random(x,y,z), normal(x,y,z), ceil(x), floor(x), round(x), ramp(x,y), stagger(x,y), logfreq(x,y,z), logfreq2(x,y,z), logfreq3(x,y,z), stride(x,y,z), stride2(x,y,z,a,b,c), vdisplace(x,y), swiggle(x,y,z), cwiggle(x,y,z) | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Group functions | count(ID), mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), fcm(ID,dim), bound(ID,dir), gyration(ID), ke(ID), angmom(ID,dim), torque(ID,dim), inertia(ID,dimdim), omega(ID,dim) | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Region functions | count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), angmom(ID,dim,IDR), torque(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Special functions | sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), label2type(kind,label) | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Atom values | id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Atom vectors | id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Compute references | c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Fix references | f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i] | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Other variables | v_name, v_name[i] | -+--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Number | 0.2, 100, 1.0e20, -15.4, etc | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Constant | PI, version, on, off, true, false, yes, no | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Thermo keywords | vol, pe, ebond, etc | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Math operators | (), -x, x+y, x-y, x\*y, x/y, x\^y, x%y, x == y, x != y, x < y, x <= y, x > y, x >= y, x && y, x \|\| y, x \|\^ y, !x | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Math functions | sqrt(x), exp(x), ln(x), log(x), abs(x), sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(y,x), random(x,y,z), normal(x,y,z), ceil(x), floor(x), round(x), ramp(x,y), stagger(x,y), logfreq(x,y,z), logfreq2(x,y,z), logfreq3(x,y,z), stride(x,y,z), stride2(x,y,z,a,b,c), vdisplace(x,y), swiggle(x,y,z), cwiggle(x,y,z) | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Group functions | count(ID), mass(ID), charge(ID), xcm(ID,dim), vcm(ID,dim), fcm(ID,dim), bound(ID,dir), gyration(ID), ke(ID), angmom(ID,dim), torque(ID,dim), inertia(ID,dimdim), omega(ID,dim) | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Region functions | count(ID,IDR), mass(ID,IDR), charge(ID,IDR), xcm(ID,dim,IDR), vcm(ID,dim,IDR), fcm(ID,dim,IDR), bound(ID,dir,IDR), gyration(ID,IDR), ke(ID,IDR), angmom(ID,dim,IDR), torque(ID,dim,IDR), inertia(ID,dimdim,IDR), omega(ID,dim,IDR) | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Special functions | sum(x), min(x), max(x), ave(x), trap(x), slope(x), gmask(x), rmask(x), grmask(x,y), next(x), is_file(name), is_os(name), extract_setting(name), label2type(kind,label), is_typelabel(kind,label) | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Feature functions | is_available(category,feature), is_active(category,feature), is_defined(category,id) | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Atom values | id[i], mass[i], type[i], mol[i], x[i], y[i], z[i], vx[i], vy[i], vz[i], fx[i], fy[i], fz[i], q[i] | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Atom vectors | id, mass, type, mol, x, y, z, vx, vy, vz, fx, fy, fz, q | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Compute references | c_ID, c_ID[i], c_ID[i][j], C_ID, C_ID[i] | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Fix references | f_ID, f_ID[i], f_ID[i][j], F_ID, F_ID[i] | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Other variables | v_name, v_name[i] | ++--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Most of the formula elements produce a scalar value. Some produce a global or per-atom vector of values. Global vectors can be produced @@ -574,9 +595,9 @@ will not work, since the *version* has been introduced more recently): if $(version<20140513) then "communicate vel yes" else "comm_modify vel yes" The thermo keywords allowed in a formula are those defined by the -:doc:`thermo_style custom ` command. Thermo keywords that -require a :doc:`compute ` to calculate their values such as -"temp" or "press", use computes stored and invoked by the +:doc:`thermo_style custom ` command. Thermo keywords +that require a :doc:`compute ` to calculate their values such +as "temp" or "press", use computes stored and invoked by the :doc:`thermo_style ` command. This means that you can only use those keywords in a variable if the style you are using with the thermo_style command (and the thermo keywords associated with that @@ -714,10 +735,12 @@ new timestep. X,y,z > 0 and y < z are required. The generated timesteps are on a base-z logarithmic scale, starting with x, and the y value is how many of the z-1 possible timesteps within one logarithmic interval are generated. I.e. the timesteps follow the -sequence x,2x,3x,...y\*x,x\*z,2x\*z,3x\*z,...y\*x\*z,x\*z\^2,2x\*z\^2,etc. For +sequence +x,2x,3x,...y\*x,x\*z,2x\*z,3x\*z,...y\*x\*z,x\*z\^2,2x\*z\^2,etc. For any current timestep, the next timestep in the sequence is returned. -Thus if logfreq(100,4,10) is used in a variable by the :doc:`dump_modify every ` command, it will generate this sequence of -output timesteps: +Thus if logfreq(100,4,10) is used in a variable by the +:doc:`dump_modify every ` command, it will generate this +sequence of output timesteps: .. parsed-literal:: @@ -726,9 +749,10 @@ output timesteps: The logfreq2(x,y,z) function is similar to logfreq, except a single logarithmic interval is divided into y equally-spaced timesteps and all of them are output. Y < z is not required. Thus, if -logfreq2(100,18,10) is used in a variable by the :doc:`dump_modify every ` command, then the interval between 100 and -1000 is divided as 900/18 = 50 steps, and it will generate the -sequence of output timesteps: +logfreq2(100,18,10) is used in a variable by the :doc:`dump_modify +every ` command, then the interval between 100 and 1000 +is divided as 900/18 = 50 steps, and it will generate the sequence of +output timesteps: .. parsed-literal:: @@ -970,53 +994,94 @@ types, bond types and so on. For the full list of available keywords *name* and their meaning, see the documentation for extract_setting() via the link in this paragraph. -The label2type() function converts type labels into numeric types, using label -maps created by the :doc:`labelmap ` or :doc:`read_data ` -commands. The first argument is the label map kind (atom, bond, angle, -dihedral, or improper) and the second argument is the label. The function -returns the corresponding numeric type. +The label2type(kind,label) function converts type labels into numeric +types, using label maps created by the :doc:`labelmap ` or +:doc:`read_data ` commands. The first argument is the label +map kind (atom, bond, angle, dihedral, or improper) and the second +argument is the label. The function returns the corresponding numeric +type or triggers an error if the queried label does not exist. + +.. versionadded:: 15Jun2023 + +The is_typelabel(kind,label) function has the same arguments as +label2type(), but returns 1 if the type label has been assigned, +otherwise it returns 0. This function can be used to check if a +particular type label already exists in the simulation. ---------- Feature Functions ----------------- -Feature functions allow to probe the running LAMMPS executable for -whether specific features are either active, defined, or available. The -functions take two arguments, a *category* and a corresponding -*argument*\ . The arguments are strings and thus cannot be formulas +Feature functions allow probing of the running LAMMPS executable for +whether specific features are available, active, or defined. All 3 of +the functions take two arguments, a *category* and a category-specific +second argument. Both are strings and thus cannot be formulas themselves; only $-style immediate variable expansion is possible. -Return value is either 1.0 or 0.0 depending on whether the function -evaluates to true or false, respectively. +The return value of the functions is either 1.0 or 0.0 depending on +whether the function evaluates to true or false, respectively. -The *is_active(category,feature)* function allows to query for active -settings which are grouped by categories. Currently supported categories -and arguments are: +The *is_available(category,name)* function queries whether a specific +feature is available in the LAMMPS executable that is being run, i.e +whether it was included or enabled at compile time. -* *package*\ : argument = *gpu* or *intel* or *kokkos* or *omp* -* *newton*\ : argument = *pair* or *bond* or *any* -* *pair*\ : argument = *single* or *respa* or *manybody* or *tail* or *shift* -* *comm_style*\ : argument = *brick* or *tiled* -* *min_style*\ : argument = any of the compiled in minimizer styles -* *run_style*\ : argument = any of the compiled in run styles -* *atom_style*\ : argument = any of the compiled in atom style) -* *pair_style*\ : argument = any of the compiled in pair styles -* *bond_style*\ : argument = any of the compiled in bond styles -* *angle_style*\ : argument = any of the compiled in angle styles -* *dihedral_style*\ : argument = any of the compiled in dihedral styles -* *improper_style*\ : argument = any of the compiled in improper styles -* *kspace_style*\ : argument = any of the compiled in kspace styles +This supports the following categories: *command*, *compute*, *fix*, +*pair_style* and *feature*\ . For all the categories except *feature* +the *name* is a style name, e.g. *nve* for the *fix* category. Note +that many LAMMPS input script commands such as *create_atoms* are +actually instances of a command style which LAMMPS defines, as opposed +to built-in commands. For all of these styles except *command*, +appending of active suffixes is also tried before reporting failure. -Most of the settings are self-explanatory, the *single* argument in the -*pair* category allows to check whether a pair style supports a -Pair::single() function as needed by compute group/group and others -features or LAMMPS, *respa* allows to check whether the inner/middle/outer -mode of r-RESPA is supported. In the various style categories, -the checking is also done using suffix flags, if available and enabled. +The *feature* category checks the availability of the following +compile-time enabled features: GZIP support, PNG support, JPEG +support, FFMPEG support, and C++ exceptions for error +handling. Corresponding names are *gzip*, *png*, *jpeg*, *ffmpeg* and +*exceptions*\ . -Example 1: disable use of suffix for pppm when using GPU package -(i.e. run it on the CPU concurrently to running the pair style on the -GPU), but do use the suffix otherwise (e.g. with OPENMP). +Example: Only dump in a given format if the compiled binary supports it. + +.. code-block:: LAMMPS + + if "$(is_available(feature,png))" then "print 'PNG supported'" else "print 'PNG not supported'" + if "$(is_available(feature,ffmpeg)" then "dump 3 all movie 25 movie.mp4 type type zoom 1.6 adiam 1.0" + +The *is_active(category,feature)* function queries whether a specific +feature is currently active within LAMMPS. The features are grouped +by categories. Supported categories and features are: + +* *package*\ : features = *gpu* or *intel* or *kokkos* or *omp* +* *newton*\ : features = *pair* or *bond* or *any* +* *pair*\ : features = *single* or *respa* or *manybody* or *tail* or *shift* +* *comm_style*\ : features = *brick* or *tiled* +* *min_style*\ : features = a minimizer style name +* *run_style*\ : features = a run style name +* *atom_style*\ : features = an atom style name +* *pair_style*\ : features = a pair style name +* *bond_style*\ : features = a bond style name +* *angle_style*\ : features = an angle style name +* *dihedral_style*\ : features = a dihedral style name +* *improper_style*\ : features = an improper style name +* *kspace_style*\ : features = a kspace style name + +Most of the settings are self-explanatory. For the *package* +category, a package may have been included in the LAMMPS build, but +not have enabled by any input script command, and hence be inactive. +The *single* feature in the *pair* category checks whether the +currently defined pair style supports a Pair::single() function as +needed by compute group/group and others features or LAMMPS. +Similarly, the *respa* feature checks whether the inner/middle/outer +mode of r-RESPA is supported by the current pair style. + +For the categories with *style* in their name, only a single instance +of the style is ever active at any time in a LAMMPS simulation. Thus +the check is whether the currently active style matches the specified +name. This check is also done using suffix flags, if available and +enabled. + +Example 1: Disable use of suffix for PPPM when using GPU package +(i.e. run it on the CPU concurrently while running the pair style on +the GPU), but do use the suffix otherwise (e.g. with OPENMP). .. code-block:: LAMMPS @@ -1024,39 +1089,23 @@ GPU), but do use the suffix otherwise (e.g. with OPENMP). if $(is_active(package,gpu)) then "suffix off" kspace_style pppm -Example 2: use r-RESPA with inner/outer cutoff, if supported by pair -style, otherwise fall back to using pair and reducing the outer time -step +Example 2: Use r-RESPA with inner/outer cutoff, if supported by the +current pair style, otherwise fall back to using r-RESPA with simply +the pair keyword and reducing the outer time step. .. code-block:: LAMMPS timestep $(2.0*(1.0+2.0*is_active(pair,respa))) - if $(is_active(pair,respa)) then "run_style respa 4 3 2 2 improper 1 inner 2 5.5 7.0 outer 3 kspace 4" else "run_style respa 3 3 2 improper 1 pair 2 kspace 3" + if $(is_active(pair,respa)) then "run_style respa 4 3 2 2 improper 1 inner 2 5.5 7.0 outer 3 kspace 4" else "run_style respa 3 3 2 improper 1 pair 2 kspace 3" -The *is_available(category,name)* function allows to query whether -a specific optional feature is available, i.e. compiled in. -This currently works for the following categories: *command*, -*compute*, *fix*, *pair_style* and *feature*\ . For all categories -except *command* and *feature* also appending active suffixes is -tried before reporting failure. - -The *feature* category is used to check the availability of compiled in -features such as GZIP support, PNG support, JPEG support, FFMPEG support, -and C++ exceptions for error handling. Corresponding values for name are -*gzip*, *png*, *jpeg*, *ffmpeg* and *exceptions*\ . - -This enables writing input scripts which only dump using a given format if -the compiled binary supports it. - -.. code-block:: LAMMPS - - if "$(is_available(feature,png))" then "print 'PNG supported'" else "print 'PNG not supported'" - - if "$(is_available(feature,ffmpeg)" then "dump 3 all movie 25 movie.mp4 type type zoom 1.6 adiam 1.0" - -The *is_defined(categoy,id)* function allows to query categories like -*compute*, *dump*, *fix*, *group*, *region*, and *variable* whether an -entry with the provided name or id is defined. +The *is_defined(category,id)* function checks whether an instance of a +style or variable with a specific ID or name is currently defined +within LAMMPS. The supported categories are *compute*, *dump*, +*fix*, *group*, *region*, and *variable*. Each of these styles (as +well as the variable command) can be specified multiple times within +LAMMPS, each with a unique *id*. This function checks whether the +specified *id* exists. For category *variable", the *id* is the +variable name. ---------- @@ -1268,6 +1317,35 @@ Vectors" discussion above. ---------- +Vector Initialization +--------------------- + +.. versionadded:: 15Jun2023 + +*Vector*-style variables only can be initialized with a special +syntax, instead of using a formula. The syntax is a bracketed, +comma-separated syntax like the following: + +.. code-block:: LAMMPS + + variable myvec vector [1,3.5,7,10.2] + +The 3rd argument formula is replaced by the vector values in brackets, +separated by commas. This example creates a 4-length vector with +specific numeric values, each of which can be specified as an integer +or floating point value. Note that while whitespace can be added +before or after individual values, no other mathematical operations +can be specified. E.g. "3*10" or "3*v_abc" are not valid vector +elements, nor is "10*[1,2,3,4]" valid for the entire vector. + +Unlike vector variables specified with formulas, this vector variable +is static; its length and values never changes. Its values can be +used in other commands (including vector-style variables specified +with formulas) via the usual syntax for accessing individual vector +elements or the entire vector. + +---------- + Immediate Evaluation of Variables """"""""""""""""""""""""""""""""" @@ -1285,18 +1363,19 @@ with a leading $ sign (e.g. $x or ${abc}) versus with a leading "v\_" (e.g. v_x or v_abc). The former can be used in any input script command, including a variable command. The input script parser evaluates the reference variable immediately and substitutes its value -into the command. As explained on the :doc:`Commands parse ` doc page, you can also use un-named -"immediate" variables for this purpose. For example, a string like -this $((xlo+xhi)/2+sqrt(v_area)) in an input script command evaluates -the string between the parenthesis as an equal-style variable formula. +into the command. As explained on the :doc:`Commands parse +` doc page, you can also use un-named "immediate" +variables for this purpose. For example, a string like this +$((xlo+xhi)/2+sqrt(v_area)) in an input script command evaluates the +string between the parenthesis as an equal-style variable formula. Referencing a variable with a leading "v\_" is an optional or required -kind of argument for some commands (e.g. the :doc:`fix ave/chunk ` or :doc:`dump custom ` or -:doc:`thermo_style ` commands) if you wish it to evaluate -a variable periodically during a run. It can also be used in a -variable formula if you wish to reference a second variable. The -second variable will be evaluated whenever the first variable is -evaluated. +kind of argument for some commands (e.g. the :doc:`fix ave/chunk +` or :doc:`dump custom ` or :doc:`thermo_style +` commands) if you wish it to evaluate a variable +periodically during a run. It can also be used in a variable formula +if you wish to reference a second variable. The second variable will +be evaluated whenever the first variable is evaluated. As an example, suppose you use this command in your input script to define the variable "v" as @@ -1309,8 +1388,9 @@ before a run where the simulation box size changes. You might think this will assign the initial volume to the variable "v". That is not the case. Rather it assigns a formula which evaluates the volume (using the thermo_style keyword "vol") to the variable "v". If you -use the variable "v" in some other command like :doc:`fix ave/time ` then the current volume of the box will be -evaluated continuously during the run. +use the variable "v" in some other command like :doc:`fix ave/time +` then the current volume of the box will be evaluated +continuously during the run. If you want to store the initial volume of the system, you can do it this way: @@ -1347,132 +1427,75 @@ will occur when the formula for "vratio" is evaluated later. Variable Accuracy """"""""""""""""" -Obviously, LAMMPS attempts to evaluate variables containing formulas -(\ *equal* and *atom* style variables) accurately whenever the -evaluation is performed. Depending on what is included in the -formula, this may require invoking a :doc:`compute `, either -directly or indirectly via a thermo keyword, or accessing a value -previously calculated by a compute, or accessing a value calculated -and stored by a :doc:`fix `. If the compute is one that calculates -the pressure or energy of the system, then these quantities need to be -tallied during the evaluation of the interatomic potentials (pair, -bond, etc) on timesteps that the variable will need the values. +Obviously, LAMMPS attempts to evaluate variables which contain +formulas (\ *equal* and *vector* and *atom* style variables) +accurately whenever the evaluation is performed. Depending on what is +included in the formula, this may require invoking a :doc:`compute +`, either directly or indirectly via a thermo keyword, or +accessing a value previously calculated by a compute, or accessing a +value calculated and stored by a :doc:`fix `. If the compute is +one that calculates the energy or pressure of the system, then the +corresponding energy or virial quantities need to be tallied during +the evaluation of the interatomic potentials (pair, bond, etc) on any +timestep that the variable needs the tallies. An input script can +also request variables be evaluated before or after or in between +runs, e.g. by including them in a :doc:`print ` command. -LAMMPS keeps track of all of this during a :doc:`run ` or :doc:`energy minimization `. An error will be generated if you -attempt to evaluate a variable on timesteps when it cannot produce -accurate values. For example, if a :doc:`thermo_style custom ` command prints a variable which accesses -values stored by a :doc:`fix ave/time ` command and the -timesteps on which thermo output is generated are not multiples of the -averaging frequency used in the fix command, then an error will occur. +LAMMPS keeps track of all of this as it performs a doc:`run ` or +:doc:`minimize ` simulation, as well as in between +simulations. An error will be generated if you attempt to evaluate a +variable when LAMMPS knows it cannot produce accurate values. For +example, if a :doc:`thermo_style custom ` command prints +a variable which accesses values stored by a :doc:`fix ave/time +` command and the timesteps on which thermo output is +generated are not multiples of the averaging frequency used in the fix +command, then an error will occur. -An input script can also request variables be evaluated before or -after or in between runs, e.g. by including them in a -:doc:`print ` command. In this case, if a compute is needed to -evaluate a variable (either directly or indirectly), LAMMPS will not -invoke the compute, but it will use a value previously calculated by -the compute, and can do this only if it was invoked on the current -timestep. Fixes will always provide a quantity needed by a variable, -but the quantity may or may not be current. This leads to one of -three kinds of behavior: +However, there are two special cases to be aware when a variable +requires invocation of a compute (directly or indirectly). The first +is if the variable is evaluated before the first doc:`run ` or +:doc:`minimize ` command in the input script. In this case, +LAMMPS will generate an error. This is because many computes require +initializations which have not yet taken place. One example is the +calculation of degrees of freedom for temperature computes. Another +example are the computes mentioned above which require tallying of +energy or virial quantities; these values are not tallied until the +first simulation begins. -(1) The variable may be evaluated accurately. If it contains -references to a compute or fix, and these values were calculated on -the last timestep of a preceding run, then they will be accessed and -used by the variable and the result will be accurate. +The second special case is when a variable that depends on a compute +is evaluated in between doc:`run ` or :doc:`minimize ` +commands. It is possible for other input script commands issued +following the previous run, but before the variable is evaluated, to +change the system. For example, the doc:`delete_atoms ` +command could be used to remove atoms. Since the compute will not +re-initialize itself until the next simulation or it may depend on +energy/virial computations performed before the system was changed, it +will potentially generate an incorrect answer when evaluated. Note +that LAMMPS will not generate an error in this case; the evaluated +variable may simply be incorrect. -(2) LAMMPS may not be able to evaluate the variable and will generate -an error message stating so. For example, if the variable requires a -quantity from a :doc:`compute ` that has not been invoked on -the current timestep, LAMMPS will generate an error. This means, for -example, that such a variable cannot be evaluated before the first run -has occurred. Likewise, in between runs, a variable containing a -compute cannot be evaluated unless the compute was invoked on the last -timestep of the preceding run, e.g. by thermodynamic output. - -One way to get around this problem is to perform a 0-timestep run -before using the variable. For example, these commands +The way to get around both of these special cases is to perform a +0-timestep run before evaluating the variable. For example, these +commands .. code-block:: LAMMPS - variable t equal temp - print "Initial temperature = $t" + # delete_atoms random fraction 0.5 yes all NULL 49839 + # run 0 post no + variable t equal temp # this thermo keyword invokes a temperature compute + print "Temperature of system = $t" run 1000 -will generate an error if the run is the first run specified in the -input script, because generating a value for the "t" variable requires -a compute for calculating the temperature to be invoked. +will generate an error if the "run 1000" command is the first +simulation in the input script. If there were a previous run, these +commands will print the correct temperature of the system. But if the +:doc:`delete_atoms ` command is uncommented, the printed +temperature will be incorrect, because information stored by +temperature compute is no longer valid. -However, this sequence of commands would be fine: - -.. code-block:: LAMMPS - - run 0 - variable t equal temp - print "Initial temperature = $t" - run 1000 - -The 0-timestep run initializes and invokes various computes, including -the one for temperature, so that the value it stores is current and -can be accessed by the variable "t" after the run has completed. Note -that a 0-timestep run does not alter the state of the system, so it -does not change the input state for the 1000-timestep run that -follows. Also note that the 0-timestep run must actually use and -invoke the compute in question (e.g. via :doc:`thermo ` or -:doc:`dump ` output) in order for it to enable the compute to be -used in a variable after the run. Thus if you are trying to print a -variable that uses a compute you have defined, you can ensure it is -invoked on the last timestep of the preceding run by including it in -thermodynamic output. - -Unlike computes, :doc:`fixes ` will never generate an error if -their values are accessed by a variable in between runs. They always -return some value to the variable. However, the value may not be what -you expect if the fix has not yet calculated the quantity of interest -or it is not current. For example, the :doc:`fix indent ` -command stores the force on the indenter. But this is not computed -until a run is performed. Thus if a variable attempts to print this -value before the first run, zeroes will be output. Again, performing -a 0-timestep run before printing the variable has the desired effect. - -(3) The variable may be evaluated incorrectly and LAMMPS may have no -way to detect this has occurred. Consider the following sequence of -commands: - -.. code-block:: LAMMPS - - pair_coeff 1 1 1.0 1.0 - run 1000 - pair_coeff 1 1 1.5 1.0 - variable e equal pe - print "Final potential energy = $e" - -The first run is performed using one setting for the pairwise -potential defined by the :doc:`pair_style ` and -:doc:`pair_coeff ` commands. The potential energy is -evaluated on the final timestep and stored by the :doc:`compute pe -` compute (this is done by the :doc:`thermo_style -` command). Then a pair coefficient is changed, -altering the potential energy of the system. When the potential -energy is printed via the "e" variable, LAMMPS will use the potential -energy value stored by the :doc:`compute pe ` compute, -thinking it is current. There are many other commands which could -alter the state of the system between runs, causing a variable to -evaluate incorrectly. - -The solution to this issue is the same as for case (2) above, namely -perform a 0-timestep run before the variable is evaluated to ensure -the system is up-to-date. For example, this sequence of commands -would print a potential energy that reflected the changed pairwise -coefficient: - -.. code-block:: LAMMPS - - pair_coeff 1 1 1.0 1.0 - run 1000 - pair_coeff 1 1 1.5 1.0 - run 0 - variable e equal pe - print "Final potential energy = $e" +Both these issues are resolved, if the "run 0" command is uncommented. +This is because the "run 0" simulation will initialize (or +re-initialize) the temperature compute correctly. ---------- @@ -1482,11 +1505,12 @@ Restrictions Indexing any formula element by global atom ID, such as an atom value, requires the :doc:`atom style ` to use a global mapping in order to look up the vector indices. By default, only atom styles -with molecular information create global maps. The :doc:`atom_modify map ` command can override the default, e.g. for +with molecular information create global maps. The :doc:`atom_modify +map ` command can override the default, e.g. for atomic-style atom styles. -All *universe*\ - and *uloop*\ -style variables defined in an input script -must have the same number of values. +All *universe*\ - and *uloop*\ -style variables defined in an input +script must have the same number of values. Related commands """""""""""""""" diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index ac4e010147..3f7bc065d0 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -1,8 +1,8 @@ -Sphinx >= 5.0.0, <7.0.0 +Sphinx >= 5.3.0, <7.1.0 sphinxcontrib-spelling sphinxcontrib-jquery git+https://github.com/akohlmey/sphinx-fortran@parallel-read -sphinx_tabs +git+https://github.com/executablebooks/sphinx-tabs@v3.4.1 breathe Pygments six diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index ab03ee3dff..5791288a06 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -55,6 +55,7 @@ Ai Aidan aij aimd +aip airebo Aj ajaramil @@ -528,6 +529,7 @@ collisional Columic colvars Colvars +COH COLVARS comID Commun @@ -550,6 +552,7 @@ conformational Connor conp conq +const ConstMatrix Contrib cooperativity @@ -1090,6 +1093,7 @@ Fellinger femtosecond femtoseconds fene +Feng Fennell fep FEP @@ -1562,6 +1566,7 @@ invertibility ionicities ionizable ionocovalent +iOS iostreams iparam ipi @@ -1620,6 +1625,7 @@ Izumi Izvekov izz Izz +Jacobian Jacobsen Jadhao Jadhav @@ -2026,6 +2032,7 @@ Marchetti Marchi Mariella Marinica +Markland Marrink Marroquin Marsaglia @@ -3594,6 +3601,7 @@ THz Tigran Tij Tildesley +Timan timeI timespan timestamp @@ -3735,6 +3743,8 @@ Umin un unary uncomment +uncommented +uncompress uncompute underprediction undump @@ -4088,4 +4098,5 @@ zu zx zy Zybin +Zykova zz diff --git a/examples/COUPLE/README b/examples/COUPLE/README index adf46d027d..13e593d55d 100644 --- a/examples/COUPLE/README +++ b/examples/COUPLE/README @@ -19,12 +19,12 @@ See these sections of the LAMMPS manual for details: Build LAMMPS as a library (doc/html/Build_basics.html) Link LAMMPS as a library to another code (doc/html/Build_link.html) Coupling LAMMPS to other codes (doc/html/Howto_couple.html) -Using LAMMPS in client/server mode (doc/html/Howto_client_server.html) Library interface to LAMMPS (doc/html/Howto_library.html) +Detailed documentation of the LAMMPS interfaces (doc/html/Library.html) -The library interface to LAMMPS is in src/library.cpp. Routines can -be easily added to this file so an external program can perform the -LAMMPS tasks desired. +The core library interface to LAMMPS is in src/library.cpp. Routines +can be easily added to this file so an external program can perform +the LAMMPS tasks desired. ------------------------------------------------------------------- @@ -36,10 +36,5 @@ plugin example for loading LAMMPS at runtime from a shared library lammps_spparks grain-growth Monte Carlo with strain via MD, coupling to SPPARKS kinetic MC code library collection of useful inter-code communication routines -fortran2 a more sophisticated wrapper on the LAMMPS library API that - can be called from Fortran -fortran_dftb wrapper written by Nir Goldman (LLNL), as an - extension to fortran2, used for calling LAMMPS - from Fortran DFTB+ tight-binding code Each sub-directory has its own README with more details. diff --git a/examples/COUPLE/fortran2/.gitignore b/examples/COUPLE/fortran2/.gitignore deleted file mode 100644 index 63a7748cf4..0000000000 --- a/examples/COUPLE/fortran2/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.mod diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS-wrapper.h b/examples/COUPLE/fortran2/LAMMPS-wrapper.h deleted file mode 100644 index 02e1a651a9..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS-wrapper.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran2/LAMMPS.F90 b/examples/COUPLE/fortran2/LAMMPS.F90 deleted file mode 100644 index 2f4ae2c95e..0000000000 --- a/examples/COUPLE/fortran2/LAMMPS.F90 +++ /dev/null @@ -1,1788 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! https://www.lammps.org/ Sandia National Laboratories -! LAMMPS Development team: developers@lammps.org -! -! Copyright (2003) Sandia Corporation. Under the terms of Contract -! DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains -! certain rights in this software. This software is distributed under -! the GNU General Public License. -! -! See the README file in the top-level LAMMPS directory. -!-------------------------------------------------------------------------- - -!! ------------------------------------------------------------------------ -! Contributing author: Karl D. Hammond -! University of Tennessee, Knoxville (USA), 2012 -! Updated October 2020 by the author (now at the University of Missouri). -!-------------------------------------------------------------------------- - -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! integer (kind=C_int) lammps_version (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_commands_list (ptr, cmds) -!! subroutine lammps_commands_string (ptr, str) -!! subroutine lammps_free (ptr) -!! integer function lammps_extract_setting (ptr, name) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & -!! periodicity, box_change) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! double precision function lammps_get_thermo (ptr, name) -!! double precision function lammps_get_natoms (ptr) -!! subroutine lammps_set_variable (ptr, name, str, [err]) -!! subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_gather_atoms_concat (ptr, name, count, data) -!! subroutine lammps_gather_atoms_subset (ptr, name, count, ids, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) -!! subroutine lammps_scatter_atoms_subset (ptr, name, ids, data) -!! logical function lammps_config_has_package (package_name) -!! integer function lammps_config_package_count () -!! logical function lammps_config_package_name (index, buffer) -!! logical function lammps_config_has_gzip_support () -!! logical function lammps_config_has_png_support () -!! logical function lammps_config_has_jpeg_support () -!! logical function lammps_config_has_ffmpeg_support () -!! logical function lammps_config_has_exceptions () -!! integer function lammps_find_pair_neighlist (ptr, style, exact, nsub, -!! request) -!! integer function lammps_find_fix_neighlist (ptr, id, request) -!! integer function lammps_find_compute_neighlist (ptr, id, request) -!! integer function lammps_neighlist_num_elements (ptr, idx) -!! subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, -!! numneigh, neighbors) -!! subroutine lammps_create_atoms (ptr, n, id, type, x, v, image, -!1 shrinkexceed) -!! -!! The following are also available if compiled with -DLAMMPS_EXCEPTIONS -!! function lammps_has_error (ptr) -!! function lammps_get_last_error_message (ptr, buffer) -!! -!! Note that the following function is not implemented from this interface: -!! lammps_set_fix_external_callback - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -! This should (?) allow this module to work with settings in lmptype.h -#if !defined(LAMMPS_SMALLSMALL) && !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG) -#define LAMMPS_SMALLBIG -#endif - -#ifdef LAMMPS_SMALLBIG -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_BIGBIG -#define C_smallint C_int -#define C_imageint C_int64_t -#define C_tagint C_int64_t -#define C_bigint C_int64_t -#endif - -#ifdef LAMMPS_SMALLSMALL -#define C_smallint C_int -#define C_imageint C_int -#define C_tagint C_int -#define C_bigint C_int -#endif - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_NULL_PTR, C_loc, C_F_pointer, C_int64_t, & - lammps_instance => C_ptr - implicit none - private - - ! We inherit some ISO_C_BINDING entities for ease of use - public :: lammps_instance, C_ptr, C_double, C_int - ! Only the following functions may be called by the user: - public :: lammps_open, lammps_open_no_mpi, lammps_close, & - lammps_version, lammps_file, lammps_command, lammps_commands_list, & - lammps_commands_string, lammps_free, lammps_extract_setting, & - lammps_extract_global, lammps_extract_box, lammps_extract_atom, & - lammps_extract_compute, lammps_extract_fix, lammps_extract_variable, & - lammps_get_thermo, lammps_get_natoms, lammps_set_variable, & - lammps_reset_box, lammps_gather_atoms, lammps_gather_atoms_concat, & - lammps_gather_atoms_subset, lammps_scatter_atoms, & - lammps_scatter_atoms_subset, lammps_config_has_package, & - lammps_config_package_count, lammps_config_package_name, & - lammps_config_has_gzip_support, lammps_config_has_png_support, & - lammps_config_has_jpeg_support, lammps_config_has_ffmpeg_support, & - lammps_config_has_exceptions, lammps_find_pair_neighlist, & - lammps_find_fix_neighlist, lammps_find_compute_neighlist, & - lammps_neighlist_num_elements, lammps_neighlist_element_neighbors, & - lammps_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - public :: lammps_has_error, lammps_get_last_error_message -#endif - - !! constants for extracting data from computes and fixes - !! and data types - - INTEGER, PARAMETER :: LMP_STYLE_GLOBAL = 0, LMP_STYLE_ATOM = 1, & - LMP_STYLE_LOCAL = 2, LMP_TYPE_SCALAR = 0, LMP_TYPE_VECTOR = 1, & - LMP_TYPE_ARRAY = 2, LMP_SIZE_VECTOR = 3, LMP_SIZE_ROWS = 4, & - LMP_SIZE_COLS = 5, LAMMPS_INT = 0, LAMMPS_INT_2D = 1, & - LAMMPS_DOUBLE = 2, LAMMPS_DOUBLE_2D = 3, LAMMPS_INT64 = 4, & - LAMMPS_INT64_2D = 5, LAMMPS_STRING = 6 - - PUBLIC :: LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL, & - LMP_TYPE_SCALAR, LMP_TYPE_VECTOR, LMP_TYPE_ARRAY, & - LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS, LAMMPS_INT, & - LAMMPS_INT_2D, LAMMPS_DOUBLE, LAMMPS_DOUBLE_2D, LAMMPS_INT64, & - LAMMPS_INT64_2D, LAMMPS_STRING - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - function lammps_version (ptr) result (version) & - bind (C, name='lammps_version') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (kind=C_int) :: version - end function lammps_version - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_actual_commands_list (ptr, ncmd, cmds) & - bind (C, name='lammps_commands_list') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - type (C_ptr), dimension(*) :: cmds - integer (C_int), value :: ncmd - end subroutine lammps_actual_commands_list - - subroutine lammps_actual_commands_string (ptr, str) & - bind (C, name='lammps_commands_string') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_commands_string - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_setting (ptr, name) result (setting) & - bind(C, name='lammps_extract_setting') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - integer (kind=C_int) :: setting - end function lammps_actual_extract_setting - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - subroutine lammps_actual_extract_box (ptr, boxlo, boxhi, xy, yz, & - xz, periodicity, box_change) bind (C, name='lammps_extract_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - integer (C_int) :: periodicity(3), box_change - end subroutine lammps_actual_extract_box - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_actual_get_thermo (ptr, name) result (dval) & - bind (C, name='lammps_get_thermo') - import :: C_ptr, C_char, C_double - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - real (C_double) :: dval - end function lammps_actual_get_thermo - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real (C_double) :: natoms - end function lammps_get_natoms - - function lammps_actual_set_variable (ptr, name, str) result (err) & - bind (C, name='lammps_set_variable') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, str - integer (C_int) :: err - end function lammps_actual_set_variable - - subroutine lammps_actual_reset_box (ptr, boxlo, boxhi, xy, yz, xz) & - bind (C, name='lammps_reset_box') - import :: C_ptr, C_double, C_int - type (C_ptr), value :: ptr - real (C_double) :: boxlo(3), boxhi(3), xy, yz, xz - end subroutine lammps_actual_reset_box - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_gather_atoms_concat (ptr, name, type, count, & - data) bind (C, name='lammps_gather_atoms_concat') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms_concat - - subroutine lammps_actual_gather_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_gather_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int) :: ids(:) - end subroutine lammps_actual_gather_atoms_subset - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - - subroutine lammps_actual_scatter_atoms_subset (ptr, name, type, count, & - ndata, ids, data) bind (C, name='lammps_scatter_atoms_subset') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count, ndata - integer (C_int), dimension(*) :: ids - end subroutine lammps_actual_scatter_atoms_subset - - function lammps_actual_config_has_package (package_name) & - result (has_it) bind (C, name='lammps_config_has_package') - import :: C_char, C_int - character (len=1, kind=C_char), dimension(*) :: package_name - integer (C_int) :: has_it - end function lammps_actual_config_has_package - - function lammps_config_package_count () result (count) & - bind (C, name='lammps_config_package_count') - import :: C_int - integer (C_int) :: count - end function lammps_config_package_count - - function lammps_actual_config_package_name (index, buffer, max_size) & - result (num) bind (C, name='lammps_config_package_name') - import :: C_int, C_char - integer (C_int), value :: index, max_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: num - end function lammps_actual_config_package_name - - function lammps_actual_config_has_gzip_support () result (C_has_it) & - bind (C, name='lammps_config_has_gzip_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_gzip_support - - function lammps_actual_config_has_png_support () result (C_has_it) & - bind (C, name='lammps_config_has_png_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_png_support - - function lammps_actual_config_has_jpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_jpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_jpeg_support - - function lammps_actual_config_has_ffmpeg_support () result (C_has_it) & - bind (C, name='lammps_config_has_ffmpeg_support') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_ffmpeg_support - - function lammps_actual_config_has_exceptions () result (C_has_it) & - bind (C, name='lammps_config_has_exceptions') - import :: C_int - integer (C_int) :: C_has_it - end function lammps_actual_config_has_exceptions - - function lammps_actual_find_pair_neighlist (ptr, style, exact, nsub, & - request) result (C_neighlist) & - bind (C, name='lammps_find_pair_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: style - integer (C_int), value :: exact, nsub, request - end function lammps_actual_find_pair_neighlist - - function lammps_actual_find_fix_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_fix_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_fix_neighlist - - function lammps_actual_find_compute_neighlist (ptr, id, request) & - result (C_neighlist) bind (C, name='lammps_find_compute_neighlist') - import :: C_ptr, C_int, C_char - integer (C_int) :: C_neighlist - type (C_ptr), value :: ptr - character (len=1, kind=C_char), dimension(*) :: id - integer (C_int), value :: request - end function lammps_actual_find_compute_neighlist - - function lammps_actual_neighlist_num_elements (ptr, idx) & - result (nelements) bind (C, name='lammps_neighlist_num_elements') - import :: C_ptr, C_int - integer (C_int) :: nelements - type (C_ptr), value :: ptr - integer (C_int), value :: idx - end function lammps_actual_neighlist_num_elements - - subroutine lammps_actual_neighlist_element_neighbors (ptr, idx, & - element, iatom, numneigh, neighbors) & - bind (C, name='lammps_neighlist_element_neighbors') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: idx, element - integer (C_int) :: iatom, numneigh - type (C_ptr) :: neighbors - end subroutine lammps_actual_neighlist_element_neighbors - - subroutine lammps_actual_create_atoms (ptr, n, id, type, x, v, image, & - shrinkexceed) bind (C, name='lammps_create_atoms') - import :: C_ptr, C_int64_t, C_double, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: n - integer (C_tagint) :: id - integer (C_int) :: type - real (C_double), dimension(*) :: x, v - integer (C_imageint), dimension(*) :: image - integer (C_int), value :: shrinkexceed - end subroutine lammps_actual_create_atoms - -#ifdef LAMMPS_EXCEPTIONS - - function lammps_actual_has_error (ptr) result (C_has_it) & - bind (C, name='lammps_has_error') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: C_has_it - end function lammps_actual_has_error - - function lammps_actual_get_last_error_message (ptr, buffer, & - buffer_size) result (error_type) & - bind (C, name='lammps_get_last_error_message') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - integer (C_int), value :: buffer_size - character (len=1, kind=C_char), dimension(*) :: buffer - integer (C_int) :: error_type - end function lammps_actual_get_last_error_message - -#endif - - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_gather_atoms_concat - module procedure lammps_gather_atoms_concat_ia, & - lammps_gather_atoms_concat_dpa - end interface lammps_gather_atoms_concat - - interface lammps_gather_atoms_subset - module procedure lammps_gather_atoms_subset_ia, & - lammps_gather_atoms_subset_dpa - end interface lammps_gather_atoms_subset - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - - interface lammps_scatter_atoms_subset - module procedure lammps_scatter_atoms_subset_ia, & - lammps_scatter_atoms_subset_dpa - end interface lammps_scatter_atoms_subset - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_list (ptr, cmds) - type (C_ptr), intent(in) :: ptr - character (len=*), dimension(:) :: cmds - integer (C_int) :: ncmd -! character (kind=C_char,len=1), dimension(size(cmds)) :: C_cmds - type (C_ptr), dimension(:), allocatable :: C_cmds - character (len=1, kind=C_char), allocatable, target :: C_strings(:,:) - integer :: i, max_len - ncmd = size(cmds) - allocate (C_cmds(ncmd)) - max_len = 0 - do i=1, size(cmds) - if ( len(cmds(i)) > max_len ) max_len = len(cmds(i)) - end do - allocate (C_strings(max_len + 1, ncmd)) - do i=1, size(cmds) - C_strings(:,i) = string2Cstring(cmds(i)) - C_cmds(i) = C_loc(C_strings(1,i)) - end do - call lammps_actual_commands_list (ptr, ncmd, C_cmds) - deallocate (C_strings) - deallocate (C_cmds) - end subroutine lammps_commands_list - -!----------------------------------------------------------------------------- - - subroutine lammps_commands_string (ptr, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: C_str - C_str = string2Cstring (str) - call lammps_actual_commands_string (ptr, C_str) - end subroutine lammps_commands_string - -!----------------------------------------------------------------------------- - - function lammps_extract_setting (ptr, name) result (setting) - integer :: setting - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: C_name - C_name = string2Cstring (name) - setting = lammps_actual_extract_setting (ptr, C_name) - end function lammps_extract_setting - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_box {{{2 - subroutine lammps_extract_box (ptr, boxlo, boxhi, xy, yz, xz, & - periodicity, box_change) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(out) :: boxlo, boxhi - double precision, intent(out) :: xy, yz, xz - logical, intent(out) :: periodicity(3), box_change - integer (kind=C_int) :: C_periodicity(3), C_box_change - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - call lammps_actual_extract_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, & - C_xz, C_periodicity, C_box_change) - boxlo = C_boxlo - boxhi = C_boxhi - xy = C_xy - yz = C_yz - xz = C_xz - periodicity = (C_periodicity == 1) - box_change = (C_box_change == 1) - end subroutine - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - atom(0:) => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - function lammps_get_thermo (ptr, name) result (dval) - double precision :: dval - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - dval = lammps_actual_get_thermo (ptr, Cname) - end function lammps_get_thermo - - subroutine lammps_set_variable (ptr, name, str, err) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name, str - integer, optional :: err - integer (C_int) :: Cerr - character (kind=C_char) :: Cname(len_trim(name)+1), Cstr(len_trim(str)+1) - Cname = string2Cstring (name) - Cstr = string2Cstring (str) - Cerr = lammps_actual_set_variable (ptr, Cname, Cstr) - if ( present(err) ) err = Cerr - end subroutine lammps_set_variable - - subroutine lammps_reset_box (ptr, boxlo, boxhi, xy, yz, xz) - type (C_ptr), intent(in) :: ptr - double precision, dimension(3), intent(in) :: boxlo, boxhi - double precision, intent(in) :: xy, yz, xz - real (C_double) :: C_boxlo(3), C_boxhi(3), C_xy, C_yz, C_xz - C_boxlo = boxlo - C_boxhi = boxhi - C_xy = xy - C_xz = xz - C_yz = yz - call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, C_xz) - end subroutine lammps_reset_box - -! lammps_gather_atoms {{{2 - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -! lammps_gather_atoms_concat {{{2 - subroutine lammps_gather_atoms_concat_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_ia - subroutine lammps_gather_atoms_concat_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_concat& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_concat (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_concat_dpa - -!----------------------------------------------------------------------------- - -! lammps_gather_atoms_subset {{{2 - subroutine lammps_gather_atoms_subset_ia (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms_subset& - & requires count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_ia - subroutine lammps_gather_atoms_subset_dpa (ptr,name,count,ids,data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count, ids(:) - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: ndata, Cids(size(ids)) - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - ndata = size(ids) - Cname = string2Cstring (name) - Cids = ids - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*ndata) ) - allocate ( data(count*ndata) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_subset_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms {{{2 - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - -! lammps_scatter_atoms_subset {{{2 - subroutine lammps_scatter_atoms_subset_ia (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - Cids = ids - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_ia - subroutine lammps_scatter_atoms_subset_dpa (ptr, name, ids, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data, ids - integer (kind=C_int) :: ndata, Ccount, Cids(size(ids)) - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - ndata = size(ids) - Cname = string2Cstring (name) - Ccount = size(data) / ndata - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_scatter_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms_subset (ptr, Cname, Ctype, Ccount, & - ndata, Cids, Cdata) - end subroutine lammps_scatter_atoms_subset_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_create_atoms (ptr, id, type, x, v, image, shrinkexceed) - type (C_ptr), intent(in) :: ptr - integer (kind=C_tagint), dimension(:), optional :: id - integer, dimension(:) :: type - double precision, dimension(:,:) :: x - double precision, dimension(:,:), optional :: v - integer (kind=C_imageint), dimension(:), target, optional :: image - logical, optional :: shrinkexceed - real (C_double), dimension(size(x)) :: C_x, C_v - integer (C_int) :: C_shrinkexceed, n - integer (kind=C_tagint) :: C_id - integer (C_imageint), dimension(size(x)/3) :: C_image - integer (C_int) :: C_type - if (shrinkexceed) then - C_shrinkexceed = 1_C_int - else - C_shrinkexceed = 0_C_int - end if - C_x = reshape(transpose(x), shape(C_x)) - if ( present(v) ) then - C_v = reshape(transpose(v), shape(C_v)) - else - C_v = 0.0_C_double - end if - if ( present(image) ) then - C_image = image - else - C_image = int(0,kind=C_imageint) - end if - n = size(type) - call lammps_actual_create_atoms (ptr, n, C_id, C_type, C_x, C_v, & - C_image, C_shrinkexceed) - end subroutine lammps_create_atoms - -!----------------------------------------------------------------------------- - - function lammps_config_has_package (package_name) result (has_it) - character (len=*), intent(in) :: package_name - character (len=1, kind=C_char), dimension(len_trim(package_name)+1) :: & - C_package_name - logical :: has_it - integer (C_int) :: C_has_it - C_package_name = string2Cstring (package_name) - C_has_it = lammps_actual_config_has_package (C_package_name) - has_it = (C_has_it == 1) - end function lammps_config_has_package - -!----------------------------------------------------------------------------- - - function lammps_config_package_name (index, buffer) result (installed) - character (len=*), intent(inout) :: buffer - integer, intent(in) :: index - logical :: installed - integer (kind=C_int) :: C_installed, C_index, max_size - character (len=1, kind=C_char), dimension(len_trim(buffer)+1) :: C_buffer - C_buffer = string2Cstring (buffer) - max_size = len(buffer) - C_index = index - C_installed = lammps_actual_config_package_name (C_index, C_buffer, & - max_size) - installed = (C_installed == 1_C_int) - buffer = Cstring2string (C_buffer) - end function lammps_config_package_name - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_gzip_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_gzip_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_gzip_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_png_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_png_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_png_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_jpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_jpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_jpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_ffmpeg_support () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_ffmpeg_support () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_ffmpeg_support - -!----------------------------------------------------------------------------- - - logical function lammps_config_has_exceptions () result (has_it) - integer (C_int) :: C_has_it - C_has_it = lammps_actual_config_has_exceptions () - has_it = (C_has_it == 1_C_int) - end function lammps_config_has_exceptions - -!----------------------------------------------------------------------------- - - function lammps_find_pair_neighlist (ptr, style, exact, nsub, request) & - result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: style - logical, intent(in) :: exact - integer, intent(in) :: nsub, request - integer (C_int) :: C_exact, C_nsub, C_neighlist, C_request - character (kind=C_char), dimension(len_trim(style)+1) :: C_style - if (exact) then - C_exact = 1_C_int - else - C_exact = 0_C_int - end if - C_nsub = nsub - C_request = request - C_style = string2Cstring (style) - C_neighlist = lammps_actual_find_pair_neighlist (ptr, C_style, C_exact, & - C_nsub, C_request) - neighlist = C_neighlist - end function lammps_find_pair_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_fix_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request, C_neighlist - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - C_neighlist = lammps_actual_find_fix_neighlist (ptr, C_id, C_request) - neighlist = C_neighlist - end function lammps_find_fix_neighlist - -!----------------------------------------------------------------------------- - - function lammps_find_compute_neighlist (ptr, id, request) result (neighlist) - integer :: neighlist - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: request - integer (C_int) :: C_request - character (kind=C_char), dimension(len_trim(id)+1) :: C_id - C_id = string2Cstring(id) - C_request = request - neighlist = lammps_actual_find_compute_neighlist (ptr, C_id, C_request) - end function lammps_find_compute_neighlist - -!----------------------------------------------------------------------------- - - function lammps_neighlist_num_elements (ptr, idx) result (nelements) - integer :: nelements - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx - integer (C_int) :: C_idx - C_idx = idx - nelements = lammps_actual_neighlist_num_elements (ptr, C_idx) - end function lammps_neighlist_num_elements - -!----------------------------------------------------------------------------- - - subroutine lammps_neighlist_element_neighbors (ptr, idx, element, iatom, & - numneigh, neighbors) - type (C_ptr), intent(in) :: ptr - integer, intent(in) :: idx, element - integer, intent(out) :: iatom, numneigh - integer (C_int), dimension(:), pointer, intent(out) :: neighbors - integer (C_int) :: C_idx, C_element, C_iatom, C_numneigh - type (C_ptr) :: C_neighbors - C_idx = idx - C_element = element - call lammps_actual_neighlist_element_neighbors (ptr, C_idx, C_element, & - C_iatom, C_numneigh, C_neighbors) - iatom = C_iatom - numneigh = C_numneigh - call C_F_pointer (C_neighbors, neighbors, [numneigh]) - end subroutine lammps_neighlist_element_neighbors - -!----------------------------------------------------------------------------- - -! These are only defined if -DLAMMPS_EXCEPTIONS was issued -#ifdef LAMMPS_EXCEPTIONS - logical function lammps_has_error (ptr) result (has_it) - type (C_ptr), intent(in) :: ptr - integer (kind=C_int) :: C_has_it - C_has_it = lammps_actual_has_error (ptr) - has_it = (C_has_it == 1_C_int) - end function lammps_has_error - -!----------------------------------------------------------------------------- - - function lammps_get_last_error_message (ptr, buffer) result (error_type) - integer (C_int) :: error_type - type (C_ptr), intent(in) :: ptr - character (len=*), intent(out) :: buffer - integer (C_int) :: buffer_size - character (len=1, kind=C_char), dimension(len(buffer)+1) :: C_buffer - buffer_size = len(buffer) - error_type = lammps_actual_get_last_error_message (ptr, C_buffer, & - buffer_size) - buffer = Cstring2string (C_buffer) - end function lammps_get_last_error_message -#endif -!-------------------------------------------------------------------------2}}} - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - pure function Cstrlen (Cstring) result (n) - character (len=1, kind=C_char), dimension(:), intent(in) :: Cstring - integer :: n, i - n = size(Cstring) - do i = 1, size(Cstring) - if ( Cstring(i) == C_NULL_CHAR ) then - n = i - 1 - return - end if - end do - end function Cstrlen - -!----------------------------------------------------------------------------- - - pure function Cstring2string (Cstring) result (string) - !use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=1, kind=C_char), intent(in) :: Cstring (:) - character (len=Cstrlen(Cstring)) :: string - integer :: i, n - n = Cstrlen(Cstring) - string = '' - forall (i = 1:n) - string(i:i) = Cstring(i) - end forall - end function Cstring2string - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran2/Makefile b/examples/COUPLE/fortran2/Makefile deleted file mode 100644 index 8ac957a4c1..0000000000 --- a/examples/COUPLE/fortran2/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpifort # replace with your Fortran compiler -CXX = mpicxx # replace with your C++ compiler -CXXLIB = -lstdc++ # replace with your C++ runtime libs - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so - @echo "WARNING: this Fortran interface is obsolete and is no longer -maintained. See $(LAMMPS_ROOT)/fortran for the new, maintained interface -(largely written by the same author). You may continue to use this interface if -desired, but it may eventually be removed from LAMMPS." - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o - $(FC) $(FFLAGS) -shared -o $@ $^ $(CXXLIB) - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czf Fortran-interface.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS.F90 makefile README diff --git a/examples/COUPLE/fortran2/README b/examples/COUPLE/fortran2/README deleted file mode 100644 index b36cb43746..0000000000 --- a/examples/COUPLE/fortran2/README +++ /dev/null @@ -1,273 +0,0 @@ -!! NOTE ------------------------------------------------------------------- -! This interface is obsolete and may be removed in a future release of -! LAMMPS. The interface in fortran/lammps.f90 replaces this one. That API -! is maintained by the LAMMPS developers and has documentation written for -! it; it is based loosely on this one, but binds all procedures to a lammps -! derived type. That interface was written in large -! part by the same author, but is also supported by other developers. -!-------------------------------------------------------------------------- - -LAMMPS.F90 defines a Fortran 2003 module, LAMMPS, which wraps all functions in -src/library.h so they can be used directly from Fortran-encoded programs. - -All functions in src/library.h that use and/or return C-style pointers have -Fortran wrapper functions that use Fortran-style arrays, pointers, and -strings; all C-style memory management is handled internally with no user -intervention. See --USE-- for notes on how this interface differs from the -C interface (and the Python interface). - -This interface was created by Karl Hammond who you can contact with -questions: - -Karl D. Hammond -University of Missouri -hammondkd at missouri.edu - -------------------------------------- - ---COMPILATION-- - -First, be advised that mixed-language programming is not trivial. It requires -you to link in the required libraries of all languages you use (in this case, -those for Fortran, C, and C++), as well as any other libraries required. -You are also advised to read the --USE-- section below before trying to -compile. - -The following steps will work to compile this module (replace ${LAMMPS_SRC} -with the path to your LAMMPS source directory). - -Steps 3-5 are accomplished, possibly after some modifications to -the makefile, by make using the attached makefile. Said makefile also builds -the dynamically-linkable library (liblammps_fortran.so). - -** STATIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a static library. - Call the resulting file ${LAMMPS_LIB}, which will have an actual name - like liblmp_openmpi.a. If compiling using the MPI stubs in - ${LAMMPS_SRC}/STUBS, you will need to know where libmpi_stubs.a - is as well (I'll call it ${MPI_STUBS} hereafter) - (2) Copy said library to your Fortran program's source directory or replace - ${LAMMPS_LIB} with its full path in the instructions below. - (3) Compile (but don't link!) LAMMPS.F90. Example: - mpifort -c LAMMPS.f90 - OR - gfortran -c LAMMPS.F90 - NOTE: you may get a warning such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This is normal (see --IMPLEMENTATION NOTES--). - - (4) Compile (but don't link) LAMMPS-wrapper.cpp. You will need its header - file as well. You will have to provide the locations of LAMMPS's - header files. For example, - mpicxx -c -I${LAMMPS_SRC} LAMMPS-wrapper.cpp - OR - g++ -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - OR - icpc -c -I${LAMMPS_SRC} -I${LAMMPS_SRC}/STUBS LAMMPS-wrapper.cpp - (5) OPTIONAL: Make a library from the object files so you can carry around - two files instead of three. Example: - ar rs liblammps_fortran.a LAMMPS.o LAMMPS-wrapper.o - This will create the file liblammps_fortran.a that you can use in place - of "LAMMPS.o LAMMPS-wrapper.o" later. Note that you will still - need to have the .mod file from part (3). - - It is also possible to add LAMMPS.o and LAMMPS-wrapper.o into the - LAMMPS library (e.g., liblmp_openmpi.a) instead of creating a separate - library, like so: - ar rs ${LAMMPS_LIB} LAMMPS.o LAMMPS-wrapper.o - In this case, you can now use the Fortran wrapper functions as if they - were part of the usual LAMMPS library interface (if you have the module - file visible to the compiler, that is). - (6) Compile (but don't link) your Fortran program. Example: - mpifort -c myfreeformatfile.f90 - mpifort -c myfixedformatfile.f - OR - gfortran -c myfreeformatfile.f90 - gfortran -c myfixedformatfile.f - The object files generated by these steps are collectively referred to - as ${my_object_files} in the next step(s). - - IMPORTANT: If the Fortran module from part (3) is not in the current - directory or in one searched by the compiler for module files, you will - need to include that location via the -I flag to the compiler, like so: - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - - (7) Link everything together, including any libraries needed by LAMMPS (such - as the C++ standard library, the C math library, the JPEG library, fftw, - etc.) For example, - mpifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} -lmpi_cxx -lstdc++ -lm - OR - gfortran LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -lstdc++ -lm - OR - ifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \ - ${LAMMPS_LIB} ${MPI_STUBS} -cxxlib -lm - Any other required libraries (e.g. -ljpeg, -lfftw) should be added to - the end of this line. - -You should now have a working executable. - -** DYNAMIC LIBRARY INSTRUCTIONS ** - (1) Compile LAMMPS as a dynamic library - (make makeshlib && make -f Makefile.shlib [targetname]). - (2) Compile, but don't link, LAMMPS.F90 using the -fPIC flag, such as - mpifort -fPIC -c LAMMPS.f90 - (3) Compile, but don't link, LAMMPS-wrapper.cpp in the same manner, e.g. - mpicxx -fPIC -c LAMMPS-wrapper.cpp - (4) Make the dynamic library, like so: - mpifort -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o - (5) Compile your program, such as, - mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90 - where ${LAMMPS_SRC}/examples/COUPLE/fortran2 contains the .mod file from - step (3) - (6) Link everything together, such as - mpifort ${my_object_files} -L${LAMMPS_SRC} \ - -L${LAMMPS_SRC}/examples/COUPLE/fortran2 -llammps_fortran \ - -llammps_openmpi -lmpi_cxx -lstdc++ -lm - -If you wish to avoid the -L flags, add the directories containing your -shared libraries to the LIBRARY_PATH environment variable. At run time, you -will have to add these directories to LD_LIBRARY_PATH as well; otherwise, -your executable will not find the libraries it needs. - -------------------------------------- - ---USAGE-- - -To use this API, your program unit (PROGRAM/SUBROUTINE/FUNCTION/MODULE/etc.) -should look something like this: - program call_lammps - use LAMMPS - ! Other modules, etc. - implicit none - type (lammps_instance) :: lmp ! This is a pointer to your LAMMPS instance - real (C_double) :: fix - real (C_double), dimension(:), pointer :: fix2 - ! Rest of declarations - call lammps_open_no_mpi ('lmp -in /dev/null -screen out.lammps',lmp) - ! Set up rest of program here - call lammps_file (lmp, 'in.example') - call lammps_extract_fix (fix, lmp, '2', 0, 1, 1, 1) - call lammps_extract_fix (fix2, lmp, '4', 0, 2, 1, 1) - call lammps_close (lmp) - end program call_lammps - -Important notes: - * Though I dislike the use of pointers, they are necessary when communicating - with C and C++, which do not support Fortran's ALLOCATABLE attribute. - * There is no need to deallocate C-allocated memory; this is done for you in - the cases when it is done (which are all cases when pointers are not - accepted, such as global fix data) - * All arguments which are char* variables in library.cpp are character (len=*) - variables here. For example, - call lammps_command (lmp, 'units metal') - will work as expected. - * The public functions (the only ones you can use) have interfaces as - described in the comments at the top of LAMMPS.F90. They are not always - the same as those in library.h, since C strings are replaced by Fortran - strings and the like. - * The module attempts to check whether you have done something stupid (such - as assign a 2D array to a scalar), but it's not perfect. For example, the - command - call lammps_extract_global (nlocal, ptr, 'nlocal') - will give nlocal correctly if nlocal is a pointer to type INTEGER, but it - will give the wrong answer if nlocal is a pointer to type REAL. This is a - feature of the (void*) type cast in library.cpp. There is no way I can - check this for you! It WILL catch you if you pass it an allocatable or - fixed-size array when it expects a pointer. - * Arrays constructed from temporary data from LAMMPS are ALLOCATABLE, and - represent COPIES of data, not the originals. Functions like - lammps_extract_atom, which return actual LAMMPS data, are pointers. - * IMPORTANT: Due to the differences between C and Fortran arrays (C uses - row-major vectors, Fortran uses column-major vectors), all arrays returned - from LAMMPS have their indices swapped. - * An example of a complete program, simple.f90, is included with this - package. - -------------------------------------- - ---TROUBLESHOOTING-- - -Compile-time errors (when compiling LAMMPS.F90, that is) probably indicate -that your compiler is not new enough to support Fortran 2003 features. For -example, GCC 4.1.2 will not compile this module, but GCC 4.4.0 will. - -If your compiler balks at 'use, intrinsic :: ISO_C_binding,' try removing the -intrinsic part so it looks like an ordinary module. However, it is likely -that such a compiler will also have problems with everything else in the -file as well. - -If you get a segfault as soon as the lammps_open call is made, check that you -compiled your program AND LAMMPS-wrapper.cpp using the same MPI headers. Using -the stubs for one and the actual MPI library for the other will cause Bad -Things to happen. - -If you find run-time errors, please pass them along via the LAMMPS Users -mailing list (please CC me as well; address above). Please provide a minimal -working example along with the names and versions of the compilers you are -using. Please make sure the error is repeatable and is in MY code, not yours -(generating a minimal working example will usually ensure this anyway). - -------------------------------------- - ---IMPLEMENTATION NOTES-- - -The Fortran procedures have the same names as the C procedures, and -their purpose is the same, but they may take different arguments. Here are -some of the important differences: - * lammps_open and lammps_open_no_mpi take a string instead of argc and - argv. This is necessary because C and C++ have a very different way - of treating strings than Fortran. If you want the command line to be - passed to lammps_open (as it often would be from C/C++), use the - GET_COMMAND intrinsic to obtain it. - * All C++ functions that accept char* pointers now accept Fortran-style - strings within this interface instead. - * All of the lammps_extract_[something] functions, which return void* - C-style pointers, have been replaced by generic subroutines that return - Fortran variables (which may be arrays). The first argument houses the - variable/pointer to be returned (pretend it's on the left-hand side); all - other arguments are identical except as stipulated above. - Note that it is not possible to declare generic functions that are selected - based solely on the type/kind/rank (TKR) signature of the return value, - only based on the TKR of the arguments. - * The SHAPE of the first argument to lammps_extract_[something] is checked - against the "shape" of the C array (e.g., double vs. double* vs. double**). - Calling a subroutine with arguments of inappropriate rank will result in an - error at run time. - * The indices i and j in lammps_extract_fix are used the same way they - are in f_ID[i][j] references in LAMMPS (i.e., starting from 1). This is - different than the way library.cpp uses these numbers, but is more - consistent with the way arrays are accessed in LAMMPS and in Fortran. - * The char* pointer normally returned by lammps_command is thrown away - in this version; note also that lammps_command is now a subroutine - instead of a function. - * The pointer to LAMMPS itself is of type(lammps_instance), which is itself - a synonym for type(C_ptr), part of ISO_C_BINDING. Type (C_ptr) is - C's void* data type. - * This module will almost certainly generate a compile-time warning, - such as, - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - Variable 'communicator' at (1) is a parameter to the BIND(C) - procedure 'lammps_open_wrapper' but may not be C interoperable - This happens because lammps_open_wrapper actually takes a Fortran - INTEGER argument, whose type is defined by the MPI library itself. The - Fortran integer is converted to a C integer by the MPI library (if such - conversion is actually necessary). - * lammps_extract_global returns COPIES of the (scalar) data, as does the - C version. - * lammps_extract_atom, lammps_extract_compute, and lammps_extract_fix - have a first argument that will be associated with ACTUAL LAMMPS DATA. - This means the first argument must be: - * The right rank (via the DIMENSION modifier) - * A C-interoperable POINTER type (i.e., INTEGER (C_int) or - REAL (C_double)). - * lammps_extract_variable returns COPIES of the data, as the C library - interface does. There is no need to deallocate using lammps_free. - * The 'data' argument to lammps_gather_atoms and lammps_scatter atoms must - be ALLOCATABLE. It should be of type INTEGER or DOUBLE PRECISION. It - does NOT need to be C inter-operable (and indeed should not be). - * The 'count' argument of lammps_scatter_atoms is unnecessary; the shape of - the array determines the number of elements LAMMPS will read. diff --git a/examples/COUPLE/fortran2/in.simple b/examples/COUPLE/fortran2/in.simple deleted file mode 100644 index 5982cbaac1..0000000000 --- a/examples/COUPLE/fortran2/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units lj -atom_modify map array -lattice bcc 1.0 -region simbox block 0 10 0 10 0 10 -create_box 2 simbox -create_atoms 1 region simbox -pair_style lj/cut 2.5 -pair_coeff * * 1.0 1.0 -mass 1 58.2 # These are made-up numbers -mass 2 28.3 -velocity all create 1200.0 7474848 dist gaussian -fix 1 all nve -fix 2 all dt/reset 1 1E-5 1E-3 0.01 units box -fix 4 all ave/histo 10 5 100 0.5 1.5 50 f_2 file temp.histo ave running -thermo_style custom step dt temp press etotal f_4[1][1] -thermo 100 diff --git a/examples/COUPLE/fortran2/simple.f90 b/examples/COUPLE/fortran2/simple.f90 deleted file mode 100644 index 0b84a1ecc1..0000000000 --- a/examples/COUPLE/fortran2/simple.f90 +++ /dev/null @@ -1,112 +0,0 @@ -program simple - - use MPI - use LAMMPS - - ! The following line is unnecessary, as I have included these three entities - ! with the LAMMPS module, but I leave them in anyway to remind people where - ! they came from - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int - - implicit none - - ! Notes: - ! * If LAMMPS returns a scalar that is allocated by the library interface - ! (see library.cpp), then that memory is deallocated automatically and - ! the argument to lammps_extract_fix must be a SCALAR. - ! * If LAMMPS returns a pointer to an array, consisting of internal LAMMPS - ! data, then the argument must be an interoperable Fortran pointer. - ! Interoperable means it is of type INTEGER (C_INT) or of type - ! REAL (C_DOUBLE) in this context. - ! * Pointers should NEVER be deallocated, as that would deallocate internal - ! LAMMPS data! - ! * Note that just because you can read the values of, say, a compute at - ! any time does not mean those values represent the "correct" values. - ! LAMMPS will abort you if you try to grab a pointer to a non-current - ! entity, but once it's bound, it's your responsibility to check that - ! it's current before evaluating. - ! * IMPORTANT: Two-dimensional arrays (such as 'x' from extract_atom) - ! will be transposed from what they might look like in C++. This is - ! because of different bookkeeping conventions between Fortran and C - ! that date back to about 1970 or so (when C was written). - ! * Arrays start from 1, EXCEPT for mass from extract_atom, which - ! starts from 0. This is because the C array actually has a blank - ! first element (and thus mass[1] corresponds to the mass of type 1) - - type (C_ptr) :: lmp - real (C_double), pointer :: compute => NULL() - real (C_double) :: fix, fix2 - real (C_double), dimension(:), pointer :: compute_v => NULL() - real (C_double), dimension(:,:), pointer :: x => NULL() - real (C_double), dimension(:), pointer :: mass => NULL() - integer, dimension(:), allocatable :: types - double precision, dimension(:), allocatable :: r - integer :: error, narg, me, nprocs - character (len=1024) :: command_line - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - ! You are free to pass any string you like to lammps_open or - ! lammps_open_no_mpi; here is how you pass it the command line - !call get_command (command_line) - !call lammps_open (command_line, MPI_COMM_WORLD, lmp) - - ! And here's how to to it with a string constant of your choice - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - - call lammps_file (lmp, 'in.simple') - call lammps_command (lmp, 'run 500') - - ! This extracts f_2 as a scalar (the last two arguments can be arbitrary) - call lammps_extract_fix (fix, lmp, '2', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR, 1, 1) - print *, 'Fix is ', fix - - ! This extracts f_4[1][1] as a scalar - call lammps_extract_fix (fix2, lmp, '4', LMP_STYLE_GLOBAL, LMP_TYPE_ARRAY, 1, 1) - print *, 'Fix 2 is ', fix2 - - ! This extracts the scalar compute of compute thermo_temp - call lammps_extract_compute (compute, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_SCALAR) - print *, 'Compute is ', compute - - ! This extracts the vector compute of compute thermo_temp - call lammps_extract_compute (compute_v, lmp, 'thermo_temp', LMP_STYLE_GLOBAL, LMP_TYPE_VECTOR) - print *, 'Vector is ', compute_v - - ! This extracts the masses - call lammps_extract_atom (mass, lmp, 'mass') - print *, 'Mass is ', mass(1:) - - ! Extracts a pointer to the arrays of positions for all atoms - call lammps_extract_atom (x, lmp, 'x') - if ( .not. associated (x) ) print *, 'x is not associated' - print *, 'x is ', x(:,1) ! Prints x, y, z for atom 1 - - ! Extracts pointer to atom types - call lammps_gather_atoms (lmp, 'type', 1, types) - print *, 'types is ', types(1:3) - - ! Allocates an array and assigns all positions to it - call lammps_gather_atoms (lmp, 'x', 3, r) - print *, 'natoms = ', int(lammps_get_natoms(lmp)) - print *, 'size(r) = ', size(r) - print *, 'r is ', r(1:6) - - ! Puts those position data back - call lammps_scatter_atoms (lmp, 'x', r) - - call lammps_command (lmp, 'run 1') - print *, 'x is ', x(:,1) ! Note that the position updates! - print *, 'Compute is ', compute ! This did only because "temp" is part of - ! the thermo output; the vector part did - ! not, and won't until we give LAMMPS a - ! thermo output or other command that - ! requires its value - - call lammps_close (lmp) - - call MPI_Finalize (error) - -end program simple diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp deleted file mode 100644 index 4774cb6b49..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper.h" -#define LAMMPS_LIB_MPI 1 -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -void lammps_open_fortran_wrapper (int argc, char **argv, - MPI_Fint communicator, void **ptr) -{ - MPI_Comm C_communicator = MPI_Comm_f2c (communicator); - lammps_open (argc, argv, C_communicator, ptr); -} - -int lammps_get_ntypes (void *ptr) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ntypes = lmp->atom->ntypes; - return ntypes; -} - -void lammps_error_all (void *ptr, const char *file, int line, const char *str) -{ - class LAMMPS *lmp = (class LAMMPS *) ptr; - lmp->error->all (file, line, str); -} - -int lammps_extract_compute_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_VECTOR); - if (size) return *size; - return 0; -} - -void lammps_extract_compute_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_ROWS); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_compute(ptr, id, style, LMP_SIZE_COLS); - if (tmp) *ncols = *tmp; - return; -} - -int lammps_extract_fix_vectorsize (void *ptr, char *id, int style) -{ - int *size; - size = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_VECTOR, 0, 0); - if (size) return *size; - return 0; -} - -void lammps_extract_fix_arraysize (void *ptr, char *id, int style, - int *nrows, int *ncols) -{ - int *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_ROWS, 0, 0); - if (tmp) *nrows = *tmp; - tmp = (int *) lammps_extract_fix(ptr, id, style, LMP_SIZE_COLS, 0, 0); - if (tmp) *ncols = *tmp; - return; -} - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h deleted file mode 100644 index e1eec9fc72..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Karl D. Hammond - University of Missouri (USA), 2012 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_open_fortran_wrapper (int, char**, MPI_Fint, void**); -int lammps_get_ntypes (void*); -int lammps_extract_compute_vectorsize (void*, char*, int); -void lammps_extract_compute_arraysize (void*, char*, int, int*, int*); -int lammps_extract_fix_vectorsize (void*, char*, int); -void lammps_extract_fix_arraysize (void*, char*, int, int*, int*); -void lammps_error_all (void*, const char*, int, const char*); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp deleted file mode 100644 index 83d594df60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All functions herein COULD be added to library.cpp instead of - including this as a separate file. See the README for instructions. */ - -#include -#include "LAMMPS-wrapper2.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace LAMMPS_NS; - -extern "C" void f_callback(void *, bigint, int, tagint *, double **, double **); - -void lammps_set_callback (void *ptr) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_callback(f_callback, ptr); - return; -} - -void lammps_set_external_vector_length (void *ptr, int n) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector_length(n); - return; -} - -void lammps_set_external_vector (void *ptr, int n, double val) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_vector (n, val); - return; -} - -void lammps_set_user_energy (void *ptr, double energy) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_energy_global(energy); - return; -} - -void lammps_set_user_virial (void *ptr, double *virial) { - class LAMMPS *lmp = (class LAMMPS *) ptr; - int ifix = lmp->modify->find_fix_by_style("external"); - FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix]; - fix->set_virial_global(virial); - return; -} - diff --git a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h b/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h deleted file mode 100644 index 45c41b569a..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS-wrapper2.h +++ /dev/null @@ -1,37 +0,0 @@ -/* ----------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------ - Contributing author: Nir Goldman, LLNL , 2016 -------------------------------------------------------------------------- */ - -/* This is set of "wrapper" functions to assist LAMMPS.F90, which itself - provides a (I hope) robust Fortran interface to library.cpp and - library.h. All prototypes herein COULD be added to library.h instead of - including this as a separate file. See the README for instructions. */ -#ifdef __cplusplus -extern "C" { -#endif - -/* Prototypes for auxiliary functions */ -void lammps_set_callback (void *); -void lammps_set_user_energy (void*, double); -void lammps_set_user_virial (void*, double*); -void lammps_set_external_vector_length (void*, int); -void lammps_set_external_vector (void*, int, double); - -#ifdef __cplusplus -} -#endif - -/* vim: set ts=3 sts=3 expandtab: */ diff --git a/examples/COUPLE/fortran_dftb/LAMMPS.F90 b/examples/COUPLE/fortran_dftb/LAMMPS.F90 deleted file mode 100644 index 188fff9d60..0000000000 --- a/examples/COUPLE/fortran_dftb/LAMMPS.F90 +++ /dev/null @@ -1,982 +0,0 @@ -!! ----------------------------------------------------------------------- -! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator -! www.cs.sandia.gov/~sjplimp/lammps.html -! Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories -! -! Copyright (2003) Sandia Corporation. Under the terms of Contract -! DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains -! certain rights in this software. This software is distributed under -! the GNU General Public License. -! -! See the README file in the top-level LAMMPS directory. -!-------------------------------------------------------------------------- - -!! ------------------------------------------------------------------------ -! Contributing author: Karl D. Hammond -! University of Missouri (USA), 2012 -!-------------------------------------------------------------------------- - -!! LAMMPS, a Fortran 2003 module containing an interface between Fortran -!! programs and the C-style functions in library.cpp that ship with LAMMPS. -!! This file should be accompanied by LAMMPS-wrapper.cpp and LAMMPS-wrapper.h, -!! which define wrapper functions that ease portability and enforce array -!! dimensions. -!! -!! Everything in this module should be 100% portable by way of Fortran 2003's -!! ISO_C_BINDING intrinsic module. See the README for instructions for -!! compilation and use. -!! -!! Here are the PUBLIC functions and subroutines included in this module. -!! subroutine lammps_open (command_line, communicator, ptr) -!! subroutine lammps_open_no_mpi (command_line, ptr) -!! subroutine lammps_close (ptr) -!! subroutine lammps_file (ptr, str) -!! subroutine lammps_command (ptr, str) -!! subroutine lammps_free (ptr) -!! subroutine lammps_extract_global (global, ptr, name) -!! subroutine lammps_extract_atom (atom, ptr, name) -!! subroutine lammps_extract_fix (fix, ptr, id, style, type, i, j) -!! subroutine lammps_extract_compute (compute, ptr, id, style, type) -!! subroutine lammps_extract_variable (variable, ptr, name, group) -!! function lammps_get_natoms (ptr) -!! subroutine lammps_gather_atoms (ptr, name, count, data) -!! subroutine lammps_scatter_atoms (ptr, name, data) - -#define FLERR __FILE__,__LINE__ -! The above line allows for similar error checking as is done with standard -! LAMMPS files. - -module LAMMPS - - use, intrinsic :: ISO_C_binding, only : C_double, C_int, C_ptr, C_char, & - C_NULL_CHAR, C_loc, C_F_pointer, lammps_instance => C_ptr - implicit none - private - public :: lammps_set_user_virial - public :: lammps_set_external_vector_length - public :: lammps_set_external_vector - public :: lammps_set_user_energy - public :: lammps_open, lammps_open_no_mpi, lammps_close, lammps_file, & - lammps_command, lammps_free, lammps_extract_global, & - lammps_extract_atom, lammps_extract_compute, lammps_extract_fix, & - lammps_extract_variable, lammps_get_natoms, lammps_gather_atoms, & - lammps_set_callback - public :: lammps_scatter_atoms, lammps_instance, C_ptr, C_double, C_int - - !! Functions supplemental to the prototypes in library.h. {{{1 - !! The function definitions (in C++) are contained in LAMMPS-wrapper.cpp. - !! I would have written the first in Fortran, but the MPI libraries (which - !! were written in C) have C-based functions to convert from Fortran MPI - !! handles to C MPI handles, and there is no Fortran equivalent for those - !! functions. - interface - subroutine lammps_open_wrapper (argc, argv, communicator, ptr) & - bind (C, name='lammps_open_fortran_wrapper') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - integer, value :: communicator - type (C_ptr) :: ptr - end subroutine lammps_open_wrapper - subroutine lammps_actual_error_all (ptr, file, line, str) & - bind (C, name='lammps_error_all') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*), intent(in) :: file, str - integer (C_int), value :: line - end subroutine lammps_actual_error_all - function lammps_get_ntypes (ptr) result (ntypes) & - bind (C, name='lammps_get_ntypes') - import :: C_int, C_ptr - type (C_ptr), value :: ptr - integer (C_int) :: ntypes - end function lammps_get_ntypes - function lammps_actual_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_compute_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_compute_vectorsize - subroutine lammps_actual_extract_compute_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_compute_arraysize') - import :: C_int, C_char, C_ptr - integer (C_int) :: arraysize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_compute_arraysize - function lammps_actual_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) bind (C, name='lammps_extract_fix_vectorsize') - import :: C_int, C_char, C_ptr - integer (C_int) :: vectorsize - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - end function lammps_actual_extract_fix_vectorsize - subroutine lammps_actual_extract_fix_arraysize (ptr, id, style, & - nrows, ncols) bind (C, name='lammps_extract_fix_arraysize') - import :: C_int, C_char, C_ptr - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style - integer (C_int) :: nrows, ncols - end subroutine lammps_actual_extract_fix_arraysize - end interface - - !! Functions/subroutines defined in library.h and library.cpp {{{1 - interface - subroutine lammps_actual_open_no_mpi (argc, argv, ptr) & - bind (C, name='lammps_open_no_mpi') - import :: C_int, C_ptr - integer (C_int), value :: argc - type (C_ptr), dimension(*) :: argv - type (C_ptr) :: ptr - end subroutine lammps_actual_open_no_mpi - - subroutine lammps_close (ptr) bind (C, name='lammps_close') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_close - - subroutine lammps_actual_file (ptr, str) bind (C, name='lammps_file') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - end subroutine lammps_actual_file - - function lammps_actual_command (ptr, str) result (command) & - bind (C, name='lammps_command') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: str - type (C_ptr) :: command - end function lammps_actual_command - - subroutine lammps_free (ptr) bind (C, name='lammps_free') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_free - - function lammps_actual_extract_global (ptr, name) & - bind (C, name='lammps_extract_global') result (global) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: global - end function lammps_actual_extract_global - - function lammps_actual_extract_atom (ptr, name) & - bind (C, name='lammps_extract_atom') result (atom) - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name - type (C_ptr) :: atom - end function lammps_actual_extract_atom - - function lammps_actual_extract_compute (ptr, id, style, type) & - result (compute) bind (C, name='lammps_extract_compute') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type - type (C_ptr) :: compute - end function lammps_actual_extract_compute - - function lammps_actual_extract_fix (ptr, id, style, type, i, j) & - result (fix) bind (C, name='lammps_extract_fix') - import :: C_ptr, C_char, C_int - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: id - integer (C_int), value :: style, type, i, j - type (C_ptr) :: fix - end function lammps_actual_extract_fix - - function lammps_actual_extract_variable (ptr, name, group) & - result (variable) bind (C, name='lammps_extract_variable') - import :: C_ptr, C_char - type (C_ptr), value :: ptr - character (kind=C_char), dimension(*) :: name, group - type (C_ptr) :: variable - end function lammps_actual_extract_variable - - function lammps_get_natoms (ptr) result (natoms) & - bind (C, name='lammps_get_natoms') - import :: C_ptr, C_int - type (C_ptr), value :: ptr - integer (C_int) :: natoms - end function lammps_get_natoms - - subroutine lammps_set_callback (ptr) & - bind (C, name='lammps_set_callback') - import :: C_ptr - type (C_ptr), value :: ptr - end subroutine lammps_set_callback - - subroutine lammps_set_user_energy (ptr, energy) & - bind (C, name='lammps_set_user_energy') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double), value :: energy - end subroutine lammps_set_user_energy - - subroutine lammps_set_user_virial (ptr, virial) & - bind (C, name='lammps_set_user_virial') - import :: C_ptr, C_double - type (C_ptr), value :: ptr - real(C_double) :: virial(6) - end subroutine lammps_set_user_virial - - subroutine lammps_set_external_vector_length (ptr, n) & - bind (C, name='lammps_set_external_vector_length') - import :: C_ptr, C_double, C_int - type(C_ptr), value :: ptr - integer (C_int), value :: n - end subroutine lammps_set_external_vector_length - - subroutine lammps_set_external_vector (ptr, n, val) & - bind (C, name='lammps_set_external_vector') - import :: C_ptr, C_int, C_double - type (C_ptr), value :: ptr - integer (C_int), value :: n - real(C_double), value :: val - end subroutine lammps_set_external_vector - - subroutine lammps_actual_gather_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_gather_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_gather_atoms - - subroutine lammps_actual_scatter_atoms (ptr, name, type, count, data) & - bind (C, name='lammps_scatter_atoms') - import :: C_ptr, C_int, C_char - type (C_ptr), value :: ptr, data - character (kind=C_char), dimension(*) :: name - integer (C_int), value :: type, count - end subroutine lammps_actual_scatter_atoms - end interface - - ! Generic functions for the wrappers below {{{1 - - interface lammps_extract_global - module procedure lammps_extract_global_i, & - lammps_extract_global_dp - end interface lammps_extract_global - - interface lammps_extract_atom - module procedure lammps_extract_atom_ia, & - lammps_extract_atom_dpa, & - lammps_extract_atom_dp2a - end interface lammps_extract_atom - - interface lammps_extract_compute - module procedure lammps_extract_compute_dp, & - lammps_extract_compute_dpa, & - lammps_extract_compute_dp2a - end interface lammps_extract_compute - - interface lammps_extract_fix - module procedure lammps_extract_fix_dp, & - lammps_extract_fix_dpa, & - lammps_extract_fix_dp2a - end interface lammps_extract_fix - - interface lammps_extract_variable - module procedure lammps_extract_variable_dp, & - lammps_extract_variable_dpa - end interface lammps_extract_variable - - interface lammps_gather_atoms - module procedure lammps_gather_atoms_ia, lammps_gather_atoms_dpa - end interface lammps_gather_atoms - - interface lammps_scatter_atoms - module procedure lammps_scatter_atoms_ia, lammps_scatter_atoms_dpa - end interface lammps_scatter_atoms - -contains !! Wrapper functions local to this module {{{1 - - subroutine lammps_open (command_line, communicator, ptr) - character (len=*), intent(in) :: command_line - integer, intent(in) :: communicator - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_open_wrapper (argc, argv, communicator, ptr) - deallocate (argv) - end subroutine lammps_open - -!----------------------------------------------------------------------------- - - subroutine lammps_open_no_mpi (command_line, ptr) - character (len=*), intent(in) :: command_line - type (C_ptr) :: ptr - integer (C_int) :: argc - type (C_ptr), dimension(:), allocatable :: argv - character (kind=C_char), dimension(len_trim(command_line)+1), target :: & - c_command_line - c_command_line = string2Cstring (command_line) - call Cstring2argcargv (c_command_line, argc, argv) - call lammps_actual_open_no_mpi (argc, argv, ptr) - deallocate (argv) - end subroutine lammps_open_no_mpi - -!----------------------------------------------------------------------------- - - subroutine lammps_file (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - Cstr = string2Cstring (str) - call lammps_actual_file (ptr, Cstr) - end subroutine lammps_file - -!----------------------------------------------------------------------------- - - subroutine lammps_command (ptr, str) - type (C_ptr) :: ptr - character (len=*) :: str - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - type (C_ptr) :: dummy - Cstr = string2Cstring (str) - dummy = lammps_actual_command (ptr, Cstr) - end subroutine lammps_command - -!----------------------------------------------------------------------------- - -! lammps_extract_global {{{2 - function lammps_extract_global_Cptr (ptr, name) result (global) - type (C_ptr) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - global = lammps_actual_extract_global (ptr, Cname) - end function lammps_extract_global_Cptr - subroutine lammps_extract_global_i (global, ptr, name) - integer (C_int), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_i - subroutine lammps_extract_global_dp (global, ptr, name) - real (C_double), pointer, intent(out) :: global - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - Cptr = lammps_extract_global_Cptr (ptr, name) - call C_F_pointer (Cptr, global) - end subroutine lammps_extract_global_dp - -!----------------------------------------------------------------------------- - -! lammps_extract_atom {{{2 - function lammps_extract_atom_Cptr (ptr, name) result (atom) - type (C_ptr) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - Cname = string2Cstring (name) - atom = lammps_actual_extract_atom (ptr, Cname) - end function lammps_extract_atom_Cptr - subroutine lammps_extract_atom_ia (atom, ptr, name) - integer (C_int), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nelements - call lammps_extract_global_i (nelements, ptr, 'nlocal') - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, atom, (/nelements/)) - end subroutine lammps_extract_atom_ia - subroutine lammps_extract_atom_dpa (atom, ptr, name) - real (C_double), dimension(:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - integer (C_int), pointer :: nlocal - integer :: nelements - real (C_double), dimension(:), pointer :: Fptr - if ( name == 'mass' ) then - nelements = lammps_get_ntypes (ptr) + 1 - else if ( name == 'x' .or. name == 'v' .or. name == 'f' .or. & - name == 'mu' .or. name == 'omega' .or. name == 'torque' .or. & - name == 'angmom' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 1 array.') - return - else - ! Everything else we can get is probably nlocal units long - call lammps_extract_global_i (nlocal, ptr, 'nlocal') - nelements = nlocal - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call C_F_pointer (Cptr, Fptr, (/nelements/)) - if ( name == 'mass' ) then - !atom(0:) => Fptr - atom => Fptr - else - atom => Fptr - end if - end subroutine lammps_extract_atom_dpa - subroutine lammps_extract_atom_dp2a (atom, ptr, name) - real (C_double), dimension(:,:), pointer, intent(out) :: atom - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - integer (C_int), pointer :: nelements - if ( name /= 'x' .and. name /= 'v' .and. name /= 'f' .and. & - name /= 'mu' .and. name /= 'omega' .and. name /= 'tandque' .and. & - name /= 'angmom' .and. name /= 'fexternal' ) then - ! We should not be getting a rank-2 array here! - call lammps_error_all (ptr, FLERR, 'You cannot extract those atom& - & data (' // trim(name) // ') into a rank 2 array.') - return - end if - Cptr = lammps_extract_atom_Cptr (ptr, name) - call lammps_extract_global_i (nelements, ptr, 'nlocal') - ! Catom will now be the array of void* pointers that the void** pointer - ! pointed to. Catom(1) is now the pointer to the first element. - call C_F_pointer (Cptr, Catom, (/nelements/)) - ! Now get the actual array, which has its shape transposed from what we - ! might think of it in C - call C_F_pointer (Catom(1), atom, (/3, nelements/)) - end subroutine lammps_extract_atom_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_compute {{{2 - function lammps_extract_compute_Cptr (ptr, id, style, type) result (compute) - type (C_ptr) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - integer (kind=C_int) :: Cstyle, Ctype - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - compute = lammps_actual_extract_compute (ptr, Cid, Cstyle, Ctype) - end function lammps_extract_compute_Cptr - subroutine lammps_extract_compute_dp (compute, ptr, id, style, type) - real (C_double), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - ! The only valid values of (style,type) are (0,0) for scalar 'compute' - if ( style /= 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot pack per-atom/local& - & data into a scalar.') - return - end if - if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & vector (rank 1) into a scalar.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a scalar.') - return - end if - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute) - end subroutine lammps_extract_compute_dp - subroutine lammps_extract_compute_dpa (compute, ptr, id, style, type) - real (C_double), dimension(:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - integer :: nelements - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 1 variable.') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 2) into a rank 1 variable.') - return - end if - nelements = lammps_extract_compute_vectorsize (ptr, id, style) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, compute, (/nelements/)) - end subroutine lammps_extract_compute_dpa - subroutine lammps_extract_compute_dp2a (compute, ptr, id, style, type) - real (C_double), dimension(:,:), pointer, intent(out) :: compute - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Ccompute - integer :: nr, nc - ! Check for the correct dimensionality - if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a compute& - & array (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_compute_arraysize (ptr, id, style, nr, nc) - Cptr = lammps_extract_compute_Cptr (ptr, id, style, type) - call C_F_pointer (Cptr, Ccompute, (/nr/)) - ! Note that the matrix is transposed, from Fortran's perspective - call C_F_pointer (Ccompute(1), compute, (/nc, nr/)) - end subroutine lammps_extract_compute_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_fix {{{2 - function lammps_extract_fix_Cptr (ptr, id, style, type, i, j) & - result (fix) - type (C_ptr) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - integer (kind=C_int) :: Cstyle, Ctype, Ci, Cj - Cid = string2Cstring (id) - Cstyle = style - Ctype = type - Ci = i - 1 ! This is for consistency with the values from f_ID[i], - Cj = j - 1 ! which is different from what library.cpp uses! - if ( (type >= 1 .and. Ci < 0) .or. & - (type == 2 .and. (Ci < 0 .or. Cj < 0) ) ) then - call lammps_error_all (ptr, FLERR, 'Index out of range in& - & lammps_extract_fix') - end if - fix = lammps_actual_extract_fix (ptr, Cid, Cstyle, Ctype, Ci, Cj) - end function lammps_extract_fix_Cptr - subroutine lammps_extract_fix_dp (fix, ptr, id, style, type, i, j) - real (C_double), intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - ! Check for the correct dimensionality - if ( style /= 0 ) then - select case (type) - case (0) - call lammps_error_all (ptr, FLERR, 'There is no per-atom or local& - & scalar data available from fixes.') - case (1) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local vector (rank 1) into a scalar.') - case (2) - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix''s & - &per-atom/local array (rank 2) into a scalar.') - case default - call lammps_error_all (ptr, FLERR, 'Invalid extract_fix style/& - &type combination.') - end select - return - end if - Cptr = lammps_extract_fix_Cptr (ptr, id, style, type, i, j) - call C_F_pointer (Cptr, Fptr) - fix = Fptr - nullify (Fptr) - ! Memory is only allocated for "global" fix variables - if ( style == 0 ) call lammps_free (Cptr) - end subroutine lammps_extract_fix_dp - subroutine lammps_extract_fix_dpa (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - integer :: fix_len - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract the& - & whole vector from global fix data') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You can''t extract a fix& - & scalar into a rank 1 variable') - return - else if ( type == 2 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & array into a rank 1 variable.') - return - else if ( type /= 1 ) then - call lammps_error_all (ptr, FLERR, 'Invalid type for fix extraction.') - return - end if - fix_len = lammps_extract_fix_vectorsize (ptr, id, style) - call C_F_pointer (Cptr, fix, (/fix_len/)) - ! Memory is only allocated for "global" fix variables, which we should - ! never get here, so no need to call lammps_free! - end subroutine lammps_extract_fix_dpa - subroutine lammps_extract_fix_dp2a (fix, ptr, id, style, type, i, j) - real (C_double), dimension(:,:), pointer, intent(out) :: fix - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style, type, i, j - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Cfix - integer :: nr, nc - ! Check for the correct dimensionality - if ( style == 0 ) then - call lammps_error_all (ptr, FLERR, 'It is not possible to extract the& - & entire array from global fix data.') - return - else if ( type == 0 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & scalar (rank 0) into a rank 2 variable.') - return - else if ( type == 1 ) then - call lammps_error_all (ptr, FLERR, 'You cannot extract a fix& - & vector (rank 1) into a rank 2 variable.') - return - end if - call lammps_extract_fix_arraysize (ptr, id, style, nr, nc) - ! Extract pointer to first element as Cfix(1) - call C_F_pointer (Cptr, Cfix, (/nr/)) - ! Now extract the array, which is transposed - call C_F_pointer (Cfix(1), fix, (/nc, nr/)) - end subroutine lammps_extract_fix_dp2a - -!----------------------------------------------------------------------------- - -! lammps_extract_variable {{{2 - function lammps_extract_variable_Cptr (ptr, name, group) result (variable) - type (C_ptr) :: ptr, variable - character (len=*) :: name - character (len=*), optional :: group - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - character (kind=C_char), dimension(:), allocatable :: Cgroup - Cname = string2Cstring (name) - if ( present(group) ) then - allocate (Cgroup(len_trim(group)+1)) - Cgroup = string2Cstring (group) - else - allocate (Cgroup(1)) - Cgroup(1) = C_NULL_CHAR - end if - variable = lammps_actual_extract_variable (ptr, Cname, Cgroup) - deallocate (Cgroup) - end function lammps_extract_variable_Cptr - subroutine lammps_extract_variable_dp (variable, ptr, name, group) - real (C_double), intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), pointer :: Fptr - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - call C_F_pointer (Cptr, Fptr) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dp - subroutine lammps_extract_variable_dpa (variable, ptr, name, group) - real (C_double), dimension(:), allocatable, intent(out) :: variable - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - character (len=*), intent(in), optional :: group - type (C_ptr) :: Cptr - real (C_double), dimension(:), pointer :: Fptr - integer :: natoms - if ( present(group) ) then - Cptr = lammps_extract_variable_Cptr (ptr, name, group) - else - Cptr = lammps_extract_variable_Cptr (ptr, name) - end if - natoms = lammps_get_natoms (ptr) - allocate (variable(natoms)) - call C_F_pointer (Cptr, Fptr, (/natoms/)) - variable = Fptr - nullify (Fptr) - call lammps_free (Cptr) - end subroutine lammps_extract_variable_dpa - -!-------------------------------------------------------------------------2}}} - - subroutine lammps_gather_atoms_ia (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - integer, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - integer (C_int), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 0_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata - deallocate (Fdata) - end subroutine lammps_gather_atoms_ia - subroutine lammps_gather_atoms_dpa (ptr, name, count, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, intent(in) :: count - double precision, dimension(:), allocatable, intent(out) :: data - type (C_ptr) :: Cdata - real (C_double), dimension(:), pointer :: Fdata - integer (C_int) :: natoms - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), parameter :: Ctype = 1_C_int - integer (C_int) :: Ccount - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - if ( count /= 1 .and. count /= 3 ) then - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - else - Ccount = count - end if - allocate ( Fdata(count*natoms) ) - allocate ( data(count*natoms) ) - Cdata = C_loc (Fdata(1)) - call lammps_actual_gather_atoms (ptr, Cname, Ctype, Ccount, Cdata) - data = Fdata(:) - deallocate (Fdata) - end subroutine lammps_gather_atoms_dpa - -!----------------------------------------------------------------------------- - - subroutine lammps_scatter_atoms_ia (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - integer, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 0_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - integer (C_int), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_ia - subroutine lammps_scatter_atoms_dpa (ptr, name, data) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: name - double precision, dimension(:), intent(in) :: data - integer (kind=C_int) :: natoms, Ccount - integer (kind=C_int), parameter :: Ctype = 1_C_int - character (kind=C_char), dimension(len_trim(name)+1) :: Cname - real (C_double), dimension(size(data)), target :: Fdata - type (C_ptr) :: Cdata - natoms = lammps_get_natoms (ptr) - Cname = string2Cstring (name) - Ccount = size(data) / natoms - if ( Ccount /= 1 .and. Ccount /= 3 ) & - call lammps_error_all (ptr, FLERR, 'lammps_gather_atoms requires& - & count to be either 1 or 3') - Fdata = data - Cdata = C_loc (Fdata(1)) - call lammps_actual_scatter_atoms (ptr, Cname, Ctype, Ccount, Cdata) - end subroutine lammps_scatter_atoms_dpa - -!----------------------------------------------------------------------------- - - function lammps_extract_compute_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_compute_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_compute_vectorsize - -!----------------------------------------------------------------------------- - - function lammps_extract_fix_vectorsize (ptr, id, style) & - result (vectorsize) - integer :: vectorsize - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer (C_int) :: Cvectorsize, Cstyle - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int(style, C_int) - Cvectorsize = lammps_actual_extract_fix_vectorsize (ptr, Cid, Cstyle) - vectorsize = int(Cvectorsize, kind(vectorsize)) - end function lammps_extract_fix_vectorsize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_compute_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, C_int) - call lammps_actual_extract_compute_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_compute_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_extract_fix_arraysize (ptr, id, style, nrows, ncols) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: id - integer, intent(in) :: style - integer, intent(out) :: nrows, ncols - integer (C_int) :: Cstyle, Cnrows, Cncols - character (kind=C_char), dimension(len_trim(id)+1) :: Cid - Cid = string2Cstring (id) - Cstyle = int (style, kind(Cstyle)) - call lammps_actual_extract_fix_arraysize (ptr, Cid, Cstyle, & - Cnrows, Cncols) - nrows = int (Cnrows, kind(nrows)) - ncols = int (Cncols, kind(ncols)) - end subroutine lammps_extract_fix_arraysize - -!----------------------------------------------------------------------------- - - subroutine lammps_error_all (ptr, file, line, str) - type (C_ptr), intent(in) :: ptr - character (len=*), intent(in) :: file, str - integer, intent(in) :: line - character (kind=C_char), dimension(len_trim(file)+1) :: Cfile - character (kind=C_char), dimension(len_trim(str)+1) :: Cstr - integer (C_int) :: Cline - Cline = int(line, kind(Cline)) - Cfile = string2Cstring (file) - Cstr = string2Cstring (str) - call lammps_actual_error_all (ptr, Cfile, Cline, Cstr) - end subroutine lammps_error_all - -!----------------------------------------------------------------------------- - -! Locally defined helper functions {{{1 - - pure function string2Cstring (string) result (C_string) - use, intrinsic :: ISO_C_binding, only : C_char, C_NULL_CHAR - character (len=*), intent(in) :: string - character (len=1, kind=C_char) :: C_string (len_trim(string)+1) - integer :: i, n - n = len_trim (string) - forall (i = 1:n) - C_string(i) = string(i:i) - end forall - C_string(n+1) = C_NULL_CHAR - end function string2Cstring - -!----------------------------------------------------------------------------- - - subroutine Cstring2argcargv (Cstring, argc, argv) - !! Converts a C-style string to argc and argv, that is, words in Cstring - !! become C-style strings in argv. IMPORTANT: Cstring is modified by - !! this routine! I would make Cstring local TO this routine and accept - !! a Fortran-style string instead, but we run into scoping and - !! allocation problems that way. This routine assumes the string is - !! null-terminated, as all C-style strings must be. - - character (kind=C_char), dimension(*), target, intent(inout) :: Cstring - integer (C_int), intent(out) :: argc - type (C_ptr), dimension(:), allocatable, intent(out) :: argv - - integer :: StringStart, SpaceIndex, strlen, argnum - - argc = 1_C_int - - ! Find the length of the string - strlen = 1 - do while ( Cstring(strlen) /= C_NULL_CHAR ) - strlen = strlen + 1 - end do - - ! Find the number of non-escaped spaces - SpaceIndex = 2 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - argc = argc + 1_C_int - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - end if - SpaceIndex = SpaceIndex + 1 - end do - - ! Now allocate memory for argv - allocate (argv(argc)) - - ! Now find the string starting and ending locations - StringStart = 1 - SpaceIndex = 2 - argnum = 1 - do while ( SpaceIndex < strlen ) - if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) /= '\' ) then - ! Found a real space => split strings and store this one - Cstring(Spaceindex) = C_NULL_CHAR ! Replaces space with NULL - argv(argnum) = C_loc(Cstring(StringStart)) - argnum = argnum + 1 - ! Find the next non-space character - do while ( Cstring(SpaceIndex+1) == ' ') - SpaceIndex = SpaceIndex + 1 - end do - StringStart = SpaceIndex + 1 - else if ( Cstring(SpaceIndex) == ' ' .and. & - Cstring(SpaceIndex-1) == '\' ) then - ! Escaped space => remove backslash and move rest of array - Cstring(SpaceIndex-1:strlen-1) = Cstring(SpaceIndex:strlen) - strlen = strlen - 1 ! Last character is still C_NULL_CHAR - end if - SpaceIndex = SpaceIndex + 1 - end do - ! Now handle the last argument - argv(argnum) = C_loc(Cstring(StringStart)) - - end subroutine Cstring2argcargv - -! 1}}} - -end module LAMMPS - -! vim: foldmethod=marker tabstop=3 softtabstop=3 shiftwidth=3 expandtab diff --git a/examples/COUPLE/fortran_dftb/README b/examples/COUPLE/fortran_dftb/README deleted file mode 100644 index 39a2f18169..0000000000 --- a/examples/COUPLE/fortran_dftb/README +++ /dev/null @@ -1,37 +0,0 @@ -This directory has an example of using a callback function to obtain -forces from a fortran code for a LAMMPS simulation. The reader should -refer to the README file in COUPLE/fortran2 before proceeding. Here, -the LAMMPS.F90 file has been modified slightly and additional files -named LAMMPS-wrapper2.h and LAMMPS-wrapper2.cpp have been included in -order to supply wrapper functions to set the LAMMPS callback function, -total energy, virial, and electronic entropy contribution (needed for -MSST simulations with a quantum code). - -In this example, the callback function is set to run the -semi-empirical quantum code DFTB+ in serial and then read in the total -energy, forces, and stress tensor from file. In this case, nlocal = -the total number of atoms in the system, so particle positions can be -read from the pos array directly, and DFTB+ forces can simply be -included via the fext array. The user should take care in the case of -a parallel calculation, where LAMMPS can assign different particules -to each processor. For example, the user should use functions such as -lammps_gather_atoms() and lammps_scatter_atoms() in the case where the -fortran force calculating code requires the positions of all atoms, -etc. - -A few more important notes: - --Calling the subroutine lammps_set_callback() is required in order to set - a pointer to the callback function in LAMMPS. --The subroutine lammps_set_user_energy() passes in the potential energy - from DFTB+ to LAMMPS. Similarly, lammps_set_user_virial passes the stress tensor. - --The electronic entropy contribution is set via lammps_set_external_vector(). Their needs - to be a call to lammps_set_external_vector_length() before this value can be - passed to LAMMPS. - -This example was created by Nir Goldman, whom you can contact with -questions: - -Nir Goldman, LLNL -ngoldman@llnl.gov diff --git a/examples/COUPLE/fortran_dftb/data.diamond b/examples/COUPLE/fortran_dftb/data.diamond deleted file mode 100644 index b3dd599cf4..0000000000 --- a/examples/COUPLE/fortran_dftb/data.diamond +++ /dev/null @@ -1,148 +0,0 @@ -# Position data file - -64 atoms -1 atom types - -0 7.134 xlo xhi -0 7.134 ylo yhi -0 7.134 zlo zhi - -0.00000000 0.00000000 0.00000000 xy xz yz - -Masses - -1 12.010000 - -Atoms - - 1 1 0 0 0 0 - 2 1 0 0.89175 0.89175 0.89175 - 3 1 0 1.7835 1.7835 0 - 4 1 0 2.67525 2.67525 0.89175 - 5 1 0 0 1.7835 1.7835 - 6 1 0 0.89175 2.67525 2.67525 - 7 1 0 1.7835 0 1.7835 - 8 1 0 2.67525 0.89175 2.67525 - 9 1 0 0 0 3.567 - 10 1 0 0.89175 0.89175 4.45875 - 11 1 0 1.7835 1.7835 3.567 - 12 1 0 2.67525 2.67525 4.45875 - 13 1 0 0 1.7835 5.3505 - 14 1 0 0.89175 2.67525 6.24225 - 15 1 0 1.7835 0 5.3505 - 16 1 0 2.67525 0.89175 6.24225 - 17 1 0 0 3.567 0 - 18 1 0 0.89175 4.45875 0.89175 - 19 1 0 1.7835 5.3505 0 - 20 1 0 2.67525 6.24225 0.89175 - 21 1 0 0 5.3505 1.7835 - 22 1 0 0.89175 6.24225 2.67525 - 23 1 0 1.7835 3.567 1.7835 - 24 1 0 2.67525 4.45875 2.67525 - 25 1 0 0 3.567 3.567 - 26 1 0 0.89175 4.45875 4.45875 - 27 1 0 1.7835 5.3505 3.567 - 28 1 0 2.67525 6.24225 4.45875 - 29 1 0 0 5.3505 5.3505 - 30 1 0 0.89175 6.24225 6.24225 - 31 1 0 1.7835 3.567 5.3505 - 32 1 0 2.67525 4.45875 6.24225 - 33 1 0 3.567 0 0 - 34 1 0 4.45875 0.89175 0.89175 - 35 1 0 5.3505 1.7835 0 - 36 1 0 6.24225 2.67525 0.89175 - 37 1 0 3.567 1.7835 1.7835 - 38 1 0 4.45875 2.67525 2.67525 - 39 1 0 5.3505 0 1.7835 - 40 1 0 6.24225 0.89175 2.67525 - 41 1 0 3.567 0 3.567 - 42 1 0 4.45875 0.89175 4.45875 - 43 1 0 5.3505 1.7835 3.567 - 44 1 0 6.24225 2.67525 4.45875 - 45 1 0 3.567 1.7835 5.3505 - 46 1 0 4.45875 2.67525 6.24225 - 47 1 0 5.3505 0 5.3505 - 48 1 0 6.24225 0.89175 6.24225 - 49 1 0 3.567 3.567 0 - 50 1 0 4.45875 4.45875 0.89175 - 51 1 0 5.3505 5.3505 0 - 52 1 0 6.24225 6.24225 0.89175 - 53 1 0 3.567 5.3505 1.7835 - 54 1 0 4.45875 6.24225 2.67525 - 55 1 0 5.3505 3.567 1.7835 - 56 1 0 6.24225 4.45875 2.67525 - 57 1 0 3.567 3.567 3.567 - 58 1 0 4.45875 4.45875 4.45875 - 59 1 0 5.3505 5.3505 3.567 - 60 1 0 6.24225 6.24225 4.45875 - 61 1 0 3.567 5.3505 5.3505 - 62 1 0 4.45875 6.24225 6.24225 - 63 1 0 5.3505 3.567 5.3505 - 64 1 0 6.24225 4.45875 6.24225 - -Velocities - -1 -0.00733742 -0.0040297 -0.00315229 -2 -0.00788609 -0.00567535 -0.00199152 -3 -0.00239042 0.00710139 -0.00335049 -4 0.00678551 0.0019976 0.00219289 -5 0.00413717 0.00275709 0.000937637 -6 -0.00126313 0.00485636 0.00727862 -7 0.00337547 -0.00234623 -0.000922223 -8 -0.00792183 -0.00509186 -0.00104168 -9 0.00414091 0.00390285 0.000845961 -10 -0.000284543 0.0010771 -0.00458404 -11 -0.00394968 -0.00446363 -0.00361688 -12 0.00067088 -0.00655175 -0.00752464 -13 0.00306632 -0.00245545 -0.00183867 -14 -0.0082145 -0.00564127 0.000281191 -15 0.00504454 0.0045835 0.000495763 -16 0.0035767 0.00320441 -0.00486426 -17 0.00420597 0.00262005 -0.0049459 -18 0.00440579 -1.76783e-05 0.00449311 -19 -0.00406463 0.00613304 0.00285599 -20 0.00171215 -0.00517887 0.00124326 -21 0.0011118 0.00334129 -0.0015222 -22 -0.00838394 -0.00112906 -0.00353379 -23 -0.00578527 -0.00415501 0.00297043 -24 -0.00211466 0.000964108 -0.00716523 -25 -0.000204107 -0.00380986 0.00681648 -26 0.00677838 0.00540935 0.0044354 -27 -0.00266809 -0.00358382 -0.00241889 -28 -0.0003973 0.00236566 0.00558871 -29 0.000754103 0.00457797 0.000105531 -30 -0.00246049 0.00110428 0.00511088 -31 0.00248891 0.00623314 0.00461597 -32 -0.00509423 0.000570503 0.00720856 -33 -0.00244427 -0.00374384 0.00618767 -34 -0.000360752 -8.10558e-05 0.00314052 -35 0.00435313 -0.00630587 -0.0070309 -36 0.00651087 -0.00389833 3.72525e-05 -37 0.00631828 -0.00316064 0.00231522 -38 -0.00579624 -0.00345068 -0.000277486 -39 0.00483974 0.000715028 0.000206355 -40 -0.00388164 -0.00189242 -0.00554862 -41 0.00398115 0.00152915 0.00756919 -42 -0.000552263 0.00352025 -0.000246143 -43 -0.00800284 0.00555703 0.00425716 -44 -0.00734405 -0.00752512 0.00667173 -45 -0.00545636 0.00421035 0.00399552 -46 0.00480246 0.00621147 -0.00492715 -47 -0.00424168 0.00621818 -9.37733e-05 -48 -0.00649561 0.00612908 -0.0020753 -49 -0.0075007 -0.00384737 -0.00687913 -50 -0.00203903 -0.00764372 0.0023883 -51 0.00442642 0.00744072 -0.0049344 -52 -0.00280486 -0.00509128 -0.00678045 -53 0.00679491 0.00583493 0.00333875 -54 0.00574665 -0.00521074 0.00523475 -55 0.00305618 -0.00320094 0.00341297 -56 0.004304 0.000615544 -0.00668787 -57 0.00564532 0.00327373 0.00388611 -58 0.000676899 0.00210326 0.00495295 -59 0.000160781 -0.00744313 -0.00279828 -60 0.00623521 0.00371301 0.00178015 -61 0.00520759 0.000642669 0.00207913 -62 0.00398042 0.0046438 -0.00359978 -63 -0.00478071 -0.00304932 -0.00765125 -64 0.00282671 -0.00548392 -0.00692691 diff --git a/examples/COUPLE/fortran_dftb/dftb_in.hsd b/examples/COUPLE/fortran_dftb/dftb_in.hsd deleted file mode 100644 index 104a4c04ce..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_in.hsd +++ /dev/null @@ -1,40 +0,0 @@ -#sample DFTB+ script to run this test code -Geometry = GenFormat { -<<< "lammps.gen" -} - -Driver = { -} - -Hamiltonian = DFTB { - LAMMPS = Yes # keyword to print energy, forces, and stress tensor to file(results.out) - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" # the user must define the location of the skf files - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { - 0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } -} - -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 -} - -ParserOptions = { - ParserVersion = 3 -} diff --git a/examples/COUPLE/fortran_dftb/dftb_pin.hsd b/examples/COUPLE/fortran_dftb/dftb_pin.hsd deleted file mode 100644 index 6d9dea4a15..0000000000 --- a/examples/COUPLE/fortran_dftb/dftb_pin.hsd +++ /dev/null @@ -1,129 +0,0 @@ -Geometry = GenFormat { -64 S -C -1 1 7.099007 7.117657 7.119139 -2 1 0.858709 0.867233 0.882294 -3 1 1.772527 1.811776 7.120239 -4 1 2.702145 2.681271 0.901362 -5 1 0.017539 1.794455 1.788454 -6 1 0.885593 2.694118 2.707994 -7 1 1.795055 7.120787 1.777896 -8 1 2.642849 0.868278 2.670699 -9 1 0.016060 0.017156 3.568644 -10 1 0.891891 0.896406 4.439286 -11 1 1.766086 1.764402 3.550134 -12 1 2.677349 2.648926 4.427174 -13 1 0.010133 1.771283 5.342173 -14 1 0.858153 2.653565 6.241596 -15 1 1.804087 0.020636 5.353268 -16 1 2.689680 0.907188 6.224575 -17 1 0.017845 3.577563 7.113016 -18 1 0.910027 4.459286 0.910286 -19 1 1.766394 5.376046 0.015526 -20 1 2.683727 6.220728 0.898553 -21 1 0.003357 5.363423 1.774139 -22 1 0.856735 6.238324 2.660213 -23 1 1.761079 3.549776 1.797054 -24 1 2.667227 4.463441 2.646074 -25 1 7.132499 3.551558 3.599764 -26 1 0.920387 4.482191 4.479257 -27 1 1.772194 5.337132 3.555569 -28 1 2.675010 6.251629 4.483124 -29 1 0.005702 5.371095 5.351147 -30 1 0.880807 6.249819 6.264231 -31 1 1.793177 3.592396 5.369939 -32 1 2.653179 4.463595 6.274044 -33 1 3.557243 7.118913 0.026006 -34 1 4.458971 0.889331 0.904950 -35 1 5.367903 1.759757 7.104941 -36 1 6.271565 2.658454 0.890168 -37 1 3.591915 1.768681 1.793880 -38 1 4.435612 2.662184 2.676722 -39 1 5.371040 0.000196 1.783464 -40 1 6.226453 0.886640 2.653384 -41 1 3.583339 0.005449 3.600177 -42 1 4.453692 0.909417 4.459713 -43 1 5.314554 1.805409 3.584215 -44 1 6.210181 2.642660 4.486206 -45 1 3.545704 1.802745 5.365369 -46 1 4.476660 2.701226 6.220451 -47 1 5.332820 0.029557 5.347965 -48 1 6.215725 0.915081 6.230289 -49 1 3.536446 3.551469 7.106600 -50 1 4.451181 4.426439 0.900180 -51 1 5.368735 5.377996 7.109524 -52 1 6.230666 6.220985 0.862175 -53 1 3.596626 5.372822 1.797613 -54 1 4.485613 6.221252 2.699652 -55 1 5.364421 3.549838 1.796281 -56 1 6.261739 4.459046 2.648152 -57 1 3.588752 3.581054 3.581755 -58 1 4.462342 4.467270 4.478800 -59 1 5.355202 5.318323 3.556531 -60 1 6.268570 6.259831 4.465795 -61 1 3.588636 5.354278 5.362327 -62 1 4.475747 6.263866 6.227803 -63 1 5.331158 3.554349 5.318368 -64 1 6.254581 4.436344 6.209681 -0.0 0.0 0.0 -7.13400000000000 0 0 -0 7.13400000000000 0 -0 0 7.13400000000000 -} -Driver = {} -Hamiltonian = DFTB { - LAMMPS = Yes - SCC = No - MaxAngularMomentum = { - C = "p" - } - Charge = 0.0 - Eigensolver = Standard {} - Filling = Fermi { - Temperature [Kelvin] = 298.0 - IndependentKFilling = No - } - SlaterKosterFiles = Type2FileNames { - Prefix = "~/slako/mio-1-1/" - Separator = "-" - Suffix = ".skf" - LowerCaseTypeName = No - } - KPointsAndWeights = { -0.0000000000000 0.0000000000000 0.0000000000000 1.00000000000000 - } - PolynomialRepulsive = {} - OldRepulsiveSum = No - OrbitalResolvedSCC = No - OldSKInterpolation = No - NoErep = No - Dispersion = {} - ThirdOrder = No - ThirdOrderFull = No -} -Options = { - CalculateForces = Yes - WriteDetailedOut = No - WriteBandOut = No - RandomSeed = 12345 - MullikenAnalysis = No - WriteEigenvectors = No - WriteAutotestTag = No - WriteDetailedXML = No - WriteResultsTag = No - AtomResolvedEnergies = No - WriteHS = No - WriteRealHS = No - MinimiseMemoryUsage = No - ShowFoldedCoords = No -} -ParserOptions = { - ParserVersion = 3 - WriteHSDInput = Yes - WriteXMLInput = No - StopAfterParsing = No - IgnoreUnprocessedNodes = No -} -Analysis = { - ProjectStates = {} -} diff --git a/examples/COUPLE/fortran_dftb/in.simple b/examples/COUPLE/fortran_dftb/in.simple deleted file mode 100644 index 894a490cf8..0000000000 --- a/examples/COUPLE/fortran_dftb/in.simple +++ /dev/null @@ -1,16 +0,0 @@ -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - diff --git a/examples/COUPLE/fortran_dftb/log.simple b/examples/COUPLE/fortran_dftb/log.simple deleted file mode 100644 index 3496e94ebe..0000000000 --- a/examples/COUPLE/fortran_dftb/log.simple +++ /dev/null @@ -1,71 +0,0 @@ -LAMMPS (6 Jul 2017) -units real -atom_style charge -atom_modify map array -atom_modify sort 0 0.0 -read_data data.diamond - triclinic box = (0 0 0) to (7.134 7.134 7.134) with tilt (0 0 0) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 64 atoms - reading velocities ... - 64 velocities -neighbor 1.0 bin -neigh_modify delay 0 every 5 check no -fix 1 all nve -fix 2 all external pf/callback 1 1 - -fix_modify 2 energy yes -thermo_style custom step temp etotal ke pe lx ly lz pxx pyy pzz press - -thermo 1 -timestep 0.5 - -run 10 -Neighbor list info ... - update every 5 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0 - ghost atom cutoff = 0 - binsize = 7.134, bins = 1 1 1 - 0 neighbor lists, perpetual/occasional/extra = 0 0 0 -Per MPI rank memory allocation (min/avg/max) = 2.3 | 2.3 | 2.3 Mbytes -Step Temp TotEng KinEng PotEng Lx Ly Lz Pxx Pyy Pzz Press - 0 298.24835 -69593.587 56.008365 -69649.595 7.134 7.134 7.134 -19980.19 -21024.038 -21097.458 -20700.562 - 1 295.24358 -69593.585 55.444098 -69649.029 7.134 7.134 7.134 -19778.833 -20799.657 -20854.156 -20477.549 - 2 286.37211 -69593.58 53.778115 -69647.358 7.134 7.134 7.134 -19227.52 -20177.28 -20176.12 -19860.306 - 3 272.062 -69593.572 51.090804 -69644.663 7.134 7.134 7.134 -18360.869 -19189.684 -19100.021 -18883.525 - 4 253.01834 -69593.561 47.514575 -69641.075 7.134 7.134 7.134 -17198.143 -17855.03 -17652.036 -17568.403 - 5 230.19242 -69593.547 43.228073 -69636.775 7.134 7.134 7.134 -15750.247 -16183.764 -15854.145 -15929.386 - 6 204.71787 -69593.533 38.44418 -69631.977 7.134 7.134 7.134 -14083.498 -14247.434 -13789.835 -14040.256 - 7 177.82397 -69593.518 33.393748 -69626.911 7.134 7.134 7.134 -12340.963 -12202.878 -11623.171 -12055.671 - 8 150.76736 -69593.503 28.312758 -69621.816 7.134 7.134 7.134 -10637.824 -10180.827 -9495.0496 -10104.567 - 9 124.7737 -69593.49 23.431383 -69616.921 7.134 7.134 7.134 -9113.3842 -8339.0492 -7572.8076 -8341.747 - 10 100.98183 -69593.478 18.963481 -69612.442 7.134 7.134 7.134 -7833.9349 -6756.9749 -5945.8968 -6845.6022 -Loop time of 2.20497 on 1 procs for 10 steps with 64 atoms - -Performance: 0.196 ns/day, 122.499 hours/ns, 4.535 timesteps/s -0.2% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0 | 0 | 0 | 0.0 | 0.00 -Neigh | 1.4305e-06 | 1.4305e-06 | 1.4305e-06 | 0.0 | 0.00 -Comm | 4.22e-05 | 4.22e-05 | 4.22e-05 | 0.0 | 0.00 -Output | 0.00067687 | 0.00067687 | 0.00067687 | 0.0 | 0.03 -Modify | 2.2042 | 2.2042 | 2.2042 | 0.0 | 99.96 -Other | | 6.533e-05 | | | 0.00 - -Nlocal: 64 ave 64 max 64 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 0 ave 0 max 0 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 0 -Ave neighs/atom = 0 -Neighbor list builds = 2 -Dangerous builds not checked -Total wall time: 0:00:02 diff --git a/examples/COUPLE/fortran_dftb/makefile b/examples/COUPLE/fortran_dftb/makefile deleted file mode 100644 index 225bd0025a..0000000000 --- a/examples/COUPLE/fortran_dftb/makefile +++ /dev/null @@ -1,45 +0,0 @@ -SHELL = /bin/sh - -# Path to LAMMPS extraction directory -LAMMPS_ROOT = ../../.. -LAMMPS_SRC = $(LAMMPS_ROOT)/src - -# Uncomment the line below if using the MPI stubs library -MPI_STUBS = #-I$(LAMMPS_SRC)/STUBS - -FC = mpif90 # replace with your Fortran compiler -CXX = mpicc # replace with your C++ compiler - -# Flags for Fortran compiler, C++ compiler, and C preprocessor, respectively -FFLAGS = -O2 -fPIC -CXXFLAGS = -O2 -fPIC -CPPFLAGS = -DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX - -all : liblammps_fortran.a liblammps_fortran.so simpleF.x - -liblammps_fortran.so : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) -shared -o $@ $^ - -simpleF.x: simple.o LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(FC) $(FFLAGS) simple.o -o simpleF.x liblammps_fortran.a $(LAMMPS_SRC)/liblammps_mvapich.a -lstdc++ /usr/lib64/libfftw3.a - -liblammps_fortran.a : LAMMPS.o LAMMPS-wrapper.o LAMMPS-wrapper2.o - $(AR) rs $@ $^ - -LAMMPS.o lammps.mod : LAMMPS.F90 - $(FC) $(CPPFLAGS) $(FFLAGS) -c $< - -simple.o : simple.f90 - $(FC) $(FFLAGS) -c $< - -LAMMPS-wrapper.o : LAMMPS-wrapper.cpp LAMMPS-wrapper.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -LAMMPS-wrapper2.o : LAMMPS-wrapper2.cpp LAMMPS-wrapper2.h - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -I$(LAMMPS_SRC) $(MPI_STUBS) - -clean : - $(RM) *.o *.mod liblammps_fortran.a liblammps_fortran.so - -dist : - tar -czvf fortran-interface-callback.tar.gz LAMMPS-wrapper.h LAMMPS-wrapper.cpp LAMMPS-wrapper2.h LAMMPS-wrapper2.cpp LAMMPS.F90 makefile README simple.f90 diff --git a/examples/COUPLE/fortran_dftb/simple.f90 b/examples/COUPLE/fortran_dftb/simple.f90 deleted file mode 100644 index 4604b4e4a9..0000000000 --- a/examples/COUPLE/fortran_dftb/simple.f90 +++ /dev/null @@ -1,110 +0,0 @@ - module callback - implicit none - contains - subroutine fortran_callback(lmp, timestep, nlocal, ids, c_pos, c_fext) & - & bind(C, name='f_callback') - use, intrinsic :: ISO_C_binding - use LAMMPS - implicit none - type (C_ptr), value :: lmp - integer(C_int64_t), intent(in), value :: timestep - integer(C_int), intent(in), value :: nlocal - real (C_double), dimension(:,:), pointer :: x - type(c_ptr) :: c_pos, c_fext, c_ids - double precision, pointer :: fext(:,:), pos(:,:) - integer, intent(in) :: ids(nlocal) - real(C_double) :: virial(6) - real (C_double) :: etot - real(C_double), pointer :: ts_lmp - double precision :: stress(3,3), ts_dftb - integer :: natom , i - real (C_double), parameter :: econv = 627.4947284155114 ! converts from Ha to - double precision, parameter :: fconv = 1185.793095983065 ! converts from Ha/bohr to - double precision, parameter :: autoatm = 2.9037166638E8 - double precision lx, ly, lz - real (C_double), pointer :: boxxlo, boxxhi - real (C_double), pointer :: boxylo, boxyhi - real (C_double), pointer :: boxzlo, boxzhi - double precision, parameter :: nktv2p = 68568.4149999999935972 - double precision :: volume - type (C_ptr) :: Cptr - type (C_ptr), pointer, dimension(:) :: Catom - - call c_f_pointer(c_pos, pos, [3,nlocal]) - call c_f_pointer(c_fext, fext, [3,nlocal]) - call lammps_extract_global(boxxlo, lmp, 'boxxlo') - call lammps_extract_global(boxxhi, lmp, 'boxxhi') - call lammps_extract_global(boxylo, lmp, 'boxylo') - call lammps_extract_global(boxyhi, lmp, 'boxyhi') - call lammps_extract_global(boxzlo, lmp, 'boxzlo') - call lammps_extract_global(boxzhi, lmp, 'boxzhi') - lx = boxxhi - boxxlo - ly = boxyhi - boxylo - lz = boxzhi - boxzlo - volume = lx*ly*lz - open (unit = 10, status = 'replace', action = 'write', file='lammps.gen') - write(10,*)nlocal,"S" - write(10,*) "C" - do i = 1, nlocal - write(10,'(2I,3F15.6)')i,1,pos(:,ids(i)) - enddo - write(10,*)"0.0 0.0 0.0" - write(10,*)lx,0,0 - write(10,*)0,ly,0 - write(10,*)0,0,lz - close(10) - call system("./dftb+ > dftb.out") - open (unit = 10, status = 'old', file = 'results.out') - read(10,*)etot - read(10,*)ts_dftb - do i = 1, 3 - read(10,*)stress(i,:) - enddo - stress (:,:) = stress(:,:)*autoatm - virial(1) = stress(1,1)/(nktv2p/volume) - virial(2) = stress(2,2)/(nktv2p/volume) - virial(3) = stress(3,3)/(nktv2p/volume) - virial(4) = stress(1,2)/(nktv2p/volume) - virial(5) = stress(1,3)/(nktv2p/volume) - virial(6) = stress(2,3)/(nktv2p/volume) - etot = etot*econv - call lammps_set_external_vector(lmp,1,ts_dftb*econv) - do i = 1, nlocal - read(10,*)fext(:,ids(i)) - fext(:,ids(i)) = fext(:,ids(i))*fconv - enddo - close(10) - call lammps_set_user_energy (lmp, etot) - call lammps_set_user_virial (lmp, virial) - - end subroutine - end module callback - - -program simple_fortran_callback - - use MPI - use LAMMPS - use callback - use, intrinsic :: ISO_C_binding, only : C_double, C_ptr, C_int, C_FUNPTR - implicit none - type (C_ptr) :: lmp - integer :: error, narg, me, nprocs - - call MPI_Init (error) - call MPI_Comm_rank (MPI_COMM_WORLD, me, error) - call MPI_Comm_size (MPI_COMM_WORLD, nprocs, error) - - call lammps_open_no_mpi ('lmp -log log.simple', lmp) - call lammps_file (lmp, 'in.simple') - call lammps_set_callback(lmp) - call lammps_set_external_vector_length(lmp,2) - - call lammps_command (lmp, 'run 10') - call lammps_close (lmp) - call MPI_Finalize (error) - - -end program simple_fortran_callback - - diff --git a/examples/COUPLE/plugin/liblammpsplugin.c b/examples/COUPLE/plugin/liblammpsplugin.c index d446f9cd2f..0cf9bea512 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.c +++ b/examples/COUPLE/plugin/liblammpsplugin.c @@ -90,6 +90,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib) ADDSYM(get_natoms); ADDSYM(get_thermo); + ADDSYM(last_thermo); ADDSYM(extract_box); ADDSYM(reset_box); diff --git a/examples/COUPLE/plugin/liblammpsplugin.h b/examples/COUPLE/plugin/liblammpsplugin.h index c6ec03e498..1520ef638d 100644 --- a/examples/COUPLE/plugin/liblammpsplugin.h +++ b/examples/COUPLE/plugin/liblammpsplugin.h @@ -37,12 +37,13 @@ #endif /* The following enums must be kept in sync with the equivalent enums - * or constants in python/lammps/constants.py, fortran/lammps.f90, - * tools/swig/lammps.i, and examples/COUPLE/plugin/liblammpsplugin.h */ + * or constants in src/library.h, src/lmptype.h, python/lammps/constants.py, + * fortran/lammps.f90, and tools/swig/lammps.i */ /* Data type constants for extracting data from atoms, computes and fixes */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ @@ -133,6 +134,7 @@ struct _liblammpsplugin { double (*get_natoms)(void *); double (*get_thermo)(void *, const char *); + void *(*last_thermo)(void *, const char *, int); void (*extract_box)(void *, double *, double *, double *, double *, double *, int *, int *); diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps index 138f7b5338..dd50a5e69f 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -37,12 +37,12 @@ group upper_wall type 3 group lower_wall type 4 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 deleted file mode 100644 index cd01601292..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.1 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.00169706 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.937 | 6.937 | 6.937 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 0 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 25 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 26 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 27 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 28 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 29 0 - 8600 8.6 29 0 - 8700 8.7 30 0 - 8800 8.8 30 0 - 8900 8.9 30 0 - 9000 9 31 0 - 9100 9.1 31 0 - 9200 9.2 31 0 - 9300 9.3 32 0 - 9400 9.4 32 0 - 9500 9.5 32 0 - 9600 9.6 33 0 - 9700 9.7 33 0 - 9800 9.8 33 0 - 9900 9.9 34 0 - 10000 10 34 0 -Loop time of 144.208 on 1 procs for 10000 steps with 1600 atoms - -Performance: 5991348.580 ns/day, 0.000 hours/ns, 69.344 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 143.08 | 143.08 | 143.08 | 0.0 | 99.22 -Neigh | 0.033195 | 0.033195 | 0.033195 | 0.0 | 0.02 -Comm | 0.24139 | 0.24139 | 0.24139 | 0.0 | 0.17 -Output | 0.11687 | 0.11687 | 0.11687 | 0.0 | 0.08 -Modify | 0.61566 | 0.61566 | 0.61566 | 0.0 | 0.43 -Other | | 0.117 | | | 0.08 - -Nlocal: 1600 ave 1600 max 1600 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 993 ave 993 max 993 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 73236 ave 73236 max 73236 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 73236 -Ave neighs/atom = 45.7725 -Neighbor list builds = 34 -Dangerous builds = 0 -Total wall time: 0:02:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 deleted file mode 100644 index 77823e00fc..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.24Oct18.2d-diffusion-in-shear-flow.g++.4 +++ /dev/null @@ -1,247 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable Lf equal $R*3 -variable Lf equal 0.5*3 -variable Lb equal $R*4 -variable Lb equal 0.5*4 -variable wall_velocity equal 0.01 # micrometers/microsecond -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -${Lb} ${Lb} 0 ${a} units box -region box block -2 2 -2 ${Lb} 0 ${a} units box -region box block -2 2 -2 2 0 ${a} units box -region box block -2 2 -2 2 0 0.1 units box -create_box 4 box -Created orthogonal box = (-2 -2 0) to (2 2 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 1600 atoms - Time spent = 0.000589566 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -region upper_wall block INF INF +${Lf} INF INF INF units box -region upper_wall block INF INF +1.5 INF INF INF units box -set region upper_wall type 3 - 200 settings made for type - -region lower_wall block INF INF INF -${Lf} INF INF units box -region lower_wall block INF INF INF -1.5 INF INF units box -set region lower_wall type 4 - 240 settings made for type - -group fluid type 1 -1079 atoms in group fluid -group sphere type 2 -81 atoms in group sphere -group upper_wall type 3 -200 atoms in group upper_wall -group lower_wall type 4 -240 atoms in group lower_wall - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 1600 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms -fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box -fix 3 upper_wall meso/move linear +0.01 0 0 units box -fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box -fix 4 lower_wall meso/move linear -0.01 0 0 units box - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 15 15 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.854 | 6.854 | 6.854 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 4 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 5 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 6 0 - 2200 2.2 6 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 7 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 8 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 9 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 10 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 11 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 12 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 13 0 - 4400 4.4 14 0 - 4500 4.5 14 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 15 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 17 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 18 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 22 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 23 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 25 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 27 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 32 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 63.2372 on 4 procs for 10000 steps with 1600 atoms - -Performance: 13662841.706 ns/day, 0.000 hours/ns, 158.135 timesteps/s -94.3% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 51.576 | 53.662 | 55.484 | 23.9 | 84.86 -Neigh | 0.011519 | 0.012395 | 0.013405 | 0.7 | 0.02 -Comm | 6.8389 | 8.5423 | 10.517 | 56.1 | 13.51 -Output | 0.12342 | 0.12513 | 0.1302 | 0.8 | 0.20 -Modify | 0.58708 | 0.69128 | 0.78806 | 11.3 | 1.09 -Other | | 0.2038 | | | 0.32 - -Nlocal: 400 ave 411 max 388 min -Histogram: 1 1 0 0 0 0 0 0 0 2 -Nghost: 552.25 ave 567 max 539 min -Histogram: 2 0 0 0 0 0 0 0 1 1 -Neighs: 18298.8 ave 18781 max 17829 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 73195 -Ave neighs/atom = 45.7469 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:03 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 new file mode 100644 index 0000000000..c4c11205e1 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.1 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.313 | 7.313 | 7.313 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 0 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 21 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 22 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 23 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 24 0 + 7200 7.2 24 0 + 7300 7.3 25 0 + 7400 7.4 25 0 + 7500 7.5 25 0 + 7600 7.6 26 0 + 7700 7.7 26 0 + 7800 7.8 26 0 + 7900 7.9 27 0 + 8000 8 27 0 + 8100 8.1 27 0 + 8200 8.2 28 0 + 8300 8.3 28 0 + 8400 8.4 28 0 + 8500 8.5 29 0 + 8600 8.6 29 0 + 8700 8.7 30 0 + 8800 8.8 30 0 + 8900 8.9 30 0 + 9000 9 31 0 + 9100 9.1 31 0 + 9200 9.2 31 0 + 9300 9.3 32 0 + 9400 9.4 32 0 + 9500 9.5 32 0 + 9600 9.6 33 0 + 9700 9.7 33 0 + 9800 9.8 33 0 + 9900 9.9 34 0 + 10000 10 34 0 +Loop time of 131.724 on 1 procs for 10000 steps with 1600 atoms + +Performance: 6559168.339 ns/day, 0.000 hours/ns, 75.916 timesteps/s, 121.466 katom-step/s +99.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 130.89 | 130.89 | 130.89 | 0.0 | 99.37 +Neigh | 0.02884 | 0.02884 | 0.02884 | 0.0 | 0.02 +Comm | 0.17863 | 0.17863 | 0.17863 | 0.0 | 0.14 +Output | 0.095497 | 0.095497 | 0.095497 | 0.0 | 0.07 +Modify | 0.42063 | 0.42063 | 0.42063 | 0.0 | 0.32 +Other | | 0.1069 | | | 0.08 + +Nlocal: 1600 ave 1600 max 1600 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 993 ave 993 max 993 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 73236 ave 73236 max 73236 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 73236 +Ave neighs/atom = 45.7725 +Neighbor list builds = 34 +Dangerous builds = 0 +Total wall time: 0:02:11 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 new file mode 100644 index 0000000000..6cb58bc233 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion-in-shear-flow/log.28Mar23.2d-diffusion-in-shear-flow.g++.4 @@ -0,0 +1,253 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable Lf equal $R*3 +variable Lf equal 0.5*3 +variable Lb equal $R*4 +variable Lb equal 0.5*4 +variable wall_velocity equal 0.01 # micrometers/microsecond +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -${Lb} ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 ${Lb} -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -${Lb} ${Lb} 0 ${a} units box +region box block -2 2 -2 ${Lb} 0 ${a} units box +region box block -2 2 -2 2 0 ${a} units box +region box block -2 2 -2 2 0 0.1 units box +create_box 4 box +Created orthogonal box = (-2 -2 0) to (2 2 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 1600 atoms + using lattice units in orthogonal box = (-2 -2 0) to (2 2 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +region upper_wall block INF INF +${Lf} INF INF INF units box +region upper_wall block INF INF +1.5 INF INF INF units box +set region upper_wall type 3 +Setting atom values ... + 200 settings made for type + +region lower_wall block INF INF INF -${Lf} INF INF units box +region lower_wall block INF INF INF -1.5 INF INF units box +set region lower_wall type 4 +Setting atom values ... + 240 settings made for type + +group fluid type 1 +1079 atoms in group fluid +group sphere type 2 +81 atoms in group sphere +group upper_wall type 3 +200 atoms in group upper_wall +group lower_wall type 4 +240 atoms in group lower_wall + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 1600 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms +fix 3 upper_wall meso/move linear +${wall_velocity} 0 0 units box +fix 3 upper_wall meso/move linear +0.01 0 0 units box +fix 4 lower_wall meso/move linear -${wall_velocity} 0 0 units box +fix 4 lower_wall meso/move linear -0.01 0 0 units box + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 15 15 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 7.23 | 7.23 | 7.23 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 10 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 11 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 13 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 14 0 + 4600 4.6 14 0 + 4700 4.7 15 0 + 4800 4.8 15 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 16 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 20 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 21 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 22 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 23 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 24 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 25 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 31 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 32 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 24.8261 on 4 procs for 10000 steps with 1600 atoms + +Performance: 34802055.618 ns/day, 0.000 hours/ns, 402.802 timesteps/s, 644.483 katom-step/s +99.1% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 21.84 | 22.879 | 23.944 | 21.4 | 92.16 +Neigh | 0.007446 | 0.0079435 | 0.0084435 | 0.6 | 0.03 +Comm | 0.5271 | 1.5894 | 2.6259 | 80.9 | 6.40 +Output | 0.034799 | 0.035302 | 0.036437 | 0.4 | 0.14 +Modify | 0.20079 | 0.21033 | 0.2202 | 1.7 | 0.85 +Other | | 0.1041 | | | 0.42 + +Nlocal: 400 ave 414 max 390 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Nghost: 555.5 ave 564 max 543 min +Histogram: 1 0 0 0 1 0 0 0 0 2 +Neighs: 18299.2 ave 18820 max 17906 min +Histogram: 1 1 0 0 0 0 1 0 0 1 + +Total # of neighbors = 73197 +Ave neighs/atom = 45.748125 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:24 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps index 6ef36a0cf6..2e0e821480 100644 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/in.lammps @@ -1,6 +1,6 @@ dimension 2 units micro -atom_style meso +atom_style sph variable R equal 0.5 # radius of sphere micrometers variable a equal $R/5 # lattice spacing micrometers @@ -27,12 +27,12 @@ group fluid type 1 group sphere type 2 mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} -fix 1 fluid meso +fix 1 fluid sph fix 2 sphere rigid/meso single fix 2d all enforce2d diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 deleted file mode 100644 index d44c0fd6f4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.1 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 1 by 1 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0015769 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.137 | 6.137 | 6.137 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 4 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 7 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 8 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 10 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 11 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 12 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 13 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 14 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 17 0 - 5100 5.1 17 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 18 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 19 0 - 6000 6 19 0 - 6100 6.1 20 0 - 6200 6.2 20 0 - 6300 6.3 20 0 - 6400 6.4 21 0 - 6500 6.5 21 0 - 6600 6.6 21 0 - 6700 6.7 21 0 - 6800 6.8 22 0 - 6900 6.9 22 0 - 7000 7 22 0 - 7100 7.1 23 0 - 7200 7.2 23 0 - 7300 7.3 23 0 - 7400 7.4 24 0 - 7500 7.5 24 0 - 7600 7.6 24 0 - 7700 7.7 25 0 - 7800 7.8 25 0 - 7900 7.9 26 0 - 8000 8 26 0 - 8100 8.1 26 0 - 8200 8.2 26 0 - 8300 8.3 27 0 - 8400 8.4 27 0 - 8500 8.5 27 0 - 8600 8.6 28 0 - 8700 8.7 28 0 - 8800 8.8 28 0 - 8900 8.9 29 0 - 9000 9 29 0 - 9100 9.1 29 0 - 9200 9.2 30 0 - 9300 9.3 30 0 - 9400 9.4 30 0 - 9500 9.5 30 0 - 9600 9.6 31 0 - 9700 9.7 31 0 - 9800 9.8 32 0 - 9900 9.9 32 0 - 10000 10 32 0 -Loop time of 80.9456 on 1 procs for 10000 steps with 900 atoms - -Performance: 10673829.855 ns/day, 0.000 hours/ns, 123.540 timesteps/s -99.8% CPU use with 1 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 80.306 | 80.306 | 80.306 | 0.0 | 99.21 -Neigh | 0.017418 | 0.017418 | 0.017418 | 0.0 | 0.02 -Comm | 0.16939 | 0.16939 | 0.16939 | 0.0 | 0.21 -Output | 0.070281 | 0.070281 | 0.070281 | 0.0 | 0.09 -Modify | 0.3154 | 0.3154 | 0.3154 | 0.0 | 0.39 -Other | | 0.067 | | | 0.08 - -Nlocal: 900 ave 900 max 900 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 762 ave 762 max 762 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 40697 ave 40697 max 40697 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 40697 -Ave neighs/atom = 45.2189 -Neighbor list builds = 32 -Dangerous builds = 0 -Total wall time: 0:01:20 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 deleted file mode 100644 index f904b78ab4..0000000000 --- a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.24Oct18.2d-diffusion.g++.4 +++ /dev/null @@ -1,226 +0,0 @@ -LAMMPS (24 Oct 2018) -dimension 2 -units micro -atom_style meso - -variable R equal 0.5 # radius of sphere micrometers -variable a equal $R/5 # lattice spacing micrometers -variable a equal 0.5/5 -variable L equal $R*3 -variable L equal 0.5*3 -variable T equal 300. -variable rho_0 equal 1. # density picograms/micrometer^3 -variable c_0 equal 100. # speed of sound micrometers/microsecond -variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) -variable h equal $a*4.5 # kernel function cutoff micrometers -variable h equal 0.1*4.5 -variable mass equal $a*$a*$a*${rho_0} -variable mass equal 0.1*$a*$a*${rho_0} -variable mass equal 0.1*0.1*$a*${rho_0} -variable mass equal 0.1*0.1*0.1*${rho_0} -variable mass equal 0.1*0.1*0.1*1 -variable dt equal 1e-3 # timestep microseconds -variable skin equal 0.2*$h -variable skin equal 0.2*0.45 - -region box block -$L $L -$L $L 0 $a units box -region box block -1.5 $L -$L $L 0 $a units box -region box block -1.5 1.5 -$L $L 0 $a units box -region box block -1.5 1.5 -1.5 $L 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 $a units box -region box block -1.5 1.5 -1.5 1.5 0 0.1 units box -create_box 2 box -Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) - 2 by 2 by 1 MPI processor grid -lattice sq $a -lattice sq 0.1 -Lattice spacing in x,y,z = 0.1 0.1 0.1 - -create_atoms 1 box -Created 900 atoms - Time spent = 0.0010246 secs - -region sphere sphere 0 0 0 $R units box -region sphere sphere 0 0 0 0.5 units box -set region sphere type 2 - 81 settings made for type - -group fluid type 1 -819 atoms in group fluid -group sphere type 2 -81 atoms in group sphere - -mass * ${mass} -mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 900 settings made for meso/rho - -pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed -pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 -pair_style sdpd/taitwater/isothermal 300 1 76787 -pair_coeff * * ${rho_0} ${c_0} ${h} -pair_coeff * * 1 ${c_0} ${h} -pair_coeff * * 1 100 ${h} -pair_coeff * * 1 100 0.45 - -fix 1 fluid meso -fix 2 sphere rigid/meso single -1 rigid bodies with 81 atoms - -fix 2d all enforce2d - -neighbor ${skin} bin -neighbor 0.09 bin -neigh_modify delay 0 every 1 check yes -timestep ${dt} -timestep 0.001 - -dump dump_id all atom 100 dump.lammpstrj - -thermo 100 -thermo_style custom step time nbuild ndanger - -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 0.54 - ghost atom cutoff = 0.54 - binsize = 0.27, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair sdpd/taitwater/isothermal, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.087 | 6.087 | 6.087 Mbytes -Step Time Nbuild Ndanger - 0 0 0 0 - 100 0.1 0 0 - 200 0.2 0 0 - 300 0.3 0 0 - 400 0.4 1 0 - 500 0.5 1 0 - 600 0.6 1 0 - 700 0.7 2 0 - 800 0.8 2 0 - 900 0.9 2 0 - 1000 1 3 0 - 1100 1.1 3 0 - 1200 1.2 3 0 - 1300 1.3 4 0 - 1400 1.4 4 0 - 1500 1.5 5 0 - 1600 1.6 5 0 - 1700 1.7 5 0 - 1800 1.8 6 0 - 1900 1.9 6 0 - 2000 2 6 0 - 2100 2.1 7 0 - 2200 2.2 7 0 - 2300 2.3 7 0 - 2400 2.4 8 0 - 2500 2.5 8 0 - 2600 2.6 8 0 - 2700 2.7 9 0 - 2800 2.8 9 0 - 2900 2.9 9 0 - 3000 3 9 0 - 3100 3.1 10 0 - 3200 3.2 10 0 - 3300 3.3 10 0 - 3400 3.4 11 0 - 3500 3.5 11 0 - 3600 3.6 11 0 - 3700 3.7 12 0 - 3800 3.8 12 0 - 3900 3.9 12 0 - 4000 4 13 0 - 4100 4.1 13 0 - 4200 4.2 13 0 - 4300 4.3 14 0 - 4400 4.4 14 0 - 4500 4.5 15 0 - 4600 4.6 15 0 - 4700 4.7 15 0 - 4800 4.8 16 0 - 4900 4.9 16 0 - 5000 5 16 0 - 5100 5.1 16 0 - 5200 5.2 17 0 - 5300 5.3 17 0 - 5400 5.4 18 0 - 5500 5.5 18 0 - 5600 5.6 19 0 - 5700 5.7 19 0 - 5800 5.8 19 0 - 5900 5.9 20 0 - 6000 6 20 0 - 6100 6.1 20 0 - 6200 6.2 21 0 - 6300 6.3 21 0 - 6400 6.4 21 0 - 6500 6.5 22 0 - 6600 6.6 22 0 - 6700 6.7 22 0 - 6800 6.8 23 0 - 6900 6.9 23 0 - 7000 7 23 0 - 7100 7.1 24 0 - 7200 7.2 24 0 - 7300 7.3 24 0 - 7400 7.4 25 0 - 7500 7.5 25 0 - 7600 7.6 25 0 - 7700 7.7 26 0 - 7800 7.8 26 0 - 7900 7.9 26 0 - 8000 8 27 0 - 8100 8.1 27 0 - 8200 8.2 27 0 - 8300 8.3 28 0 - 8400 8.4 28 0 - 8500 8.5 28 0 - 8600 8.6 28 0 - 8700 8.7 29 0 - 8800 8.8 29 0 - 8900 8.9 29 0 - 9000 9 30 0 - 9100 9.1 30 0 - 9200 9.2 31 0 - 9300 9.3 31 0 - 9400 9.4 31 0 - 9500 9.5 31 0 - 9600 9.6 32 0 - 9700 9.7 32 0 - 9800 9.8 32 0 - 9900 9.9 33 0 - 10000 10 33 0 -Loop time of 69.01 on 4 procs for 10000 steps with 900 atoms - -Performance: 12519931.275 ns/day, 0.000 hours/ns, 144.907 timesteps/s -48.7% CPU use with 4 MPI tasks x no OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 56.528 | 57.936 | 58.729 | 11.0 | 83.95 -Neigh | 0.013157 | 0.013382 | 0.013551 | 0.1 | 0.02 -Comm | 8.9594 | 9.7555 | 11.113 | 26.7 | 14.14 -Output | 0.14644 | 0.15009 | 0.15809 | 1.2 | 0.22 -Modify | 0.72913 | 0.91574 | 1.0524 | 12.4 | 1.33 -Other | | 0.2389 | | | 0.35 - -Nlocal: 225 ave 229 max 223 min -Histogram: 1 2 0 0 0 0 0 0 0 1 -Nghost: 442 ave 444 max 439 min -Histogram: 1 0 0 0 1 0 0 0 0 2 -Neighs: 10188.8 ave 10437 max 9932 min -Histogram: 1 0 0 1 0 0 0 1 0 1 - -Total # of neighbors = 40755 -Ave neighs/atom = 45.2833 -Neighbor list builds = 33 -Dangerous builds = 0 -Total wall time: 0:01:09 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 new file mode 100644 index 0000000000..30bf43dcf6 --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.1 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 1 by 1 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.512 | 6.512 | 6.512 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 6 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 7 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 10 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 13 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 17 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 18 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 19 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 21 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 22 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 23 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 24 0 + 7700 7.7 25 0 + 7800 7.8 25 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 26 0 + 8300 8.3 27 0 + 8400 8.4 27 0 + 8500 8.5 27 0 + 8600 8.6 28 0 + 8700 8.7 28 0 + 8800 8.8 28 0 + 8900 8.9 29 0 + 9000 9 29 0 + 9100 9.1 29 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 30 0 + 9500 9.5 30 0 + 9600 9.6 31 0 + 9700 9.7 31 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 32 0 +Loop time of 78.0094 on 1 procs for 10000 steps with 900 atoms + +Performance: 11075589.479 ns/day, 0.000 hours/ns, 128.190 timesteps/s, 115.371 katom-step/s +99.5% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 77.441 | 77.441 | 77.441 | 0.0 | 99.27 +Neigh | 0.016471 | 0.016471 | 0.016471 | 0.0 | 0.02 +Comm | 0.14821 | 0.14821 | 0.14821 | 0.0 | 0.19 +Output | 0.062415 | 0.062415 | 0.062415 | 0.0 | 0.08 +Modify | 0.25323 | 0.25323 | 0.25323 | 0.0 | 0.32 +Other | | 0.0877 | | | 0.11 + +Nlocal: 900 ave 900 max 900 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 762 ave 762 max 762 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 40697 ave 40697 max 40697 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 40697 +Ave neighs/atom = 45.218889 +Neighbor list builds = 32 +Dangerous builds = 0 +Total wall time: 0:01:18 diff --git a/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 new file mode 100644 index 0000000000..03f5ed01bb --- /dev/null +++ b/examples/PACKAGES/dpd-smooth/2d-diffusion/log.28Mar23.2d-diffusion.g++.4 @@ -0,0 +1,230 @@ +LAMMPS (28 Mar 2023 - Development) +dimension 2 +units micro +atom_style sph + +variable R equal 0.5 # radius of sphere micrometers +variable a equal $R/5 # lattice spacing micrometers +variable a equal 0.5/5 +variable L equal $R*3 +variable L equal 0.5*3 +variable T equal 300. +variable rho_0 equal 1. # density picograms/micrometer^3 +variable c_0 equal 100. # speed of sound micrometers/microsecond +variable mu equal 1. # dynamic viscosity picogram/(micrometer-microsecond) +variable h equal $a*4.5 # kernel function cutoff micrometers +variable h equal 0.1*4.5 +variable mass equal $a*$a*$a*${rho_0} +variable mass equal 0.1*$a*$a*${rho_0} +variable mass equal 0.1*0.1*$a*${rho_0} +variable mass equal 0.1*0.1*0.1*${rho_0} +variable mass equal 0.1*0.1*0.1*1 +variable dt equal 1e-3 # timestep microseconds +variable skin equal 0.2*$h +variable skin equal 0.2*0.45 + +region box block -$L $L -$L $L 0 $a units box +region box block -1.5 $L -$L $L 0 $a units box +region box block -1.5 1.5 -$L $L 0 $a units box +region box block -1.5 1.5 -1.5 $L 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 $a units box +region box block -1.5 1.5 -1.5 1.5 0 0.1 units box +create_box 2 box +Created orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + 2 by 2 by 1 MPI processor grid +lattice sq $a +lattice sq 0.1 +Lattice spacing in x,y,z = 0.1 0.1 0.1 + +create_atoms 1 box +Created 900 atoms + using lattice units in orthogonal box = (-1.5 -1.5 0) to (1.5 1.5 0.1) + create_atoms CPU = 0.001 seconds + +region sphere sphere 0 0 0 $R units box +region sphere sphere 0 0 0 0.5 units box +set region sphere type 2 +Setting atom values ... + 81 settings made for type + +group fluid type 1 +819 atoms in group fluid +group sphere type 2 +81 atoms in group sphere + +mass * ${mass} +mass * 0.001 +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 900 settings made for sph/rho + +pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed +pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 +pair_style sdpd/taitwater/isothermal 300 1 76787 +pair_coeff * * ${rho_0} ${c_0} ${h} +pair_coeff * * 1 ${c_0} ${h} +pair_coeff * * 1 100 ${h} +pair_coeff * * 1 100 0.45 + +fix 1 fluid sph +fix 2 sphere rigid/meso single + 1 rigid bodies with 81 atoms + +fix 2d all enforce2d + +neighbor ${skin} bin +neighbor 0.09 bin +neigh_modify delay 0 every 1 check yes +timestep ${dt} +timestep 0.001 + +dump dump_id all atom 100 dump.lammpstrj + +thermo 100 +thermo_style custom step time nbuild ndanger + +run 10000 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 0.54 + ghost atom cutoff = 0.54 + binsize = 0.27, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sdpd/taitwater/isothermal, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.463 | 6.463 | 6.463 Mbytes + Step Time Nbuild Ndanger + 0 0 0 0 + 100 0.1 0 0 + 200 0.2 0 0 + 300 0.3 0 0 + 400 0.4 1 0 + 500 0.5 1 0 + 600 0.6 1 0 + 700 0.7 2 0 + 800 0.8 2 0 + 900 0.9 2 0 + 1000 1 3 0 + 1100 1.1 3 0 + 1200 1.2 3 0 + 1300 1.3 4 0 + 1400 1.4 4 0 + 1500 1.5 4 0 + 1600 1.6 5 0 + 1700 1.7 5 0 + 1800 1.8 5 0 + 1900 1.9 6 0 + 2000 2 6 0 + 2100 2.1 6 0 + 2200 2.2 7 0 + 2300 2.3 7 0 + 2400 2.4 7 0 + 2500 2.5 8 0 + 2600 2.6 8 0 + 2700 2.7 8 0 + 2800 2.8 9 0 + 2900 2.9 9 0 + 3000 3 9 0 + 3100 3.1 10 0 + 3200 3.2 10 0 + 3300 3.3 11 0 + 3400 3.4 11 0 + 3500 3.5 11 0 + 3600 3.6 12 0 + 3700 3.7 12 0 + 3800 3.8 12 0 + 3900 3.9 12 0 + 4000 4 13 0 + 4100 4.1 13 0 + 4200 4.2 14 0 + 4300 4.3 14 0 + 4400 4.4 14 0 + 4500 4.5 15 0 + 4600 4.6 15 0 + 4700 4.7 15 0 + 4800 4.8 16 0 + 4900 4.9 16 0 + 5000 5 16 0 + 5100 5.1 17 0 + 5200 5.2 17 0 + 5300 5.3 17 0 + 5400 5.4 17 0 + 5500 5.5 18 0 + 5600 5.6 18 0 + 5700 5.7 18 0 + 5800 5.8 19 0 + 5900 5.9 19 0 + 6000 6 19 0 + 6100 6.1 20 0 + 6200 6.2 20 0 + 6300 6.3 20 0 + 6400 6.4 21 0 + 6500 6.5 21 0 + 6600 6.6 21 0 + 6700 6.7 22 0 + 6800 6.8 22 0 + 6900 6.9 22 0 + 7000 7 23 0 + 7100 7.1 23 0 + 7200 7.2 23 0 + 7300 7.3 24 0 + 7400 7.4 24 0 + 7500 7.5 24 0 + 7600 7.6 25 0 + 7700 7.7 25 0 + 7800 7.8 26 0 + 7900 7.9 26 0 + 8000 8 26 0 + 8100 8.1 26 0 + 8200 8.2 27 0 + 8300 8.3 27 0 + 8400 8.4 28 0 + 8500 8.5 28 0 + 8600 8.6 28 0 + 8700 8.7 29 0 + 8800 8.8 29 0 + 8900 8.9 29 0 + 9000 9 30 0 + 9100 9.1 30 0 + 9200 9.2 30 0 + 9300 9.3 30 0 + 9400 9.4 31 0 + 9500 9.5 31 0 + 9600 9.6 31 0 + 9700 9.7 32 0 + 9800 9.8 32 0 + 9900 9.9 32 0 + 10000 10 33 0 +Loop time of 13.5306 on 4 procs for 10000 steps with 900 atoms + +Performance: 63855371.888 ns/day, 0.000 hours/ns, 739.067 timesteps/s, 665.160 katom-step/s +98.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 12.327 | 12.56 | 12.738 | 4.3 | 92.83 +Neigh | 0.0043391 | 0.0044297 | 0.0045381 | 0.1 | 0.03 +Comm | 0.53746 | 0.71463 | 0.94685 | 18.1 | 5.28 +Output | 0.021884 | 0.02228 | 0.023428 | 0.4 | 0.16 +Modify | 0.14457 | 0.14548 | 0.14643 | 0.2 | 1.08 +Other | | 0.08351 | | | 0.62 + +Nlocal: 225 ave 228 max 222 min +Histogram: 1 0 0 1 0 0 1 0 0 1 +Nghost: 438.25 ave 442 max 434 min +Histogram: 1 0 0 0 0 1 1 0 0 1 +Neighs: 10152.2 ave 10328 max 9853 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 40609 +Ave neighs/atom = 45.121111 +Neighbor list builds = 33 +Dangerous builds = 0 +Total wall time: 0:00:13 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps index 0d06723f59..59359d4b38 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/in.lammps @@ -1,6 +1,6 @@ dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -21,7 +21,7 @@ lattice sc $a create_atoms 1 box mass * ${mass} -set group all meso/rho ${rho_0} +set group all sph/rho ${rho_0} pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_coeff * * ${rho_0} ${c_0} ${h} @@ -34,7 +34,7 @@ variable vx_sq_check equal c_v_sq[1]*${mass}/${kB}/$T variable vy_sq_check equal c_v_sq[2]*${mass}/${kB}/$T variable vz_sq_check equal c_v_sq[3]*${mass}/${kB}/$T -fix 1 all meso +fix 1 all sph neighbor ${skin} bin timestep ${dt} diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 index 06ffd699bc..2fa4771a74 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.1 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.1 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00285411 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.002 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 13.54 | 13.54 | 13.54 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.70973271 0.71495693 0.71910087 - 20 0.01 0.90418096 0.88845437 0.89659567 - 30 0.015 0.9590736 0.97880338 0.9619016 - 40 0.02 0.98533774 0.96057682 0.95600448 - 50 0.025 0.96433662 0.96650071 0.95509683 - 60 0.03 0.96598029 0.96373656 0.96734888 - 70 0.035 0.95433045 0.98004764 0.96255924 - 80 0.04 0.97872906 0.95987289 0.96623598 - 90 0.045 0.99913888 0.99255731 0.95616142 - 100 0.05 0.98872675 0.97141018 0.95338841 - 110 0.055 0.97794592 0.97389258 0.98473719 - 120 0.06 0.98389266 0.96716284 0.95504862 - 130 0.065 0.98572886 0.96680923 0.95599065 - 140 0.07 0.97602684 0.97580081 0.9886878 - 150 0.075 0.99172003 0.95027467 0.96028033 - 160 0.08 0.96793247 0.94590928 0.95644301 - 170 0.085 0.94167619 0.98048861 0.93439426 - 180 0.09 0.97277934 0.97383622 0.96900866 - 190 0.095 0.96647288 1.0027643 0.96230782 - 200 0.1 0.94864291 0.95902585 0.96398175 -Loop time of 60.1095 on 1 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 14.29 | 14.29 | 14.29 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.70973271 0.71495693 0.71910087 + 20 0.01 0.90418096 0.88845437 0.89659567 + 30 0.015 0.9590736 0.97880338 0.9619016 + 40 0.02 0.98533774 0.96057682 0.95600448 + 50 0.025 0.96433662 0.96650071 0.95509683 + 60 0.03 0.96598029 0.96373656 0.96734888 + 70 0.035 0.95433045 0.98004764 0.96255924 + 80 0.04 0.97872906 0.95987289 0.96623598 + 90 0.045 0.99913888 0.99255731 0.95616142 + 100 0.05 0.98872675 0.97141018 0.95338841 + 110 0.055 0.97794592 0.97389258 0.98473719 + 120 0.06 0.98389266 0.96716284 0.95504862 + 130 0.065 0.98572886 0.96680923 0.95599065 + 140 0.07 0.97602684 0.97580081 0.9886878 + 150 0.075 0.99172003 0.95027467 0.96028033 + 160 0.08 0.96793247 0.94590928 0.95644301 + 170 0.085 0.94167619 0.98048861 0.93439426 + 180 0.09 0.97277934 0.97383622 0.96900866 + 190 0.095 0.96647288 1.0027643 0.96230782 + 200 0.1 0.94864291 0.95902585 0.96398175 +Loop time of 55.7542 on 1 procs for 200 steps with 8000 atoms -Performance: 143737.595 ns/day, 0.000 hours/ns, 3.327 timesteps/s -99.7% CPU use with 1 MPI tasks x no OpenMP threads +Performance: 154965.922 ns/day, 0.000 hours/ns, 3.587 timesteps/s, 28.697 katom-step/s +99.6% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 59.92 | 59.92 | 59.92 | 0.0 | 99.68 +Pair | 55.642 | 55.642 | 55.642 | 0.0 | 99.80 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.11154 | 0.11154 | 0.11154 | 0.0 | 0.19 -Output | 0.0063498 | 0.0063498 | 0.0063498 | 0.0 | 0.01 -Modify | 0.043546 | 0.043546 | 0.043546 | 0.0 | 0.07 -Other | | 0.02811 | | | 0.05 +Comm | 0.060977 | 0.060977 | 0.060977 | 0.0 | 0.11 +Output | 0.0066393 | 0.0066393 | 0.0066393 | 0.0 | 0.01 +Modify | 0.028354 | 0.028354 | 0.028354 | 0.0 | 0.05 +Other | | 0.01623 | | | 0.03 -Nlocal: 8000 ave 8000 max 8000 min +Nlocal: 8000 ave 8000 max 8000 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 16389 ave 16389 max 16389 min +Nghost: 16389 ave 16389 max 16389 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min +Neighs: 1.456e+06 ave 1.456e+06 max 1.456e+06 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:01:00 +Total wall time: 0:00:56 diff --git a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 similarity index 58% rename from examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 rename to examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 index 88509f0fd1..e4f11d305e 100644 --- a/examples/PACKAGES/dpd-smooth/equipartition-verification/log.24Oct18.equipartition.g++.4 +++ b/examples/PACKAGES/dpd-smooth/equipartition-verification/log.28Mar23.equipartition.g++.4 @@ -1,7 +1,7 @@ -LAMMPS (24 Oct 2018) +LAMMPS (28 Mar 2023 - Development) dimension 3 units micro -atom_style meso +atom_style sph variable a equal 0.1 # lattice spacing micrometers variable L equal $a*10 @@ -38,13 +38,15 @@ Lattice spacing in x,y,z = 0.1 0.1 0.1 create_atoms 1 box Created 8000 atoms - Time spent = 0.00252754 secs + using lattice units in orthogonal box = (-1 -1 -1) to (1 1 1) + create_atoms CPU = 0.001 seconds mass * ${mass} mass * 0.001 -set group all meso/rho ${rho_0} -set group all meso/rho 1 - 8000 settings made for meso/rho +set group all sph/rho ${rho_0} +set group all sph/rho 1 +Setting atom values ... + 8000 settings made for sph/rho pair_style sdpd/taitwater/isothermal $T ${mu} 76787 # temperature viscosity random_seed pair_style sdpd/taitwater/isothermal 300 ${mu} 76787 @@ -71,7 +73,7 @@ variable vz_sq_check equal c_v_sq[3]*0.001/${kB}/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/$T variable vz_sq_check equal c_v_sq[3]*0.001/1.3806504e-08/300 -fix 1 all meso +fix 1 all sph neighbor ${skin} bin neighbor 0.04 bin @@ -82,8 +84,9 @@ thermo 10 thermo_style custom step time v_vx_sq_check v_vy_sq_check v_vz_sq_check run 200 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 10 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 0.44 ghost atom cutoff = 0.44 @@ -92,55 +95,55 @@ Neighbor list info ... (1) pair sdpd/taitwater/isothermal, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 5.795 | 5.795 | 5.795 Mbytes -Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check - 0 0 0 0 0 - 10 0.005 0.71224819 0.71470372 0.7008956 - 20 0.01 0.90627589 0.90683966 0.90116506 - 30 0.015 0.938505 0.95884272 0.93337542 - 40 0.02 0.94394649 0.93668038 0.96468004 - 50 0.025 0.97152309 0.97546161 0.95107762 - 60 0.03 0.94710871 0.95678322 0.97285504 - 70 0.035 0.96253148 0.95838642 0.95450883 - 80 0.04 0.97581495 0.95278681 0.95099478 - 90 0.045 0.96251614 0.9740684 0.96081505 - 100 0.05 0.94191275 0.97137523 0.94084858 - 110 0.055 0.953406 0.95739684 0.98574522 - 120 0.06 0.99001614 0.99608287 0.9839996 - 130 0.065 0.96575225 0.94309655 0.92847798 - 140 0.07 0.97642687 0.97458638 0.94696406 - 150 0.075 0.99316381 0.96876814 0.95440106 - 160 0.08 0.94589744 0.95264791 0.95495169 - 170 0.085 0.97599092 0.95336014 0.97687718 - 180 0.09 0.97214242 0.9726305 0.9726035 - 190 0.095 0.97577583 0.96523645 0.9756968 - 200 0.1 0.96386053 0.97268854 0.94582436 -Loop time of 32.5247 on 4 procs for 200 steps with 8000 atoms +Per MPI rank memory allocation (min/avg/max) = 6.172 | 6.172 | 6.172 Mbytes + Step Time v_vx_sq_check v_vy_sq_check v_vz_sq_check + 0 0 0 0 0 + 10 0.005 0.71224819 0.71470372 0.7008956 + 20 0.01 0.90627589 0.90683966 0.90116506 + 30 0.015 0.938505 0.95884272 0.93337542 + 40 0.02 0.94394649 0.93668038 0.96468004 + 50 0.025 0.97152309 0.97546161 0.95107762 + 60 0.03 0.94710871 0.95678322 0.97285504 + 70 0.035 0.96253148 0.95838642 0.95450883 + 80 0.04 0.97581495 0.95278681 0.95099478 + 90 0.045 0.96251614 0.9740684 0.96081505 + 100 0.05 0.94191275 0.97137523 0.94084858 + 110 0.055 0.953406 0.95739684 0.98574522 + 120 0.06 0.99001614 0.99608287 0.9839996 + 130 0.065 0.96575225 0.94309655 0.92847798 + 140 0.07 0.97642687 0.97458638 0.94696406 + 150 0.075 0.99316381 0.96876814 0.95440106 + 160 0.08 0.94589744 0.95264791 0.95495169 + 170 0.085 0.97599092 0.95336014 0.97687718 + 180 0.09 0.97214242 0.9726305 0.9726035 + 190 0.095 0.97577583 0.96523645 0.9756968 + 200 0.1 0.96386053 0.97268854 0.94582436 +Loop time of 9.59181 on 4 procs for 200 steps with 8000 atoms -Performance: 265644.515 ns/day, 0.000 hours/ns, 6.149 timesteps/s -73.9% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 900768.333 ns/day, 0.000 hours/ns, 20.851 timesteps/s, 166.809 katom-step/s +98.1% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 27.385 | 28.409 | 28.761 | 11.1 | 87.34 +Pair | 8.9729 | 9.2147 | 9.4383 | 5.5 | 96.07 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 3.582 | 3.9343 | 4.9531 | 29.7 | 12.10 -Output | 0.022267 | 0.026073 | 0.033141 | 2.7 | 0.08 -Modify | 0.031714 | 0.033134 | 0.034367 | 0.6 | 0.10 -Other | | 0.1226 | | | 0.38 +Comm | 0.13739 | 0.36068 | 0.60216 | 27.6 | 3.76 +Output | 0.0022724 | 0.002394 | 0.0026506 | 0.3 | 0.02 +Modify | 0.0068559 | 0.0069926 | 0.0070974 | 0.1 | 0.07 +Other | | 0.007004 | | | 0.07 -Nlocal: 2000 ave 2000 max 2000 min +Nlocal: 2000 ave 2000 max 2000 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 8469 ave 8469 max 8469 min +Nghost: 8469 ave 8469 max 8469 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Neighs: 364000 ave 376628 max 351184 min +Neighs: 364000 ave 376628 max 351184 min Histogram: 1 0 1 0 0 0 0 1 0 1 Total # of neighbors = 1456000 Ave neighs/atom = 182 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:00:32 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm new file mode 120000 index 0000000000..fe5cccfcd2 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/COH.aip.water.2dm @@ -0,0 +1 @@ +../../../../potentials/COH.aip.water.2dm \ No newline at end of file diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data b/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data new file mode 100644 index 0000000000..7e6d3925f0 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/gra_water.data @@ -0,0 +1,2040 @@ +LAMMPS data file via write_data, version 23 Jun 2022, timestep = 100000 + +936 atoms +3 atom types +96 bonds +1 bond types +48 angles +1 angle types + +0 46.92336 xlo xhi +0 44.331078317370086 ylo yhi +0 200 zlo zhi + +Atoms # full + +1 1 1 0 0 0 0 0 0 0 +2 1 1 0 0.71096 1.231418842149169 0 0 0 0 +3 1 1 0 2.13288 1.231418842149169 0 0 0 0 +4 1 1 0 2.84384 0 0 0 0 0 +5 1 1 0 0 2.462837684298338 0 0 0 0 +6 1 1 0 0.71096 3.694256526447507 0 0 0 0 +7 1 1 0 2.13288 3.694256526447507 0 0 0 0 +8 1 1 0 2.84384 2.462837684298338 0 0 0 0 +9 1 1 0 0 4.925675368596676 0 0 0 0 +10 1 1 0 0.71096 6.157094210745845 0 0 0 0 +11 1 1 0 2.13288 6.157094210745845 0 0 0 0 +12 1 1 0 2.84384 4.925675368596676 0 0 0 0 +13 1 1 0 0 7.388513052895014 0 0 0 0 +14 1 1 0 0.71096 8.619931895044184 0 0 0 0 +15 1 1 0 2.13288 8.619931895044184 0 0 0 0 +16 1 1 0 2.84384 7.388513052895014 0 0 0 0 +17 1 1 0 0 9.851350737193352 0 0 0 0 +20 1 1 0 2.84384 9.851350737193352 0 0 0 0 +73 1 1 0 4.26576 0 0 0 0 0 +74 1 1 0 4.97672 1.231418842149169 0 0 0 0 +77 1 1 0 4.26576 2.462837684298338 0 0 0 0 +78 1 1 0 4.97672 3.694256526447507 0 0 0 0 +81 1 1 0 4.26576 4.925675368596676 0 0 0 0 +82 1 1 0 4.97672 6.157094210745845 0 0 0 0 +85 1 1 0 4.26576 7.388513052895014 0 0 0 0 +86 1 1 0 4.97672 8.619931895044184 0 0 0 0 +89 1 1 0 4.26576 9.851350737193352 0 0 0 0 +18 1 1 0 0.71096 11.082769579342521 0 0 0 0 +19 1 1 0 2.13288 11.082769579342521 0 0 0 0 +21 1 1 0 0 12.31418842149169 0 0 0 0 +22 1 1 0 0.71096 13.545607263640859 0 0 0 0 +23 1 1 0 2.13288 13.545607263640859 0 0 0 0 +24 1 1 0 2.84384 12.31418842149169 0 0 0 0 +25 1 1 0 0 14.777026105790029 0 0 0 0 +26 1 1 0 0.71096 16.008444947939196 0 0 0 0 +27 1 1 0 2.13288 16.008444947939196 0 0 0 0 +28 1 1 0 2.84384 14.777026105790029 0 0 0 0 +29 1 1 0 0 17.239863790088364 0 0 0 0 +30 1 1 0 0.71096 18.471282632237532 0 0 0 0 +31 1 1 0 2.13288 18.471282632237532 0 0 0 0 +32 1 1 0 2.84384 17.239863790088364 0 0 0 0 +33 1 1 0 0 19.702701474386703 0 0 0 0 +34 1 1 0 0.71096 20.93412031653587 0 0 0 0 +35 1 1 0 2.13288 20.93412031653587 0 0 0 0 +36 1 1 0 2.84384 19.702701474386703 0 0 0 0 +90 1 1 0 4.97672 11.082769579342521 0 0 0 0 +93 1 1 0 4.26576 12.31418842149169 0 0 0 0 +94 1 1 0 4.97672 13.545607263640859 0 0 0 0 +97 1 1 0 4.26576 14.777026105790029 0 0 0 0 +98 1 1 0 4.97672 16.008444947939196 0 0 0 0 +101 1 1 0 4.26576 17.239863790088364 0 0 0 0 +102 1 1 0 4.97672 18.471282632237532 0 0 0 0 +105 1 1 0 4.26576 19.702701474386703 0 0 0 0 +106 1 1 0 4.97672 20.93412031653587 0 0 0 0 +37 1 1 0 0 22.165539158685043 0 0 0 0 +38 1 1 0 0.71096 23.39695800083421 0 0 0 0 +39 1 1 0 2.13288 23.39695800083421 0 0 0 0 +40 1 1 0 2.84384 22.165539158685043 0 0 0 0 +41 1 1 0 0 24.62837684298338 0 0 0 0 +42 1 1 0 0.71096 25.859795685132546 0 0 0 0 +43 1 1 0 2.13288 25.859795685132546 0 0 0 0 +44 1 1 0 2.84384 24.62837684298338 0 0 0 0 +45 1 1 0 0 27.091214527281718 0 0 0 0 +46 1 1 0 0.71096 28.322633369430886 0 0 0 0 +47 1 1 0 2.13288 28.322633369430886 0 0 0 0 +48 1 1 0 2.84384 27.091214527281718 0 0 0 0 +49 1 1 0 0 29.554052211580057 0 0 0 0 +50 1 1 0 0.71096 30.785471053729225 0 0 0 0 +51 1 1 0 2.13288 30.785471053729225 0 0 0 0 +52 1 1 0 2.84384 29.554052211580057 0 0 0 0 +53 1 1 0 0 32.01688989587839 0 0 0 0 +56 1 1 0 2.84384 32.01688989587839 0 0 0 0 +109 1 1 0 4.26576 22.165539158685043 0 0 0 0 +110 1 1 0 4.97672 23.39695800083421 0 0 0 0 +113 1 1 0 4.26576 24.62837684298338 0 0 0 0 +114 1 1 0 4.97672 25.859795685132546 0 0 0 0 +117 1 1 0 4.26576 27.091214527281718 0 0 0 0 +118 1 1 0 4.97672 28.322633369430886 0 0 0 0 +121 1 1 0 4.26576 29.554052211580057 0 0 0 0 +122 1 1 0 4.97672 30.785471053729225 0 0 0 0 +125 1 1 0 4.26576 32.01688989587839 0 0 0 0 +54 1 1 0 0.71096 33.24830873802756 0 0 0 0 +55 1 1 0 2.13288 33.24830873802756 0 0 0 0 +57 1 1 0 0 34.47972758017673 0 0 0 0 +58 1 1 0 0.71096 35.711146422325896 0 0 0 0 +59 1 1 0 2.13288 35.711146422325896 0 0 0 0 +60 1 1 0 2.84384 34.47972758017673 0 0 0 0 +61 1 1 0 0 36.94256526447507 0 0 0 0 +62 1 1 0 0.71096 38.17398410662424 0 0 0 0 +63 1 1 0 2.13288 38.17398410662424 0 0 0 0 +64 1 1 0 2.84384 36.94256526447507 0 0 0 0 +65 1 1 0 0 39.40540294877341 0 0 0 0 +66 1 1 0 0.71096 40.636821790922575 0 0 0 0 +67 1 1 0 2.13288 40.636821790922575 0 0 0 0 +68 1 1 0 2.84384 39.40540294877341 0 0 0 0 +69 1 1 0 0 41.86824063307174 0 0 0 0 +70 1 1 0 0.71096 43.09965947522091 0 0 0 0 +71 1 1 0 2.13288 43.09965947522091 0 0 0 0 +72 1 1 0 2.84384 41.86824063307174 0 0 0 0 +126 1 1 0 4.97672 33.24830873802756 0 0 0 0 +129 1 1 0 4.26576 34.47972758017673 0 0 0 0 +130 1 1 0 4.97672 35.711146422325896 0 0 0 0 +133 1 1 0 4.26576 36.94256526447507 0 0 0 0 +134 1 1 0 4.97672 38.17398410662424 0 0 0 0 +137 1 1 0 4.26576 39.40540294877341 0 0 0 0 +138 1 1 0 4.97672 40.636821790922575 0 0 0 0 +141 1 1 0 4.26576 41.86824063307174 0 0 0 0 +142 1 1 0 4.97672 43.09965947522091 0 0 0 0 +75 1 1 0 6.39864 1.231418842149169 0 0 0 0 +76 1 1 0 7.1096 0 0 0 0 0 +79 1 1 0 6.39864 3.694256526447507 0 0 0 0 +80 1 1 0 7.1096 2.462837684298338 0 0 0 0 +83 1 1 0 6.39864 6.157094210745845 0 0 0 0 +84 1 1 0 7.1096 4.925675368596676 0 0 0 0 +87 1 1 0 6.39864 8.619931895044184 0 0 0 0 +88 1 1 0 7.1096 7.388513052895014 0 0 0 0 +92 1 1 0 7.1096 9.851350737193352 0 0 0 0 +145 1 1 0 8.53152 0 0 0 0 0 +146 1 1 0 9.24248 1.231418842149169 0 0 0 0 +147 1 1 0 10.6644 1.231418842149169 0 0 0 0 +148 1 1 0 11.37536 0 0 0 0 0 +149 1 1 0 8.53152 2.462837684298338 0 0 0 0 +150 1 1 0 9.24248 3.694256526447507 0 0 0 0 +151 1 1 0 10.6644 3.694256526447507 0 0 0 0 +152 1 1 0 11.37536 2.462837684298338 0 0 0 0 +153 1 1 0 8.53152 4.925675368596676 0 0 0 0 +154 1 1 0 9.24248 6.157094210745845 0 0 0 0 +155 1 1 0 10.6644 6.157094210745845 0 0 0 0 +156 1 1 0 11.37536 4.925675368596676 0 0 0 0 +157 1 1 0 8.53152 7.388513052895014 0 0 0 0 +158 1 1 0 9.24248 8.619931895044184 0 0 0 0 +159 1 1 0 10.6644 8.619931895044184 0 0 0 0 +160 1 1 0 11.37536 7.388513052895014 0 0 0 0 +161 1 1 0 8.53152 9.851350737193352 0 0 0 0 +164 1 1 0 11.37536 9.851350737193352 0 0 0 0 +91 1 1 0 6.39864 11.082769579342521 0 0 0 0 +95 1 1 0 6.39864 13.545607263640859 0 0 0 0 +96 1 1 0 7.1096 12.31418842149169 0 0 0 0 +99 1 1 0 6.39864 16.008444947939196 0 0 0 0 +100 1 1 0 7.1096 14.777026105790029 0 0 0 0 +103 1 1 0 6.39864 18.471282632237532 0 0 0 0 +104 1 1 0 7.1096 17.239863790088364 0 0 0 0 +107 1 1 0 6.39864 20.93412031653587 0 0 0 0 +108 1 1 0 7.1096 19.702701474386703 0 0 0 0 +162 1 1 0 9.24248 11.082769579342521 0 0 0 0 +163 1 1 0 10.6644 11.082769579342521 0 0 0 0 +165 1 1 0 8.53152 12.31418842149169 0 0 0 0 +166 1 1 0 9.24248 13.545607263640859 0 0 0 0 +167 1 1 0 10.6644 13.545607263640859 0 0 0 0 +168 1 1 0 11.37536 12.31418842149169 0 0 0 0 +169 1 1 0 8.53152 14.777026105790029 0 0 0 0 +170 1 1 0 9.24248 16.008444947939196 0 0 0 0 +171 1 1 0 10.6644 16.008444947939196 0 0 0 0 +172 1 1 0 11.37536 14.777026105790029 0 0 0 0 +173 1 1 0 8.53152 17.239863790088364 0 0 0 0 +174 1 1 0 9.24248 18.471282632237532 0 0 0 0 +175 1 1 0 10.6644 18.471282632237532 0 0 0 0 +176 1 1 0 11.37536 17.239863790088364 0 0 0 0 +177 1 1 0 8.53152 19.702701474386703 0 0 0 0 +178 1 1 0 9.24248 20.93412031653587 0 0 0 0 +179 1 1 0 10.6644 20.93412031653587 0 0 0 0 +180 1 1 0 11.37536 19.702701474386703 0 0 0 0 +111 1 1 0 6.39864 23.39695800083421 0 0 0 0 +112 1 1 0 7.1096 22.165539158685043 0 0 0 0 +115 1 1 0 6.39864 25.859795685132546 0 0 0 0 +116 1 1 0 7.1096 24.62837684298338 0 0 0 0 +119 1 1 0 6.39864 28.322633369430886 0 0 0 0 +120 1 1 0 7.1096 27.091214527281718 0 0 0 0 +123 1 1 0 6.39864 30.785471053729225 0 0 0 0 +124 1 1 0 7.1096 29.554052211580057 0 0 0 0 +128 1 1 0 7.1096 32.01688989587839 0 0 0 0 +181 1 1 0 8.53152 22.165539158685043 0 0 0 0 +182 1 1 0 9.24248 23.39695800083421 0 0 0 0 +183 1 1 0 10.6644 23.39695800083421 0 0 0 0 +184 1 1 0 11.37536 22.165539158685043 0 0 0 0 +185 1 1 0 8.53152 24.62837684298338 0 0 0 0 +186 1 1 0 9.24248 25.859795685132546 0 0 0 0 +187 1 1 0 10.6644 25.859795685132546 0 0 0 0 +188 1 1 0 11.37536 24.62837684298338 0 0 0 0 +189 1 1 0 8.53152 27.091214527281718 0 0 0 0 +190 1 1 0 9.24248 28.322633369430886 0 0 0 0 +191 1 1 0 10.6644 28.322633369430886 0 0 0 0 +192 1 1 0 11.37536 27.091214527281718 0 0 0 0 +193 1 1 0 8.53152 29.554052211580057 0 0 0 0 +194 1 1 0 9.24248 30.785471053729225 0 0 0 0 +195 1 1 0 10.6644 30.785471053729225 0 0 0 0 +196 1 1 0 11.37536 29.554052211580057 0 0 0 0 +197 1 1 0 8.53152 32.01688989587839 0 0 0 0 +200 1 1 0 11.37536 32.01688989587839 0 0 0 0 +127 1 1 0 6.39864 33.24830873802756 0 0 0 0 +131 1 1 0 6.39864 35.711146422325896 0 0 0 0 +132 1 1 0 7.1096 34.47972758017673 0 0 0 0 +135 1 1 0 6.39864 38.17398410662424 0 0 0 0 +136 1 1 0 7.1096 36.94256526447507 0 0 0 0 +139 1 1 0 6.39864 40.636821790922575 0 0 0 0 +140 1 1 0 7.1096 39.40540294877341 0 0 0 0 +143 1 1 0 6.39864 43.09965947522091 0 0 0 0 +144 1 1 0 7.1096 41.86824063307174 0 0 0 0 +198 1 1 0 9.24248 33.24830873802756 0 0 0 0 +199 1 1 0 10.6644 33.24830873802756 0 0 0 0 +201 1 1 0 8.53152 34.47972758017673 0 0 0 0 +202 1 1 0 9.24248 35.711146422325896 0 0 0 0 +203 1 1 0 10.6644 35.711146422325896 0 0 0 0 +204 1 1 0 11.37536 34.47972758017673 0 0 0 0 +205 1 1 0 8.53152 36.94256526447507 0 0 0 0 +206 1 1 0 9.24248 38.17398410662424 0 0 0 0 +207 1 1 0 10.6644 38.17398410662424 0 0 0 0 +208 1 1 0 11.37536 36.94256526447507 0 0 0 0 +209 1 1 0 8.53152 39.40540294877341 0 0 0 0 +210 1 1 0 9.24248 40.636821790922575 0 0 0 0 +211 1 1 0 10.6644 40.636821790922575 0 0 0 0 +212 1 1 0 11.37536 39.40540294877341 0 0 0 0 +213 1 1 0 8.53152 41.86824063307174 0 0 0 0 +214 1 1 0 9.24248 43.09965947522091 0 0 0 0 +215 1 1 0 10.6644 43.09965947522091 0 0 0 0 +216 1 1 0 11.37536 41.86824063307174 0 0 0 0 +217 1 1 0 12.79728 0 0 0 0 0 +218 1 1 0 13.50824 1.231418842149169 0 0 0 0 +219 1 1 0 14.93016 1.231418842149169 0 0 0 0 +220 1 1 0 15.64112 0 0 0 0 0 +221 1 1 0 12.79728 2.462837684298338 0 0 0 0 +222 1 1 0 13.50824 3.694256526447507 0 0 0 0 +223 1 1 0 14.93016 3.694256526447507 0 0 0 0 +224 1 1 0 15.64112 2.462837684298338 0 0 0 0 +225 1 1 0 12.79728 4.925675368596676 0 0 0 0 +226 1 1 0 13.50824 6.157094210745845 0 0 0 0 +227 1 1 0 14.93016 6.157094210745845 0 0 0 0 +228 1 1 0 15.64112 4.925675368596676 0 0 0 0 +229 1 1 0 12.79728 7.388513052895014 0 0 0 0 +230 1 1 0 13.50824 8.619931895044184 0 0 0 0 +231 1 1 0 14.93016 8.619931895044184 0 0 0 0 +232 1 1 0 15.64112 7.388513052895014 0 0 0 0 +233 1 1 0 12.79728 9.851350737193352 0 0 0 0 +236 1 1 0 15.64112 9.851350737193352 0 0 0 0 +289 1 1 0 17.06304 0 0 0 0 0 +293 1 1 0 17.06304 2.462837684298338 0 0 0 0 +297 1 1 0 17.06304 4.925675368596676 0 0 0 0 +301 1 1 0 17.06304 7.388513052895014 0 0 0 0 +305 1 1 0 17.06304 9.851350737193352 0 0 0 0 +234 1 1 0 13.50824 11.082769579342521 0 0 0 0 +235 1 1 0 14.93016 11.082769579342521 0 0 0 0 +237 1 1 0 12.79728 12.31418842149169 0 0 0 0 +238 1 1 0 13.50824 13.545607263640859 0 0 0 0 +239 1 1 0 14.93016 13.545607263640859 0 0 0 0 +240 1 1 0 15.64112 12.31418842149169 0 0 0 0 +241 1 1 0 12.79728 14.777026105790029 0 0 0 0 +242 1 1 0 13.50824 16.008444947939196 0 0 0 0 +243 1 1 0 14.93016 16.008444947939196 0 0 0 0 +244 1 1 0 15.64112 14.777026105790029 0 0 0 0 +245 1 1 0 12.79728 17.239863790088364 0 0 0 0 +246 1 1 0 13.50824 18.471282632237532 0 0 0 0 +247 1 1 0 14.93016 18.471282632237532 0 0 0 0 +248 1 1 0 15.64112 17.239863790088364 0 0 0 0 +249 1 1 0 12.79728 19.702701474386703 0 0 0 0 +250 1 1 0 13.50824 20.93412031653587 0 0 0 0 +251 1 1 0 14.93016 20.93412031653587 0 0 0 0 +252 1 1 0 15.64112 19.702701474386703 0 0 0 0 +309 1 1 0 17.06304 12.31418842149169 0 0 0 0 +313 1 1 0 17.06304 14.777026105790029 0 0 0 0 +317 1 1 0 17.06304 17.239863790088364 0 0 0 0 +321 1 1 0 17.06304 19.702701474386703 0 0 0 0 +253 1 1 0 12.79728 22.165539158685043 0 0 0 0 +254 1 1 0 13.50824 23.39695800083421 0 0 0 0 +255 1 1 0 14.93016 23.39695800083421 0 0 0 0 +256 1 1 0 15.64112 22.165539158685043 0 0 0 0 +257 1 1 0 12.79728 24.62837684298338 0 0 0 0 +258 1 1 0 13.50824 25.859795685132546 0 0 0 0 +259 1 1 0 14.93016 25.859795685132546 0 0 0 0 +260 1 1 0 15.64112 24.62837684298338 0 0 0 0 +261 1 1 0 12.79728 27.091214527281718 0 0 0 0 +262 1 1 0 13.50824 28.322633369430886 0 0 0 0 +263 1 1 0 14.93016 28.322633369430886 0 0 0 0 +264 1 1 0 15.64112 27.091214527281718 0 0 0 0 +265 1 1 0 12.79728 29.554052211580057 0 0 0 0 +266 1 1 0 13.50824 30.785471053729225 0 0 0 0 +267 1 1 0 14.93016 30.785471053729225 0 0 0 0 +268 1 1 0 15.64112 29.554052211580057 0 0 0 0 +269 1 1 0 12.79728 32.01688989587839 0 0 0 0 +272 1 1 0 15.64112 32.01688989587839 0 0 0 0 +325 1 1 0 17.06304 22.165539158685043 0 0 0 0 +329 1 1 0 17.06304 24.62837684298338 0 0 0 0 +333 1 1 0 17.06304 27.091214527281718 0 0 0 0 +337 1 1 0 17.06304 29.554052211580057 0 0 0 0 +341 1 1 0 17.06304 32.01688989587839 0 0 0 0 +270 1 1 0 13.50824 33.24830873802756 0 0 0 0 +271 1 1 0 14.93016 33.24830873802756 0 0 0 0 +273 1 1 0 12.79728 34.47972758017673 0 0 0 0 +274 1 1 0 13.50824 35.711146422325896 0 0 0 0 +275 1 1 0 14.93016 35.711146422325896 0 0 0 0 +276 1 1 0 15.64112 34.47972758017673 0 0 0 0 +277 1 1 0 12.79728 36.94256526447507 0 0 0 0 +278 1 1 0 13.50824 38.17398410662424 0 0 0 0 +279 1 1 0 14.93016 38.17398410662424 0 0 0 0 +280 1 1 0 15.64112 36.94256526447507 0 0 0 0 +281 1 1 0 12.79728 39.40540294877341 0 0 0 0 +282 1 1 0 13.50824 40.636821790922575 0 0 0 0 +283 1 1 0 14.93016 40.636821790922575 0 0 0 0 +284 1 1 0 15.64112 39.40540294877341 0 0 0 0 +285 1 1 0 12.79728 41.86824063307174 0 0 0 0 +286 1 1 0 13.50824 43.09965947522091 0 0 0 0 +287 1 1 0 14.93016 43.09965947522091 0 0 0 0 +288 1 1 0 15.64112 41.86824063307174 0 0 0 0 +345 1 1 0 17.06304 34.47972758017673 0 0 0 0 +349 1 1 0 17.06304 36.94256526447507 0 0 0 0 +353 1 1 0 17.06304 39.40540294877341 0 0 0 0 +357 1 1 0 17.06304 41.86824063307174 0 0 0 0 +290 1 1 0 17.774 1.231418842149169 0 0 0 0 +291 1 1 0 19.19592 1.231418842149169 0 0 0 0 +292 1 1 0 19.90688 0 0 0 0 0 +294 1 1 0 17.774 3.694256526447507 0 0 0 0 +295 1 1 0 19.19592 3.694256526447507 0 0 0 0 +296 1 1 0 19.90688 2.462837684298338 0 0 0 0 +298 1 1 0 17.774 6.157094210745845 0 0 0 0 +299 1 1 0 19.19592 6.157094210745845 0 0 0 0 +300 1 1 0 19.90688 4.925675368596676 0 0 0 0 +302 1 1 0 17.774 8.619931895044184 0 0 0 0 +303 1 1 0 19.19592 8.619931895044184 0 0 0 0 +304 1 1 0 19.90688 7.388513052895014 0 0 0 0 +308 1 1 0 19.90688 9.851350737193352 0 0 0 0 +361 1 1 0 21.3288 0 0 0 0 0 +362 1 1 0 22.03976 1.231418842149169 0 0 0 0 +365 1 1 0 21.3288 2.462837684298338 0 0 0 0 +366 1 1 0 22.03976 3.694256526447507 0 0 0 0 +369 1 1 0 21.3288 4.925675368596676 0 0 0 0 +370 1 1 0 22.03976 6.157094210745845 0 0 0 0 +373 1 1 0 21.3288 7.388513052895014 0 0 0 0 +374 1 1 0 22.03976 8.619931895044184 0 0 0 0 +377 1 1 0 21.3288 9.851350737193352 0 0 0 0 +306 1 1 0 17.774 11.082769579342521 0 0 0 0 +307 1 1 0 19.19592 11.082769579342521 0 0 0 0 +310 1 1 0 17.774 13.545607263640859 0 0 0 0 +311 1 1 0 19.19592 13.545607263640859 0 0 0 0 +312 1 1 0 19.90688 12.31418842149169 0 0 0 0 +314 1 1 0 17.774 16.008444947939196 0 0 0 0 +315 1 1 0 19.19592 16.008444947939196 0 0 0 0 +316 1 1 0 19.90688 14.777026105790029 0 0 0 0 +318 1 1 0 17.774 18.471282632237532 0 0 0 0 +319 1 1 0 19.19592 18.471282632237532 0 0 0 0 +320 1 1 0 19.90688 17.239863790088364 0 0 0 0 +322 1 1 0 17.774 20.93412031653587 0 0 0 0 +323 1 1 0 19.19592 20.93412031653587 0 0 0 0 +324 1 1 0 19.90688 19.702701474386703 0 0 0 0 +378 1 1 0 22.03976 11.082769579342521 0 0 0 0 +381 1 1 0 21.3288 12.31418842149169 0 0 0 0 +382 1 1 0 22.03976 13.545607263640859 0 0 0 0 +385 1 1 0 21.3288 14.777026105790029 0 0 0 0 +386 1 1 0 22.03976 16.008444947939196 0 0 0 0 +389 1 1 0 21.3288 17.239863790088364 0 0 0 0 +390 1 1 0 22.03976 18.471282632237532 0 0 0 0 +393 1 1 0 21.3288 19.702701474386703 0 0 0 0 +394 1 1 0 22.03976 20.93412031653587 0 0 0 0 +326 1 1 0 17.774 23.39695800083421 0 0 0 0 +327 1 1 0 19.19592 23.39695800083421 0 0 0 0 +328 1 1 0 19.90688 22.165539158685043 0 0 0 0 +330 1 1 0 17.774 25.859795685132546 0 0 0 0 +331 1 1 0 19.19592 25.859795685132546 0 0 0 0 +332 1 1 0 19.90688 24.62837684298338 0 0 0 0 +334 1 1 0 17.774 28.322633369430886 0 0 0 0 +335 1 1 0 19.19592 28.322633369430886 0 0 0 0 +336 1 1 0 19.90688 27.091214527281718 0 0 0 0 +338 1 1 0 17.774 30.785471053729225 0 0 0 0 +339 1 1 0 19.19592 30.785471053729225 0 0 0 0 +340 1 1 0 19.90688 29.554052211580057 0 0 0 0 +344 1 1 0 19.90688 32.01688989587839 0 0 0 0 +397 1 1 0 21.3288 22.165539158685043 0 0 0 0 +398 1 1 0 22.03976 23.39695800083421 0 0 0 0 +401 1 1 0 21.3288 24.62837684298338 0 0 0 0 +402 1 1 0 22.03976 25.859795685132546 0 0 0 0 +405 1 1 0 21.3288 27.091214527281718 0 0 0 0 +406 1 1 0 22.03976 28.322633369430886 0 0 0 0 +409 1 1 0 21.3288 29.554052211580057 0 0 0 0 +410 1 1 0 22.03976 30.785471053729225 0 0 0 0 +413 1 1 0 21.3288 32.01688989587839 0 0 0 0 +342 1 1 0 17.774 33.24830873802756 0 0 0 0 +343 1 1 0 19.19592 33.24830873802756 0 0 0 0 +346 1 1 0 17.774 35.711146422325896 0 0 0 0 +347 1 1 0 19.19592 35.711146422325896 0 0 0 0 +348 1 1 0 19.90688 34.47972758017673 0 0 0 0 +350 1 1 0 17.774 38.17398410662424 0 0 0 0 +351 1 1 0 19.19592 38.17398410662424 0 0 0 0 +352 1 1 0 19.90688 36.94256526447507 0 0 0 0 +354 1 1 0 17.774 40.636821790922575 0 0 0 0 +355 1 1 0 19.19592 40.636821790922575 0 0 0 0 +356 1 1 0 19.90688 39.40540294877341 0 0 0 0 +358 1 1 0 17.774 43.09965947522091 0 0 0 0 +359 1 1 0 19.19592 43.09965947522091 0 0 0 0 +360 1 1 0 19.90688 41.86824063307174 0 0 0 0 +414 1 1 0 22.03976 33.24830873802756 0 0 0 0 +417 1 1 0 21.3288 34.47972758017673 0 0 0 0 +418 1 1 0 22.03976 35.711146422325896 0 0 0 0 +421 1 1 0 21.3288 36.94256526447507 0 0 0 0 +422 1 1 0 22.03976 38.17398410662424 0 0 0 0 +425 1 1 0 21.3288 39.40540294877341 0 0 0 0 +426 1 1 0 22.03976 40.636821790922575 0 0 0 0 +429 1 1 0 21.3288 41.86824063307174 0 0 0 0 +430 1 1 0 22.03976 43.09965947522091 0 0 0 0 +363 1 1 0 23.46168 1.231418842149169 0 0 0 0 +364 1 1 0 24.17264 0 0 0 0 0 +367 1 1 0 23.46168 3.694256526447507 0 0 0 0 +368 1 1 0 24.17264 2.462837684298338 0 0 0 0 +371 1 1 0 23.46168 6.157094210745845 0 0 0 0 +372 1 1 0 24.17264 4.925675368596676 0 0 0 0 +375 1 1 0 23.46168 8.619931895044184 0 0 0 0 +376 1 1 0 24.17264 7.388513052895014 0 0 0 0 +380 1 1 0 24.17264 9.851350737193352 0 0 0 0 +433 1 1 0 25.59456 0 0 0 0 0 +434 1 1 0 26.30552 1.231418842149169 0 0 0 0 +435 1 1 0 27.72744 1.231418842149169 0 0 0 0 +436 1 1 0 28.4384 0 0 0 0 0 +437 1 1 0 25.59456 2.462837684298338 0 0 0 0 +438 1 1 0 26.30552 3.694256526447507 0 0 0 0 +439 1 1 0 27.72744 3.694256526447507 0 0 0 0 +440 1 1 0 28.4384 2.462837684298338 0 0 0 0 +441 1 1 0 25.59456 4.925675368596676 0 0 0 0 +442 1 1 0 26.30552 6.157094210745845 0 0 0 0 +443 1 1 0 27.72744 6.157094210745845 0 0 0 0 +444 1 1 0 28.4384 4.925675368596676 0 0 0 0 +445 1 1 0 25.59456 7.388513052895014 0 0 0 0 +446 1 1 0 26.30552 8.619931895044184 0 0 0 0 +447 1 1 0 27.72744 8.619931895044184 0 0 0 0 +448 1 1 0 28.4384 7.388513052895014 0 0 0 0 +449 1 1 0 25.59456 9.851350737193352 0 0 0 0 +452 1 1 0 28.4384 9.851350737193352 0 0 0 0 +824 2 3 0.5564 27.869304504728962 5.441231954072771 7.1662725516060455 0 1 0 +882 2 3 0.5564 28.591049353698207 2.8104183869168513 5.199459350263634 0 1 0 +915 2 3 0.5564 28.292441133424674 2.1988836940092424 7.463258849755662 0 1 0 +839 2 3 0.5564 26.910290112042958 6.063448035194025 5.063585745298239 0 1 0 +880 2 2 -1.1128 28.406942326033935 2.7991510311135688 4.260199050138843 0 1 0 +897 2 3 0.5564 27.747536325556545 1.2206385238286348 3.5735630764050397 0 1 0 +881 2 3 0.5564 29.245437925664305 3.008615335710485 3.848759968343325 0 1 0 +840 2 3 0.5564 27.732306784723644 4.9179177154124885 4.512269230492448 0 1 0 +823 2 2 -1.1128 27.744982568298607 4.921082089542739 7.960138430480629 0 1 0 +825 2 3 0.5564 28.164684169862443 5.433634827582471 8.651059816127074 0 1 0 +838 2 2 -1.1128 27.618723311223718 5.461577610249769 5.291862125144689 0 1 0 +918 2 3 0.5564 29.02685745449238 0.37211643590853727 5.955025086554165 0 1 0 +895 2 2 -1.1128 27.54700508575224 0.3218588761159764 3.312383533998835 0 1 0 +913 2 2 -1.1128 28.964145363419156 1.767681453892013 6.93494944041131 0 1 0 +896 2 3 0.5564 26.73803217297322 0.39396829884754553 2.8058305738430946 0 1 0 +379 1 1 0 23.46168 11.082769579342521 0 0 0 0 +383 1 1 0 23.46168 13.545607263640859 0 0 0 0 +384 1 1 0 24.17264 12.31418842149169 0 0 0 0 +387 1 1 0 23.46168 16.008444947939196 0 0 0 0 +388 1 1 0 24.17264 14.777026105790029 0 0 0 0 +391 1 1 0 23.46168 18.471282632237532 0 0 0 0 +392 1 1 0 24.17264 17.239863790088364 0 0 0 0 +395 1 1 0 23.46168 20.93412031653587 0 0 0 0 +396 1 1 0 24.17264 19.702701474386703 0 0 0 0 +450 1 1 0 26.30552 11.082769579342521 0 0 0 0 +451 1 1 0 27.72744 11.082769579342521 0 0 0 0 +453 1 1 0 25.59456 12.31418842149169 0 0 0 0 +454 1 1 0 26.30552 13.545607263640859 0 0 0 0 +455 1 1 0 27.72744 13.545607263640859 0 0 0 0 +456 1 1 0 28.4384 12.31418842149169 0 0 0 0 +457 1 1 0 25.59456 14.777026105790029 0 0 0 0 +458 1 1 0 26.30552 16.008444947939196 0 0 0 0 +459 1 1 0 27.72744 16.008444947939196 0 0 0 0 +460 1 1 0 28.4384 14.777026105790029 0 0 0 0 +461 1 1 0 25.59456 17.239863790088364 0 0 0 0 +462 1 1 0 26.30552 18.471282632237532 0 0 0 0 +463 1 1 0 27.72744 18.471282632237532 0 0 0 0 +464 1 1 0 28.4384 17.239863790088364 0 0 0 0 +465 1 1 0 25.59456 19.702701474386703 0 0 0 0 +466 1 1 0 26.30552 20.93412031653587 0 0 0 0 +467 1 1 0 27.72744 20.93412031653587 0 0 0 0 +468 1 1 0 28.4384 19.702701474386703 0 0 0 0 +399 1 1 0 23.46168 23.39695800083421 0 0 0 0 +400 1 1 0 24.17264 22.165539158685043 0 0 0 0 +403 1 1 0 23.46168 25.859795685132546 0 0 0 0 +404 1 1 0 24.17264 24.62837684298338 0 0 0 0 +407 1 1 0 23.46168 28.322633369430886 0 0 0 0 +408 1 1 0 24.17264 27.091214527281718 0 0 0 0 +411 1 1 0 23.46168 30.785471053729225 0 0 0 0 +412 1 1 0 24.17264 29.554052211580057 0 0 0 0 +416 1 1 0 24.17264 32.01688989587839 0 0 0 0 +469 1 1 0 25.59456 22.165539158685043 0 0 0 0 +470 1 1 0 26.30552 23.39695800083421 0 0 0 0 +471 1 1 0 27.72744 23.39695800083421 0 0 0 0 +472 1 1 0 28.4384 22.165539158685043 0 0 0 0 +473 1 1 0 25.59456 24.62837684298338 0 0 0 0 +474 1 1 0 26.30552 25.859795685132546 0 0 0 0 +475 1 1 0 27.72744 25.859795685132546 0 0 0 0 +476 1 1 0 28.4384 24.62837684298338 0 0 0 0 +477 1 1 0 25.59456 27.091214527281718 0 0 0 0 +478 1 1 0 26.30552 28.322633369430886 0 0 0 0 +479 1 1 0 27.72744 28.322633369430886 0 0 0 0 +480 1 1 0 28.4384 27.091214527281718 0 0 0 0 +481 1 1 0 25.59456 29.554052211580057 0 0 0 0 +482 1 1 0 26.30552 30.785471053729225 0 0 0 0 +483 1 1 0 27.72744 30.785471053729225 0 0 0 0 +484 1 1 0 28.4384 29.554052211580057 0 0 0 0 +485 1 1 0 25.59456 32.01688989587839 0 0 0 0 +488 1 1 0 28.4384 32.01688989587839 0 0 0 0 +415 1 1 0 23.46168 33.24830873802756 0 0 0 0 +419 1 1 0 23.46168 35.711146422325896 0 0 0 0 +420 1 1 0 24.17264 34.47972758017673 0 0 0 0 +423 1 1 0 23.46168 38.17398410662424 0 0 0 0 +424 1 1 0 24.17264 36.94256526447507 0 0 0 0 +427 1 1 0 23.46168 40.636821790922575 0 0 0 0 +428 1 1 0 24.17264 39.40540294877341 0 0 0 0 +431 1 1 0 23.46168 43.09965947522091 0 0 0 0 +432 1 1 0 24.17264 41.86824063307174 0 0 0 0 +486 1 1 0 26.30552 33.24830873802756 0 0 0 0 +487 1 1 0 27.72744 33.24830873802756 0 0 0 0 +489 1 1 0 25.59456 34.47972758017673 0 0 0 0 +490 1 1 0 26.30552 35.711146422325896 0 0 0 0 +491 1 1 0 27.72744 35.711146422325896 0 0 0 0 +492 1 1 0 28.4384 34.47972758017673 0 0 0 0 +493 1 1 0 25.59456 36.94256526447507 0 0 0 0 +494 1 1 0 26.30552 38.17398410662424 0 0 0 0 +495 1 1 0 27.72744 38.17398410662424 0 0 0 0 +496 1 1 0 28.4384 36.94256526447507 0 0 0 0 +497 1 1 0 25.59456 39.40540294877341 0 0 0 0 +498 1 1 0 26.30552 40.636821790922575 0 0 0 0 +499 1 1 0 27.72744 40.636821790922575 0 0 0 0 +500 1 1 0 28.4384 39.40540294877341 0 0 0 0 +501 1 1 0 25.59456 41.86824063307174 0 0 0 0 +502 1 1 0 26.30552 43.09965947522091 0 0 0 0 +503 1 1 0 27.72744 43.09965947522091 0 0 0 0 +504 1 1 0 28.4384 41.86824063307174 0 0 0 0 +916 2 2 -1.1128 29.08618298573557 43.94947838758336 5.367978087245454 0 0 0 +917 2 3 0.5564 28.386514599822995 44.08700021343198 4.729397955617813 0 0 0 +505 1 1 0 29.86032 0 0 0 0 0 +506 1 1 0 30.57128 1.231418842149169 0 0 0 0 +507 1 1 0 31.9932 1.231418842149169 0 0 0 0 +508 1 1 0 32.70416 0 0 0 0 0 +509 1 1 0 29.86032 2.462837684298338 0 0 0 0 +510 1 1 0 30.57128 3.694256526447507 0 0 0 0 +511 1 1 0 31.9932 3.694256526447507 0 0 0 0 +512 1 1 0 32.70416 2.462837684298338 0 0 0 0 +513 1 1 0 29.86032 4.925675368596676 0 0 0 0 +514 1 1 0 30.57128 6.157094210745845 0 0 0 0 +515 1 1 0 31.9932 6.157094210745845 0 0 0 0 +516 1 1 0 32.70416 4.925675368596676 0 0 0 0 +517 1 1 0 29.86032 7.388513052895014 0 0 0 0 +518 1 1 0 30.57128 8.619931895044184 0 0 0 0 +519 1 1 0 31.9932 8.619931895044184 0 0 0 0 +520 1 1 0 32.70416 7.388513052895014 0 0 0 0 +521 1 1 0 29.86032 9.851350737193352 0 0 0 0 +524 1 1 0 32.70416 9.851350737193352 0 0 0 0 +577 1 1 0 34.12608 0 0 0 0 0 +578 1 1 0 34.83704 1.231418842149169 0 0 0 0 +581 1 1 0 34.12608 2.462837684298338 0 0 0 0 +582 1 1 0 34.83704 3.694256526447507 0 0 0 0 +585 1 1 0 34.12608 4.925675368596676 0 0 0 0 +586 1 1 0 34.83704 6.157094210745845 0 0 0 0 +589 1 1 0 34.12608 7.388513052895014 0 0 0 0 +590 1 1 0 34.83704 8.619931895044184 0 0 0 0 +593 1 1 0 34.12608 9.851350737193352 0 0 0 0 +817 2 2 -1.1128 32.95909328018726 1.6637108808053531 5.668801991409098 0 1 0 +934 2 2 -1.1128 33.03662922860542 5.539750355496759 3.4106598806856026 0 1 0 +844 2 2 -1.1128 32.621956673723574 8.462510491174692 3.097685137766835 0 1 0 +865 2 2 -1.1128 33.39821533005053 4.27658110246568 8.57211051291085 0 1 0 +926 2 3 0.5564 34.92704311330822 0.3845425638438278 3.265292528280904 0 1 0 +936 2 3 0.5564 33.75132011550044 5.390752767402144 2.7915877722683704 0 1 0 +845 2 3 0.5564 32.95333393700144 7.6062659773288255 3.3683635070864155 0 1 0 +819 2 3 0.5564 32.7762889404034 1.1154582070700432 4.905758051766679 0 1 0 +884 2 3 0.5564 34.37559715270682 2.4504450164493186 4.161687719751862 0 1 0 +928 2 2 -1.1128 31.427550994207557 2.4943780016602988 7.958560374626963 0 1 0 +832 2 2 -1.1128 30.792128585762608 3.236529264630232 3.148554951507026 0 1 0 +866 2 3 0.5564 33.498279431301086 5.15245480897742 8.94502756132422 0 1 0 +879 2 3 0.5564 31.732225644992504 0.6458474538482556 8.445047264076692 0 1 0 +929 2 3 0.5564 31.77966866913706 2.4458814443480152 7.069800530214144 0 1 0 +935 2 3 0.5564 33.378544384335676 5.232733920405251 4.250343211939568 0 1 0 +909 2 3 0.5564 34.652364031673926 9.711776039203794 3.0913066271420564 0 1 0 +846 2 3 0.5564 31.81206671515871 8.574696009442315 3.595405469907686 0 1 0 +867 2 3 0.5564 34.29090448110653 3.9354082288573955 8.517893415156758 0 1 0 +914 2 3 0.5564 29.77283350609241 1.883495478021958 7.433793196056744 0 1 0 +818 2 3 0.5564 33.45847517590033 1.097384085601532 6.25712553579729 0 1 0 +793 2 2 -1.1128 31.42830690864691 0.30749748676379024 3.451602894838017 0 1 0 +833 2 3 0.5564 31.524189385665945 3.8525231665567263 3.17806031753671 0 1 0 +834 2 3 0.5564 31.198864521440843 2.3888322887806708 2.969088763806106 0 1 0 +930 2 3 0.5564 31.832512681924495 3.2758254964154077 8.334829251422462 0 1 0 +883 2 2 -1.1128 35.06386221461597 2.1652239249670107 3.56071142612891 0 1 0 +794 2 3 0.5564 31.07805011932854 0.1628051877054162 2.572616093573198 0 1 0 +795 2 3 0.5564 30.711778331953756 0.06543858818245951 4.038311517945166 0 1 0 +522 1 1 0 30.57128 11.082769579342521 0 0 0 0 +523 1 1 0 31.9932 11.082769579342521 0 0 0 0 +525 1 1 0 29.86032 12.31418842149169 0 0 0 0 +526 1 1 0 30.57128 13.545607263640859 0 0 0 0 +527 1 1 0 31.9932 13.545607263640859 0 0 0 0 +528 1 1 0 32.70416 12.31418842149169 0 0 0 0 +529 1 1 0 29.86032 14.777026105790029 0 0 0 0 +530 1 1 0 30.57128 16.008444947939196 0 0 0 0 +531 1 1 0 31.9932 16.008444947939196 0 0 0 0 +532 1 1 0 32.70416 14.777026105790029 0 0 0 0 +533 1 1 0 29.86032 17.239863790088364 0 0 0 0 +534 1 1 0 30.57128 18.471282632237532 0 0 0 0 +535 1 1 0 31.9932 18.471282632237532 0 0 0 0 +536 1 1 0 32.70416 17.239863790088364 0 0 0 0 +537 1 1 0 29.86032 19.702701474386703 0 0 0 0 +538 1 1 0 30.57128 20.93412031653587 0 0 0 0 +539 1 1 0 31.9932 20.93412031653587 0 0 0 0 +540 1 1 0 32.70416 19.702701474386703 0 0 0 0 +594 1 1 0 34.83704 11.082769579342521 0 0 0 0 +597 1 1 0 34.12608 12.31418842149169 0 0 0 0 +598 1 1 0 34.83704 13.545607263640859 0 0 0 0 +601 1 1 0 34.12608 14.777026105790029 0 0 0 0 +602 1 1 0 34.83704 16.008444947939196 0 0 0 0 +605 1 1 0 34.12608 17.239863790088364 0 0 0 0 +606 1 1 0 34.83704 18.471282632237532 0 0 0 0 +609 1 1 0 34.12608 19.702701474386703 0 0 0 0 +610 1 1 0 34.83704 20.93412031653587 0 0 0 0 +541 1 1 0 29.86032 22.165539158685043 0 0 0 0 +542 1 1 0 30.57128 23.39695800083421 0 0 0 0 +543 1 1 0 31.9932 23.39695800083421 0 0 0 0 +544 1 1 0 32.70416 22.165539158685043 0 0 0 0 +545 1 1 0 29.86032 24.62837684298338 0 0 0 0 +546 1 1 0 30.57128 25.859795685132546 0 0 0 0 +547 1 1 0 31.9932 25.859795685132546 0 0 0 0 +548 1 1 0 32.70416 24.62837684298338 0 0 0 0 +549 1 1 0 29.86032 27.091214527281718 0 0 0 0 +550 1 1 0 30.57128 28.322633369430886 0 0 0 0 +551 1 1 0 31.9932 28.322633369430886 0 0 0 0 +552 1 1 0 32.70416 27.091214527281718 0 0 0 0 +553 1 1 0 29.86032 29.554052211580057 0 0 0 0 +554 1 1 0 30.57128 30.785471053729225 0 0 0 0 +555 1 1 0 31.9932 30.785471053729225 0 0 0 0 +556 1 1 0 32.70416 29.554052211580057 0 0 0 0 +557 1 1 0 29.86032 32.01688989587839 0 0 0 0 +560 1 1 0 32.70416 32.01688989587839 0 0 0 0 +613 1 1 0 34.12608 22.165539158685043 0 0 0 0 +614 1 1 0 34.83704 23.39695800083421 0 0 0 0 +617 1 1 0 34.12608 24.62837684298338 0 0 0 0 +618 1 1 0 34.83704 25.859795685132546 0 0 0 0 +621 1 1 0 34.12608 27.091214527281718 0 0 0 0 +622 1 1 0 34.83704 28.322633369430886 0 0 0 0 +625 1 1 0 34.12608 29.554052211580057 0 0 0 0 +626 1 1 0 34.83704 30.785471053729225 0 0 0 0 +629 1 1 0 34.12608 32.01688989587839 0 0 0 0 +558 1 1 0 30.57128 33.24830873802756 0 0 0 0 +559 1 1 0 31.9932 33.24830873802756 0 0 0 0 +561 1 1 0 29.86032 34.47972758017673 0 0 0 0 +562 1 1 0 30.57128 35.711146422325896 0 0 0 0 +563 1 1 0 31.9932 35.711146422325896 0 0 0 0 +564 1 1 0 32.70416 34.47972758017673 0 0 0 0 +565 1 1 0 29.86032 36.94256526447507 0 0 0 0 +566 1 1 0 30.57128 38.17398410662424 0 0 0 0 +567 1 1 0 31.9932 38.17398410662424 0 0 0 0 +568 1 1 0 32.70416 36.94256526447507 0 0 0 0 +569 1 1 0 29.86032 39.40540294877341 0 0 0 0 +570 1 1 0 30.57128 40.636821790922575 0 0 0 0 +571 1 1 0 31.9932 40.636821790922575 0 0 0 0 +572 1 1 0 32.70416 39.40540294877341 0 0 0 0 +573 1 1 0 29.86032 41.86824063307174 0 0 0 0 +574 1 1 0 30.57128 43.09965947522091 0 0 0 0 +575 1 1 0 31.9932 43.09965947522091 0 0 0 0 +576 1 1 0 32.70416 41.86824063307174 0 0 0 0 +630 1 1 0 34.83704 33.24830873802756 0 0 0 0 +633 1 1 0 34.12608 34.47972758017673 0 0 0 0 +634 1 1 0 34.83704 35.711146422325896 0 0 0 0 +637 1 1 0 34.12608 36.94256526447507 0 0 0 0 +638 1 1 0 34.83704 38.17398410662424 0 0 0 0 +641 1 1 0 34.12608 39.40540294877341 0 0 0 0 +642 1 1 0 34.83704 40.636821790922575 0 0 0 0 +645 1 1 0 34.12608 41.86824063307174 0 0 0 0 +646 1 1 0 34.83704 43.09965947522091 0 0 0 0 +857 2 3 0.5564 31.280093348563454 40.92413736707893 6.6129915041108855 0 0 0 +856 2 2 -1.1128 31.40625202155322 40.21708321945418 7.245756851263454 0 0 0 +892 2 2 -1.1128 31.44124789790012 42.595258440016934 5.939207128004798 0 0 0 +893 2 3 0.5564 31.51332483392942 42.86716514991827 6.854141078427132 0 0 0 +886 2 2 -1.1128 34.01903467331608 42.21640858508662 5.249166944042416 0 0 0 +828 2 3 0.5564 32.936087243922984 39.01715292261755 6.258330984602254 0 0 0 +887 2 3 0.5564 33.06416149038681 42.23692223473913 5.31266208454256 0 0 0 +826 2 2 -1.1128 33.39528676861921 38.50985593645892 5.588989616608882 0 0 0 +827 2 3 0.5564 32.73225698170465 37.911697838992474 5.244270601582248 0 0 0 +894 2 3 0.5564 30.602363734473947 42.95262718865609 5.648014222802151 0 0 0 +925 2 2 -1.1128 34.84802945499661 43.76986891444704 3.140612646843307 0 0 0 +858 2 3 0.5564 30.675738345874993 40.309216087673825 7.857389270234698 0 0 0 +878 2 3 0.5564 32.99974881977633 44.200178456643876 8.15878411943684 0 0 0 +812 2 3 0.5564 34.62910581051034 43.605123868773425 6.411277828859756 0 0 0 +927 2 3 0.5564 34.27329532640793 43.48151669199635 3.849673061844464 0 0 0 +888 2 3 0.5564 34.21818732626533 41.3445338672516 4.907982839354571 0 0 0 +877 2 2 -1.1128 32.10811143071273 44.09784681673461 8.491565398531655 0 0 0 +835 2 2 -1.1128 35.185759286779124 40.039097016824876 3.8999166884707246 0 0 0 +811 2 2 -1.1128 34.72988962100261 44.30600404203223 7.05535990375944 0 0 0 +837 2 3 0.5564 34.873780058275806 39.29804634363621 4.419289163091052 0 0 0 +579 1 1 0 36.25896 1.231418842149169 0 0 0 0 +580 1 1 0 36.96992 0 0 0 0 0 +583 1 1 0 36.25896 3.694256526447507 0 0 0 0 +584 1 1 0 36.96992 2.462837684298338 0 0 0 0 +587 1 1 0 36.25896 6.157094210745845 0 0 0 0 +588 1 1 0 36.96992 4.925675368596676 0 0 0 0 +591 1 1 0 36.25896 8.619931895044184 0 0 0 0 +592 1 1 0 36.96992 7.388513052895014 0 0 0 0 +596 1 1 0 36.96992 9.851350737193352 0 0 0 0 +649 1 1 0 38.39184 0 0 0 0 0 +650 1 1 0 39.1028 1.231418842149169 0 0 0 0 +651 1 1 0 40.52472 1.231418842149169 0 0 0 0 +653 1 1 0 38.39184 2.462837684298338 0 0 0 0 +654 1 1 0 39.1028 3.694256526447507 0 0 0 0 +655 1 1 0 40.52472 3.694256526447507 0 0 0 0 +657 1 1 0 38.39184 4.925675368596676 0 0 0 0 +658 1 1 0 39.1028 6.157094210745845 0 0 0 0 +659 1 1 0 40.52472 6.157094210745845 0 0 0 0 +661 1 1 0 38.39184 7.388513052895014 0 0 0 0 +662 1 1 0 39.1028 8.619931895044184 0 0 0 0 +663 1 1 0 40.52472 8.619931895044184 0 0 0 0 +665 1 1 0 38.39184 9.851350737193352 0 0 0 0 +864 2 3 0.5564 38.72559977454883 6.453140217896254 3.9654022350817373 0 1 0 +885 2 3 0.5564 35.86457499683829 2.187926621046695 4.084712133041518 0 1 0 +891 2 3 0.5564 36.49290196320123 4.5825554857830815 2.340280303271688 0 1 0 +905 2 3 0.5564 35.6539726734068 6.533533581961909 4.2226103514317215 0 1 0 +847 2 2 -1.1128 38.31073636731568 9.297637163461909 3.018631746447206 0 1 0 +807 2 3 0.5564 39.93839438218238 3.380787594401584 8.070189977397536 0 1 0 +842 2 3 0.5564 40.4439801215969 3.4539357982168974 5.874913654515922 0 1 0 +806 2 3 0.5564 39.53388614087088 1.9224662216249124 8.030602383511098 0 1 0 +841 2 2 -1.1128 40.346631074078815 3.161275558289171 4.968764399811248 0 1 0 +848 2 3 0.5564 37.378243475312125 9.509492777618444 2.9761304825701878 0 1 0 +805 2 2 -1.1128 39.1879363509718 2.799773990143194 8.194559951043354 0 1 0 +862 2 2 -1.1128 39.527254402566676 6.871055409294266 3.6508699018474053 0 1 0 +808 2 2 -1.1128 40.9813125028353 6.491622655244695 6.1252186603712815 0 1 0 +863 2 3 0.5564 39.2982209112595 7.796620838566813 3.566577577839523 0 1 0 +906 2 3 0.5564 35.63016556188961 6.980217848903836 5.668916912294608 0 1 0 +803 2 3 0.5564 37.21046144155504 3.3547056748419672 8.44685444624274 0 1 0 +820 2 2 -1.1128 40.238058884519425 8.892908109209923 7.228256282347458 0 1 0 +813 2 3 0.5564 35.66411242895095 0.1828007460118728 7.039625445693748 0 1 0 +830 2 3 0.5564 37.461900361164744 5.761054225296827 7.339683551589981 0 1 0 +809 2 3 0.5564 40.143388183992 6.666539751684856 5.6968272273146985 0 1 0 +849 2 3 0.5564 38.545146461582334 9.064870760768706 2.1202418370825424 0 1 0 +814 2 2 -1.1128 40.748134171936435 0.7389880780512781 3.3949349561238815 0 1 0 +816 2 3 0.5564 40.34138668782936 1.5417691543993164 3.7210197692903493 0 1 0 +933 2 3 0.5564 38.42845468599284 3.199245505203782 4.980786350179616 0 1 0 +932 2 3 0.5564 37.36968971559904 3.309266240641299 6.057265875709786 0 1 0 +802 2 2 -1.1128 36.25679030038503 3.29601481677218 8.38941777770298 0 1 0 +931 2 2 -1.1128 37.542384613917065 2.9133905650069245 5.203046413341369 0 1 0 +907 2 2 -1.1128 35.578884551020806 9.573590646940167 3.2880229990945917 0 1 0 +831 2 3 0.5564 36.268287811817636 4.832138094401851 7.27407174097549 0 1 0 +804 2 3 0.5564 36.035479013673445 2.501960846901915 8.875969191698895 0 1 0 +904 2 2 -1.1128 35.40021179318659 7.265609687237741 4.784662067802107 0 1 0 +829 2 2 -1.1128 36.67463142628169 5.575159558617119 6.8279361567305 0 1 0 +890 2 3 0.5564 35.51445085753465 3.6096863189422184 2.96322151266684 0 1 0 +919 2 2 -1.1128 40.013239321978745 0.15668706717705305 7.440776242049551 0 1 0 +908 2 3 0.5564 35.58368296090604 8.875183376627756 3.9425735956748125 0 1 0 +800 2 3 0.5564 37.74677816296982 0.734680968209546 5.402507033516551 0 1 0 +859 2 2 -1.1128 40.622879392981964 10.272720036648469 4.720042613666213 0 1 0 +861 2 3 0.5564 39.78296055209543 10.382230179324548 4.274198380882334 0 1 0 +889 2 2 -1.1128 35.68276124895589 4.5449882413929235 2.8487022953494807 0 1 0 +860 2 3 0.5564 40.42792864795578 9.700111278266009 5.461896012943214 0 1 0 +822 2 3 0.5564 40.522133068490525 8.019471778966093 6.958729128356608 0 1 0 +821 2 3 0.5564 40.47731496825091 8.948235047845442 8.153419981025246 0 1 0 +595 1 1 0 36.25896 11.082769579342521 0 0 0 0 +599 1 1 0 36.25896 13.545607263640859 0 0 0 0 +600 1 1 0 36.96992 12.31418842149169 0 0 0 0 +603 1 1 0 36.25896 16.008444947939196 0 0 0 0 +604 1 1 0 36.96992 14.777026105790029 0 0 0 0 +607 1 1 0 36.25896 18.471282632237532 0 0 0 0 +608 1 1 0 36.96992 17.239863790088364 0 0 0 0 +611 1 1 0 36.25896 20.93412031653587 0 0 0 0 +612 1 1 0 36.96992 19.702701474386703 0 0 0 0 +666 1 1 0 39.1028 11.082769579342521 0 0 0 0 +667 1 1 0 40.52472 11.082769579342521 0 0 0 0 +669 1 1 0 38.39184 12.31418842149169 0 0 0 0 +670 1 1 0 39.1028 13.545607263640859 0 0 0 0 +671 1 1 0 40.52472 13.545607263640859 0 0 0 0 +673 1 1 0 38.39184 14.777026105790029 0 0 0 0 +674 1 1 0 39.1028 16.008444947939196 0 0 0 0 +675 1 1 0 40.52472 16.008444947939196 0 0 0 0 +677 1 1 0 38.39184 17.239863790088364 0 0 0 0 +678 1 1 0 39.1028 18.471282632237532 0 0 0 0 +679 1 1 0 40.52472 18.471282632237532 0 0 0 0 +681 1 1 0 38.39184 19.702701474386703 0 0 0 0 +682 1 1 0 39.1028 20.93412031653587 0 0 0 0 +683 1 1 0 40.52472 20.93412031653587 0 0 0 0 +615 1 1 0 36.25896 23.39695800083421 0 0 0 0 +616 1 1 0 36.96992 22.165539158685043 0 0 0 0 +619 1 1 0 36.25896 25.859795685132546 0 0 0 0 +620 1 1 0 36.96992 24.62837684298338 0 0 0 0 +623 1 1 0 36.25896 28.322633369430886 0 0 0 0 +624 1 1 0 36.96992 27.091214527281718 0 0 0 0 +627 1 1 0 36.25896 30.785471053729225 0 0 0 0 +628 1 1 0 36.96992 29.554052211580057 0 0 0 0 +632 1 1 0 36.96992 32.01688989587839 0 0 0 0 +685 1 1 0 38.39184 22.165539158685043 0 0 0 0 +686 1 1 0 39.1028 23.39695800083421 0 0 0 0 +687 1 1 0 40.52472 23.39695800083421 0 0 0 0 +689 1 1 0 38.39184 24.62837684298338 0 0 0 0 +690 1 1 0 39.1028 25.859795685132546 0 0 0 0 +691 1 1 0 40.52472 25.859795685132546 0 0 0 0 +693 1 1 0 38.39184 27.091214527281718 0 0 0 0 +694 1 1 0 39.1028 28.322633369430886 0 0 0 0 +695 1 1 0 40.52472 28.322633369430886 0 0 0 0 +697 1 1 0 38.39184 29.554052211580057 0 0 0 0 +698 1 1 0 39.1028 30.785471053729225 0 0 0 0 +699 1 1 0 40.52472 30.785471053729225 0 0 0 0 +701 1 1 0 38.39184 32.01688989587839 0 0 0 0 +631 1 1 0 36.25896 33.24830873802756 0 0 0 0 +635 1 1 0 36.25896 35.711146422325896 0 0 0 0 +636 1 1 0 36.96992 34.47972758017673 0 0 0 0 +639 1 1 0 36.25896 38.17398410662424 0 0 0 0 +640 1 1 0 36.96992 36.94256526447507 0 0 0 0 +643 1 1 0 36.25896 40.636821790922575 0 0 0 0 +644 1 1 0 36.96992 39.40540294877341 0 0 0 0 +647 1 1 0 36.25896 43.09965947522091 0 0 0 0 +648 1 1 0 36.96992 41.86824063307174 0 0 0 0 +702 1 1 0 39.1028 33.24830873802756 0 0 0 0 +703 1 1 0 40.52472 33.24830873802756 0 0 0 0 +705 1 1 0 38.39184 34.47972758017673 0 0 0 0 +706 1 1 0 39.1028 35.711146422325896 0 0 0 0 +707 1 1 0 40.52472 35.711146422325896 0 0 0 0 +709 1 1 0 38.39184 36.94256526447507 0 0 0 0 +710 1 1 0 39.1028 38.17398410662424 0 0 0 0 +711 1 1 0 40.52472 38.17398410662424 0 0 0 0 +713 1 1 0 38.39184 39.40540294877341 0 0 0 0 +714 1 1 0 39.1028 40.636821790922575 0 0 0 0 +715 1 1 0 40.52472 40.636821790922575 0 0 0 0 +717 1 1 0 38.39184 41.86824063307174 0 0 0 0 +718 1 1 0 39.1028 43.09965947522091 0 0 0 0 +719 1 1 0 40.52472 43.09965947522091 0 0 0 0 +801 2 3 0.5564 37.548308436970686 43.56537533039196 5.365704432988823 0 0 0 +852 2 3 0.5564 38.88919502047367 42.042424135970684 3.6087789454249384 0 0 0 +876 2 3 0.5564 36.695468476045846 41.81307318973102 4.654847654027673 0 0 0 +851 2 3 0.5564 39.88056712847529 43.079060421379005 3.124565190962247 0 0 0 +836 2 3 0.5564 35.55710562397264 39.6409654643291 3.11262603757073 0 0 0 +874 2 2 -1.1128 37.156592548770114 42.42602324299549 4.082231251420106 0 0 0 +875 2 3 0.5564 36.4628015962606 42.8541504174728 3.580640511788261 0 0 0 +850 2 2 -1.1128 39.74740412124872 42.13377480969944 3.1948153248505924 0 0 0 +920 2 3 0.5564 40.541519697736526 43.81546496276574 7.010468244614621 0 0 0 +921 2 3 0.5564 39.11034070400223 44.265151888276336 7.21395020009192 0 0 0 +799 2 2 -1.1128 37.54782393045426 44.314597322511524 5.9614390867350435 0 0 0 +652 1 1 0 41.23568 0 0 0 0 0 +656 1 1 0 41.23568 2.462837684298338 0 0 0 0 +660 1 1 0 41.23568 4.925675368596676 0 0 0 0 +664 1 1 0 41.23568 7.388513052895014 0 0 0 0 +668 1 1 0 41.23568 9.851350737193352 0 0 0 0 +721 1 1 0 42.6576 0 0 0 0 0 +722 1 1 0 43.36856 1.231418842149169 0 0 0 0 +723 1 1 0 44.79048 1.231418842149169 0 0 0 0 +724 1 1 0 45.50144 0 0 0 0 0 +725 1 1 0 42.6576 2.462837684298338 0 0 0 0 +726 1 1 0 43.36856 3.694256526447507 0 0 0 0 +727 1 1 0 44.79048 3.694256526447507 0 0 0 0 +728 1 1 0 45.50144 2.462837684298338 0 0 0 0 +729 1 1 0 42.6576 4.925675368596676 0 0 0 0 +730 1 1 0 43.36856 6.157094210745845 0 0 0 0 +731 1 1 0 44.79048 6.157094210745845 0 0 0 0 +732 1 1 0 45.50144 4.925675368596676 0 0 0 0 +733 1 1 0 42.6576 7.388513052895014 0 0 0 0 +734 1 1 0 43.36856 8.619931895044184 0 0 0 0 +735 1 1 0 44.79048 8.619931895044184 0 0 0 0 +736 1 1 0 45.50144 7.388513052895014 0 0 0 0 +737 1 1 0 42.6576 9.851350737193352 0 0 0 0 +740 1 1 0 45.50144 9.851350737193352 0 0 0 0 +855 2 3 0.5564 42.60570890502672 6.754108104519662 3.2778996089299444 0 1 0 +853 2 2 -1.1128 42.099480757637274 5.9504482420758835 3.3966273472818673 0 1 0 +924 2 3 0.5564 42.55717296882286 9.17260477834803 2.5938337966266043 0 1 0 +796 2 2 -1.1128 42.77023484300884 3.2473201847921502 3.212925112248156 0 1 0 +902 2 3 0.5564 42.12839423169956 3.7289140838154062 7.1537282390574495 0 1 0 +903 2 3 0.5564 41.53585251071065 5.1118011663682905 7.322300070785221 0 1 0 +898 2 2 -1.1128 45.445001196506084 2.452551396966245 3.028403472579563 0 1 0 +797 2 3 0.5564 42.58443206962962 4.186306057729107 3.2089115332453373 0 1 0 +798 2 3 0.5564 43.71048122279908 3.189455512069421 3.38269391940839 0 1 0 +810 2 3 0.5564 41.63040595115056 6.5777864583716426 5.427015401612798 0 1 0 +854 2 3 0.5564 41.20236665318539 6.25112336337136 3.5415926908824034 0 1 0 +923 2 3 0.5564 42.32247135813611 9.521352146245636 4.048203548805301 0 1 0 +922 2 2 -1.1128 42.80519254575484 8.918478791891543 3.4827315727519106 0 1 0 +900 2 3 0.5564 45.15285956979833 1.5485234956341212 3.145105564354613 0 1 0 +899 2 3 0.5564 46.07339231136837 2.4105339689072443 2.3075759749099993 0 1 0 +901 2 2 -1.1128 41.44718299707816 4.208196261290198 7.625398774411962 0 1 0 +815 2 3 0.5564 41.32793113560261 1.0321378043039096 2.6919903566852 0 1 0 +843 2 3 0.5564 41.07940607864339 3.567038821973523 4.505483562010162 0 1 0 +672 1 1 0 41.23568 12.31418842149169 0 0 0 0 +676 1 1 0 41.23568 14.777026105790029 0 0 0 0 +680 1 1 0 41.23568 17.239863790088364 0 0 0 0 +684 1 1 0 41.23568 19.702701474386703 0 0 0 0 +738 1 1 0 43.36856 11.082769579342521 0 0 0 0 +739 1 1 0 44.79048 11.082769579342521 0 0 0 0 +741 1 1 0 42.6576 12.31418842149169 0 0 0 0 +742 1 1 0 43.36856 13.545607263640859 0 0 0 0 +743 1 1 0 44.79048 13.545607263640859 0 0 0 0 +744 1 1 0 45.50144 12.31418842149169 0 0 0 0 +745 1 1 0 42.6576 14.777026105790029 0 0 0 0 +746 1 1 0 43.36856 16.008444947939196 0 0 0 0 +747 1 1 0 44.79048 16.008444947939196 0 0 0 0 +748 1 1 0 45.50144 14.777026105790029 0 0 0 0 +749 1 1 0 42.6576 17.239863790088364 0 0 0 0 +750 1 1 0 43.36856 18.471282632237532 0 0 0 0 +751 1 1 0 44.79048 18.471282632237532 0 0 0 0 +752 1 1 0 45.50144 17.239863790088364 0 0 0 0 +753 1 1 0 42.6576 19.702701474386703 0 0 0 0 +754 1 1 0 43.36856 20.93412031653587 0 0 0 0 +755 1 1 0 44.79048 20.93412031653587 0 0 0 0 +756 1 1 0 45.50144 19.702701474386703 0 0 0 0 +688 1 1 0 41.23568 22.165539158685043 0 0 0 0 +692 1 1 0 41.23568 24.62837684298338 0 0 0 0 +696 1 1 0 41.23568 27.091214527281718 0 0 0 0 +700 1 1 0 41.23568 29.554052211580057 0 0 0 0 +704 1 1 0 41.23568 32.01688989587839 0 0 0 0 +757 1 1 0 42.6576 22.165539158685043 0 0 0 0 +758 1 1 0 43.36856 23.39695800083421 0 0 0 0 +759 1 1 0 44.79048 23.39695800083421 0 0 0 0 +760 1 1 0 45.50144 22.165539158685043 0 0 0 0 +761 1 1 0 42.6576 24.62837684298338 0 0 0 0 +762 1 1 0 43.36856 25.859795685132546 0 0 0 0 +763 1 1 0 44.79048 25.859795685132546 0 0 0 0 +764 1 1 0 45.50144 24.62837684298338 0 0 0 0 +765 1 1 0 42.6576 27.091214527281718 0 0 0 0 +766 1 1 0 43.36856 28.322633369430886 0 0 0 0 +767 1 1 0 44.79048 28.322633369430886 0 0 0 0 +768 1 1 0 45.50144 27.091214527281718 0 0 0 0 +769 1 1 0 42.6576 29.554052211580057 0 0 0 0 +770 1 1 0 43.36856 30.785471053729225 0 0 0 0 +771 1 1 0 44.79048 30.785471053729225 0 0 0 0 +772 1 1 0 45.50144 29.554052211580057 0 0 0 0 +773 1 1 0 42.6576 32.01688989587839 0 0 0 0 +776 1 1 0 45.50144 32.01688989587839 0 0 0 0 +708 1 1 0 41.23568 34.47972758017673 0 0 0 0 +712 1 1 0 41.23568 36.94256526447507 0 0 0 0 +716 1 1 0 41.23568 39.40540294877341 0 0 0 0 +720 1 1 0 41.23568 41.86824063307174 0 0 0 0 +774 1 1 0 43.36856 33.24830873802756 0 0 0 0 +775 1 1 0 44.79048 33.24830873802756 0 0 0 0 +777 1 1 0 42.6576 34.47972758017673 0 0 0 0 +778 1 1 0 43.36856 35.711146422325896 0 0 0 0 +779 1 1 0 44.79048 35.711146422325896 0 0 0 0 +780 1 1 0 45.50144 34.47972758017673 0 0 0 0 +781 1 1 0 42.6576 36.94256526447507 0 0 0 0 +782 1 1 0 43.36856 38.17398410662424 0 0 0 0 +783 1 1 0 44.79048 38.17398410662424 0 0 0 0 +784 1 1 0 45.50144 36.94256526447507 0 0 0 0 +785 1 1 0 42.6576 39.40540294877341 0 0 0 0 +786 1 1 0 43.36856 40.636821790922575 0 0 0 0 +787 1 1 0 44.79048 40.636821790922575 0 0 0 0 +788 1 1 0 45.50144 39.40540294877341 0 0 0 0 +789 1 1 0 42.6576 41.86824063307174 0 0 0 0 +790 1 1 0 43.36856 43.09965947522091 0 0 0 0 +791 1 1 0 44.79048 43.09965947522091 0 0 0 0 +792 1 1 0 45.50144 41.86824063307174 0 0 0 0 +871 2 2 -1.1128 42.43621342090696 41.361777660606826 3.5286311215230155 0 0 0 +910 2 2 -1.1128 44.00261269418429 44.009231456650014 3.7548439135777425 0 0 0 +873 2 3 0.5564 42.81116163142683 40.8806399438352 2.7909638607684895 0 0 0 +912 2 3 0.5564 44.01512081357764 43.199784996149646 3.244083663427368 0 0 0 +872 2 3 0.5564 41.50534987825062 41.436128256982094 3.318397554899502 0 0 0 +869 2 3 0.5564 41.92696097428322 42.44540495044042 4.918533220471727 0 0 0 +868 2 2 -1.1128 41.602312218152235 43.15319449082845 5.475195560073079 0 0 0 +870 2 3 0.5564 41.17840173459901 43.7603473856229 4.8686487491511015 0 0 0 +911 2 3 0.5564 43.2397024819597 43.9207537163753 4.326134358669964 0 0 0 + +Velocities + +1 0 0 0 +2 0 0 0 +3 0 0 0 +4 0 0 0 +5 0 0 0 +6 0 0 0 +7 0 0 0 +8 0 0 0 +9 0 0 0 +10 0 0 0 +11 0 0 0 +12 0 0 0 +13 0 0 0 +14 0 0 0 +15 0 0 0 +16 0 0 0 +17 0 0 0 +20 0 0 0 +73 0 0 0 +74 0 0 0 +77 0 0 0 +78 0 0 0 +81 0 0 0 +82 0 0 0 +85 0 0 0 +86 0 0 0 +89 0 0 0 +18 0 0 0 +19 0 0 0 +21 0 0 0 +22 0 0 0 +23 0 0 0 +24 0 0 0 +25 0 0 0 +26 0 0 0 +27 0 0 0 +28 0 0 0 +29 0 0 0 +30 0 0 0 +31 0 0 0 +32 0 0 0 +33 0 0 0 +34 0 0 0 +35 0 0 0 +36 0 0 0 +90 0 0 0 +93 0 0 0 +94 0 0 0 +97 0 0 0 +98 0 0 0 +101 0 0 0 +102 0 0 0 +105 0 0 0 +106 0 0 0 +37 0 0 0 +38 0 0 0 +39 0 0 0 +40 0 0 0 +41 0 0 0 +42 0 0 0 +43 0 0 0 +44 0 0 0 +45 0 0 0 +46 0 0 0 +47 0 0 0 +48 0 0 0 +49 0 0 0 +50 0 0 0 +51 0 0 0 +52 0 0 0 +53 0 0 0 +56 0 0 0 +109 0 0 0 +110 0 0 0 +113 0 0 0 +114 0 0 0 +117 0 0 0 +118 0 0 0 +121 0 0 0 +122 0 0 0 +125 0 0 0 +54 0 0 0 +55 0 0 0 +57 0 0 0 +58 0 0 0 +59 0 0 0 +60 0 0 0 +61 0 0 0 +62 0 0 0 +63 0 0 0 +64 0 0 0 +65 0 0 0 +66 0 0 0 +67 0 0 0 +68 0 0 0 +69 0 0 0 +70 0 0 0 +71 0 0 0 +72 0 0 0 +126 0 0 0 +129 0 0 0 +130 0 0 0 +133 0 0 0 +134 0 0 0 +137 0 0 0 +138 0 0 0 +141 0 0 0 +142 0 0 0 +75 0 0 0 +76 0 0 0 +79 0 0 0 +80 0 0 0 +83 0 0 0 +84 0 0 0 +87 0 0 0 +88 0 0 0 +92 0 0 0 +145 0 0 0 +146 0 0 0 +147 0 0 0 +148 0 0 0 +149 0 0 0 +150 0 0 0 +151 0 0 0 +152 0 0 0 +153 0 0 0 +154 0 0 0 +155 0 0 0 +156 0 0 0 +157 0 0 0 +158 0 0 0 +159 0 0 0 +160 0 0 0 +161 0 0 0 +164 0 0 0 +91 0 0 0 +95 0 0 0 +96 0 0 0 +99 0 0 0 +100 0 0 0 +103 0 0 0 +104 0 0 0 +107 0 0 0 +108 0 0 0 +162 0 0 0 +163 0 0 0 +165 0 0 0 +166 0 0 0 +167 0 0 0 +168 0 0 0 +169 0 0 0 +170 0 0 0 +171 0 0 0 +172 0 0 0 +173 0 0 0 +174 0 0 0 +175 0 0 0 +176 0 0 0 +177 0 0 0 +178 0 0 0 +179 0 0 0 +180 0 0 0 +111 0 0 0 +112 0 0 0 +115 0 0 0 +116 0 0 0 +119 0 0 0 +120 0 0 0 +123 0 0 0 +124 0 0 0 +128 0 0 0 +181 0 0 0 +182 0 0 0 +183 0 0 0 +184 0 0 0 +185 0 0 0 +186 0 0 0 +187 0 0 0 +188 0 0 0 +189 0 0 0 +190 0 0 0 +191 0 0 0 +192 0 0 0 +193 0 0 0 +194 0 0 0 +195 0 0 0 +196 0 0 0 +197 0 0 0 +200 0 0 0 +127 0 0 0 +131 0 0 0 +132 0 0 0 +135 0 0 0 +136 0 0 0 +139 0 0 0 +140 0 0 0 +143 0 0 0 +144 0 0 0 +198 0 0 0 +199 0 0 0 +201 0 0 0 +202 0 0 0 +203 0 0 0 +204 0 0 0 +205 0 0 0 +206 0 0 0 +207 0 0 0 +208 0 0 0 +209 0 0 0 +210 0 0 0 +211 0 0 0 +212 0 0 0 +213 0 0 0 +214 0 0 0 +215 0 0 0 +216 0 0 0 +217 0 0 0 +218 0 0 0 +219 0 0 0 +220 0 0 0 +221 0 0 0 +222 0 0 0 +223 0 0 0 +224 0 0 0 +225 0 0 0 +226 0 0 0 +227 0 0 0 +228 0 0 0 +229 0 0 0 +230 0 0 0 +231 0 0 0 +232 0 0 0 +233 0 0 0 +236 0 0 0 +289 0 0 0 +293 0 0 0 +297 0 0 0 +301 0 0 0 +305 0 0 0 +234 0 0 0 +235 0 0 0 +237 0 0 0 +238 0 0 0 +239 0 0 0 +240 0 0 0 +241 0 0 0 +242 0 0 0 +243 0 0 0 +244 0 0 0 +245 0 0 0 +246 0 0 0 +247 0 0 0 +248 0 0 0 +249 0 0 0 +250 0 0 0 +251 0 0 0 +252 0 0 0 +309 0 0 0 +313 0 0 0 +317 0 0 0 +321 0 0 0 +253 0 0 0 +254 0 0 0 +255 0 0 0 +256 0 0 0 +257 0 0 0 +258 0 0 0 +259 0 0 0 +260 0 0 0 +261 0 0 0 +262 0 0 0 +263 0 0 0 +264 0 0 0 +265 0 0 0 +266 0 0 0 +267 0 0 0 +268 0 0 0 +269 0 0 0 +272 0 0 0 +325 0 0 0 +329 0 0 0 +333 0 0 0 +337 0 0 0 +341 0 0 0 +270 0 0 0 +271 0 0 0 +273 0 0 0 +274 0 0 0 +275 0 0 0 +276 0 0 0 +277 0 0 0 +278 0 0 0 +279 0 0 0 +280 0 0 0 +281 0 0 0 +282 0 0 0 +283 0 0 0 +284 0 0 0 +285 0 0 0 +286 0 0 0 +287 0 0 0 +288 0 0 0 +345 0 0 0 +349 0 0 0 +353 0 0 0 +357 0 0 0 +290 0 0 0 +291 0 0 0 +292 0 0 0 +294 0 0 0 +295 0 0 0 +296 0 0 0 +298 0 0 0 +299 0 0 0 +300 0 0 0 +302 0 0 0 +303 0 0 0 +304 0 0 0 +308 0 0 0 +361 0 0 0 +362 0 0 0 +365 0 0 0 +366 0 0 0 +369 0 0 0 +370 0 0 0 +373 0 0 0 +374 0 0 0 +377 0 0 0 +306 0 0 0 +307 0 0 0 +310 0 0 0 +311 0 0 0 +312 0 0 0 +314 0 0 0 +315 0 0 0 +316 0 0 0 +318 0 0 0 +319 0 0 0 +320 0 0 0 +322 0 0 0 +323 0 0 0 +324 0 0 0 +378 0 0 0 +381 0 0 0 +382 0 0 0 +385 0 0 0 +386 0 0 0 +389 0 0 0 +390 0 0 0 +393 0 0 0 +394 0 0 0 +326 0 0 0 +327 0 0 0 +328 0 0 0 +330 0 0 0 +331 0 0 0 +332 0 0 0 +334 0 0 0 +335 0 0 0 +336 0 0 0 +338 0 0 0 +339 0 0 0 +340 0 0 0 +344 0 0 0 +397 0 0 0 +398 0 0 0 +401 0 0 0 +402 0 0 0 +405 0 0 0 +406 0 0 0 +409 0 0 0 +410 0 0 0 +413 0 0 0 +342 0 0 0 +343 0 0 0 +346 0 0 0 +347 0 0 0 +348 0 0 0 +350 0 0 0 +351 0 0 0 +352 0 0 0 +354 0 0 0 +355 0 0 0 +356 0 0 0 +358 0 0 0 +359 0 0 0 +360 0 0 0 +414 0 0 0 +417 0 0 0 +418 0 0 0 +421 0 0 0 +422 0 0 0 +425 0 0 0 +426 0 0 0 +429 0 0 0 +430 0 0 0 +363 0 0 0 +364 0 0 0 +367 0 0 0 +368 0 0 0 +371 0 0 0 +372 0 0 0 +375 0 0 0 +376 0 0 0 +380 0 0 0 +433 0 0 0 +434 0 0 0 +435 0 0 0 +436 0 0 0 +437 0 0 0 +438 0 0 0 +439 0 0 0 +440 0 0 0 +441 0 0 0 +442 0 0 0 +443 0 0 0 +444 0 0 0 +445 0 0 0 +446 0 0 0 +447 0 0 0 +448 0 0 0 +449 0 0 0 +452 0 0 0 +824 23.28678663838591 -19.695178733121715 -4.712860628654516 +882 -7.0610581976405244 16.44204311186104 -4.175586130223243 +915 5.458359862786789 12.338077912032869 3.646984172142374 +839 20.392115541402525 21.839207526251702 -29.285410530315588 +880 -1.6972489953530285 5.884325737897911 -5.109687018230828 +897 -0.5612899831289091 6.907522350424367 -17.06603259626599 +881 -3.29469084908246 18.230178486719424 -2.0874433657999796 +840 0.3491624797675958 -9.4770564186721 5.993889540912456 +823 -2.4113508906287486 0.7060826232690176 4.591531586272169 +825 -9.503739029582237 10.088287372649603 1.9260324522526424 +838 -4.206308232163817 2.7689815350821445 -3.2345774478153677 +918 5.963097489077942 -5.811799881204121 -1.1246744751170932 +895 -3.6065546286281265 3.360807936038344 -2.5135837850671177 +913 -3.9429603880542876 -3.803003714965937 4.88513733901858 +896 7.160890299407335 0.32762830929124437 -20.137386051219497 +379 0 0 0 +383 0 0 0 +384 0 0 0 +387 0 0 0 +388 0 0 0 +391 0 0 0 +392 0 0 0 +395 0 0 0 +396 0 0 0 +450 0 0 0 +451 0 0 0 +453 0 0 0 +454 0 0 0 +455 0 0 0 +456 0 0 0 +457 0 0 0 +458 0 0 0 +459 0 0 0 +460 0 0 0 +461 0 0 0 +462 0 0 0 +463 0 0 0 +464 0 0 0 +465 0 0 0 +466 0 0 0 +467 0 0 0 +468 0 0 0 +399 0 0 0 +400 0 0 0 +403 0 0 0 +404 0 0 0 +407 0 0 0 +408 0 0 0 +411 0 0 0 +412 0 0 0 +416 0 0 0 +469 0 0 0 +470 0 0 0 +471 0 0 0 +472 0 0 0 +473 0 0 0 +474 0 0 0 +475 0 0 0 +476 0 0 0 +477 0 0 0 +478 0 0 0 +479 0 0 0 +480 0 0 0 +481 0 0 0 +482 0 0 0 +483 0 0 0 +484 0 0 0 +485 0 0 0 +488 0 0 0 +415 0 0 0 +419 0 0 0 +420 0 0 0 +423 0 0 0 +424 0 0 0 +427 0 0 0 +428 0 0 0 +431 0 0 0 +432 0 0 0 +486 0 0 0 +487 0 0 0 +489 0 0 0 +490 0 0 0 +491 0 0 0 +492 0 0 0 +493 0 0 0 +494 0 0 0 +495 0 0 0 +496 0 0 0 +497 0 0 0 +498 0 0 0 +499 0 0 0 +500 0 0 0 +501 0 0 0 +502 0 0 0 +503 0 0 0 +504 0 0 0 +916 2.1969507203442245 -1.4352986791463374 -7.127919603909629 +917 11.826235663356204 14.279824537641929 -14.280083496635585 +505 0 0 0 +506 0 0 0 +507 0 0 0 +508 0 0 0 +509 0 0 0 +510 0 0 0 +511 0 0 0 +512 0 0 0 +513 0 0 0 +514 0 0 0 +515 0 0 0 +516 0 0 0 +517 0 0 0 +518 0 0 0 +519 0 0 0 +520 0 0 0 +521 0 0 0 +524 0 0 0 +577 0 0 0 +578 0 0 0 +581 0 0 0 +582 0 0 0 +585 0 0 0 +586 0 0 0 +589 0 0 0 +590 0 0 0 +593 0 0 0 +817 1.6133973243890818 0.09544910649802017 -2.82837163408008 +934 -0.7137103646976727 -3.722196372187516 0.848848803609948 +844 -1.412310995403245 2.5213507567859863 -4.599202803630543 +865 8.862935798755592 -1.7466754230232333 -1.6569510007225825 +926 -4.119692818575567 8.294228711700969 -32.74811918647688 +936 -15.928953261034998 -9.92364110983116 -15.23435729552565 +845 -7.482059146842958 -2.336334839582908 -12.584395592557943 +819 19.704188351794787 13.480076284531094 -16.836845023051307 +884 -5.8411676590434105 -3.4674785948480853 3.373261182910667 +928 -0.47949465869401636 4.8766140418593915 -1.7082902202551018 +832 3.7664949439970346 -7.725237251790142 2.249127795467372 +866 8.574128387623029 11.87092357709237 -33.55660077300949 +879 2.397970035203643 -1.0067012033099316 -24.55246411236801 +929 3.276394804624606 -17.02257780299615 0.9984492433600977 +935 20.101385093495328 5.113530565709303 -4.402939514605331 +909 -4.28073098421694 -15.637815198236153 -13.025293876950634 +846 -12.564589941629468 -6.4025051268954645 -20.75775453419462 +867 8.983700225517605 -3.390103398382499 10.693415861649115 +914 -2.2270563485919563 -24.131906542363726 6.875944405629472 +818 0.2383020958130696 -5.676983900196928 -7.219651526329348 +793 5.148041806008255 2.984645492151128 3.4961269673039586 +833 -0.6438138903502075 -2.2828874172817644 -2.0720922776886743 +834 10.612584098261342 -7.3667177513881885 16.15587930450157 +930 6.00984818290816 8.246158764929453 -15.698501664737071 +883 -3.3507225248985764 -0.5583884018684485 4.849649083643576 +794 3.908344161677918 -24.184551279453736 8.492626116154728 +795 8.894549364978065 12.946246804004156 12.17949248871838 +522 0 0 0 +523 0 0 0 +525 0 0 0 +526 0 0 0 +527 0 0 0 +528 0 0 0 +529 0 0 0 +530 0 0 0 +531 0 0 0 +532 0 0 0 +533 0 0 0 +534 0 0 0 +535 0 0 0 +536 0 0 0 +537 0 0 0 +538 0 0 0 +539 0 0 0 +540 0 0 0 +594 0 0 0 +597 0 0 0 +598 0 0 0 +601 0 0 0 +602 0 0 0 +605 0 0 0 +606 0 0 0 +609 0 0 0 +610 0 0 0 +541 0 0 0 +542 0 0 0 +543 0 0 0 +544 0 0 0 +545 0 0 0 +546 0 0 0 +547 0 0 0 +548 0 0 0 +549 0 0 0 +550 0 0 0 +551 0 0 0 +552 0 0 0 +553 0 0 0 +554 0 0 0 +555 0 0 0 +556 0 0 0 +557 0 0 0 +560 0 0 0 +613 0 0 0 +614 0 0 0 +617 0 0 0 +618 0 0 0 +621 0 0 0 +622 0 0 0 +625 0 0 0 +626 0 0 0 +629 0 0 0 +558 0 0 0 +559 0 0 0 +561 0 0 0 +562 0 0 0 +563 0 0 0 +564 0 0 0 +565 0 0 0 +566 0 0 0 +567 0 0 0 +568 0 0 0 +569 0 0 0 +570 0 0 0 +571 0 0 0 +572 0 0 0 +573 0 0 0 +574 0 0 0 +575 0 0 0 +576 0 0 0 +630 0 0 0 +633 0 0 0 +634 0 0 0 +637 0 0 0 +638 0 0 0 +641 0 0 0 +642 0 0 0 +645 0 0 0 +646 0 0 0 +857 0.014723103701010352 19.617056339014884 16.55424143708416 +856 -0.643223754474494 5.776893808258414 1.1873537786475037 +892 -3.075450592140558 0.21721350023132013 -1.4569947460087087 +893 -16.397277523345814 -3.4380854612300413 0.6965615832113001 +886 -0.2961775166926003 1.3204871191677252 -6.423441607226728 +828 -5.723804354158924 -2.2689365841904983 2.5260940343682323 +887 0.8430831533311819 -13.339077650133666 15.172508195501921 +826 -4.448639032696121 -0.8915914080568843 2.3567943259561948 +827 1.718412324889533 -14.893863590144628 14.797129976414348 +894 -6.427973685028659 -12.558615271775233 -7.485451456789206 +925 8.402235075352133 3.407952177949016 -3.5053149045150525 +858 -6.427819874217524 -13.261042052865486 -2.844099672535822 +878 4.549175257644374 -9.190685290399665 7.233790964076811 +812 1.6130765364411193 6.523491914724538 -2.1666788533706773 +927 5.411595894339899 18.95778556645519 0.4163503598847362 +888 6.673800249844219 -4.147769988251276 11.562868346675096 +877 0.7642590168406848 -0.42640846170725205 -0.24362676533615443 +835 4.762512418319816 4.257619894363519 -2.633248633741173 +811 2.94897877928045 1.1358222911198308 3.501491126078737 +837 -25.574582055486644 8.173269863077355 -15.333432600063208 +579 0 0 0 +580 0 0 0 +583 0 0 0 +584 0 0 0 +587 0 0 0 +588 0 0 0 +591 0 0 0 +592 0 0 0 +596 0 0 0 +649 0 0 0 +650 0 0 0 +651 0 0 0 +653 0 0 0 +654 0 0 0 +655 0 0 0 +657 0 0 0 +658 0 0 0 +659 0 0 0 +661 0 0 0 +662 0 0 0 +663 0 0 0 +665 0 0 0 +864 18.10875991489158 -1.221818047957972 14.493518869719745 +885 -3.50759902491298 9.459430974379575 4.647666016780896 +891 1.2937876234992576 -13.218582770473045 1.8043374968280674 +905 -4.091578474774505 3.159726887798095 -1.8642051540811495 +847 13.821135507553436 3.78277650099749 -0.8935962180188131 +807 -2.855822557363695 -1.3802914256701821 1.3207757685673218 +842 -3.5610017924774 20.399114965452245 -9.059382158173541 +806 -4.05498634870798 -0.7854363713825808 -8.046995507898338 +841 2.77935600657832 0.33087027354111276 -3.276950737363777 +848 14.223073217510889 7.872740511148931 10.887767283489458 +805 -1.6775622324299977 -2.2096661714145456 4.5967537734138295 +862 5.242654019377736 5.918079707262924 -8.884230198450263 +808 -3.696957383720496 1.0048882207315841 -0.5768482173888145 +863 -1.8703493217333826 5.862886335539861 9.68692462574889 +906 18.26182603645302 7.175694562498453 -2.7522051758285015 +803 3.2862566934744275 -9.793076664879903 3.0089122195092575 +820 -6.318316424453873 -6.3876103453941235 -3.8277653578536937 +813 2.860647424855888 1.4990458438578118 3.0590515326924304 +830 17.528802909679435 -19.339237046941598 -20.741951943235076 +809 -1.7667991174728181 2.556579099847797 -3.7133211964009396 +849 -1.1901850692743416 -8.440379804790025 -1.6424701640814479 +814 1.1332861799827034 0.6093309476680691 1.6239157816953607 +816 8.576684394424559 3.76294659470765 3.1067139692854044 +933 3.343313506115779 -12.788319535305213 0.4254781025251201 +932 1.2123994730269427 3.3154650357069606 -3.334409286644367 +802 3.413872469336105 -1.1546266031788768 -7.788063759324826 +931 -1.4494894135693275 -0.007254181008071915 -2.3332218927708426 +907 -5.153001723767468 0.1363135393043927 2.075664750863472 +831 -10.004566446956199 14.6294729429816 -0.9646159688100753 +804 -7.991671584288851 -7.475452917857694 -23.323610756314213 +904 -7.100120239541285 -0.3942667752088697 1.4081501423590068 +829 1.9015007439507077 5.283166213121213 -5.6785558614538445 +890 -19.32307212346698 3.2014322404638675 -4.971981839089952 +919 -2.338652775866846 -1.6192256874434943 3.5872094229145635 +908 -4.506448801038724 7.6944348035494805 10.147202763194022 +800 0.525815621025557 0.8800480170316483 -0.20140766169559945 +859 -3.7638632187225913 -1.3301900297863984 -1.6857540996503018 +861 -1.300800867558945 -21.968770646198 -11.380968378191717 +889 -0.13291154686447318 0.408222226270759 0.5188896950022159 +860 2.8418653167563583 -10.860696318995991 -7.274081987407397 +822 18.555841947164804 1.3488795446530215 -2.57263197376979 +821 2.5914509962410404 6.1128885622856535 -6.891713022600967 +595 0 0 0 +599 0 0 0 +600 0 0 0 +603 0 0 0 +604 0 0 0 +607 0 0 0 +608 0 0 0 +611 0 0 0 +612 0 0 0 +666 0 0 0 +667 0 0 0 +669 0 0 0 +670 0 0 0 +671 0 0 0 +673 0 0 0 +674 0 0 0 +675 0 0 0 +677 0 0 0 +678 0 0 0 +679 0 0 0 +681 0 0 0 +682 0 0 0 +683 0 0 0 +615 0 0 0 +616 0 0 0 +619 0 0 0 +620 0 0 0 +623 0 0 0 +624 0 0 0 +627 0 0 0 +628 0 0 0 +632 0 0 0 +685 0 0 0 +686 0 0 0 +687 0 0 0 +689 0 0 0 +690 0 0 0 +691 0 0 0 +693 0 0 0 +694 0 0 0 +695 0 0 0 +697 0 0 0 +698 0 0 0 +699 0 0 0 +701 0 0 0 +631 0 0 0 +635 0 0 0 +636 0 0 0 +639 0 0 0 +640 0 0 0 +643 0 0 0 +644 0 0 0 +647 0 0 0 +648 0 0 0 +702 0 0 0 +703 0 0 0 +705 0 0 0 +706 0 0 0 +707 0 0 0 +709 0 0 0 +710 0 0 0 +711 0 0 0 +713 0 0 0 +714 0 0 0 +715 0 0 0 +717 0 0 0 +718 0 0 0 +719 0 0 0 +801 6.3791360737229175 -0.06294951897585185 6.275276534287049 +852 9.533204722301026 3.635358487275625 11.325241984676676 +876 -7.5288457960325195 10.343955685749071 9.174112903806698 +851 11.324630200416946 -5.3841269941632195 -4.331280522070834 +836 -18.948267184095485 3.059583577066092 -13.205211938026421 +874 0.11331962980175045 -2.6443097750575877 1.3904229166613291 +875 5.578453451251161 -1.707571521972893 -5.365721983984957 +850 3.508833846356138 -4.177464350024476 -2.929550119627118 +920 9.735651740617827 11.172654877683243 -1.520392490494708 +921 2.634342633192178 -7.473941525247307 -10.3819677968746 +799 2.480261876941381 2.6479286070540775 2.8757710276609134 +652 0 0 0 +656 0 0 0 +660 0 0 0 +664 0 0 0 +668 0 0 0 +721 0 0 0 +722 0 0 0 +723 0 0 0 +724 0 0 0 +725 0 0 0 +726 0 0 0 +727 0 0 0 +728 0 0 0 +729 0 0 0 +730 0 0 0 +731 0 0 0 +732 0 0 0 +733 0 0 0 +734 0 0 0 +735 0 0 0 +736 0 0 0 +737 0 0 0 +740 0 0 0 +855 -4.983418977664709 7.316762475632069 -4.804677515261691 +853 -0.9889242911612474 4.9363545378208835 -3.893215427287619 +924 24.809030366392236 12.938030894027968 -7.929148423342626 +796 -2.042486989230798 -1.6716889696169193 4.818040886059996 +902 -12.24631912078176 -9.296091792191639 -5.933828252367176 +903 14.861767381200762 0.646302630400826 8.128909247439392 +898 -2.268970865642067 0.19593504253976693 -1.7002095325194038 +797 13.389488449540423 1.304501878497851 -5.024765837418713 +798 -4.04938216085792 -15.534814466192707 11.193556197029825 +810 -3.4873315530660745 -26.291881956134898 -3.7360180315706857 +854 -0.050097723565420214 1.1979024312153128 9.895624196355202 +923 -20.553020845996645 -9.899327350049255 -9.819708647345967 +922 4.523293437546675 5.218998274954441 -4.49072202518129 +900 7.633861074709448 -2.2307704025903523 4.296521673635092 +899 -19.369173009793435 5.968253817215517 -16.94178229768782 +901 3.1298945853524573 1.0199579971809891 5.836464708883643 +815 12.880886365907195 -2.18582234580474 10.172206114924288 +843 3.8805061810272847 -6.900108272859447 -7.842804013717792 +672 0 0 0 +676 0 0 0 +680 0 0 0 +684 0 0 0 +738 0 0 0 +739 0 0 0 +741 0 0 0 +742 0 0 0 +743 0 0 0 +744 0 0 0 +745 0 0 0 +746 0 0 0 +747 0 0 0 +748 0 0 0 +749 0 0 0 +750 0 0 0 +751 0 0 0 +752 0 0 0 +753 0 0 0 +754 0 0 0 +755 0 0 0 +756 0 0 0 +688 0 0 0 +692 0 0 0 +696 0 0 0 +700 0 0 0 +704 0 0 0 +757 0 0 0 +758 0 0 0 +759 0 0 0 +760 0 0 0 +761 0 0 0 +762 0 0 0 +763 0 0 0 +764 0 0 0 +765 0 0 0 +766 0 0 0 +767 0 0 0 +768 0 0 0 +769 0 0 0 +770 0 0 0 +771 0 0 0 +772 0 0 0 +773 0 0 0 +776 0 0 0 +708 0 0 0 +712 0 0 0 +716 0 0 0 +720 0 0 0 +774 0 0 0 +775 0 0 0 +777 0 0 0 +778 0 0 0 +779 0 0 0 +780 0 0 0 +781 0 0 0 +782 0 0 0 +783 0 0 0 +784 0 0 0 +785 0 0 0 +786 0 0 0 +787 0 0 0 +788 0 0 0 +789 0 0 0 +790 0 0 0 +791 0 0 0 +792 0 0 0 +871 3.8388411617482983 2.1415774247586086 2.2282258014613365 +910 7.602860298670014 2.6393823107390926 0.5414737324680828 +873 20.507332409943604 5.51145846781714 8.496326839610182 +912 -3.629349712693535 23.337951853868613 -32.58198418026529 +872 4.080216979227207 -18.995820981792978 -6.328839221258122 +869 25.409329042660474 4.159096283589856 8.003159128696433 +868 -6.119380276761435 0.9901059131840709 -6.330598686020231 +870 -10.78856535095556 -17.561195466544348 -21.63165476286472 +911 14.291030359419361 -16.1359695519986 6.557863766321599 + +Bonds + +1 1 880 881 +2 1 880 882 +3 1 823 824 +4 1 823 825 +5 1 838 839 +6 1 838 840 +7 1 895 896 +8 1 895 897 +9 1 913 914 +10 1 913 915 +11 1 916 917 +12 1 916 918 +13 1 817 818 +14 1 817 819 +15 1 934 935 +16 1 934 936 +17 1 844 845 +18 1 844 846 +19 1 865 866 +20 1 865 867 +21 1 928 929 +22 1 928 930 +23 1 832 833 +24 1 832 834 +25 1 793 794 +26 1 793 795 +27 1 883 884 +28 1 883 885 +29 1 856 857 +30 1 856 858 +31 1 892 893 +32 1 892 894 +33 1 886 887 +34 1 886 888 +35 1 826 827 +36 1 826 828 +37 1 925 926 +38 1 925 927 +39 1 877 878 +40 1 877 879 +41 1 835 836 +42 1 835 837 +43 1 811 812 +44 1 811 813 +45 1 847 848 +46 1 847 849 +47 1 841 842 +48 1 841 843 +49 1 805 806 +50 1 805 807 +51 1 862 863 +52 1 862 864 +53 1 808 809 +54 1 808 810 +55 1 820 821 +56 1 820 822 +57 1 814 815 +58 1 814 816 +59 1 802 803 +60 1 802 804 +61 1 931 932 +62 1 931 933 +63 1 907 908 +64 1 907 909 +65 1 904 905 +66 1 904 906 +67 1 829 830 +68 1 829 831 +69 1 919 920 +70 1 919 921 +71 1 859 860 +72 1 859 861 +73 1 889 890 +74 1 889 891 +75 1 874 875 +76 1 874 876 +77 1 850 851 +78 1 850 852 +79 1 799 800 +80 1 799 801 +81 1 853 854 +82 1 853 855 +83 1 796 797 +84 1 796 798 +85 1 898 899 +86 1 898 900 +87 1 922 923 +88 1 922 924 +89 1 901 902 +90 1 901 903 +91 1 871 872 +92 1 871 873 +93 1 910 911 +94 1 910 912 +95 1 868 869 +96 1 868 870 + +Angles + +1 1 881 880 882 +2 1 824 823 825 +3 1 839 838 840 +4 1 896 895 897 +5 1 914 913 915 +6 1 917 916 918 +7 1 818 817 819 +8 1 935 934 936 +9 1 845 844 846 +10 1 866 865 867 +11 1 929 928 930 +12 1 833 832 834 +13 1 794 793 795 +14 1 884 883 885 +15 1 857 856 858 +16 1 893 892 894 +17 1 887 886 888 +18 1 827 826 828 +19 1 926 925 927 +20 1 878 877 879 +21 1 836 835 837 +22 1 812 811 813 +23 1 848 847 849 +24 1 842 841 843 +25 1 806 805 807 +26 1 863 862 864 +27 1 809 808 810 +28 1 821 820 822 +29 1 815 814 816 +30 1 803 802 804 +31 1 932 931 933 +32 1 908 907 909 +33 1 905 904 906 +34 1 830 829 831 +35 1 920 919 921 +36 1 860 859 861 +37 1 890 889 891 +38 1 875 874 876 +39 1 851 850 852 +40 1 800 799 801 +41 1 854 853 855 +42 1 797 796 798 +43 1 899 898 900 +44 1 923 922 924 +45 1 902 901 903 +46 1 872 871 873 +47 1 911 910 912 +48 1 869 868 870 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water new file mode 100644 index 0000000000..9f8e717a7e --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt new file mode 100644 index 0000000000..8494bfcb3e --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/in.gr_water.opt @@ -0,0 +1,51 @@ +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +group water molecule 2 +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 new file mode 100644 index 0000000000..c8268c72f6 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.1 @@ -0,0 +1,239 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = 6009, + year = 2018, +} + +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 32.9 | 32.9 | 32.9 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491435 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496703 -21.072663 3.5759596 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02157e-05 48 + 800 -17.478623 -20.819504 3.3408809 188.37868 -1.9112996 272.06505 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.48086 -20.728495 3.2476349 188.59022 -1.8922102 264.47155 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111712 48 + 1000 -17.498465 -20.331545 2.8330804 188.87473 -1.812177 230.71225 +Loop time of 20.3334 on 1 procs for 1000 steps with 936 atoms + +Performance: 4.249 ns/day, 5.648 hours/ns, 49.180 timesteps/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 16.179 | 16.179 | 16.179 | 0.0 | 79.57 +Bond | 0.00021103 | 0.00021103 | 0.00021103 | 0.0 | 0.00 +Kspace | 3.3118 | 3.3118 | 3.3118 | 0.0 | 16.29 +Neigh | 0.79017 | 0.79017 | 0.79017 | 0.0 | 3.89 +Comm | 0.026379 | 0.026379 | 0.026379 | 0.0 | 0.13 +Output | 0.00046496 | 0.00046496 | 0.00046496 | 0.0 | 0.00 +Modify | 0.017013 | 0.017013 | 0.017013 | 0.0 | 0.08 +Other | | 0.008835 | | | 0.04 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:20 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 new file mode 100644 index 0000000000..ab28c96657 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.g++.4 @@ -0,0 +1,239 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.017 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = 6009, + year = 2018, +} + +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm, perpetual + attributes: full, newton on, ghost + pair build: full/bin/ghost + stencil: full/ghost/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.22 | 25.25 | 25.29 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505683 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62422e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.06489 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480865 -20.728504 3.2476386 188.5902 -1.8922108 264.47185 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498474 -20.331607 2.833133 188.87466 -1.8121689 230.71654 +Loop time of 9.05361 on 4 procs for 1000 steps with 936 atoms + +Performance: 9.543 ns/day, 2.515 hours/ns, 110.453 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.462 | 4.2266 | 7.1075 | 89.3 | 46.68 +Bond | 0.00018424 | 0.00019878 | 0.00022125 | 0.0 | 0.00 +Kspace | 1.4698 | 4.338 | 6.1001 | 87.8 | 47.91 +Neigh | 0.39462 | 0.39489 | 0.39518 | 0.0 | 4.36 +Comm | 0.043753 | 0.055826 | 0.062746 | 3.1 | 0.62 +Output | 0.00048755 | 0.00053971 | 0.00062785 | 0.0 | 0.01 +Modify | 0.027255 | 0.028664 | 0.030278 | 0.7 | 0.32 +Other | | 0.008904 | | | 0.10 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 new file mode 100644 index 0000000000..c795e85d56 --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.1 @@ -0,0 +1,256 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.012 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = 6009, + year = 2018, +} + +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 84320 48000 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 25.27 | 25.27 | 25.27 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494868 -20.796993 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.486271 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502844 -20.993704 3.49086 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495287 -20.828353 3.3330658 188.48002 -1.8429075 271.42862 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443044 2.9516084 188.7589 -1.8566335 240.36459 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24516e-05 48 + 600 -17.505684 -20.608457 3.1027731 188.72078 -1.9560796 252.67471 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50422e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496701 -21.07266 3.5759595 188.2777 -1.9833956 291.20871 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15262e-06 96 +Angle: 1 104.52 7.02158e-05 48 + 800 -17.478623 -20.819504 3.340881 188.37868 -1.9112996 272.06506 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14138e-07 96 +Angle: 1 104.52 6.98742e-05 48 + 900 -17.480864 -20.728498 3.2476343 188.59022 -1.8922102 264.4715 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00586e-06 96 +Angle: 1 104.52 0.000111711 48 + 1000 -17.498466 -20.331547 2.8330808 188.87473 -1.8121768 230.71228 +Loop time of 8.11929 on 1 procs for 1000 steps with 936 atoms + +Performance: 10.641 ns/day, 2.255 hours/ns, 123.163 timesteps/s +99.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.6849 | 4.6849 | 4.6849 | 0.0 | 57.70 +Bond | 0.00017678 | 0.00017678 | 0.00017678 | 0.0 | 0.00 +Kspace | 3.2098 | 3.2098 | 3.2098 | 0.0 | 39.53 +Neigh | 0.17546 | 0.17546 | 0.17546 | 0.0 | 2.16 +Comm | 0.024693 | 0.024693 | 0.024693 | 0.0 | 0.30 +Output | 0.00037798 | 0.00037798 | 0.00037798 | 0.0 | 0.00 +Modify | 0.015853 | 0.015853 | 0.015853 | 0.0 | 0.20 +Other | | 0.007983 | | | 0.10 + +Nlocal: 936 ave 936 max 936 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 5242 ave 5242 max 5242 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 431382 ave 431382 max 431382 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:08 diff --git a/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 new file mode 100644 index 0000000000..f885c5708d --- /dev/null +++ b/examples/PACKAGES/interlayer/aip_water_2dm/log.18May23.gr_water.opt.g++.4 @@ -0,0 +1,256 @@ +LAMMPS (23 Jun 2022 - Update 4) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +# Initialization +units metal +boundary p p p +atom_style full +processors * * 1 # domain decomposition over x and y +read_data ./gra_water.data +Reading data file ... + orthogonal box = (0 0 0) to (46.92336 44.331078 200) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 936 atoms + reading velocities ... + 936 velocities + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 96 bonds + reading angles ... + 48 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.001 seconds + read_data CPU = 0.014 seconds +mass 1 12.0107 # carbon mass (g/mole) +mass 2 15.9994 # oxygen mass (g/mole) +mass 3 1.008 # hydrogen mass (g/mole) +# Separate atom groups +group gr molecule 1 +792 atoms in group gr +group water molecule 2 +144 atoms in group water +######################## Potential defition ############################## +# Interlayer potential +pair_style hybrid/overlay aip/water/2dm/opt 16.0 lj/cut/tip4p/long 2 3 1 1 0.1546 10 8.5 +#################################################################### +pair_coeff 1 1 none +pair_coeff 2 2 lj/cut/tip4p/long 8.0313e-3 3.1589 # O-O +pair_coeff 2 3 lj/cut/tip4p/long 0.0 0.0 # O-H +pair_coeff 3 3 lj/cut/tip4p/long 0.0 0.0 # H-H +pair_coeff * * aip/water/2dm/opt COH.aip.water.2dm C Ow Hw # C-H2O +Reading aip/water/2dm potential file COH.aip.water.2dm with DATE: 2022-12-02 +# bond and angle +bond_style harmonic +bond_coeff 1 0.0 0.9572 +angle_style harmonic +angle_coeff 1 0.0 104.52 +# define kspace calculation +kspace_style pppm/tip4p 1E-5 +# Neighbor update settings +neighbor 2.0 bin +neigh_modify every 1 delay 5 check yes page 1000000 one 100000 +#################################################################### +# Calculate pair energy +compute 1 all pair lj/cut/tip4p/long +compute 2 all pair aip/water/2dm/opt +compute wt water temp +variable TIP4P equal c_1 +variable EILP equal c_2 # total interlayer energy +variable temp_wt equal c_wt +############# Output ############## +thermo_style custom step etotal pe ke v_TIP4P v_EILP v_temp_wt +thermo 100 +thermo_modify lost error + +fix subf gr setforce 0.0 0.0 0.0 +fix 1 water shake 0.0001 20 100 b 1 a 1 + 0 = # of size 2 clusters + 0 = # of size 3 clusters + 0 = # of size 4 clusters + 48 = # of frozen angles + find clusters CPU = 0.000 seconds + +timestep 1e-3 +velocity water create 300.0 12345 dist gaussian mom yes rot yes +fix 2 water nve +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848 +@Article{Ouyang2018 + author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod}, + title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials}, + journal = {Nano Letters}, + volume = 18, + pages = 6009, + year = 2018, +} + +- ilp/tmd potential doi:10.1021/acs.jctc.1c00782 +@Article{Ouyang2021 + author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and + A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod}, + title = {Anisotropic Interlayer Force Field for Transition + Metal Dichalcogenides: The Case of Molybdenum Disulfide}, + journal = {J.~Chem.\ Theory Comput.}, + volume = 17, + pages = {7237--7245} + year = 2021, +} + +- ilp/water/2dm potential doi/10.1021/acs.jpcc.2c08464 +@Article{Feng2023 + author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang}, + title = {Registry-Dependent Potential for Interfaces of Water with Graphene}, + journal = {J. Phys. Chem. C}, + volume = 127, + pages = {8704-8713} + year = 2023, +} + +- ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137 +@inproceedings{gao2021lmff + author = {Gao, Ping and Duan, Xiaohui and Others}, + title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors}, + year = {2021}, + isbn = {9781450384421}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + url = {https://doi.org/10.1145/3458817.3476137}, + doi = {10.1145/3458817.3476137}, + booktitle = {Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis}, + articleno = {42}, + numpages = {14}, + location = {St. Louis, Missouri}, + series = {SC'21}, +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +PPPM initialization ... + extracting TIP4P info from pair style + using 12-bit tables for long-range coulomb (../kspace.cpp:342) + G vector (1/distance) = 0.28684806 + grid = 25 24 80 + stencil order = 5 + estimated absolute RMS force accuracy = 0.0001640931 + estimated relative force accuracy = 1.1395635e-05 + using single precision MKL FFT + 3d grid and FFT values/proc = 30685 12480 +WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (../pair.cpp:239) +WARNING: Communication cutoff 0 is shorter than a bond length based estimate of 3.4358. This may lead to errors. (../comm.cpp:727) +WARNING: Increasing communication cutoff to 11.6118 for TIP4P pair style (../pair_lj_cut_tip4p_long.cpp:484) +Neighbor list info ... + update every 1 steps, delay 5 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 18 + ghost atom cutoff = 18 + binsize = 9, bins = 6 5 23 + 3 neighbor lists, perpetual/occasional/extra = 3 0 0 + (1) pair aip/water/2dm/opt, perpetual + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair lj/cut/tip4p/long, perpetual, skip from (3) + attributes: half, newton on + pair build: skip + stencil: none + bin: none + (3) neighbor class addition, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +WARNING: Communication cutoff adjusted to 18 (../comm.cpp:736) +SHAKE stats (type/ave/delta/count) on step 0 +Bond: 1 0.957201 2.19705e-06 96 +Angle: 1 104.52 0.000203056 48 +Per MPI rank memory allocation (min/avg/max) = 21.4 | 21.44 | 21.48 Mbytes + Step TotEng PotEng KinEng v_TIP4P v_EILP v_temp_wt + 0 -16.131263 -19.815178 3.6839141 189.37246 -1.903543 300 +SHAKE stats (type/ave/delta/count) on step 100 +Bond: 1 0.9572 9.54949e-07 96 +Angle: 1 104.52 6.01522e-05 48 + 100 -17.494869 -20.796995 3.3021253 188.4955 -1.8981262 268.90898 +SHAKE stats (type/ave/delta/count) on step 200 +Bond: 1 0.9572 9.63922e-07 96 +Angle: 1 104.52 7.7021e-05 48 + 200 -17.48627 -21.194892 3.7086213 188.14561 -1.9871708 302.01203 +SHAKE stats (type/ave/delta/count) on step 300 +Bond: 1 0.9572 1.4264e-06 96 +Angle: 1 104.52 6.48393e-05 48 + 300 -17.502843 -20.993703 3.4908599 188.23268 -1.8457229 284.27861 +SHAKE stats (type/ave/delta/count) on step 400 +Bond: 1 0.9572 1.33728e-06 96 +Angle: 1 104.52 7.6239e-05 48 + 400 -17.495285 -20.82835 3.333065 188.48003 -1.8429074 271.42856 +SHAKE stats (type/ave/delta/count) on step 500 +Bond: 1 0.9572 1.14685e-06 96 +Angle: 1 104.52 8.58621e-05 48 + 500 -17.491436 -20.443043 2.9516075 188.7589 -1.8566335 240.36452 +SHAKE stats (type/ave/delta/count) on step 600 +Bond: 1 0.9572 9.17601e-07 96 +Angle: 1 104.52 8.24517e-05 48 + 600 -17.505682 -20.608456 3.1027734 188.72078 -1.9560795 252.67474 +SHAKE stats (type/ave/delta/count) on step 700 +Bond: 1 0.9572 9.50425e-07 96 +Angle: 1 104.52 5.62423e-05 48 + 700 -17.496706 -21.072664 3.575958 188.2777 -1.9833951 291.20858 +SHAKE stats (type/ave/delta/count) on step 800 +Bond: 1 0.9572 1.15256e-06 96 +Angle: 1 104.52 7.02177e-05 48 + 800 -17.478628 -20.819507 3.340879 188.37868 -1.9113009 272.0649 +SHAKE stats (type/ave/delta/count) on step 900 +Bond: 1 0.9572 9.14163e-07 96 +Angle: 1 104.52 6.98849e-05 48 + 900 -17.480868 -20.728506 3.2476383 188.5902 -1.8922108 264.47182 +SHAKE stats (type/ave/delta/count) on step 1000 +Bond: 1 0.9572 1.00568e-06 96 +Angle: 1 104.52 0.000111707 48 + 1000 -17.498472 -20.331605 2.8331335 188.87466 -1.8121689 230.71657 +Loop time of 4.24862 on 4 procs for 1000 steps with 936 atoms + +Performance: 20.336 ns/day, 1.180 hours/ns, 235.370 timesteps/s +99.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.25749 | 1.1806 | 2.6872 | 89.0 | 27.79 +Bond | 0.00018656 | 0.00020786 | 0.00025377 | 0.0 | 0.00 +Kspace | 1.4259 | 2.9204 | 3.8414 | 56.3 | 68.74 +Neigh | 0.057504 | 0.057852 | 0.05818 | 0.1 | 1.36 +Comm | 0.041952 | 0.053593 | 0.05876 | 3.0 | 1.26 +Output | 0.0004296 | 0.00046809 | 0.00055317 | 0.0 | 0.01 +Modify | 0.026204 | 0.027251 | 0.028382 | 0.6 | 0.64 +Other | | 0.008209 | | | 0.19 + +Nlocal: 234 ave 302 max 198 min +Histogram: 2 0 0 1 0 0 0 0 0 1 +Nghost: 2876.5 ave 3122 max 2632 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 107846 ave 150684 max 82181 min +Histogram: 2 0 0 0 1 0 0 0 0 1 + +Total # of neighbors = 431382 +Ave neighs/atom = 460.87821 +Ave special neighs/atom = 0.30769231 +Neighbor list builds = 28 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 new file mode 100644 index 0000000000..3dc2944ed9 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt01 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.338208372875723 -8.724519590498623 -8.445612139491281 0 -1 1 +82 1 -7.5133824622188925 -6.978636164411631 -10.191775661279799 0 0 0 +57 1 -6.093878587859262 -9.276313581141936 -7.744358551066254 1 0 0 +8 1 -7.188384493977925 -11.000743174865285 -10.566868392413127 0 1 1 +49 1 -0.45896030511450936 -8.721648062141405 -7.76988436909876 0 1 0 +54 1 4.36019737005205 -9.840722628422576 -9.652200105153977 0 -1 1 +114 1 3.904944042667676 -8.560258519206736 -6.227256449483399 -1 0 1 +128 1 1.537670815459421 11.367557646509137 -7.44113189883349 0 0 -2 +102 1 2.6467980910798623 -6.300231690446356 -10.839747469959917 1 -1 -1 +157 1 6.599214138053117 -6.278630725537236 -7.389049268829837 -1 0 1 +20 1 8.160418209241914 -11.236890922228888 -9.90427297873004 0 1 0 +147 1 10.464052914243185 -5.834517788008704 -9.403782126876184 -1 2 0 +169 1 9.355540563360105 -8.982132042608429 -6.861385656669775 0 1 1 +123 1 -6.908328795781873 -3.2942152122483694 -10.871702946953768 -1 0 -1 +130 1 -6.59789640513614 -2.559000332768779 -7.109058819418416 -1 1 0 +140 1 -9.12121182032633 -1.3228381271313019 -9.248705124201138 -1 1 0 +153 1 -4.57209419001429 -5.197951679459013 -8.806559015841044 0 1 0 +129 1 -0.17714454435176596 -5.056145756511569 -8.582370909018262 0 1 1 +148 1 -3.197585507102101 -2.0540921199407465 -9.77932871778502 0 0 0 +119 1 -3.51954842440485 -3.8478081846346726 10.678236929073831 0 -1 -1 +174 1 3.1384595215939513 -1.9078182147633918 -10.748237231758047 -1 1 -1 +134 1 -0.0032185119392025285 -0.36841629060197645 -8.631895429784365 -1 0 2 +189 1 2.892780086534627 -1.3587472579142499 -6.410113256095116 0 0 2 +28 1 6.224912481821424 -1.100900418829165 -9.316948573538184 0 0 -1 +1 1 7.533342646866252 -2.8858379557892953 -6.5588822497649195 1 -1 0 +24 1 10.891564390761006 -2.1693511431878143 -8.14872153065027 0 -1 1 +176 1 10.35065200687287 -3.6683271215630047 -4.32699396695263 0 0 0 +182 1 -10.764131367809398 0.5730937842904389 -5.180063181396292 0 1 -1 +137 1 -8.194528746006949 3.76661130396705 -8.596433076900993 -1 1 0 +89 1 -5.793296966734716 0.9591211322466908 -8.532912969707475 0 0 -1 +88 1 -3.2415549382910047 2.6063473128515433 -11.019658141847422 0 1 -1 +160 1 -0.17978720428819353 5.335367005111222 -5.961111228150678 0 0 1 +125 1 -3.2595127311899836 3.541669787125592 -7.094678802230409 0 1 0 +167 1 2.6101389699783257 2.7016950511217104 -7.510579719545417 0 1 0 +107 1 2.478905108002845 1.3710464608203452 -11.241338409619438 -1 1 1 +45 1 -0.2728444271939366 3.4472072045614333 -9.803824961885091 0 1 0 +95 1 7.005885045149228 1.8641755193621776 -11.033503201926393 0 2 -1 +111 1 11.28085723924775 1.3577973865073396 -8.404143782130012 0 1 1 +37 1 7.50412447792306 1.5806311975228182 -7.696866725729485 1 0 2 +53 1 9.464056637143884 5.181490576538966 -10.160960273108417 -1 -1 1 +122 1 -8.61454149114821 11.46923394337289 -7.097906043887797 2 -1 -1 +126 1 -8.658911027419105 9.160142379367757 -10.196432851978876 0 0 -1 +72 1 -11.223582472260205 7.275428216701358 10.836645274139237 2 0 0 +144 1 -3.0387339366126 -9.918200912273784 -9.896452956043586 0 1 1 +135 1 0.03771056281680529 7.830565362407303 -8.390686664231268 1 0 0 +183 1 2.8786138768293665 5.221499246050073 -10.100270572243783 0 0 0 +155 1 3.821499942128122 9.224610559399695 -9.359914290522674 0 0 0 +21 1 6.6299071097705 6.818271712520994 -8.197268594363944 1 0 0 +66 1 9.53812274637967 7.559409537149467 -6.194715694404919 -2 -1 0 +22 1 11.107750453110658 10.72621054512756 -6.232964722376559 -1 0 0 +42 1 9.127119842763733 9.280850325093446 -10.249747757735628 -1 1 0 +77 1 -6.840159982144716 -10.92057206639582 -3.876267638432264 1 -1 1 +47 1 -8.742923464684916 -8.023408201112765 -5.403173093100989 1 2 1 +18 1 -10.63751608820882 -11.30186343558728 -3.9206887105699195 1 0 -1 +46 1 11.298180499183054 -7.685155723666886 -4.06604680107494 1 0 -2 +14 1 -9.566429851257723 -7.447961115721825 -2.010931774940218 -1 0 2 +178 1 -4.527419254322211 -8.045910047035035 -4.819501104832851 2 1 0 +48 1 -3.2147691406929866 -10.888877164915472 -6.377437598460709 1 1 -1 +55 1 -0.9601171939836206 -6.238495322587188 -4.2762406549238605 -1 0 -1 +12 1 -1.8964494825899862 -9.405283267682947 -2.3799601015584315 -1 0 2 +15 1 6.020890846962015 -8.178330582079944 0.7240728610757863 -1 0 -1 +64 1 2.731938348082501 -10.543443272156145 -1.741916704711699 1 1 0 +44 1 8.065377899358 -6.2776681789760715 -3.599447303926354 -1 0 1 +188 1 10.02823971588665 -8.47709879900416 -0.7307124355000334 -1 0 0 +200 1 -9.394872508283228 -3.330386381489715 -5.1567351351767705 -1 0 0 +198 1 -7.21209897973175 -1.1704302343832897 -2.203950414480204 0 0 1 +76 1 -9.986350100477846 -3.0116982250661763 -1.5200938888623745 1 0 0 +194 1 -6.746550374491012 -4.972813556867408 -2.5010542319113824 0 1 -1 +68 1 -2.5395355119165752 -3.5084431511046077 -6.11089008487593 0 1 1 +96 1 -3.383034995518244 -3.996115182399876 -2.1114098179404905 -1 2 0 +91 1 3.023350222125586 -6.242259457656427 -2.3794062527217115 1 -1 -1 +154 1 -0.21966769644821582 -2.9431607814775376 -3.0023832902544516 -1 2 0 +19 1 3.1658091018639274 -2.0642468786997554 -2.307083850490244 0 1 -1 +120 1 6.655220459905831 -2.268055028492757 -2.8431810436972036 1 1 1 +138 1 9.657284951715521 -4.552145938528714 -0.6562837148986382 -1 1 -1 +9 1 7.577787647310252 -2.027383158459481 0.591256647470022 0 0 1 +150 1 -9.975709520806461 2.045189761629004 -1.3967042898865678 1 -1 1 +38 1 -5.780821497271447 4.724336446491739 -4.727424802574532 1 0 2 +172 1 -9.690365647641709 4.0528825638271995 -4.90299752668659 0 0 2 +29 1 -7.905836311144201 7.618140007848844 2.0916587803060374 1 -1 -1 +87 1 -3.2429786758343386 -0.9446923499804107 -3.602689802943157 0 -1 1 +93 1 -6.311310050813026 0.9463486890063564 -4.844328963553153 0 -1 1 +195 1 1.0294591756555889 0.17190072131794665 -3.729109843284945 1 -1 3 +149 1 -2.2517532526979984 2.837758606759653 -2.568308902690684 1 0 0 +25 1 4.622058806898725 1.1966098061131745 -0.5762266975161516 -1 0 1 +35 1 2.770724754796497 3.7811224145924633 -3.6900492736017867 1 -1 0 +116 1 5.985384722273807 5.820793889080573 -5.01963853113883 0 1 0 +5 1 5.710509981071034 1.5091333740272113 -4.1779355439452 0 -1 -1 +112 1 4.909280213802248 5.451229842365678 -0.23301351689583433 -1 0 0 +152 1 11.352756404691903 -0.5457110274170986 -1.851635893722021 -2 -1 0 +132 1 8.574718024729343 1.7846682488107686 -1.3135653711870618 0 0 0 +173 1 8.985071256603522 3.7974294357041134 -5.507410143502991 0 0 1 +73 1 -9.997675226742189 8.034933990134746 -6.6211967592334595 0 -2 1 +161 1 -11.552860384837217 7.057039822309078 -3.567109853559714 2 0 2 +78 1 -1.8080552760100446 10.151101687740656 -1.7466859905812946 1 -2 1 +11 1 4.503908677727956 -11.845112920212848 -5.000489634351112 0 2 1 +84 1 2.4816138724708487 7.425072174245171 -5.250945864454475 1 0 0 +90 1 6.134640615065156 9.297869169242624 -0.8361676575747339 0 -1 1 +36 1 1.9591052897014976 7.715785297331987 -1.741598961638701 2 -1 0 +98 1 8.55440808947692 7.573996243117245 -2.894381804652479 -1 0 0 +56 1 7.300059241947594 10.446841724098018 -6.708609001665156 -1 0 1 +109 1 9.185972290533323 11.319457447612841 -0.9199703749554402 -1 1 1 +115 1 -7.290737513756202 -8.128422064576581 2.840900089769448 1 0 0 +124 1 -11.095494798277388 -8.787146009506092 4.06143463064398 1 0 -2 +121 1 -8.269324094623837 -10.076632693187037 6.580117501920071 0 1 -1 +80 1 -4.964400090273426 -7.254460179243866 -0.2516287260948715 0 0 1 +101 1 -4.352556925935133 -8.093642941491481 4.9061967743324075 1 3 1 +4 1 1.6615068736969008 10.065280091130505 4.658196599859135 -1 -1 -1 +81 1 7.340287496174785 -8.542929146635126 6.681008128047246 -1 1 1 +6 1 8.92830710513934 -10.595453002991315 2.772878983207939 1 1 0 +166 1 -8.702005772998799 -5.0252019350878925 4.355591496028076 0 2 0 +40 1 -7.050509790391359 -4.52399648752538 1.2979104738341645 1 1 0 +127 1 -5.6981160982548635 -2.4804262914214696 3.963876974872145 0 -1 0 +104 1 -0.43889931205929145 -0.6786512342031208 -0.26982380817326046 -1 0 -1 +151 1 0.38632233704260427 -6.436575550724694 0.28827602607540115 0 1 2 +60 1 -2.3388191412291297 -2.1909895686965264 5.332358036316238 0 1 0 +168 1 3.905092056046815 -3.342842649601014 0.743162620375255 -1 1 -1 +51 1 0.30821594516237355 -3.3431888641351466 2.97421468380087 0 0 -1 +97 1 2.0959982908166124 -0.09218688876005032 2.2065126859574242 0 -1 -1 +103 1 4.032770557637615 -1.033589048853706 6.026643139338357 -1 2 0 +163 1 -10.67096111340156 -2.753792851497721 2.2777487994238297 0 -1 0 +175 1 5.732332747304902 -3.395357434547403 3.9793999602240824 -1 1 0 +158 1 8.900731939704714 -6.465614302153284 2.882524782105495 -1 0 -1 +85 1 10.256991086371421 -0.03399764580791596 5.19749850902792 1 0 1 +63 1 -8.206071489694988 -0.20777550918309284 1.1337283531787357 -1 0 1 +133 1 -10.53669133454302 2.413445898515217 3.6779422317228634 1 1 0 +67 1 -6.580427997228583 3.5308019506173483 3.249950052857889 1 0 0 +83 1 -3.837130760373457 0.5948829995405305 2.7555803207629808 0 -2 1 +162 1 0.5628056325507875 0.015590885064073646 6.104541108047491 0 0 0 +170 1 -2.741308504695489 4.278253215456882 6.467354505657028 -1 1 -2 +181 1 -5.298818879016533 0.6747551441657151 5.729306597544269 -1 1 -1 +71 1 1.6643578976841618 4.095917673198805 -0.5219437486813767 0 -1 -1 +31 1 1.0515428688465895 4.152933403466363 6.1671972298548825 0 -2 0 +139 1 3.7848906674638663 3.6854393920193473 3.29399693806094 -1 2 0 +3 1 10.981379981294642 1.2656622142958476 0.9353988521574017 0 -1 1 +108 1 6.1052451115408175 0.8636547219490183 3.620998736363435 1 1 0 +16 1 8.972094495168673 3.5728016103606848 4.03251575890399 0 -2 1 +110 1 -11.360244143589199 5.991417852211969 3.108858276372061 0 0 -2 +50 1 -7.001523002421964 11.111129854490866 4.085896982012491 0 0 0 +191 1 -8.535734954334753 7.01291974923636 5.601813919122847 1 -1 0 +187 1 -10.711068400768836 11.24759510548256 5.108018843428019 1 1 0 +180 1 -1.0115990012221623 6.198904069067613 -1.8166876549028856 1 -1 2 +30 1 -0.6366171189365808 8.860606610617594 1.2441466899617097 1 -2 -1 +2 1 -1.8186886713768473 5.401678057284073 2.675711617904522 1 -2 -1 +17 1 -2.0021887273825953 8.358120841698845 5.289337562756078 -2 0 -1 +7 1 4.074924702840786 8.78812906409422 1.7171879913627848 -1 0 1 +164 1 1.8692613585489788 6.285969009685708 2.179749632062295 -1 0 0 +69 1 4.63280772470042 6.917030747154868 5.0992927825629835 0 -2 -1 +61 1 10.180483484726627 5.102933813094147 -0.6143013682078827 -1 -2 0 +34 1 7.6753980260971115 9.289346236573914 2.385702988209246 0 0 -1 +43 1 7.122060213065371 6.027541758611427 2.434097564627603 -1 -2 1 +177 1 8.528259310530697 7.357497844279905 5.573095645895759 -1 1 -1 +179 1 11.765063377112929 -11.216117555594387 -10.520782276852188 -1 3 2 +65 1 -9.939292746165652 -8.35547457034324 11.370610161953358 0 -1 -1 +27 1 -10.951259960706151 -11.676718912293088 8.46919851147203 1 1 1 +58 1 -9.681801591871107 -6.867288275839336 8.155377252027327 -1 0 -1 +32 1 -6.131008336203429 -5.3807894145123 6.404139996945254 2 1 -2 +26 1 -5.277766259873033 -8.47443173172751 9.34226968131783 1 0 0 +142 1 -2.2300264866152233 -6.734520703453221 8.54527447884555 2 1 0 +100 1 -1.5334511532264656 -10.941538235330839 6.762850724892153 1 2 0 +184 1 7.375517404090732 -7.455937963783537 -11.443563002056962 0 1 2 +105 1 1.3322147240971494 -7.892907018083993 3.959755431262508 0 0 -1 +75 1 4.579073338589469 -6.332281766890766 5.401380400098642 0 -1 0 +99 1 1.6872589572610692 -11.008904691990601 10.790406649632594 0 0 0 +193 1 2.165378393000026 -6.907577487565213 9.269079214220964 1 1 -1 +33 1 4.415243573456659 -11.651415043860048 7.196586725345009 0 -1 0 +79 1 8.562132664810616 11.60776935837499 5.9765813232044 -1 0 0 +92 1 9.7882797687825 -9.546408677583251 11.099049944831634 0 2 -1 +165 1 -9.230629586630256 -3.286419219229394 7.361693942438226 0 0 0 +199 1 -6.865681519441191 -4.960200472270827 9.951650907912764 0 -1 1 +70 1 -5.465385410624981 -2.359017759235627 7.824489075549977 0 1 1 +146 1 -1.4128831058942808 -0.5651321764460739 11.276244400666037 2 1 1 +106 1 -1.359759429785522 -2.5612049312124596 8.66030082151058 0 0 -1 +52 1 0.6275246163307096 -3.6626685091764974 11.394079726568394 0 0 0 +86 1 5.385048800206313 -4.521509414521681 8.656605720260643 -1 0 1 +197 1 1.5960773668099044 -4.632851183052137 7.050260712413685 -1 0 -1 +185 1 2.0988154112902677 -0.6155858372057779 10.039741652805866 -2 1 -2 +190 1 7.402096413387279 -0.25029457328283883 9.918579248632192 0 0 -1 +145 1 7.12421994994077 -3.662416626939269 -11.744325877649178 -1 -2 0 +131 1 11.18002293743892 -5.284301350499634 6.202872301153104 1 0 0 +156 1 -5.458324556633278 -0.38542205585237 11.508150106421377 0 -1 -1 +10 1 -9.11455987814511 -0.7284053525098189 4.7937364242043685 0 0 2 +196 1 -9.334790977795333 0.22026194254469544 8.665774918646903 1 2 1 +143 1 -7.202065049712928 3.0671354576980563 8.711576683539384 1 0 0 +13 1 -11.827431931265373 3.351396387549464 6.969024410690874 -1 -1 1 +59 1 -3.4888315694577976 1.7945900827414363 9.37212343512276 1 -1 1 +186 1 0.1399856131518682 2.5706426278242667 9.701168522174706 1 1 0 +136 1 3.4415384834588973 2.185354911818653 7.959200431003509 0 -1 -3 +192 1 10.528638878678947 2.482587032106114 9.852249456508758 1 1 1 +113 1 7.169273245351864 2.240386648237891 6.81806834338785 -1 -1 -1 +62 1 3.8919207853480167 6.881948160439718 8.99101225575 1 0 0 +74 1 -8.178685418297237 9.818884262184877 8.930172678325137 1 -1 0 +118 1 -11.577334387980462 8.493934752303879 6.984011067983683 0 1 0 +117 1 -5.265098295144998 11.327347075770236 7.5602122003602945 -1 -1 0 +23 1 -5.150793196726769 5.778029085599102 11.296630874448987 0 0 -2 +171 1 -4.323653153250317 7.139179037030907 7.775653914779269 0 2 -2 +94 1 0.595594702317225 9.593135599654605 9.048522029833913 -1 0 0 +41 1 5.495056487999116 11.528824616719037 11.673423310901565 0 0 -1 +141 1 9.858324590689726 5.708495049079261 9.011577695177973 1 -1 -1 +159 1 9.655575431519994 9.766549249024301 9.761747234830672 0 -1 0 + +Velocities + +39 3.843901085922765 -0.7556840039136884 3.588481686862416 +82 -6.7131250110640295 0.1978517371310493 3.794615543737683 +57 -3.8444246166822666 -0.12509187511770853 -0.15016726331630528 +8 2.510198026755905 3.9393955076781997 2.1890256483333417 +49 2.3436002495676416 -3.937791517692209 -0.8678317852601907 +54 0.6032383013072746 3.3962808798459587 -4.353772407339659 +114 1.733121125021854 -5.515987819958336 5.5418081738213125 +128 0.6238341583124627 -4.373836957545107 -1.8358939583013871 +102 3.7217703111263405 -2.1130321869806172 0.3604425898099683 +157 -3.060805678543839 -4.541031970793705 2.0247670855961024 +20 0.19495210236206537 0.7445218389780817 -4.9481403197240175 +147 1.300002576089047 0.4456991718445389 -0.49416915478347523 +169 -0.4362191685321444 -3.947171092840025 -1.656461237016801 +123 -4.189637911629164 -3.3929868871757067 0.6670412748458154 +130 0.6134420085318386 2.2669355259081905 -3.459678248548238 +140 -3.017718530938869 2.2011145660870097 -0.08987220236519784 +153 1.8522800493758318 0.8156876148506785 -9.385509457300062 +129 4.422122082904887 0.7131966606636173 0.3531709089212848 +148 0.6611682907987628 -0.38909659051429185 -0.4773785971811748 +119 -1.669105812009433 -0.37002694554897725 -3.3024540150626986 +174 -6.672226703796612 4.247321732812844 1.6315053674536977 +134 -3.0608984486057835 -2.4129204610506294 -2.734745807674302 +189 -2.302704208974844 3.481037259019509 -2.794714120652709 +28 -2.75682827680027 -3.050875489215879 -4.227117245181596 +1 -2.1560141369701795 4.052819594846101 5.448339653382999 +24 -2.386079256841039 -2.8280668145030563 4.35837241466938 +176 -1.4372688768932664 -6.6415313837559875 4.129983376772735 +182 -0.4720828255607976 3.662207995039096 2.519318256725504 +137 3.2869116185302323 3.2307568609578143 -1.9509349541264633 +89 0.9583454014186878 -1.6238254590624648 1.3557912965537908 +88 1.7694593220184982 -1.036030143090322 1.9233033494166958 +160 1.008621423016506 -6.119196433851812 5.640861548269096 +125 1.8734575131064475 -1.5413231325971886 -1.3731468026454559 +167 0.5552538334188052 4.600624550198432 0.10361430748931168 +107 -3.2399064229680294 -1.8236363657903167 0.5755237816639006 +45 -0.8909937912895557 3.652128037032182 0.47945125158298724 +95 -3.55734648018246 -1.7071938037895589 -0.49307606319505376 +111 -0.5877274590969576 -1.0815552570296887 1.2264280053757328 +37 -0.4940015083502718 2.120546197357239 -6.129979680695427 +53 -0.2896516389711194 0.42515885739039166 -1.8677025658203998 +122 0.967791765282903 1.7401195129115046 1.9118554789129 +126 -2.954209751448974 2.164651827051895 2.3297982456925053 +72 3.173369384034092 -3.8176084785054245 -2.272242460318536 +144 7.811875555936 4.819434744326224 0.3359991553117815 +135 0.1395889289809734 1.0258297209323288 -3.8437628564556956 +183 3.6133240015570744 -0.6507150055387017 -3.110230107415811 +155 -1.81416144798709 -3.5659788058079758 -2.041490164886604 +21 0.6092276970785621 -4.133031653047547 -1.1692481377542574 +66 -1.2540845964267104 -3.824259504042551 3.29729030480536 +22 2.5446763351186448 -0.6513499783353496 -2.0932016159863465 +42 5.82871794909335 1.6743919751666467 0.7126718280768334 +77 -0.4040118365141223 -3.2290750702108357 1.818231240430787 +47 0.028653058178313952 -2.27141290239272 0.7388413469098802 +18 -0.3605358292652272 -2.51632133097868 -2.2152302223559324 +46 -4.956822430210972 1.7347845441659948 -0.8052402055568453 +14 1.0447813005670052 1.7950897980192044 -5.120385937069129 +178 2.8613069610645323 -1.221832900100255 4.786474400939546 +48 -1.0101057057064093 -4.108390928419403 -3.626668446988165 +55 3.380329095570148 1.9767809972549477 -0.7468971412257048 +12 0.5796037236485843 -2.968894009109519 -1.109629405353503 +15 -1.0805423425753338 -0.6224135466634316 2.517980927489596 +64 2.772129192684522 2.307682180641892 1.326944641441264 +44 -2.8172327982334355 1.083586023278567 -1.8763865737567058 +188 -3.437261818925725 1.5454398749025489 -0.16540078855271825 +200 -4.575258061249265 4.788641216932844 -0.4020526553149053 +198 2.0555443873273083 -3.895983368588817 1.158820403753976 +76 -0.43680328576927907 -2.690054938184871 -3.1926091395345697 +194 -4.927518640766644 -2.7958765254010074 2.346084579105554 +68 3.8869230882195995 -4.532127531608888 -3.709193335672372 +96 0.5541428371102486 2.469654795647139 1.3292842757665846 +91 -0.732047074282118 -2.6885559423815857 -2.1949168022734056 +154 -2.5136766428597386 3.590700279102351 -0.059374328708080126 +19 -6.161653279730477 -2.8765306398549155 2.4409492942004887 +120 3.4942280062726017 -3.9836089343560284 -3.098191865520773 +138 -1.392154916395345 -2.6054126458670575 -0.5249503554366697 +9 -1.4056559546036238 -7.532778826245055 -1.3371688664267456 +150 0.5460808983742688 1.1289965684546914 0.03903574349628039 +38 7.617629027425106 5.411105913171608 -2.660628272394109 +172 1.971077098016012 -2.934759849810778 -2.6385133345793075 +29 -0.8567705552974654 6.938534740571189 1.1877415743187205 +87 -2.465817251368031 -0.5425773738872799 -0.8367656554342691 +93 -3.238874163573574 -1.2524540618123574 0.7858441913773856 +195 0.6658739747764354 -1.3905513374439 -4.4817269197268415 +149 4.447455849494194 -3.5745477247727786 -0.5281496993793596 +25 3.022648709593685 0.43914951689799137 -0.6775610151451638 +35 1.3277674074899293 0.9468507964705938 -3.026965993493294 +116 3.907132307739244 1.560341819486881 -2.1186616218198884 +5 -3.10241641974574 6.10623002683338 -0.012215259748321432 +112 -2.863798374154691 0.5948426813836486 0.35177484162268213 +152 1.5766503044655036 -0.41730163186181074 1.996501964828515 +132 -2.0634425438904502 -6.992874517268254 -0.2451331836568511 +173 0.12455810167557121 0.14574198963840712 2.9966160518510416 +73 -0.10493988646970537 0.013265555839272553 -3.9096646776491677 +161 -0.7682600042762859 1.8026603641653332 -2.7660568636516665 +78 -4.598805320864625 -0.6966368634003359 -2.729429984123398 +11 -0.9758381654162251 0.5227854122925947 0.3448945101494703 +84 2.841479136799234 0.22602223675017963 -1.9286282882334902 +90 -1.170230656537341 -0.6922100007103397 1.00880686523509 +36 -1.555842370975647 0.5631255749042902 -1.1019837065378786 +98 2.0124676556916246 0.6570695281160257 5.910973495167498 +56 -0.022897610961461763 5.352337474059436 -7.2334429828662445 +109 -0.08981766099555996 -2.306157996649536 -0.3829489041252826 +115 -0.9773922652842171 -1.500230307176322 -3.510085314469408 +124 -1.1435154328225432 2.1646855444941977 -2.677614067537958 +121 -0.6489305438370466 -5.377205725667324 6.410392354489873 +80 -2.184720009719291 -4.6495239027996265 -0.404219915911962 +101 -1.8277373470288034 -0.16307514644975357 -4.871062878988115 +4 5.273572229084702 -6.329640548895822 -0.10537322064888095 +81 -3.237096839577087 -1.2899510482475711 -0.501749653216555 +6 -2.850185972190969 -0.9855865922331829 1.2879726986158606 +166 -0.71207408822265 -1.941276610007301 -0.46670672944069197 +40 2.5501094465369287 -4.1121537776062285 -3.7730629800493616 +127 0.9391826983400688 -0.23609028118969985 -0.8428319005564415 +104 -2.889702758235898 2.6026465825944647 1.733501739951787 +151 1.0239383010373613 4.20250515830853 -2.5188428027750676 +60 0.8768242700054026 -1.4452870366932915 4.607166615214986 +168 2.6499467008683806 0.15351519699868008 -2.4173199831848433 +51 -2.7001470663696083 2.298050292705142 -1.8727439352999022 +97 4.077411493370136 -0.49363711607361804 2.618893169202227 +103 -0.7976469434966291 -2.8296239792549494 -3.1085019733170576 +163 1.4239083858918546 -1.7152330037559187 -3.7262201886107413 +175 2.28608354457103 -5.013082617544787 1.9463144730607622 +158 2.364724804444635 -1.417965451640216 3.3110988056960116 +85 2.634049111053192 2.030183273599258 -1.1156959044778305 +63 -2.5594596368644584 6.5807348164634165 1.2216612365119401 +133 0.11496856368877509 -1.3029278864933922 0.3137832360475215 +67 3.2847742901460815 -3.509493405431694 2.207008202574443 +83 2.570557721108847 -0.3717669874940476 0.19918880069367745 +162 3.0399699011039054 1.3116112714661063 2.674382531726811 +170 -1.38109599459742 3.3822351643604485 2.3645182440787846 +181 -3.229104480841883 0.4809626947427979 -1.0038042842684436 +71 3.9132675825937917 1.4930647145750953 -2.169388439547446 +31 0.2080392077753374 -0.7175240437209078 5.244126748535574 +139 -3.2722113265821164 2.403646928095839 4.89007181946881 +3 0.23844888496446556 -1.2064671761077215 -3.765272552252597 +108 1.9533881124972572 2.2407632376201616 2.7809203919337717 +16 -2.546655497698339 -2.9475172512416052 5.679217575496501 +110 -2.0619258300646304 -2.5135908125338595 -1.9634278842507895 +50 2.7297022478135924 -1.7023753942716038 0.9305543045166054 +191 -5.08419299322051 0.0712033790584315 4.019663294315123 +187 -1.1602692653736124 0.6592040176624594 -0.9276587772961099 +180 3.9270482120535912 0.7337070019018614 -6.1521791130682715 +30 2.146405625539158 -4.470711382216746 2.4389136902743624 +2 -2.164694698633498 -3.946038803617009 -6.932908852758065 +17 -5.0136316664846525 -4.910395378878622 0.2531438520391362 +7 6.405139093241594 -0.029320522419797518 -2.4556700372713656 +164 -4.71978957162196 0.7565882723845814 -7.804804192177828 +69 0.585325244096323 -4.172549570259053 1.421305529899283 +61 -1.2969434367599055 0.21371727493194503 -5.996553017036012 +34 0.836211095631979 4.842199148306591 -0.264740483545493 +43 4.973431404758735 -3.0161637272673114 0.6585207320279483 +177 1.9972180553856484 2.8405653312769714 3.7936113983454574 +179 -1.8016662165736297 0.17922718595288942 1.675961420609039 +65 -0.3262344061357664 4.502937830108041 -1.6925046570602365 +27 3.2148912674329595 -4.265923914349978 0.20837858074619325 +58 -2.5148141053183966 -3.410776250506333 -4.126435252324821 +32 -3.9688004644027894 -4.975859333985981 -0.31037975343014773 +26 -1.8868624613436276 -0.6784023280861808 -6.9019978159434325 +142 -2.2655622806415803 5.065238482808602 -0.5612653461135326 +100 -3.1689440110918863 3.611829368506524 -5.535634657025687 +184 1.155071447769214 1.3970696009831187 5.21877428678114 +105 -1.0527289600189955 -0.359868396602688 -4.314898952688254 +75 1.1126434309490583 7.161365583137096 -6.8797286508213995 +99 -2.2511573267704605 4.325930022921806 -4.536664094156967 +193 -1.8538759123569282 -0.3771359852226918 1.3265167612281819 +33 4.043103770190031 -2.463191434468879 0.2825585567463736 +79 0.8247934215179962 -0.8593180918731026 1.8075425908507756 +92 -1.9872298962564725 4.526116206000229 5.875185828559399 +165 -0.9325271408003691 1.9234746099504088 0.09139445808177141 +199 -2.4466143796538278 -3.5392337118481905 0.07336564176962056 +70 1.6955535004916 2.7542669443749292 -2.844202030673744 +146 -2.7188074197448584 1.8546678027188679 3.404472056065058 +106 1.6207845192963544 1.2164210998710923 7.1450165172108 +52 6.210256198054289 -2.1514980948844977 -3.0246733234381606 +86 -4.166581136807711 -0.379450814784322 -2.11423926273923 +197 -2.0944322960049 2.1097024434581955 -1.5699756741420037 +185 0.496431323422778 -0.673746468047717 1.6256733179580487 +190 3.5894390751435754 -0.5232916689073732 -2.5898259464521436 +145 -5.060692392767518 -3.604348262830216 8.963086293155014 +131 -1.7493649096325448 1.9215551392824017 -5.654561521157757 +156 3.0486560090093078 0.7623397112130897 -0.6623326467666147 +10 -0.3025813929631971 3.8012367067722552 1.7944918683195408 +196 0.20779509519657535 1.1724947587327104 -3.2497684331092898 +143 0.1615216816901657 0.541965759645283 -0.3699391852573772 +13 0.3416281793998905 2.006587618812918 -4.356326172952984 +59 1.6542517855144645 1.9404536050042447 2.6385288647359855 +186 -3.4589984191612237 4.344929883747252 -2.4261876990284055 +136 -1.052237178030063 1.7981079687785935 1.5452947189881334 +192 -1.8283033036376375 -2.1460456664281984 0.4532252919540826 +113 -0.07210257811201395 0.4448121853700756 0.4002442722770919 +62 0.07671657245048122 3.988794018720988 -1.5215067553007326 +74 -6.261763851450271 6.841230877971418 0.19948931371832682 +118 -4.55843930988713 0.7045880922983706 -1.5541929923380147 +117 -1.7138030815767766 -2.2218466460669197 -2.4862510267677966 +23 3.4139900995951797 -1.2153416151189098 1.5870813641624815 +171 2.9673700826094715 -2.730113253007238 -0.013674771129509489 +94 -1.559158449433541 -4.089352807642382 -4.9936243516296415 +41 0.05830786336808787 1.0332428056957692 -1.4731928753411638 +141 2.0403501209228514 0.38114816689047215 0.2637593201666092 +159 -2.276370624127765 -5.5130320242721425 -2.201507053272948 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 new file mode 100644 index 0000000000..d48c9e654f --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt02 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.348412656724513 -8.709686235988883 -8.4270990310572 0 -1 1 +57 1 -6.076254771403757 -9.286388884881402 -7.702702502017148 1 0 0 +82 1 -7.550388144071918 -7.009510153923324 -10.103430125234938 0 0 0 +65 1 -10.007477542149314 -8.426774632489874 11.409858756818739 0 -1 -1 +8 1 -7.164995520412905 -11.038468804393306 -10.58636480246276 0 1 1 +49 1 -0.45959797061569213 -8.711842576893478 -7.759689256680434 0 1 0 +54 1 4.335836096446666 -9.860468354448713 -9.596810041931791 0 -1 1 +102 1 2.5723817340883883 -6.321599469181216 -10.836018784654463 1 -1 -1 +114 1 3.9633708583907534 -8.59122246718616 -6.211421303718058 -1 0 1 +128 1 1.6111319524977374 11.42178725036819 -7.424763349756333 0 0 -2 +157 1 6.676723241532642 -6.249807038476984 -7.434858543313773 -1 0 1 +20 1 8.180031746693997 -11.224906976375225 -9.914700910890055 0 1 0 +147 1 10.552595438745763 -5.846535200951102 -9.39377855844701 -1 2 0 +169 1 9.349136090221942 -8.979140149397233 -6.8265579785125965 0 1 1 +123 1 -6.855446583817184 -3.2640394531559696 -10.949254791001273 -1 0 -1 +130 1 -6.535059536526429 -2.567484128692307 -7.041716414515715 -1 1 0 +140 1 -9.06855871809178 -1.3542845787289544 -9.224892837601802 -1 1 0 +153 1 -4.569518029474378 -5.203914109037015 -8.781875667281184 0 1 0 +129 1 -0.2299073567614939 -5.077417463604178 -8.55580527821163 0 1 1 +148 1 -3.144987560803104 -2.0908434236033218 -9.879429686918634 0 0 0 +119 1 -3.5411143846194992 -3.8360561641889532 10.696563632316428 0 -1 -1 +134 1 -0.04545170129816967 -0.3594090384455699 -8.557611667254108 -1 0 2 +174 1 3.1061081743214345 -1.9799957752444968 -10.724581364205001 -1 1 -1 +189 1 2.8769937819916396 -1.3674240720053161 -6.389788220787231 0 0 2 +28 1 6.237115641177313 -1.1545998190288946 -9.272228860156012 0 0 -1 +1 1 7.549394959535029 -2.854734791893552 -6.538590887699934 1 -1 0 +24 1 10.883729099000904 -2.1271876989337706 -8.117545982704844 0 -1 1 +176 1 10.267930709995003 -3.6438442151633126 -4.343476582694092 0 0 0 +182 1 -10.786266284256198 0.5593263120798149 -5.188887623332871 0 1 -1 +137 1 -8.253864841052525 3.7298295620111226 -8.568533527553154 -1 1 0 +89 1 -5.794201120520342 0.9380076791670935 -8.557102414588634 0 0 -1 +88 1 -3.290466618666769 2.666597373561615 -10.965754432660972 0 1 -1 +160 1 -0.18201736379451042 5.440877252854083 -6.045408976448922 0 0 1 +125 1 -3.2721098231201498 3.482326329512073 -7.20800643325733 0 1 0 +167 1 2.6838478408055124 2.662941774470184 -7.446400398896404 0 1 0 +107 1 2.461769881852174 1.4723823486650787 -11.23948224456525 -1 1 1 +45 1 -0.32643148409171074 3.4132158246810462 -9.890588978502432 0 1 0 +95 1 7.12050576869771 1.8830305880227627 -11.021337217501824 0 2 -1 +111 1 11.302810293745958 1.3519264206984616 -8.432303785348612 0 1 1 +37 1 7.499987535787309 1.5957548452787924 -7.727720303674275 1 0 2 +53 1 9.440512427968931 5.294797843867766 -10.137582763727357 -1 -1 1 +122 1 -8.602536179448315 11.512272015578171 -7.106756749836173 2 -1 -1 +126 1 -8.684507097426447 9.102724910576027 -10.228076159133025 0 0 -1 +72 1 -11.212168106684132 7.24750708554837 10.879317278944692 2 0 0 +144 1 -3.026583839716779 -9.884067057114146 -9.895519067990667 0 1 1 +135 1 -0.0021296445465068814 7.861337183488864 -8.408004375424728 1 0 0 +183 1 2.8552963287326403 5.197557014594176 -10.04944592034365 0 0 0 +155 1 3.763607040992876 9.197661654352766 -9.383705258407385 0 0 0 +21 1 6.743085276662367 6.819489412060577 -8.245771575257553 1 0 0 +66 1 9.52403312105875 7.459476022143324 -6.138585785756646 -2 -1 0 +42 1 9.12856561120073 9.359598065403702 -10.255808680046007 -1 1 0 +22 1 11.084937277836246 10.7346270298744 -6.189336343510782 -1 0 0 +47 1 -8.79851480543095 -8.030651717047036 -5.3995272670275725 1 2 1 +77 1 -6.824604399212273 -10.927075660857042 -3.894519486445894 1 -1 1 +18 1 -10.638894292838417 -11.301447222259686 -3.92180055862298 1 0 -1 +46 1 11.290286356240586 -7.674430365874162 -4.055829279128204 1 0 -2 +14 1 -9.506577112536185 -7.441780453176744 -2.0080876276818103 -1 0 2 +178 1 -4.543756730558393 -8.097143654115143 -4.784790404681888 2 1 0 +48 1 -3.2444312260629573 -10.940861821243079 -6.354255167480908 1 1 -1 +55 1 -0.9464860706310958 -6.285996525353373 -4.30908825600282 -1 0 -1 +12 1 -1.856123326430506 -9.517447392023085 -2.3435724928975645 -1 0 2 +15 1 6.077305695814157 -8.166300444221115 0.7448836933119019 -1 0 -1 +64 1 2.7452944971646858 -10.558129575009149 -1.730050297615053 1 1 0 +44 1 8.116024736633927 -6.297043957734161 -3.618119081228304 -1 0 1 +188 1 9.990490631214506 -8.453825757862562 -0.7847723993749525 -1 0 0 +200 1 -9.371399961242005 -3.371895968187197 -5.193597997968697 -1 0 0 +198 1 -7.163187216472317 -1.1934858004192783 -2.2622400054633864 0 0 1 +76 1 -9.919958613706985 -3.040871792288106 -1.4149931903428534 1 0 0 +194 1 -6.743945843921815 -5.005230021567819 -2.613393963742155 0 1 -1 +68 1 -2.5671189668335317 -3.434435519320573 -6.1465461411366 0 1 1 +96 1 -3.430661147431614 -4.018545052073527 -2.021400662533695 -1 2 0 +91 1 2.9683873682514026 -6.254217834947031 -2.3589109971891737 1 -1 -1 +154 1 -0.2218228203315391 -2.902150057925404 -2.9725706529414366 -1 2 0 +19 1 3.2665435171804194 -1.9817522239515633 -2.3096363660640975 0 1 -1 +120 1 6.609146288179666 -2.2318382061287565 -2.808377349441308 1 1 1 +138 1 9.631227201052864 -4.547744518411388 -0.6709487904267171 -1 1 -1 +9 1 7.596887391638223 -2.0237588049028696 0.6051605861836649 0 0 1 +150 1 -10.044973671786467 2.0147581633676452 -1.3897952482345524 1 -1 1 +38 1 -5.7978106400822895 4.770632320137689 -4.758054319452569 1 0 2 +172 1 -9.658785222083136 4.026164557116778 -4.942402258050777 0 0 2 +152 1 11.431334273176418 -0.4623515239881826 -1.925450909701469 -2 -1 0 +29 1 -7.909238416570071 7.61624491229837 2.2042493522591258 1 -1 -1 +87 1 -3.3103551172038665 -0.94337019011639 -3.5930404382745955 0 -1 1 +93 1 -6.2863195662557 0.9404795536165196 -4.898675396085437 0 -1 1 +195 1 1.0245553543549981 0.20159488775043144 -3.679042462676364 1 -1 3 +149 1 -2.269526344184385 2.8074136653426387 -2.5814855370744945 1 0 0 +25 1 4.649154714287583 1.2394738761102164 -0.6186508337325307 -1 0 1 +35 1 2.8516234465534787 3.745844200453856 -3.7667964552544286 1 -1 0 +5 1 5.795606814798939 1.5285888723891716 -4.179888075744685 0 -1 -1 +116 1 6.001522247841404 5.755884373452364 -5.02433183427119 0 1 0 +112 1 4.844016623012077 5.465934695953432 -0.25432767294668557 -1 0 0 +132 1 8.53939720077536 1.8213558063438606 -1.3830903771567364 0 0 0 +173 1 9.062655610340409 3.8664027467280935 -5.47150892329001 0 0 1 +73 1 -9.979257287380412 7.98839910326609 -6.702836934882303 0 -2 1 +161 1 -11.50425364162053 7.022415057658153 -3.488322518144713 2 0 2 +78 1 -1.7469625877850241 10.184158454427994 -1.7648096425042503 1 -2 1 +11 1 4.444644958846757 11.851997915189173 -4.933412264679578 0 1 1 +84 1 2.459047681073617 7.373812748831801 -5.213139361825189 1 0 0 +90 1 6.1482860548874925 9.307626902509035 -0.9026751698054234 0 -1 1 +36 1 1.9695381713294537 7.78336838361963 -1.7729647147442544 2 -1 0 +98 1 8.527874795717773 7.612035599231426 -2.9325216125652 -1 0 0 +56 1 7.282783408448612 10.400831236794666 -6.728973679619628 -1 0 1 +109 1 9.156728968120607 11.308407539099598 -0.9040861597803378 -1 1 1 +115 1 -7.309621980156194 -8.117595813105002 2.8126740615279595 1 0 0 +124 1 -11.142069858043358 -8.82667541719755 4.10932707265772 1 0 -2 +121 1 -8.21003433895173 -10.089956822420406 6.660752548831763 0 1 -1 +80 1 -4.909425537698309 -7.256236799158399 -0.2747148144591023 0 0 1 +101 1 -4.312342956814611 -8.070113074572049 4.879741561255617 1 3 1 +4 1 1.5494925162428856 10.03102296069128 4.602107842780676 -1 -1 -1 +81 1 7.27113702294054 -8.472013640467047 6.625505444757195 -1 1 1 +6 1 8.885736885591768 -10.557271403060728 2.7878338185404203 1 1 0 +166 1 -8.69650192512206 -5.07362796560642 4.236148217669305 0 2 0 +40 1 -6.987849762900474 -4.511534637942379 1.3175075163680883 1 1 0 +127 1 -5.689629608203652 -2.3907227510814337 3.9463589292537864 0 -1 0 +104 1 -0.4397363632556015 -0.6165598923688651 -0.3313279093278112 -1 0 -1 +151 1 0.4300685018079994 -6.441488457556783 0.38045612640805615 0 1 2 +60 1 -2.3217820522915846 -2.1704723730197557 5.333166404467865 0 1 0 +168 1 3.9149834819211655 -3.3791911515481985 0.7567189672094479 -1 1 -1 +51 1 0.398133835057336 -3.3931578730294385 3.016370538231655 0 0 -1 +97 1 2.1573351041413034 -0.0855884286300217 2.2286851783702524 0 -1 -1 +103 1 3.9664988893980713 -1.064731427067052 6.037166605284854 -1 2 0 +163 1 -10.709566329240587 -2.7332402144894417 2.2660820588417665 0 -1 0 +175 1 5.762755562271241 -3.3856559659466114 4.002375112428048 -1 1 0 +158 1 8.862173003831924 -6.538751027751994 2.8769202677556542 -1 0 -1 +85 1 10.229250850148503 -0.01502947727190853 5.300096059690905 1 0 1 +63 1 -8.263417127255543 -0.18022873161562153 1.17510825734459 -1 0 1 +133 1 -10.480766232506394 2.392923584409271 3.720879727063737 1 1 0 +67 1 -6.544234163722191 3.501038541004621 3.191437971422375 1 0 0 +83 1 -3.849802400718045 0.6646468573486004 2.7446055069817703 0 -2 1 +162 1 0.6098193007635196 -0.05324811248282152 6.154363200071202 0 0 0 +170 1 -2.6786368359767714 4.255168732248176 6.435570102352074 -1 1 -2 +181 1 -5.252793067773865 0.7761154003139943 5.79909696611136 -1 1 -1 +71 1 1.6452911952303246 4.06622820161267 -0.5166203216146883 0 -1 -1 +31 1 1.0738987741436463 4.15303788757344 6.141061091921109 0 -2 0 +139 1 3.8104659718300624 3.693576878280304 3.384062081506274 -1 2 0 +3 1 10.9858871588246 1.2545617976234098 0.8570931258327192 0 -1 1 +108 1 6.174388178357244 0.8538858651722911 3.6472942727893374 1 1 0 +16 1 8.97282237909764 3.5943899325206274 4.02632096928566 0 -2 1 +110 1 -11.336507152318017 5.947474598331584 3.14037651741927 0 0 -2 +50 1 -7.046202899905131 11.083294806174674 4.036430331092051 0 0 0 +191 1 -8.508890702823583 6.994301261898876 5.5988324620755945 1 -1 0 +187 1 -10.749519222803974 11.280267500561628 5.071750333310352 1 1 0 +180 1 -1.0032349913124285 6.140237973021502 -1.7436540397788036 1 -1 2 +2 1 -1.7946548786825645 5.404613901091388 2.68002365908378 1 -2 -1 +30 1 -0.6282593143948212 8.881746166196663 1.2420280890418454 1 -2 -1 +17 1 -1.9971151666590217 8.252473054961822 5.30244560397972 -2 0 -1 +7 1 4.0488432159812255 8.81693522673231 1.6114995620401231 -1 0 1 +164 1 1.873438403508949 6.222826359057496 2.2533705281578316 -1 0 0 +69 1 4.6051775335846745 6.921132428828564 5.128620799236167 0 -2 -1 +61 1 10.268176907196304 5.08172043450454 -0.642274843845057 -1 -2 0 +34 1 7.601946368008498 9.256904252690223 2.406585955238384 0 0 -1 +43 1 7.165450199452092 6.0290506218302085 2.4419163969738023 -1 -2 1 +177 1 8.561622776612461 7.244917835893727 5.602147565752702 -1 1 -1 +179 1 11.750057623239174 -11.228395927014766 -10.487778908482419 -1 3 2 +27 1 -10.974224751020245 -11.635298968202441 8.509409995684443 1 1 1 +58 1 -9.692847117546727 -6.99702076150861 8.089242933510139 -1 0 -1 +32 1 -6.165044846878473 -5.3531372054847 6.419358142287187 2 1 -2 +26 1 -5.15775210282499 -8.509724647787523 9.35521475378418 1 0 0 +142 1 -2.2394120995772013 -6.757001235575803 8.53817557952535 2 1 0 +100 1 -1.562747759528225 -10.930435349230905 6.862796976881519 1 2 0 +184 1 7.329483236732028 -7.477553906204161 -11.457403276020457 0 1 2 +105 1 1.3124523565691075 -7.852976862538032 4.005035595809602 0 0 -1 +75 1 4.597924698307231 -6.283694211187047 5.476806400599068 0 -1 0 +99 1 1.716773073271929 -10.998458790026556 10.715096401091909 0 0 0 +193 1 2.1325154242736666 -6.931854968739277 9.419307764840358 1 1 -1 +33 1 4.48712925680286 -11.671378658171115 7.267170381111049 0 -1 0 +79 1 8.573107089496888 11.611228502272368 5.983087465760138 -1 0 0 +92 1 9.81601068917706 -9.527916362770739 11.159627680682005 0 2 -1 +165 1 -9.2113400341349 -3.219195257680457 7.288219778779848 0 0 0 +199 1 -6.931272020823427 -5.000130571946396 9.88597891452116 0 -1 1 +70 1 -5.507541862888313 -2.393142934597723 7.807143673901248 0 1 1 +146 1 -1.4771503758916822 -0.5410305896302106 11.279923136114263 2 1 1 +106 1 -1.3651808664767915 -2.54616781259121 8.590647351661577 0 0 -1 +52 1 0.6779843498698166 -3.7311606456725768 11.453754175953545 0 0 0 +86 1 5.4031998049641565 -4.549788149287394 8.596350093940629 -1 0 1 +197 1 1.573548668834416 -4.687213943022477 7.1278633337641 -1 0 -1 +185 1 2.1532991864501554 -0.6046775517606129 10.000779301772766 -2 1 -2 +190 1 7.401787297285096 -0.2505978640044338 9.870584022136198 0 0 -1 +145 1 7.111702440333872 -3.6540730490844453 -11.814469255040187 -1 -2 0 +131 1 11.130905707249603 -5.281990426153451 6.209567942496238 1 0 0 +156 1 -5.482768650143603 -0.4312680407464029 11.466238929392272 0 -1 -1 +10 1 -9.053182404201642 -0.711645217691651 4.8230146575990815 0 0 2 +196 1 -9.337441409320208 0.1609718702750058 8.663781619737854 1 2 1 +143 1 -7.17068301465806 3.0756929715249197 8.74321294778271 1 0 0 +13 1 -11.784452395762827 3.289072175663378 7.001527553636599 -1 -1 1 +59 1 -3.4378714190696336 1.7721863061771366 9.36771463550879 1 -1 1 +186 1 0.1662370132365254 2.5243181917810595 9.709168312215267 1 1 0 +136 1 3.4094152339708126 2.153729603693705 8.008621315534214 0 -1 -3 +192 1 10.489678729236587 2.4935818679754185 9.842929691077494 1 1 1 +113 1 7.1536296108923345 2.1797090477435894 6.8304033834765505 -1 -1 -1 +62 1 3.9169396613561496 6.861682724751661 8.976027690230366 1 0 0 +74 1 -8.118378807759774 9.793902614888827 8.932362315849124 1 -1 0 +118 1 -11.58583737453999 8.536873240765573 7.014861349235567 0 1 0 +117 1 -5.277108589074334 11.352800033973235 7.597327201748058 -1 -1 0 +23 1 -5.157626384085098 5.75340956696832 11.215724105856438 0 0 -2 +171 1 -4.306475221375887 7.1666374724202555 7.827635610104089 0 2 -2 +94 1 0.5173001347371304 9.700900025717369 9.033047100941438 -1 0 0 +41 1 5.490142462338115 11.510392579949611 11.613725539319557 0 0 -1 +141 1 9.87566572043054 5.774221219191659 9.0665289512053 1 -1 -1 +159 1 9.686865955901812 9.753371327924555 9.75057962979839 0 -1 0 + +Velocities + +39 -1.9399818993193945 -6.2245952285602995 3.5338548174142916 +57 1.5287860491005811 -2.72214429330134 2.2456706435699694 +82 4.011405667244886 1.5297461738282854 -0.00848199347765205 +65 -8.99687886174914 -3.5904944014362874 -0.24257004026483364 +8 1.3456043077490425 -2.128460026427474 0.5438548397418695 +49 3.9804563992312922 -6.033137289721198 -2.4992971438276896 +54 -0.8797092038138496 -4.4441361344158485 -1.158307352101043 +102 -1.6073661483672754 -6.3013772766305705 -0.8971841583061024 +114 4.952776653242985 1.9508143607180544 -4.637659613505405 +128 -1.269058654850369 2.9109256516813193 0.4053666332013952 +157 -1.0484348115580815 1.3302695757858152 -2.3230656835483483 +20 1.6286859684439459 0.8384182438479687 3.337320080806048 +147 1.7009416069818912 -1.6078420463299883 0.41513271531119245 +169 4.488200687237288 -6.490934602483694 0.13987631822178037 +123 -2.8913963004993426 7.445402407235762 -0.2708525381058624 +130 -1.3405859620177862 1.4399831113332697 0.048073865645907876 +140 5.071347652434061 -0.6702612789643095 4.605780995472893 +153 -3.7972143859475698 -0.514917067426214 -4.9181301157390225 +129 -0.524987732421045 -3.209340969084892 2.932495986872108 +148 -5.447057077277419 -1.4060679681657386 -5.483184347880067 +119 -2.5629223421862375 1.3882127095818109 2.83591016397441 +134 -1.3621064953428361 4.288456433365155 -1.6190478694645496 +174 1.7758446648889914 4.86331991854285 1.1265592480566544 +189 -2.1997618638118066 -5.481413979755256 -1.086026577758521 +28 0.47277982211285713 -2.417172577737755 -1.932990476216946 +1 0.6703800334847378 0.767366418061703 0.19201532965448842 +24 0.04297238333671294 5.144308305848863 0.078997482901074 +176 0.4965479246937361 -0.13321844730810892 -0.13420426694661658 +182 -0.03943631525057928 -0.4576897656157408 5.202139202652978 +137 3.3038160138315282 -2.8142339694373977 5.5902387847740025 +89 -0.7210799083306686 1.5890809944259632 -0.7203455040724582 +88 1.0693506358892855 0.004219772825099388 -0.34637529725335453 +160 2.818428049318086 3.2244292228167537 -4.494216600884747 +125 0.42818621594139183 3.1889923789665167 -0.2889418149701054 +167 -1.634028108672504 2.274964875925839 -2.5010575325085713 +107 -2.275260397982265 0.40965124117591156 3.7368455922538386 +45 -0.7001662440449031 1.119455401379465 0.23148546097076927 +95 5.262372995855103 -2.4350400461030928 4.204427583146448 +111 -2.8606969082837232 -2.7980553847036016 -5.595977877258418 +37 -2.2899225677006445 -0.8948602257995134 -0.4803200724258121 +53 3.002131309420766 2.6120771462261168 -0.9952903525863226 +122 0.8674217257039606 -7.734997952666523 0.833404061351757 +126 -1.1420613062006533 -4.550118096866477 -4.2790463933780245 +72 -1.8516741228057083 5.947761028964626 1.6102399224289305 +144 -1.1917460086100382 5.214371411898472 2.577241700331775 +135 -0.6560595442322588 -5.810339924107932 -4.318267593309593 +183 -10.386809746296331 1.1897898885572993 3.451816626760367 +155 -5.162635743080924 -0.24765733386766664 -0.9110712844247615 +21 -4.2563878171076155 -3.402344841498928 -6.759865341543254 +66 3.892260841699981 -3.872668437572034 -0.3337143786545691 +42 0.4166666127989469 6.100606589949791 -1.4397576055696024 +22 0.3608663266598049 -0.6522614903150212 1.896193166731318 +47 -5.327073086748509 -3.490472671050769 -0.07383525372930849 +77 -0.978728222397191 3.4020107799172736 1.0077489411757843 +18 -0.4650542307772494 2.9718359172432747 1.4633800163719572 +46 -3.027050149464662 4.17167624743228 -1.827230734431756 +14 -0.09677720578549692 -2.7193038262530447 1.7914199983541117 +178 3.696002315695369 1.6876713658009856 -4.672832052845037 +48 3.983692149992739 -1.1833239408832328 -4.299433489091069 +55 1.4078039475385906 2.056934505867413 3.7406982539078393 +12 -6.525348764219679 3.3122244911450394 2.6197769407714624 +15 -3.3141834562011994 0.5054069138851847 -2.97725365266652 +64 -7.771910612976191 -4.581106933347833 -0.41638292972909086 +44 1.6412238745050067 -1.8908109366759165 -0.06612343065785803 +188 -3.5844091539515395 1.8268122826497 -0.2374993089904055 +200 7.894813073634868 0.057995156825788374 -2.5771892403060033 +198 2.1286980919165597 1.0207578884216715 -2.002608806720997 +76 -4.082585877193767 -3.634723448931757 0.6497689857802457 +194 -5.141422516595061 -5.385767090831518 4.1044833771883145 +68 -1.3677719930905985 1.0604606148180302 -1.7254671966550923 +96 -2.592687583785919 -0.5546395167068001 0.38605262002135754 +91 -4.294011884932044 -4.480411411848511 4.543287343202344 +154 1.815487275814105 -0.07008532516876564 -4.441392134697374 +19 -0.24976249513756998 1.579721447829149 -1.7421975373515703 +120 1.804118819372854 0.520165481785893 -0.866356354838586 +138 0.7160603181741005 -3.5316114730742316 2.8815518324723897 +9 -4.1756988875943195 2.0672991466342374 -0.8825046873416664 +150 1.815083623557248 2.773051884794719 1.9746918971798604 +38 -1.502458122060807 2.504120522003904 3.5630087040476006 +172 2.925371783317832 -4.008067088721308 2.95272814084428 +152 -4.6300230395213555 -1.2429914909034638 -3.848634119515747 +29 2.326120452340355 2.730479927388889 -4.850062460498464 +87 -3.7757652246448092 -2.144244861787354 1.0169754355289107 +93 -2.0873983214067384 0.5358760575940038 -0.23325341995082138 +195 -1.4168233936677792 2.3959259540484603 -2.0506018284590537 +149 2.2841089396850274 0.26447423100144896 -0.8987301521306412 +25 2.8990369033774663 3.4475964151025584 0.06622887609588958 +35 -3.439056984685437 3.8288190767067634 0.5330155111995796 +5 1.1832213107046619 -0.3877998693431248 -1.369194610956917 +116 -2.0849829431786198 -1.7654561629509715 0.6633937705540919 +112 -0.5822227923488573 0.3013831835536517 -4.31387983328802 +132 -4.968232076425547 -0.6461873308157724 3.153818258163696 +173 -2.606365772909947 -3.929167709306097 -2.1504295970222675 +73 1.5595598163445097 -0.6161933298135185 6.6258235518245785 +161 5.1614226588847085 4.911303681383577 3.193451794720913 +78 2.399770604666089 -1.7368694007148553 3.13840955491289 +11 -0.1723279344217883 3.2117525787482495 -5.003125430736541 +84 -3.0246026160032238 -0.10349126829912314 -2.244471367403812 +90 2.2752472907587027 0.5192129247104318 1.739661062051631 +36 3.3131943405122586 -4.945706489020841 0.7304326039438429 +98 2.222390966846857 2.076728811998776 2.745752031197498 +56 3.2308827790046997 2.20226369176158 -0.16256864643069302 +109 -5.432919034165497 -0.6507653252627013 -2.288197504123378 +115 3.2470353212929526 -7.326498442980268 2.0848162375252226 +124 3.23326108206676 -1.3727946801269606 -2.040624527813595 +121 4.263689866797482 2.7161360736926117 -0.9353436003014414 +80 -3.183923910858363 -1.409115057483441 0.20655585479413852 +101 1.8647413072811272 -5.138741167769708 1.449442652238715 +4 -4.059920467104848 2.021712460074869 4.0296908872357 +81 -1.4496413113665318 0.22275997734715647 1.0204012050853233 +6 -2.5319674910604797 2.921972066778776 -0.5937144564354684 +166 -1.7032554189048639 0.4271452228969883 -3.929596648952609 +40 -3.2997667945300786 1.7569019147151133 0.9556994202850172 +127 -4.094479436855724 1.004173845399162 -0.957686162248562 +104 5.839775077994146 0.5614942472461542 1.3388300846640222 +151 0.03681474392662332 4.158212179208171 3.087410074045597 +60 -0.5753595098363337 -1.944185172990125 -8.542198180005448 +168 1.356831683366837 -2.3643099268420564 3.337777267437989 +51 0.594767745409305 2.5443394223058013 -0.5744844027146594 +97 -1.4592614460552826 -2.9896997140291077 4.468909988652328 +103 -1.7464552873436274 -2.725030040682925 -4.682984068370838 +163 -1.6811327453491027 1.203374785043913 -2.52756154734346 +175 -2.36073693749339 -3.2083472883959288 -2.522379591971816 +158 2.0901462213047384 -0.8790568223757592 2.862349710125339 +85 1.6955544698562546 1.329401432748634 1.339424168209504 +63 -0.9387866016534254 -4.101481886236126 2.5768942521591023 +133 -3.3950934863801323 -1.1853227351766746 -0.8938618367927571 +67 -4.93636647331341 -5.808321017441839 -1.5826220082758682 +83 -4.348910184667013 0.5721399223517865 -0.7197270365001088 +162 1.9809720767805532 -3.8356819219002203 -1.5209517397218844 +170 -4.1339290337428345 5.621618700525048 -1.5836709740423311 +181 1.1838126543084162 -1.2107904166348504 5.997389392830687 +71 -3.6322706258882382 0.4573448065249036 -3.4819929402094774 +31 1.5672965345476493 -2.5171072174405418 -5.016079150444441 +139 2.347944365043533 5.087068349207903 -1.4373175728413294 +3 -0.6897541703497496 -5.2109972760726215 -3.1967261285849102 +108 2.1632029794076 -2.3278780023196486 -2.2165896316468543 +16 0.5518752214748219 1.7443113317844785 -0.3914314868799459 +110 0.6545696772446776 -2.3972319991341955 4.869786319607602 +50 3.4589447101316337 -3.631848006300771 3.113137145447494 +191 -1.2968299225913498 0.4433703369757638 -1.5568387599668925 +187 1.9322905031758904 1.7630376183510783 -1.713007037692872 +180 6.8380544057940424 1.3883512491464782 2.155270210489675 +2 -0.9447291546303294 -0.0513923732527517 -3.0672808505869886 +30 1.6158645533289293 3.1155851081317145 -2.1710811001472363 +17 -1.543787339459575 3.1374805002054007 -4.413979305864849 +7 4.040936876599553 1.9639386370487468 3.3637852508743804 +164 1.4392327984967968 -0.8254697339648331 -0.33613984139186426 +69 4.683013019846548 -1.4001774602376138 2.7483283024733463 +61 4.859801586904617 0.3945575299928299 -0.36030106753723035 +34 2.144274218554215 0.30058665232035375 1.6815154302941946 +43 -2.262284846661947 -1.933549681130589 -1.7228919249476684 +177 -0.04379017544723046 -3.0489629385721146 0.8031465712034731 +179 0.1618165357299699 -0.15566873489305255 -1.156913000807537 +27 2.280685460437968 0.25990101487970774 2.9095092475822724 +58 -0.6292223334449243 -1.0309616093739953 -3.156937935356546 +32 -0.011281818866179849 -0.9102886141888968 3.1492471714773824 +26 0.3704942133027209 -1.9855236287495084 -1.1813125622083982 +142 -1.0547774115337973 9.781673444693524 -0.5474605098370294 +100 -2.466739505935093 -2.401234723424822 -0.9166143227115303 +184 0.998183931841219 0.5555844351868584 -0.24866844568146534 +105 -0.9091746414938665 -0.6852682268807229 -0.5049408850325867 +75 -1.2458876998256998 -3.70960636595479 -1.979594195572476 +99 4.943544682867021 -2.8438984768476887 -2.114165836507449 +193 1.6648153391738203 1.9396654116178769 -2.563892949279256 +33 -1.6878161438450656 0.40927910646954185 0.5582734801758544 +79 -3.538909021595642 3.805204310016289 2.7765516255860625 +92 -2.394452859130453 -1.9459314788883335 -4.8163793839903395 +165 5.545976326258468 -1.4902648191681507 -2.852217343260048 +199 6.057154285340822 -2.785333961235231 -3.9368802597200943 +70 4.428171740986177 -4.8728670167946255 3.9631873121213563 +146 3.789706894596731 -0.4960046634434 2.7214958472715947 +106 -0.23074985036276763 -8.713636612175375 4.005748004431039 +52 -0.7237533363087905 4.119548929665377 -2.8963629157006965 +86 -0.7790443173139772 8.632440811261022 1.3650149071424797 +197 1.0158635207501077 -0.6540677867631334 -1.9286092656946883 +185 0.14103906323580015 -1.9230099439242179 -2.9613897973588497 +190 -6.016428738140042 -1.2480913921594763 3.6835279433237065 +145 2.079579027486713 7.671127892348986 -1.2249224435341195 +131 -0.32590310182334836 -2.4757135143210527 -1.108006743304219 +156 1.5441602101522276 -4.3012365664752 2.152192470473115 +10 -1.9251615561320725 7.7941703098856605 1.152489777841718 +196 -2.5417164626144206 -2.322970333327737 6.382288207464665 +143 1.1146704068320736 2.2068798409995507 4.003296941736723 +13 0.2218873541633033 2.002339450538451 -3.9278426768807844 +59 -1.1249725039613747 -1.38236183692768 0.6273981188606278 +186 0.17954184943335427 -2.3932954696372053 -0.7313011465358523 +136 -0.6086309213506338 3.5713339511273894 -3.8080329205654193 +192 -2.4502215368224705 -4.545932925209442 -1.62934516857554 +113 -3.3214500416678074 4.555014566016373 7.353766374710929 +62 -4.358088896189819 -5.982496403026446 2.5501878477362316 +74 -0.5539329584507672 2.794170243271062 -2.161412931865338 +118 -1.979611801168517 3.0336891371182197 1.2515672466968413 +117 -2.6346443065380387 -6.52420382221947 -2.3221165776786097 +23 6.421824321311546 1.7253174765287 -9.160076509970361 +171 2.1156964930224973 3.568443790163169 -3.4488134770961105 +94 2.1701428589622624 4.886850980047828 3.260178593455835 +41 6.033712104492915 2.2785562972718627 -1.4849735175385876 +141 1.4706522295431979 -1.8195923066965298 0.019053288005804775 +159 -4.554564437682667 0.05936456417819991 -1.932073129933284 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 new file mode 100644 index 0000000000..ca36561e7a --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt03 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.394704135733114 -8.775565826160808 -8.397941096758792 0 -1 1 +57 1 -6.0931281896189695 -9.344348749599556 -7.681818125657076 1 0 0 +82 1 -7.510250310452092 -7.015516388660279 -10.07082880494168 0 0 0 +47 1 -8.77559664157391 -8.051556457641034 -5.414795391990417 1 2 1 +8 1 -7.186535453159322 -11.036850971616609 -10.567777816088821 0 1 1 +49 1 -0.39620530191825165 -8.622783800666731 -7.678166749572666 0 1 0 +184 1 7.393521813917142 -7.373039726272342 -11.446331826056564 0 1 2 +54 1 4.350458272629415 -9.857224313433228 -9.653286924521744 0 -1 1 +114 1 3.8685603455186985 -8.598956542283156 -6.307174409208557 -1 0 1 +128 1 1.5947628847115236 11.435941489344966 -7.415359628481937 0 0 -2 +102 1 2.581923114006006 -6.377657392511939 -10.762619336954629 1 -1 -1 +157 1 6.660414728640671 -6.277919775804619 -7.429265669038422 -1 0 1 +20 1 8.111607396483045 -11.231970200759829 -9.923403990974927 0 1 0 +147 1 10.627447337694411 -5.758860591417452 -9.410039814850826 -1 2 0 +169 1 9.360516562348877 -8.959647419481891 -6.858134439225374 0 1 1 +123 1 -6.81574278381186 -3.257465879140419 -10.90227212401971 -1 0 -1 +182 1 -10.83184823295899 0.6211210726593173 -5.225302920513499 0 1 -1 +130 1 -6.48675645240678 -2.4960330140097717 -7.149887944428669 -1 1 0 +140 1 -9.06689925915267 -1.3404094442689392 -9.265230651366284 -1 1 0 +153 1 -4.596115154274846 -5.2269288210583476 -8.762725686367764 0 1 0 +129 1 -0.18023204267520931 -5.069487595679249 -8.563855383994511 0 1 1 +148 1 -3.129776386379185 -2.132302209017619 -9.812957672584432 0 0 0 +68 1 -2.5326692981381176 -3.433323674590902 -6.08354364753642 0 1 1 +119 1 -3.563878018222407 -3.8548716132518166 10.583657201237452 0 -1 -1 +174 1 3.1103832548223167 -1.970524067942005 -10.720839500990373 -1 1 -1 +134 1 -0.0533798609747933 -0.3943397369034881 -8.568909963478589 -1 0 2 +189 1 2.8780134490012608 -1.3406833227009611 -6.386852522463116 0 0 2 +28 1 6.229563951867086 -1.1530156323854972 -9.327046250788925 0 0 -1 +1 1 7.525938759972945 -2.8198310481116913 -6.5604190503711814 1 -1 0 +24 1 10.94065283830757 -2.1209886921600436 -8.153560298060441 0 -1 1 +89 1 -5.78369558828959 0.914992281244533 -8.554571507812774 0 0 -1 +137 1 -8.18813666088715 3.7027977864495334 -8.645965827566897 -1 1 0 +88 1 -3.2799196205792844 2.576742862817614 -11.027465080959736 0 1 -1 +160 1 -0.2557418723462786 5.44151330793023 -5.976638045093324 0 0 1 +125 1 -3.2953557120100467 3.5116994482831103 -7.1553118740511215 0 1 0 +167 1 2.6725243652102173 2.638087495697569 -7.466301426847419 0 1 0 +107 1 2.5245946528561056 1.4391466346789628 -11.24156229950114 -1 1 1 +45 1 -0.29130191021650537 3.390022307884845 -9.780519849519312 0 1 0 +95 1 7.067732497970006 1.8275651232311958 -11.06782765028197 0 2 -1 +111 1 11.286054617943643 1.4415120259015062 -8.377487796984207 0 1 1 +37 1 7.567677172981714 1.512274859816151 -7.66702414977977 1 0 2 +53 1 9.41684489904846 5.317555173980882 -10.149115122842298 -1 -1 1 +122 1 -8.696560905496263 11.52907921791907 -7.072120720309414 2 -1 -1 +126 1 -8.701961655974642 9.131336810565264 -10.209192118557077 0 0 -1 +72 1 -11.181614439635823 7.328242947804642 10.873052780217858 2 0 0 +144 1 -3.063630044241759 -9.888584626042347 -9.88620302733954 0 1 1 +135 1 -0.011770197460421628 7.809248750526247 -8.433472830923051 1 0 0 +183 1 2.868185059788288 5.159526867067117 -10.074475497261854 0 0 0 +155 1 3.7046375990422384 9.18029420434672 -9.355401725486303 0 0 0 +21 1 6.6545915304717695 6.763201059850044 -8.264144019598284 1 0 0 +66 1 9.504750400993288 7.515486524178964 -6.171582593350192 -2 -1 0 +22 1 11.084351988266622 10.76412261505721 -6.106373064516015 -1 0 0 +42 1 9.142378798766934 9.296638377937079 -10.23790547780751 -1 1 0 +77 1 -6.875408369074396 -10.905367618463075 -3.8927601705390593 1 -1 1 +18 1 -10.586419483635158 -11.318597225412478 -3.865523315987396 1 0 -1 +46 1 11.248362092754824 -7.711534097612761 -3.9950725578324935 1 0 -2 +14 1 -9.503351845338017 -7.486629728113749 -2.029636008930268 -1 0 2 +178 1 -4.577490558383545 -8.077630279121967 -4.852591089043882 2 1 0 +48 1 -3.2127534742600403 -10.982725180284804 -6.34369805529311 1 1 -1 +55 1 -0.9448027936788463 -6.214616210957371 -4.309013304243614 -1 0 -1 +12 1 -1.8077376902517912 -9.51331251139922 -2.294135008818479 -1 0 2 +15 1 6.0707891099498035 -8.158735340051752 0.7389132882736256 -1 0 -1 +64 1 2.744794419170617 -10.568743032836894 -1.6560300803721786 1 1 0 +44 1 8.059994426810258 -6.349491556263628 -3.6188994660194567 -1 0 1 +188 1 10.007211181841205 -8.471311544163584 -0.7301030264655086 -1 0 0 +200 1 -9.361429934020506 -3.325582783501604 -5.251291205351098 -1 0 0 +198 1 -7.206783651218934 -1.1768543952383812 -2.2878728904921033 0 0 1 +76 1 -9.957900853453992 -2.990392708748729 -1.4836790089375538 1 0 0 +194 1 -6.720915931526202 -5.0514840317136205 -2.6178060083265535 0 1 -1 +96 1 -3.442998842345119 -4.030752937282784 -2.1099501345166054 -1 2 0 +104 1 -0.4344464897733502 -0.6370527730950448 -0.3065766310174318 -1 0 -1 +91 1 3.028414651691776 -6.371562707358944 -2.3012007885342207 1 -1 -1 +154 1 -0.18450456920986724 -2.8959245063427446 -2.9727341046372144 -1 2 0 +19 1 3.3110202139376677 -2.0069344123928587 -2.3036519362171575 0 1 -1 +176 1 10.315295502792623 -3.712962672865248 -4.262743726209571 0 0 0 +120 1 6.599910778171431 -2.290014983742207 -2.708516274908039 1 1 1 +138 1 9.70090444039391 -4.510671194156078 -0.7586380570561282 -1 1 -1 +9 1 7.581463530555666 -2.0591591013924426 0.5576192070111965 0 0 1 +150 1 -9.916366847902271 1.9274446583917424 -1.3280546499490278 1 -1 1 +38 1 -5.810864806174543 4.79569434382538 -4.7432663890343605 1 0 2 +172 1 -9.649044476681059 4.000883539130775 -4.9787866594630685 0 0 2 +87 1 -3.293106763914671 -0.9728697280200684 -3.5717383721780784 0 -1 1 +93 1 -6.290260113883048 1.000513447709075 -4.873943848533926 0 -1 1 +195 1 0.9143548729177553 0.18149461265281985 -3.719891858874817 1 -1 3 +149 1 -2.3007300445292564 2.7637958268752776 -2.589523265551314 1 0 0 +25 1 4.621842262318463 1.3043820546828728 -0.6225207492747167 -1 0 1 +35 1 2.847846769015831 3.7484794005209174 -3.7317005078406185 1 -1 0 +5 1 5.76859301522971 1.4821693744986142 -4.192625078793096 0 -1 -1 +116 1 5.980108401532309 5.771931805152196 -4.952107221267599 0 1 0 +112 1 4.9004069037624305 5.449030478588363 -0.25381811981375635 -1 0 0 +152 1 11.427575396440815 -0.5215078327180223 -1.9270850902641319 -2 -1 0 +132 1 8.550991064218966 1.8728424902700131 -1.3413841671493485 0 0 0 +173 1 8.98824885831321 3.8266779448060135 -5.54469830676447 0 0 1 +73 1 -9.970827412932536 8.006037772956901 -6.707069562638264 0 -2 1 +29 1 -7.851850658958549 7.656691482687513 2.2522623824361467 1 -1 -1 +161 1 -11.447924236091708 7.060851422709438 -3.5858559166646984 2 0 2 +78 1 -1.7537678607411138 10.085056705494843 -1.7540835643783588 1 -2 1 +11 1 4.471756401488951 11.779896969440827 -4.946674669424063 0 1 1 +84 1 2.43612195340992 7.404092397911457 -5.290554303714214 1 0 0 +90 1 6.2047805444381146 9.344776673352051 -0.9025295949725489 0 -1 1 +36 1 1.9413202066882462 7.760257880084115 -1.7928253633196454 2 -1 0 +98 1 8.489759189718113 7.59448375625753 -2.9903904190005255 -1 0 0 +56 1 7.283347233840352 10.49272575590101 -6.717344837699539 -1 0 1 +109 1 9.256731562506227 11.306927316729052 -0.9017849515922478 -1 1 1 +115 1 -7.271375340356332 -8.164250984794014 2.885007836656445 1 0 0 +124 1 -11.095529268087242 -8.923461918340646 4.126541576799873 1 0 -2 +121 1 -8.243366755262961 -10.114098944495577 6.642910506934619 0 1 -1 +80 1 -4.970941376701066 -7.256796443574398 -0.2694927115936565 0 0 1 +151 1 0.35720010482862147 -6.473326344145772 0.3145914251441795 0 1 2 +4 1 1.490868001691105 10.008505441456391 4.6538607757363515 -1 -1 -1 +6 1 9.00182583692019 -10.573496261667716 2.7405792887239087 1 1 0 +166 1 -8.709149836110669 -5.121301291304988 4.221356992297617 0 2 0 +40 1 -6.986302058442625 -4.546619094873101 1.2165687777692458 1 1 0 +127 1 -5.703890672733537 -2.4808733861641947 3.9258140668162143 0 -1 0 +60 1 -2.3900969955392997 -2.1240248283806444 5.301270425252238 0 1 0 +168 1 3.975110510651529 -3.4413029165097235 0.7867580630241555 -1 1 -1 +51 1 0.36128571956442473 -3.39012855469405 2.9987895355425387 0 0 -1 +97 1 2.1619059504545017 -0.14370659092792337 2.253550136735452 0 -1 -1 +103 1 4.021656515073349 -0.9827338117732367 6.042568640726292 -1 2 0 +163 1 -10.59690034092717 -2.73669268553396 2.3250010477277816 0 -1 0 +175 1 5.789631011184049 -3.417672117461432 3.9954654049476215 -1 1 0 +158 1 8.907482269205014 -6.491283319059688 2.9624073267859536 -1 0 -1 +85 1 10.197413661591135 -0.012917762754849087 5.257965818060175 1 0 1 +63 1 -8.188715623008076 -0.18029853692280418 1.160315648952679 -1 0 1 +133 1 -10.49518128239182 2.3754251515033395 3.670523930057962 1 1 0 +67 1 -6.57681506296786 3.490338685255813 3.2777499682226248 1 0 0 +83 1 -3.8395282904771557 0.6878472661538524 2.789698047147944 0 -2 1 +181 1 -5.242185082676098 0.757446996867543 5.798435988392239 -1 1 -1 +162 1 0.5730435311953745 0.02538554697642809 6.131446692962922 0 0 0 +71 1 1.5861291557437986 4.031923436354859 -0.5668685974116876 0 -1 -1 +31 1 1.1084648099889496 4.166735507593387 6.199029350547128 0 -2 0 +139 1 3.8934885611865404 3.644680090821751 3.3699758952172827 -1 2 0 +3 1 11.031167120250961 1.2297818113295769 0.8240448962619134 0 -1 1 +108 1 6.151774132335838 0.9127260755469919 3.630865862972541 1 1 0 +16 1 8.948393568215273 3.5697656211117277 4.019424538349256 0 -2 1 +110 1 -11.360902504880006 5.931262380786016 3.1386340545012104 0 0 -2 +50 1 -7.03855700568745 11.1587737863648 4.038018652970141 0 0 0 +191 1 -8.539592833531575 6.98957805034221 5.576163396973422 1 -1 0 +187 1 -10.749591400235348 11.27674482179097 5.078753839959464 1 1 0 +180 1 -1.0497509784332344 6.113751500784257 -1.8125940782158025 1 -1 2 +2 1 -1.7901048404834796 5.395364205758469 2.706946913090345 1 -2 -1 +30 1 -0.609763114135145 8.866708941315338 1.2567907242718874 1 -2 -1 +7 1 4.024360795442131 8.792731325824677 1.6316831819568236 -1 0 1 +164 1 1.9253904296798758 6.2539753963352425 2.2732172727821673 -1 0 0 +69 1 4.589943704480154 6.860175335740237 5.107742575629615 0 -2 -1 +61 1 10.211708813407666 5.048929362482134 -0.6556133826774401 -1 -2 0 +34 1 7.618123086186067 9.260791062852595 2.410253158978456 0 0 -1 +43 1 7.187831963553112 6.047643259558733 2.377231426556367 -1 -2 1 +177 1 8.53679514766192 7.2855280107021585 5.618179930120522 -1 1 -1 +65 1 -10.025744517789033 -8.43398132011017 11.42484399314975 0 -1 -1 +27 1 -10.94664003963282 -11.66367183635281 8.50586002909509 1 1 1 +58 1 -9.736423247717525 -6.9374057905213675 8.120131077653108 -1 0 -1 +26 1 -5.214988898132063 -8.488979255655 9.322140672840906 1 0 0 +142 1 -2.2289627568453696 -6.732212289220556 8.533930418433167 2 1 0 +101 1 -4.332868168974628 -8.046497536008985 4.908195000324994 1 3 1 +100 1 -1.5781140115056829 -10.89378955359733 6.845196027213777 1 2 0 +105 1 1.348709072973532 -7.840212526420486 3.935309569976617 0 0 -1 +75 1 4.538409842632715 -6.347596431637598 5.462073088539682 0 -1 0 +99 1 1.681804464017192 -11.02047184883833 10.743929007254543 0 0 0 +193 1 2.131527690130696 -6.895966349546285 9.427352746134135 1 1 -1 +33 1 4.441375653691135 -11.736850231117081 7.202677955581144 0 -1 0 +81 1 7.255373647519644 -8.53916396071646 6.739789624034124 -1 1 1 +92 1 9.790634573312333 -9.44185811686149 11.159147618448468 0 2 -1 +131 1 11.167512844489337 -5.2910720883824744 6.1780456625725 1 0 0 +32 1 -6.188065315477864 -5.388148534056967 6.4630859734577015 2 1 -2 +165 1 -9.199411318810375 -3.239575676768024 7.39142666230393 0 0 0 +199 1 -6.937479844200535 -4.998516463158538 9.811426478379644 0 -1 1 +70 1 -5.484149755229003 -2.3316100376807256 7.82342156113301 0 1 1 +146 1 -1.4782561675061032 -0.5332293079309558 11.298322053799005 2 1 1 +106 1 -1.299565649633866 -2.547377817344993 8.672457149378053 0 0 -1 +86 1 5.4346476876843255 -4.567525864857576 8.586496749161867 -1 0 1 +52 1 0.6258963928325112 -3.6737913184680213 11.408468473681546 0 0 0 +197 1 1.6655903827098761 -4.690360650696893 7.1487356646988935 -1 0 -1 +185 1 2.1215529597432052 -0.6042753779764993 10.00914541981377 -2 1 -2 +145 1 7.122063254971888 -3.6848122349525525 -11.806135592932787 -1 -2 0 +156 1 -5.464187808325629 -0.39192954326422935 11.38371879051662 0 -1 -1 +10 1 -9.035521158465771 -0.7757159430461369 4.809652747733452 0 0 2 +196 1 -9.335669158910619 0.22813232884729473 8.66176404595545 1 2 1 +143 1 -7.124352690053236 3.030922198080938 8.687337455424057 1 0 0 +13 1 -11.772101478818819 3.2748279418542197 6.990058907086091 -1 -1 1 +170 1 -2.6686912671072918 4.2637019013785284 6.493175161410804 -1 1 -2 +59 1 -3.414884055242947 1.7144589247064204 9.304818354414252 1 -1 1 +190 1 7.431647314963107 -0.2323681547056703 9.930387554553988 0 0 -1 +186 1 0.12403907626679356 2.5751847736553266 9.610847507588266 1 1 0 +136 1 3.4038632456152635 2.1695685652264665 7.948376142475482 0 -1 -3 +62 1 3.9322597596563718 6.930006246409542 8.985009369790514 1 0 0 +192 1 10.419594684028056 2.5035467156582776 9.806945423286493 1 1 1 +113 1 7.193391146269118 2.2362428283193516 6.875806515902987 -1 -1 -1 +179 1 11.834426610265067 -11.194697762969987 -10.475928756799647 -1 3 2 +74 1 -8.13998220698503 9.794354756748188 9.006589181804868 1 -1 0 +118 1 -11.66384578850255 8.468830152015009 7.042404750007243 0 1 0 +117 1 -5.315240522733173 11.32072783429444 7.576721087819581 -1 -1 0 +23 1 -5.138619088737474 5.725030905668137 11.239725943022542 0 0 -2 +171 1 -4.330917401708549 7.140228396638214 7.942565065680071 0 2 -2 +17 1 -2.03596415813805 8.313925455397243 5.2823718467129375 -2 0 -1 +94 1 0.5232518791432845 9.687616975679045 9.044820921363916 -1 0 0 +79 1 8.56918534055184 11.565534359174451 5.948120961320791 -1 0 0 +41 1 5.45739715811315 11.541960137674769 11.642369134799488 0 0 -1 +141 1 9.892948341443592 5.76405276568962 9.068370836458591 1 -1 -1 +159 1 9.60684214528172 9.743113663992652 9.758679903521092 0 -1 0 + +Velocities + +39 -2.179321628468343 1.1511761233721014 -0.5234785181560597 +57 -6.53120961304823 2.2544161501487334 -1.2373865721091248 +82 -1.0543302569480935 -1.2919030991113425 -2.688794866729753 +47 1.4420685217894869 -0.5747049377538087 0.6848122481945966 +8 2.36242269061923 3.5603470370323436 1.4936669774368116 +49 -0.6083156247744255 -1.170955618423765 -3.8346753413107364 +184 3.2429732085760055 -3.3821697881066015 -7.235911314720436 +54 -3.6115695852161833 0.0106170916100512 5.665158101271987 +114 6.929262289695876 4.643270489304085 -2.432510904848287 +128 3.7837119455630903 -0.5425190416852157 -0.9248832742343969 +102 -5.730330621950312 2.5925672733788283 -4.330025077474401 +157 -0.16543207126613158 -3.935307993847579 1.876153422628358 +20 -2.5674917416750285 7.261116339316168 -0.2822364811608604 +147 3.957269802164221 -0.44334252499690296 1.8428688293334772 +169 -0.43761432062493966 -2.7004091328373003 -1.9616354437812995 +123 0.4419336641195504 1.661879969268821 -0.34576656499174563 +182 -2.755633666515818 2.89026397900542 -3.3064689855078004 +130 0.4228585869964945 -2.6339270059626747 2.3472759619296717 +140 -2.5258615952943133 4.5464360654810925 -2.960299517136603 +153 2.614799199811544 -6.997005129983971 -0.4675266931999429 +129 -1.0794701392816852 -0.7999027589273617 -1.3594765973927763 +148 -2.5441459127388772 -5.738540142837333 1.2458734580393733 +68 -0.8806574381084391 3.664356747058979 4.498638804868755 +119 1.348535842985886 -1.9096618944303452 1.6705192446304495 +174 0.23536625265167066 3.432430764653958 -0.9841797613553105 +134 0.26301203065712264 2.9239481371691687 4.198089422305616 +189 -5.106229336056745 1.3598593078850199 -5.0921887654096665 +28 -0.5789581538284776 4.678352716038949 1.6083556088979694 +1 4.3168451733041335 -0.8087879863432109 -1.1510010508143134 +24 4.684129190758672 0.5864820180144825 1.3599272674223446 +89 1.2931815025110984 -1.7192563446283065 -3.2675358462468287 +137 -2.489381057507014 1.3936843668930472 -3.4953181455890334 +88 5.564916491075967 0.8520321811715912 -4.447122865446203 +160 -0.07033878109043368 2.2522705799844327 1.9030072089658323 +125 -1.5185131407725638 0.6804743431846004 -2.389477187487043 +167 -3.6035218377687275 -1.9787464624356907 1.2495634883162925 +107 -4.50061384293538 -4.128984940089246 -1.940600692273992 +45 -2.0130680589133294 1.0097638511181886 -1.9327875523898734 +95 -1.8894050626509937 -4.373548537324043 0.32709687823368594 +111 -4.9090211058158335 -4.89034728498546 -4.4838347069372535 +37 -0.7827825654937912 0.2606671310038102 1.2648209822548744 +53 -3.3248176554427693 -1.934526339006954 -2.2700456945424197 +122 2.3544797713703187 -0.1174286295452037 -1.1080357975092663 +126 -1.8232106805443349 -4.42954489421542 3.9468260248902474 +72 -0.3083487798866145 7.089424978098924 -4.065977117594069 +144 -3.209546353795563 2.7953912155418355 -1.9419952653204642 +135 2.825460830342647 -1.3242735854960683 -1.061464548303972 +183 -0.6219322132099675 4.350176294595897 -3.2016653855084876 +155 -4.16183730251878 -4.394917007094668 3.143265712814128 +21 1.042679461197399 -3.76474130433989 3.307467644481217 +66 -0.5660353999856405 -0.9094642274226821 -0.5314610131608182 +22 -1.709804393279522 2.6955272721787336 6.847933865416769 +42 1.5723865718421481 1.2482884329237185 2.4822430118654624 +77 1.0256281250413677 0.6998122284735013 2.9532003047278765 +18 -3.421972744387341 -0.5274519950694775 -4.133682641337289 +46 2.168436016686143 1.0804778012063694 -4.320033516090909 +14 -4.0164283054824255 0.49834440962343196 -0.8290451948901274 +178 -1.7412819488092 2.798973205265782 -0.479900827844132 +48 -0.555572193190021 -2.2271111327857946 -5.48753500392571 +55 -0.2945098160209474 -2.3597197684570634 -1.323571695006608 +12 2.648780275608345 -5.627798255886156 3.878499085658468 +15 5.08064047237585 10.983886551374368 -3.8614562219189974 +64 4.528407739688303 3.5669581487847277 -1.59783436247384 +44 0.6179240842533569 4.733042665051045 3.2581525303469463 +188 -7.148050937863482 -0.9829624495370496 -0.8418403492142479 +200 -2.1181786226695647 -0.7796260516164706 -2.0505857854477805 +198 -0.41864716042364125 2.296081055566785 0.29109905683884685 +76 3.589037248934578 3.9784201870774147 -0.18396191505765547 +194 3.2793423730519953 -0.6090514771278666 -3.4934826993710537 +96 -1.781539941975932 -4.363514711154816 4.864062078072237 +104 1.408163209882818 -2.2024070797001714 1.13197301326935 +91 0.7549842936282545 -1.8949946215618456 -1.0202618871629823 +154 -3.58496442590166 0.6965660533263317 -1.9948941159972786 +19 1.1538547086598117 4.352147462832853 0.5698931598819479 +176 6.6158635134989 -2.4436529370166666 -7.921148144074609 +120 1.9770896033272432 5.325440429480748 0.4321682589452387 +138 -2.434142355712014 -4.211844174503549 3.7463686848024356 +9 -7.9556317081134775 1.3611081846148716 1.1973651519179334 +150 7.132627873294173 -1.1589700932996243 -0.3531633921451265 +38 -2.373885424533282 -1.6670776794732187 7.126244784839699 +172 -4.190332426742245 1.4971407429268737 -2.1038522992559976 +87 3.8705371644824407 0.6946282376038537 -0.5718475935933448 +93 1.3514689577122314 2.2886635029067657 1.1457291529838165 +195 0.8294761589431854 6.809445622982572 -4.490681006002271 +149 4.665694837020095 -3.8971221183097815 -7.000247317496072 +25 -1.4227504585025186 2.666757793916314 -4.2485642256584795 +35 2.0433487025942068 2.1539055294115 -2.682708261193331 +5 -3.648704562720594 -0.39330823945136234 0.15528838477335327 +116 2.764952659364006 3.2308857608345534 -0.538944143891585 +112 1.7976356559372615 -1.540357698562047 -2.170928793825917 +152 -2.4572877205036923 -1.6206485240807629 -4.85936004694647 +132 4.802107956404735 -0.11013197470116909 0.6674735986355181 +173 -0.7045077946396323 0.6277364102624156 1.4282110726540087 +73 -3.4535983591604964 -1.3273163733693092 3.631166806617851 +29 -5.742750315320132 4.210335165654985 -3.183862358662845 +161 0.7207671082657183 -2.639249856838032 1.2031913703667394 +78 1.9802499580941673 3.892356471093276 -6.0300544674355 +11 0.3710597317170738 3.014897507875772 7.0674999285689495 +84 0.06314153271125988 -4.938702818012672 2.3405049696166014 +90 -3.021721770486999 0.5895782968475963 -0.883462541486843 +36 0.6115261475891951 3.326758596635819 5.305093464697983 +98 -3.289247327924386 -0.7716659861479829 -0.8061979190797803 +56 -2.484208615656381 -0.7583806019455193 2.000293738990754 +109 4.065544877208817 -0.31468790514138334 0.3860037578404895 +115 -1.5583103456503846 -4.034490286401138 0.5420000897756707 +124 2.716664944254732 1.195693130251065 -1.0534283229167152 +121 8.492299287405391 -0.8573607139000322 2.0906896396885357 +80 -4.269726737071596 1.290253084422534 1.3756246647776993 +151 0.17922239204385892 -5.243344038190157 -1.7214465623209987 +4 -1.5287457726003018 4.545253326761756 0.4075652200807629 +6 -5.5555965267113505 5.196757149002673 -2.131768740002899 +166 3.8192709965319924 8.287983828276944 -1.2203929922517287 +40 3.450300769917062 1.3679263003539135 -5.713912913407013 +127 -1.8550057408599427 0.2529213554001156 4.292787610095508 +60 -0.4570467791684108 2.1995625338737512 0.38684023826685754 +168 -1.1461639744415708 -3.7753008221986715 -0.7069362633693567 +51 4.246427854086795 2.2660286121479016 -0.17525536000106454 +97 -0.45920058079801923 2.3672214881822935 2.918793131685986 +103 2.8457407886760415 5.079818233132883 -1.6831372889932052 +163 6.588786306029201 2.961102097923318 0.12898108224833468 +175 -0.7784000842847736 0.05239163186710383 4.783927411692968 +158 1.324975092911766 5.716483065795907 -2.766582829578808 +85 1.126575470046233 1.8878210873276244 -0.3160540074040886 +63 0.26385610607819265 -1.0518690744177137 4.681584068045189 +133 -0.8004471826186864 6.474544076922776 1.4133211461125943 +67 3.6157553514613374 3.5767340310447207 0.22045279936244222 +83 -1.0062072078141164 -6.493845317833074 -5.600689394569981 +181 -1.9698774782124704 -2.4967875449198838 -1.482046688397622 +162 -2.904567214261779 4.609525946829769 -4.773883794319192 +71 4.704149679704777 3.1523586525426124 4.57547323305684 +31 -1.5901553457672002 -3.05689507101266 2.2039810687618497 +139 -2.695407001366337 2.151237461783768 -2.283708689815052 +3 -0.46766817551787454 -3.140857693103965 0.4361924390516714 +108 0.1913617703423478 -2.71581239158428 0.6724779385423365 +16 -0.5574602967458635 2.869089341747036 3.246617986586125 +110 -3.2935781644783413 -4.906537822882089 2.429950659174858 +50 1.3517081278566716 0.7979565345760338 -0.4185472621695281 +191 -6.186669509381163 1.5069910278978673 -3.122140179713244 +187 0.8559064953620825 0.3957056787517148 0.9088293844669495 +180 0.221714052316844 3.344232199120801 0.5800459730217239 +2 2.3994296631460794 -2.8375195813060388 -1.0887178593496891 +30 1.2210690766888224 3.5899619104376446 0.08151741673684687 +7 2.7726111769463913 0.687615055956059 0.37410979119832144 +164 -1.1931898641891907 -1.3539824930215878 -3.3405462160564703 +69 1.9731979197688503 -3.2571194324245205 1.6749831681024951 +61 3.1823016504442476 -3.0315743307115213 0.8747268024881065 +34 0.42940760329491323 -0.8546757769020348 0.7046464666351262 +43 -1.2834304624987016 -0.32585553857664296 0.40311374457538895 +177 -4.156106157869977 -1.1691085227558309 4.764406539360629 +65 0.7459698348800096 2.6999150256104985 -3.5548113977053744 +27 1.2331887682296838 -1.694381902758542 0.04304965560826135 +58 -6.154057979578904 -0.19938148972279413 -3.4163165607386854 +26 2.910747146350628 -2.990465499480819 -1.5258142005591657 +142 -2.6857404309480515 -0.4742647340730133 0.8619212003727141 +101 0.8564696967146533 -2.0546263222545185 5.004696469365843 +100 1.7773361390238631 3.5466656645190247 -4.741841979587642 +105 5.236015515046745 -7.745834640119119 -2.0944663177984997 +75 3.19034440896343 4.856191854526413 0.20239301909347396 +99 0.7372059827598996 0.8218000327204846 1.1962914445625328 +193 -5.54751039136509 -0.8984829893317632 -0.09804506747660646 +33 -0.9015609488918586 2.8634014710755875 -0.5142897564939601 +81 -4.226349362632615 0.4990338142221863 -3.177351469506789 +92 4.852938979419456 -0.5312580038435196 0.4444574326006344 +131 -6.780942865007681 0.2505331120455996 2.984671966978939 +32 2.043323184339133 -2.0915365663642502 0.3570674081797969 +165 1.772621337461088 5.624086428613788 -2.1958779155861525 +199 -4.655961690467214 -1.5582587292151853 -1.0372922469851396 +70 2.1009520029345854 -3.4367267457669444 0.3489118952393979 +146 1.1094627356046975 -3.7052416904893786 3.1151669468585044 +106 0.9244635796842038 -0.8697076449017062 -1.1271268628891515 +86 -2.4614440724404063 -1.1443915951868173 3.0472327038543923 +52 2.206997554373295 0.48895638167295574 7.813903343751546 +197 -4.43947099244034 0.3827402537789232 -6.114284477117655 +185 1.8450115502667273 -3.367103363338241 -2.7646657581326055 +145 -4.495233666659511 1.3255674480674051 -1.5848168476287035 +156 -1.1061826790673608 3.490100920043544 1.7425058587963753 +10 0.10888349121518726 -2.3346954910750384 0.3634642612209191 +196 -1.237862986215301 2.306399540514406 -5.426709024577362 +143 1.387043305733553 -2.3787136376519027 -0.20756141146550633 +13 2.2357687358768974 1.685714857075964 2.2457142840004356 +170 5.1889099023089535 2.9826822454922652 1.0755609101553643 +59 -1.712405925615148 -2.553137012160255 0.03926835373766702 +190 -1.7274645985224364 -0.0964601276780217 -0.8892867639051387 +186 -0.5051041743099376 2.0346977046537615 2.086897795173162 +136 1.6635288094047165 0.5254443611211371 1.8199836517530088 +62 0.7708640981248649 0.12152082573932288 1.7717141492471689 +192 -1.0422128532558474 -4.04447955732469 -1.926662726630305 +113 -4.472429838979146 -6.765621050808509 -3.003588999898843 +179 -1.7067254128417755 -7.980317775082368 -0.9140818138687279 +74 3.515578700667397 -5.09057685611017 -2.4373465493326076 +118 -3.836950473028625 -4.398228703366778 -0.9008313748045251 +117 1.2669363304661976 0.4817377004658103 -1.5641060379969072 +23 -3.023411190495862 0.4127754096885368 0.24116380806370397 +171 0.782437003849918 2.278657242176388 -1.477387925776958 +17 0.8979396881179555 -2.2139965953711083 -0.9661842759619532 +94 -2.2083649456241576 -0.3520697824173402 6.939477089019811 +79 -5.097477099334401 -1.1053765447054356 -0.5927717885602897 +41 2.717742851180541 -0.8197068618726784 -1.1670313842646072 +141 1.3223712852080913 -1.1251601779570968 2.4100632027817 +159 -3.979797713933269 1.5260607907829866 1.4624579807682239 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 new file mode 100644 index 0000000000..7fcb4a8bac --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/data.metalnpt04 @@ -0,0 +1,422 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 100000 + +200 atoms +1 atom types + +-11.876696863105703 11.876696863105703 xlo xhi +-11.876696863105703 11.876696863105703 ylo yhi +-11.876696863105703 11.876696863105703 zlo zhi + +Masses + +1 39.948 + +Pair Coeffs # lj/cut + +1 0.00965188 3.4 + +Atoms # atomic + +39 1 -10.354249178970125 -8.813051919915168 -8.382969093379817 0 -1 1 +57 1 -6.095139656027609 -9.359263918713493 -7.698842353606457 1 0 0 +82 1 -7.493664607592135 -7.0059769885785474 -10.165574967227153 0 0 0 +8 1 -7.207830943811267 -11.030802786228156 -10.545758277848378 0 1 1 +49 1 -0.3707760358866739 -8.703874147846175 -7.734231800660862 0 1 0 +54 1 4.371171010756674 -9.822286390366472 -9.608608173022526 0 -1 1 +114 1 3.857478702816806 -8.583003039261015 -6.26115845444949 -1 0 1 +128 1 1.580452299690882 11.414121196534609 -7.383200117467098 0 0 -2 +102 1 2.6350731915864145 -6.397417482172074 -10.801961817246344 1 -1 -1 +157 1 6.611187455803048 -6.205022609136458 -7.392834911294685 -1 0 1 +20 1 8.102933091687992 -11.214330088075124 -9.936524774492973 0 1 0 +147 1 10.596045290286296 -5.759130098910738 -9.380762680610847 -1 2 0 +169 1 9.366630474689176 -8.921006522319503 -6.843673029579733 0 1 1 +123 1 -6.859009660270495 -3.2379537512590297 -10.864178266429683 -1 0 -1 +130 1 -6.577322046738903 -2.5106835965921164 -7.224326100490352 -1 1 0 +140 1 -9.107723436323155 -1.3229863757258506 -9.244986454221655 -1 1 0 +153 1 -4.548656766959874 -5.17967134910819 -8.787434718939945 0 1 0 +129 1 -0.17808656259561137 -5.023072792674526 -8.617493408883192 0 1 1 +148 1 -3.2601725736553027 -2.033844854035978 -9.777384129731104 0 0 0 +119 1 -3.5689822234610595 -3.8505044768944927 10.627709646886371 0 -1 -1 +174 1 3.140197534695247 -1.913882100151838 -10.76389374977719 -1 1 -1 +134 1 0.048608226174046365 -0.39555664243276595 -8.555122102444741 -1 0 2 +189 1 2.8889478385298655 -1.3768037709890826 -6.4534432907832056 0 0 2 +28 1 6.251824687614619 -1.150087307901578 -9.266876365488919 0 0 -1 +1 1 7.556173300837827 -2.8495110668506705 -6.5781416096142475 1 -1 0 +24 1 10.885498404916829 -2.163413929107282 -8.181530231530648 0 -1 1 +176 1 10.317143708012939 -3.6994503272775026 -4.285905348037859 0 0 0 +182 1 -10.866713794399553 0.5835390862478285 -5.190897922574198 0 1 -1 +137 1 -8.197336531384668 3.7710266805092836 -8.628333311872499 -1 1 0 +89 1 -5.830740775393367 0.9227024639457406 -8.56962226272939 0 0 -1 +88 1 -3.2174671278447153 2.596119117918313 -11.010039397757382 0 1 -1 +160 1 -0.16353319092958282 5.356569592952759 -6.027400461354258 0 0 1 +125 1 -3.2660565494911986 3.5402608994580014 -7.139474945270797 0 1 0 +107 1 2.5004686193441863 1.4213418016161157 -11.264390107008213 -1 1 1 +167 1 2.6306438675911963 2.7047021139073024 -7.49322777752869 0 1 0 +45 1 -0.26576210897417507 3.3660903959893673 -9.858663372020018 0 1 0 +95 1 7.02981932063029 1.8215081284089933 -11.08913793230704 0 2 -1 +111 1 11.249280516767561 1.4119125550850526 -8.355555586118154 0 1 1 +37 1 7.519477058425284 1.5490589443573544 -7.629176894794767 1 0 2 +53 1 9.42047942911636 5.244187392085703 -10.133263719784543 -1 -1 1 +122 1 -8.63992654505136 11.450404981587694 -7.075458716341785 2 -1 -1 +126 1 -8.723342916981192 9.13102883296233 -10.17466547482745 0 0 -1 +72 1 -11.206699277582317 7.297248005363309 10.79372604446887 2 0 0 +144 1 -3.0607758424636864 -9.877816322452732 -9.947243110943289 0 1 1 +135 1 -0.051808796348424835 7.83802622288054 -8.426793042584595 1 0 0 +183 1 2.8265474855254293 5.2650728973076095 -10.056888138059385 0 0 0 +155 1 3.7333346013160673 9.271985029918303 -9.380687277523048 0 0 0 +21 1 6.713007344355741 6.806136281598503 -8.223321187919673 1 0 0 +66 1 9.521874492322397 7.474069880889854 -6.18586873962963 -2 -1 0 +22 1 11.050170157856584 10.74761987425433 -6.194431008418831 -1 0 0 +42 1 9.124991617085433 9.313926068749339 -10.259091612355418 -1 1 0 +77 1 -6.847598261663958 -10.941109014822928 -3.892206492676891 1 -1 1 +47 1 -8.72137736883077 -8.020553455249186 -5.411695457067339 1 2 1 +46 1 11.333911554840483 -7.659682887184623 -4.080815689532784 1 0 -2 +18 1 -10.646224114047842 -11.295142102189118 -3.8769976756703564 1 0 -1 +14 1 -9.605745944890806 -7.401374860679573 -1.982921039201294 -1 0 2 +178 1 -4.564495057067056 -8.050510749495825 -4.8659978849512635 2 1 0 +48 1 -3.165816579392377 -10.956276319999837 -6.319173483966388 1 1 -1 +55 1 -0.9801312338979216 -6.257580408615657 -4.2669674058977485 -1 0 -1 +12 1 -1.844858616965503 -9.490670669998687 -2.2961766563429364 -1 0 2 +15 1 6.049786455655653 -8.189634166823847 0.7790760301881896 -1 0 -1 +64 1 2.7732180154018238 -10.586600242266561 -1.7220526985868578 1 1 0 +44 1 7.987685169786731 -6.317537693048875 -3.624602682973471 -1 0 1 +188 1 9.985693632064716 -8.552544016815117 -0.7260907476837022 -1 0 0 +200 1 -9.468913996814749 -3.332006112139499 -5.219156914346259 -1 0 0 +198 1 -7.176651640198091 -1.1963525306783946 -2.253714347543795 0 0 1 +76 1 -9.922127224407973 -2.9538091484944595 -1.5482866071777552 1 0 0 +194 1 -6.755129554954018 -4.9982944036574395 -2.6156955876752477 0 1 -1 +68 1 -2.4837259122195063 -3.490803572414407 -6.114089975980331 0 1 1 +96 1 -3.411864655652117 -4.073235933810771 -2.067669105620388 -1 2 0 +91 1 3.0280594613502636 -6.3376596415711255 -2.326898295867128 1 -1 -1 +154 1 -0.19811764587289105 -2.9629996027018635 -2.9145103486688195 -1 2 0 +19 1 3.201765959673939 -2.0909064907714274 -2.3150720129859153 0 1 -1 +120 1 6.666250093808799 -2.2381082538053363 -2.826357084420522 1 1 1 +138 1 9.709412364194842 -4.510669257803851 -0.7371785941816178 -1 1 -1 +9 1 7.576584804759921 -2.0173260225381977 0.5837619474494389 0 0 1 +150 1 -9.925148350003655 2.008414757334357 -1.3585989335940631 1 -1 1 +38 1 -5.774540065294694 4.703952130507923 -4.709776738882269 1 0 2 +172 1 -9.650643801070206 4.065753015545833 -4.8890536457268325 0 0 2 +152 1 11.354703841174967 -0.5574832611945055 -1.878354960063874 -2 -1 0 +29 1 -7.8756923654824735 7.618259977195223 2.1884603240114373 1 -1 -1 +87 1 -3.3182201208100697 -0.9619504843434044 -3.571516039019219 0 -1 1 +93 1 -6.22447967806385 0.9237017015404234 -4.899961705314269 0 -1 1 +195 1 0.9557760919893532 0.18190089307880442 -3.7530657563825116 1 -1 3 +149 1 -2.258211757279497 2.7869892960968605 -2.6067337721972543 1 0 0 +25 1 4.582659783463335 1.197304704789868 -0.6333382889463834 -1 0 1 +35 1 2.8340362437473665 3.775198295599683 -3.7220216498098746 1 -1 0 +5 1 5.712702262390174 1.525516395213053 -4.231454437885219 0 -1 -1 +116 1 5.993880302160488 5.819609728686341 -4.981314501727478 0 1 0 +112 1 4.993891288991353 5.44294004315121 -0.20000094912971011 -1 0 0 +132 1 8.553215140035688 1.848923908331039 -1.3929852223418029 0 0 0 +173 1 9.058614097754903 3.793989570565648 -5.529277027531151 0 0 1 +73 1 -9.97609370360327 8.001052498887105 -6.678871508542809 0 -2 1 +161 1 -11.443764897577033 7.1235053711641685 -3.5412879782897306 2 0 2 +78 1 -1.7946589875472476 10.140074782001498 -1.7188309657767924 1 -2 1 +11 1 4.48445505597226 -11.863465860429208 -4.995823112103199 0 2 1 +84 1 2.463379766571318 7.427030445050496 -5.251636426023569 1 0 0 +90 1 6.171978058160043 9.299313343642424 -0.9265676065333643 0 -1 1 +36 1 1.9133463519046003 7.719511929183511 -1.7420567765226709 2 -1 0 +56 1 7.255050752153057 10.433125182056429 -6.693622072998551 -1 0 1 +109 1 9.138840387988623 11.32849279657362 -0.9075432219499753 -1 1 1 +98 1 8.493633429672352 7.664253543281429 -2.9150549381854445 -1 0 0 +115 1 -7.310435599643078 -8.126317136056372 2.852881189844054 1 0 0 +124 1 -11.031652111608674 -8.829616358814924 4.11892916031843 1 0 -2 +121 1 -8.24719811507558 -10.102559907485395 6.644774570363861 0 1 -1 +80 1 -4.990158022745006 -7.228416620009519 -0.23616829431627906 0 0 1 +101 1 -4.425835217027135 -8.041862792922046 4.912842377205241 1 3 1 +4 1 1.6093443070111064 10.036215537003722 4.649624528139505 -1 -1 -1 +6 1 8.957102959942503 -10.648514255179037 2.7520244907338807 1 1 0 +81 1 7.208459443972924 -8.512507364143946 6.7186127098675 -1 1 1 +166 1 -8.735612761804596 -5.051940162290023 4.287135452158321 0 2 0 +40 1 -7.0154409632766175 -4.6058645552640805 1.2332349553758588 1 1 0 +127 1 -5.628166701486109 -2.4571683554307384 3.9074191001707503 0 -1 0 +104 1 -0.4346324933964958 -0.6513905925349095 -0.2958543835790408 -1 0 -1 +151 1 0.3877075536664327 -6.4007225085014845 0.24945488280004469 0 1 2 +60 1 -2.369840965541917 -2.0961144039265633 5.2852382593681435 0 1 0 +168 1 3.911007973828095 -3.389123300929967 0.7576129789066393 -1 1 -1 +51 1 0.3292384996563097 -3.420112775820937 2.935489834742583 0 0 -1 +97 1 2.1485649172664862 -0.10439592636417316 2.279403065792625 0 -1 -1 +103 1 4.042877904485135 -1.0208892892284567 6.118986931410435 -1 2 0 +163 1 -10.685207062128164 -2.805182722090798 2.2992408280776737 0 -1 0 +175 1 5.777080728790477 -3.428422767297768 3.9500489905592655 -1 1 0 +158 1 8.901770795533949 -6.449835056793116 2.8925949474189174 -1 0 -1 +85 1 10.225188926473791 0.0017773278841735195 5.209115671649155 1 0 1 +63 1 -8.213348572388885 -0.1729333455438991 1.128439638194422 -1 0 1 +133 1 -10.560391258433501 2.3871994933981604 3.6217764405881163 1 1 0 +67 1 -6.58893267726452 3.5537178434565275 3.2475644463629347 1 0 0 +83 1 -3.8515887631140515 0.6260605243857498 2.809794279660778 0 -2 1 +162 1 0.5353669870800427 0.011171969691910696 6.140615526988775 0 0 0 +170 1 -2.6982076482868784 4.239239002024167 6.5023488926564 -1 1 -2 +181 1 -5.269736706670749 0.6633143508889567 5.80856876438175 -1 1 -1 +71 1 1.6280398876142836 3.9922472717626896 -0.5550063690378906 0 -1 -1 +31 1 1.1405250667226041 4.200703300864838 6.2167435118694465 0 -2 0 +139 1 3.842562548009269 3.6547622321511497 3.2913955399115533 -1 2 0 +3 1 10.98202973743475 1.2548431833407037 0.9250033618641567 0 -1 1 +108 1 6.094576089388102 0.9247979169923504 3.624011344184912 1 1 0 +16 1 8.94421023892344 3.592040529277952 3.968834804835023 0 -2 1 +110 1 -11.386726712959288 6.012786074810452 3.1335330551037686 0 0 -2 +50 1 -7.019873322974002 11.162655244151733 4.132863440221239 0 0 0 +191 1 -8.58859990391919 7.042920679843704 5.549588183323656 1 -1 0 +187 1 -10.694945657883851 11.280545373237025 5.089277301544773 1 1 0 +180 1 -0.9832322177090624 6.17374336331137 -1.7810168677844587 1 -1 2 +30 1 -0.5786545001726999 8.92644611919124 1.2001444343316763 1 -2 -1 +2 1 -1.7987623083026563 5.385135175592104 2.641095387043805 1 -2 -1 +17 1 -1.9803131781320147 8.340104277288379 5.2339610584552005 -2 0 -1 +7 1 4.056078571838132 8.755054555667046 1.7129552906297647 -1 0 1 +164 1 1.8606879960472185 6.264401812470137 2.238048307949188 -1 0 0 +69 1 4.582260343749063 6.901308432226479 5.16724455389889 0 -2 -1 +61 1 10.203999344055715 5.098875037493535 -0.6552273031803888 -1 -2 0 +34 1 7.6452062423181015 9.296589241677342 2.4017008610787727 0 0 -1 +43 1 7.186240451053859 6.044802069738282 2.458597580290494 -1 -2 1 +177 1 8.52522272174418 7.310838340899178 5.550705478002598 -1 1 -1 +179 1 11.738401405730409 -11.171052154041227 -10.46073671167246 -1 3 2 +65 1 -9.923794257190753 -8.360277300667597 11.397343948439744 0 -1 -1 +27 1 -10.96202039046517 -11.679459496759502 8.461761452894827 1 1 1 +58 1 -9.782820449181592 -6.900116722543098 8.161461366886957 -1 0 -1 +32 1 -6.176757614808324 -5.427580338396943 6.37353314773015 2 1 -2 +26 1 -5.244950495195521 -8.48903289150118 9.276610316099598 1 0 0 +142 1 -2.2192381371286913 -6.710860567512032 8.5692633945157 2 1 0 +100 1 -1.5829434980745454 -10.919909502588283 6.783259906533759 1 2 0 +184 1 7.415704119987677 -7.40752254135457 -11.394836902247562 0 1 2 +105 1 1.324436294552863 -7.868824845245506 3.928981783067961 0 0 -1 +75 1 4.559950916659301 -6.316720857110099 5.422215632967026 0 -1 0 +99 1 1.6556187341181972 -11.042676696296036 10.823511254079808 0 0 0 +193 1 2.1147403084852634 -6.885083505075134 9.409447220216105 1 1 -1 +33 1 4.45464187128425 -11.736247949088288 7.271061852952995 0 -1 0 +79 1 8.565919655629239 11.638486198403275 5.960760377855752 -1 0 0 +92 1 9.769060714231218 -9.492631803351557 11.102372610406375 0 2 -1 +165 1 -9.212711733999253 -3.259454828813142 7.377981593005203 0 0 0 +199 1 -6.873376106851867 -4.9933518932685566 9.87422952115871 0 -1 1 +70 1 -5.445601633222862 -2.349920544152827 7.807205278865663 0 1 1 +146 1 -1.4368974006040247 -0.5526263308116413 11.329045170425331 2 1 1 +106 1 -1.320489681644758 -2.525949605897458 8.649126125808394 0 0 -1 +52 1 0.6432865601156172 -3.653577986848175 11.390625659771409 0 0 0 +86 1 5.463936380191402 -4.545155299286932 8.600558169678536 -1 0 1 +197 1 1.6297777023246702 -4.6288437196490895 7.127308915254101 -1 0 -1 +185 1 2.117376701545396 -0.6740584604995838 9.981858778655166 -2 1 -2 +190 1 7.391326441541653 -0.2420688149799064 9.912167028101104 0 0 -1 +145 1 7.1433612487852685 -3.600502105720082 -11.787138473864353 -1 -2 0 +131 1 11.237287581981867 -5.265986055819216 6.2884198947288406 1 0 0 +156 1 -5.499196268975016 -0.3842368684419455 11.47923685297254 0 -1 -1 +10 1 -9.091750969544233 -0.8101391784724588 4.798103517685853 0 0 2 +196 1 -9.331229431870144 0.22379652065858124 8.694495890506026 1 2 1 +143 1 -7.138465404537655 3.0174764853722347 8.68001066247089 1 0 0 +13 1 -11.76499693524697 3.321385859999623 6.936314787144568 -1 -1 1 +59 1 -3.4402166179497833 1.730296081472357 9.358944812035546 1 -1 1 +186 1 0.1617283142132493 2.5970365582430226 9.662083422391825 1 1 0 +136 1 3.4199513038280873 2.163828872826315 7.95543255977617 0 -1 -3 +62 1 3.963989117283031 6.890950850270743 8.983560199060738 1 0 0 +192 1 10.513433172209162 2.5350934882928264 9.78265608934408 1 1 1 +113 1 7.161285582100181 2.2124289355489886 6.79272048842973 -1 -1 -1 +74 1 -8.169335431227 9.77557136132564 9.00057456275031 1 -1 0 +118 1 -11.608821137521177 8.521503367814617 7.013321378357836 0 1 0 +117 1 -5.327579617349453 11.314505774662308 7.558097527322893 -1 -1 0 +23 1 -5.129126916477775 5.721102420605024 11.278247239081892 0 0 -2 +171 1 -4.352281149020513 7.112600115001591 7.871167109278595 0 2 -2 +94 1 0.5998107735037941 9.708724091432982 9.014903980367055 -1 0 0 +41 1 5.4449659738536695 11.522021070488632 11.662868284303414 0 0 -1 +141 1 9.872190892571076 5.7761026505659245 8.948318084922565 1 -1 -1 +159 1 9.641274357072867 9.726441601090215 9.76145240542319 0 -1 0 + +Velocities + +39 2.577793097354695 -3.3983788380629387 0.9311775479132861 +57 0.044350439903272976 -2.756321060337954 -1.0428315092461067 +82 -2.504296787676701 -3.6468474399030493 0.2541672097953289 +8 3.6367927137204146 -0.708503612114486 -3.734398328076926 +49 1.8873851156019454 -1.4752561333771483 0.44317628658177016 +54 2.0609459874818237 -3.7591063995516816 6.295629243534251 +114 5.3525465279303015 -3.959388563871946 6.9201302420483755 +128 1.2908060914043953 -2.111376197467554 -0.48873831716967264 +102 -4.571293842871747 8.300052861760934 -2.8260260042769847 +157 0.6864784580965262 2.3741938996988416 3.197851910441299 +20 4.652994650182517 -2.368616661754701 -3.6239824640674376 +147 2.3112278761829046 2.7926157746726785 0.3841905616879638 +169 3.8809056176148298 -3.783797831749185 1.5132762830383186 +123 1.2907138384495385 4.5605260997379515 6.265572889261794 +130 2.3899251274818005 0.27666961403153456 4.415473432866114 +140 1.0077403345435272 3.331618501750946 3.823686801783437 +153 -4.158360194263056 -0.05792314282326738 -0.09170129980331274 +129 -2.0924141264102167 -2.229463311149641 5.774701380963026 +148 4.419535691773222 -2.221801500903651 -1.322900377568077 +119 3.3013302732178436 1.0440417527080033 2.8019660816699443 +174 1.8865107534171663 4.984254074383621 -4.4680569390231515 +134 -3.051462360151183 0.13872483873263985 0.8334720216492622 +189 -1.575075881871396 1.8217362685289014 -2.0444979947436 +28 3.421168174684726 -5.498073809092277 -0.04014458535812704 +1 1.9883484696931384 -5.62737172391044 -0.6897496957906657 +24 -1.2667871307922316 4.30277534955836 -0.9434339008200991 +176 5.33889839399068 -0.7261935889242956 -1.0648636501642632 +182 -1.3434249574772492 -1.2612974855392476 -0.8264254407007674 +137 1.9669241314073078 1.4304166951432975 -0.7941330665668798 +89 3.0037245881229415 0.2485958612228784 0.43340084246330035 +88 -4.773290068397481 -4.145612735120506 2.9587651882723076 +160 3.2238819912540246 1.454427974780249 -0.8931785023147302 +125 -2.027584749577839 0.2846539404784728 -1.9747515011844237 +107 -0.4309962618034694 -3.6977689727188716 -1.9008509957370174 +167 1.1593622921328293 -1.8699221821464713 -0.35243227029296986 +45 3.8023301775972866 1.4226356824680009 0.7412574800338123 +95 -6.444883722807761 -0.36547146467399716 -2.3313614045704956 +111 2.654717565255864 1.4059595144409067 -0.8812624422906502 +37 2.6344865612342447 3.1241557322031097 0.21727945365726709 +53 -1.162490586497141 -1.8114743286402544 -3.3819238034771355 +122 -0.39245032082132514 6.341371204609977 0.15639083036810653 +126 -1.605697227924968 4.594486921923675 2.22444280178021 +72 5.553154164868334 -1.6002168773168566 2.986954509825138 +144 1.3403843285320132 -1.7279031413546053 1.3999311572505995 +135 2.534876793407053 -3.9801581090182863 3.1492981080983657 +183 -4.679242103632781 2.993032322724656 -1.3277928954591556 +155 2.478325342602548 0.096505570078343 0.23454435113676975 +21 -3.5229231861916004 -3.9816529561376006 0.026639755919907415 +66 -4.078355783351698 -0.12178976416838905 3.6922808103625115 +22 -3.6395126219587364 -6.832262596301959 1.5951115669463118 +42 -4.403508549300507 -1.075423056570003 -0.591849033607009 +77 -3.529890611915624 -4.75010415058562 1.6925557776838493 +47 -2.1850961781212535 0.29268584139732723 -6.145825548126078 +46 4.627258609793938 -0.35735610275796525 -4.228603145133978 +18 3.73167019444449 -0.1412650186120299 1.8269713694609548 +14 4.255528637119755 -1.6399584278487664 -2.3670010206718466 +178 -5.547816263652345 -3.2716811779531016 0.3760629173372536 +48 4.425750039051989 -1.6380895084775802 3.0834785539819825 +55 0.9664608309050373 -3.9279561872107216 3.738153737041613 +12 -0.41819517254673283 0.9367025298427245 1.548662259471958 +15 -1.5561256264944465 -1.7138464717908113 -5.214325558070718 +64 -4.340047339400262 -2.22675786620723 -1.8953705605237372 +44 1.1388904606478099 1.1952052434483869 -4.7138321817777165 +188 -0.6813174034115439 -5.349606335139992 -0.5494798369887832 +200 4.5313662932423755 -1.509632335926491 -0.7143667001741889 +198 -0.147474124917653 -4.398760900940008 -1.3829542092135303 +76 3.499335281047853 4.321577651994544 1.8422196851357424 +194 0.40702093571028386 2.536045454224767 -0.25948941675872716 +68 1.095513798887539 6.302453994563069 -0.032465133466722085 +96 -0.8025115532160563 4.133456324521671 -0.3987555142125939 +91 -1.0924701330602116 -4.134760716625712 -2.5476966892452007 +154 -0.6420195815805342 0.5441210237991451 -2.4764714848254394 +19 -6.45757006657402 -1.8917738383254377 -2.2385612755611657 +120 -2.333329676155747 -2.6263663088962446 -0.31608193981125454 +138 -4.2274347886527295 -5.149547905719161 0.18051226809116783 +9 1.9482438581325014 1.836033317169747 4.767132863545005 +150 1.9981648567087547 6.350098740087899 -2.8565846607881165 +38 0.7805411976234249 3.2336875919271204 -5.491325260091564 +172 -1.6067207370017498 -4.025457011374177 3.328473783113818 +152 1.2783569248468387 1.1836235305806408 -2.8398807957375904 +29 0.012522208655832867 -2.202968899510487 1.2653923818179775 +87 2.4301555960867915 -0.3844922649780862 2.3653616101850643 +93 -0.8167645337546143 7.0869554155527865 -0.992159930343214 +195 1.386850643478473 -2.1138124263507945 -2.6343099572277926 +149 -1.9222490388239173 -2.9269314999007365 1.9288615526733388 +25 -3.59971099165819 -1.6866464810245103 1.7143969426226588 +35 1.1068675504822845 2.9570865620910163 1.5489285873628789 +5 -0.06525583154753622 4.64663174535613 0.0051166703840210825 +116 -2.156521693342489 -1.106530196750272 -0.7392284182460408 +112 0.8256766355184204 -3.3427544054629896 2.364051175484082 +132 2.1070952059277808 -0.7636208241660348 -2.901239577070981 +173 0.9555468923097092 0.9205686685241707 -3.199573856104545 +73 1.5067078955449293 -1.4433124895723743 -1.0680684282081363 +161 2.1775187990003184 -2.0432036406877887 -2.502427749527437 +78 0.4277549814794872 0.923985061568942 -4.462582084674592 +11 -0.7883572752861073 -3.298996571191427 5.184829507433079 +84 -0.3908120720288031 0.8981771084266208 2.781123174827333 +90 0.1806374932457661 1.6703751943299625 2.7208543462130645 +36 -1.267739998375956 2.1167954160312523 -2.3987528368253503 +56 0.42755132352919767 0.3105230600944311 -0.03753157138922093 +109 1.9130458422765049 -2.4592218292820647 -3.7955776970359176 +98 2.224412680285525 2.8105570053709483 -6.007751163289515 +115 -2.8264888701698423 -6.77384783439804 -4.5128631453140455 +124 1.0115631212847158 2.197697811017366 -1.4884565302411554 +121 1.819952585372025 2.133685315101777 -0.48009196690211353 +80 3.6825834395072827 2.9369744584874624 0.7772431106319383 +101 3.8152106585296663 -0.7504695117106335 -1.3678083578602058 +4 1.1543968705285124 3.6108919626584783 1.279726012491966 +6 -2.734554328800396 0.45690265044985007 1.7653493310436426 +81 2.173385375162031 -1.545557384488483 -2.635973810143899 +166 -1.239464711076861 1.3504238003340796 -0.49024226288977 +40 1.7898346069542372 -0.4474778752941201 3.4790111502788887 +127 1.6296109635966738 0.6612604860538578 5.807821273928263 +104 -4.901664479006097 1.1052244598202794 3.4465808005881824 +151 -3.983151444075344 -3.2501191110732113 -1.2526584841338049 +60 -1.922006700361108 -0.7785585059363819 -4.390434339117124 +168 -2.788478664171041 3.923738577427861 2.49523972250301 +51 -1.6149322848467969 -3.4296394320723262 4.226459281197094 +97 -1.226730421851149 -2.392775221203476 5.070036120535187 +103 -2.9962982871055357 -2.90339448475708 -1.1348192929647936 +163 0.3128021577268095 -4.112121184421586 2.47129388197539 +175 -4.72131850682648 -1.6008946774115904 -3.6054426092000593 +158 -5.274680729271083 -0.4457302148856164 4.174272671309751 +85 2.9757034033315444 -0.5103121033627565 1.99919210117291 +63 1.600933165736236 1.4604641421860185 5.197681341346513 +133 0.3650834395918216 4.123541846312257 2.1615515366543354 +67 2.0607792864448453 2.3124375339420076 0.21959246817514527 +83 -6.156022387564482 -1.1548915743184078 -0.4948872456362283 +162 -2.1450070724040025 3.9286059442169066 2.007885747151935 +170 1.8166139807691821 -1.95234066921456 -1.8559861240898843 +181 -1.587457433365127 -3.2094890956838205 2.212401241994942 +71 1.7829689662908779 -3.6713609566551657 1.3773962271622693 +31 3.918178411733008 -0.5772484115851036 0.16726508680219976 +139 -4.560722486125075 -0.5471630166750243 5.863010868871481 +3 -3.9686726349917825 3.6173076990026054 2.5273959166862507 +108 0.3042801304200664 4.847444330423647 -0.35518169829313484 +16 -2.4685650045584717 5.98056595230015 0.9384145704518219 +110 -0.6129548866614436 1.8199747299312752 -0.6050782543434758 +50 -1.8884152067915962 -1.4877561250799833 -3.9811275374353494 +191 1.500896458072849 -1.9099553342822155 -5.024921011162899 +187 -2.013243274912701 -0.8604266013822317 -1.038480536601888 +180 1.4966822969502809 2.2104050426784707 3.732721924128324 +30 -2.3551911487538373 -1.0313809690434763 -1.4871503115129143 +2 2.4972367326603697 -1.5125466361921762 1.0762650051734106 +17 0.43112912988867413 -1.9548201848493156 -0.43017998184207773 +7 6.622180146484479 4.7673609572662725 0.19425898871224434 +164 2.301415823751322 0.4827221772498991 4.559127095693677 +69 -3.4364505629674733 -1.1594038113628669 -1.2078137888752072 +61 1.7869953777023173 0.9935547623401149 0.14745693195171444 +34 -0.027807484985171937 -3.1354780466577754 -1.036977576868685 +43 -1.3037743820903311 -5.61028065095172 -4.306710886889687 +177 2.1781720801097206 -1.516912077043328 -2.054689845757315 +179 0.4934049365569875 -4.8639422788504625 -6.225153590664796 +65 2.6970228261721383 0.19294320506195817 6.683323231860031 +27 -1.6731814501881797 0.7519385590564082 3.2183027406212203 +58 -0.7774753429967389 -0.6669437971456971 3.5183225900940927 +32 -5.389835933890947 -0.4954507654154201 0.4594525916972694 +26 0.7382474998065096 -3.102724138188651 -2.185686698723454 +142 -1.944479379421283 -1.2761486898263725 0.72348529709274 +100 -2.739025692998968 -2.6245009262596986 3.182008026346906 +184 1.4210317521782347 3.1395926369797884 5.319543188841913 +105 -1.2308708716614136 -1.2494207925918743 -3.3415190888725443 +75 -1.8835854547991517 -1.3807763884880995 3.052239941977269 +99 2.3501462152911015 -0.09098282020287418 -2.963130739502538 +193 3.2483282921859455 -6.045063326765766 -1.2297831607518321 +33 -1.5552221515820004 2.623852853566988 -0.3953508079233695 +79 2.0518370606822334 1.899510113710928 2.0859744201323727 +92 1.5026700715390955 0.9352029472761221 -5.528904283783295 +165 -2.240438523644089 -0.6103912799862421 0.40653914875448993 +199 -1.2653571662196268 3.710626862073433 1.4730516528440072 +70 1.655492430853343 0.17760859693009826 -1.650919734678463 +146 -1.4225048482747793 2.74232833480091 -3.413198079564811 +106 -1.093901348299414 0.20953760114868714 -0.7298112830112282 +52 6.647000075136453 -0.30141024565553315 1.2035752428962934 +86 0.6741589587443484 4.365068713763016 3.5677961016049315 +197 -0.666824417721529 0.7257967702216201 6.272517109849018 +185 -1.1845876194928404 2.1001111189632264 2.457366035714506 +190 -1.6517508143986053 2.271851696760304 3.7976228734124575 +145 -0.6660913411508007 -2.1887913545610314 1.427073342591097 +131 3.4923356345857024 1.8910870819349503 0.22757964871813297 +156 1.3901143776938099 -0.5912367128957199 -1.945898273856384 +10 -3.3254266550003906 2.363446512042732 -2.8505669909097167 +196 1.9772342503358795 2.9791453967072834 5.0702556945320305 +143 1.3619198656944898 -4.070780999483669 0.554762511858757 +13 -3.6607073229889986 -6.103961980753075 3.3895476442791126 +59 1.3424546798513801 -0.012418821554116527 -1.0607350515292961 +186 -0.19147109350375446 -0.14042042908600805 -5.06183250631794 +136 10.318783006250738 -0.33198398090799297 -3.1695432610471372 +62 -0.9320061937291512 -8.919718141167188 -1.0031472261072583 +192 -6.036717500669019 -0.4626110813075395 -5.283002697165421 +113 -1.9312339562598033 1.2868323831429733 -0.27836767602350954 +74 0.289298974376203 4.639184114550362 -1.3074893268836063 +118 2.3186362762712704 0.014757210175651903 -1.9096714905556824 +117 2.917320124569121 -0.927139463682407 -2.038093079844118 +23 3.445296199640721 -2.484450168397722 6.150025302403371 +171 -1.3488599922862394 -0.40015537573335275 5.541824987776105 +94 2.7016234671889183 -4.500360725821148 -0.3771036206116729 +41 0.040051409073174504 1.3144504850460685 -2.628956804481983 +141 0.8101589418958534 -0.40901282998394567 2.3777914588666906 +159 -2.168905163137191 -3.9077440516609387 3.1238186982134213 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/in.lmp b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp new file mode 100644 index 0000000000..124063df99 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/in.lmp @@ -0,0 +1,28 @@ +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ new file mode 100644 index 0000000000..fa22106766 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 4 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 new file mode 100644 index 0000000000..00787df8ba --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.0 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt01 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 01 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 0 -7.3046601 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -164.47373 + 100 149.95804 3.8573359 0 -7.7921375 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 -101.30374 + 200 245.00113 6.3021074 0 -8.2639651 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 112.22426 + 300 300.57486 7.7316177 0 -8.2986331 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 814.45889 + 400 368.08438 9.4681493 0 -8.4800193 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1202.0398 + 500 419.32066 10.786088 0 -8.640773 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 952.59748 + 600 385.4127 9.9138817 0 -8.4356035 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 676.62913 + 700 360.14242 9.2638601 0 -8.2900275 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 456.91446 + 800 346.92167 8.923786 0 -8.0694169 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 454.60123 + 900 364.39442 9.3732334 0 -8.0415668 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 499.75868 + 1000 390.77042 10.051697 0 -8.1948009 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 572.98799 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14541 | 0.14541 | 0.14541 | 0.0 | 58.59 +Neigh | 0.00099082 | 0.00099082 | 0.00099082 | 0.0 | 0.40 +Comm | 0.0039966 | 0.0039966 | 0.0039966 | 0.0 | 1.61 +Output | 0.00016346 | 0.00016346 | 0.00016346 | 0.0 | 0.07 +Modify | 0.096205 | 0.096205 | 0.096205 | 0.0 | 38.76 +Other | | 0.001425 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1342 ave 1342 max 1342 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10325 ave 10325 max 10325 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10325 +Ave neighs/atom = 51.625 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 new file mode 100644 index 0000000000..83821cafb7 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.1 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt02 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 02 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 11.920908 -7.3063682 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -167.65544 + 100 483.61933 12.440028 11.405863 -7.7749671 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 606.14668 + 200 452.03836 11.627678 11.47094 -8.2534927 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 583.5476 + 300 470.25997 12.096389 11.739306 -8.3750153 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1152.6851 + 400 459.46597 11.818737 12.502421 -8.5240576 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1381.0251 + 500 442.73121 11.388273 11.19396 -8.6488583 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1000.6119 + 600 493.47034 12.693424 11.91335 -8.4625706 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 904.52944 + 700 470.04548 12.090871 10.348757 -8.278182 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 715.22796 + 800 458.04928 11.782296 11.152029 -8.0926613 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 678.21261 + 900 468.60547 12.05383 10.937315 -8.0319335 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 735.24377 + 1000 427.44192 10.99499 11.916587 -8.2229199 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 637.98311 +Loop time of 0.248186 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.126 ns/day, 0.069 hours/ns, 4029.238 timesteps/s, 805.848 katom-step/s +99.5% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14654 | 0.14654 | 0.14654 | 0.0 | 59.04 +Neigh | 0.00099986 | 0.00099986 | 0.00099986 | 0.0 | 0.40 +Comm | 0.0041628 | 0.0041628 | 0.0041628 | 0.0 | 1.68 +Output | 0.00018019 | 0.00018019 | 0.00018019 | 0.0 | 0.07 +Modify | 0.094878 | 0.094878 | 0.094878 | 0.0 | 38.23 +Other | | 0.001424 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10328 ave 10328 max 10328 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10328 +Ave neighs/atom = 51.64 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 new file mode 100644 index 0000000000..fd8dd409ae --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.2 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 2 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt03 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 03 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.862314 -7.320388 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -175.34503 + 100 455.18121 11.708521 11.48472 -7.8033686 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 526.41632 + 200 460.81997 11.853566 10.817157 -8.2276485 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 615.80924 + 300 481.48652 12.385166 10.035423 -8.3866916 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1169.2917 + 400 487.3584 12.536208 11.766522 -8.3643382 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1574.1427 + 500 446.36019 11.48162 12.144202 -8.680266 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 979.68395 + 600 500.3783 12.871115 11.075008 -8.47833 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 912.39361 + 700 435.40634 11.199857 10.923558 -8.3090105 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 617.20857 + 800 446.82793 11.493652 11.599712 -8.0900498 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 652.13243 + 900 448.28506 11.531133 12.130739 -8.0810557 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 674.68073 + 1000 440.94913 11.342433 10.765654 -8.1419484 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 730.67128 +Loop time of 0.248185 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.128 ns/day, 0.069 hours/ns, 4029.259 timesteps/s, 805.852 katom-step/s +97.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14702 | 0.14702 | 0.14702 | 0.0 | 59.24 +Neigh | 0.0010003 | 0.0010003 | 0.0010003 | 0.0 | 0.40 +Comm | 0.0039821 | 0.0039821 | 0.0039821 | 0.0 | 1.60 +Output | 0.00023527 | 0.00023527 | 0.00023527 | 0.0 | 0.09 +Modify | 0.094519 | 0.094519 | 0.094519 | 0.0 | 38.08 +Other | | 0.001427 | | | 0.58 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10313 ave 10313 max 10313 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10313 +Ave neighs/atom = 51.565 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 new file mode 100644 index 0000000000..423ebb7d63 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/log.14Jun23.langevin.metal.g++.3 @@ -0,0 +1,106 @@ +LAMMPS (28 Mar 2023) +Processor partition = 3 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 99 pad + +units metal +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 9.5251 +read_data data.metalnpt${ibead} +read_data data.metalnpt04 +Reading data file ... + orthogonal box = (-11.876697 -11.876697 -11.876697) to (11.876697 11.876697 11.876697) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + reading velocities ... + 200 velocities + read_data CPU = 0.001 seconds + +pair_coeff * * 0.00965188 3.4 +pair_modify shift yes + +mass 1 39.948 + +timestep 0.001 + +velocity all create 0.0 ${ibead} +velocity all create 0.0 04 + +fix 1 all pimd/langevin ensemble npt integrator obabo thermostat PILE_L 1234 tau 1.0 temp 113.15 iso 1.0 barostat BZP taup 1.0 fixcom no + +Initializing PIMD BZP barostat... +The barostat mass is W = 2.3401256650800001e+01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +# dump dcd all custom 100 ${ibead}.dcd id type xu yu zu vx vy vz ix iy iz fx fy fz +# dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99500125e-01 3.16148726e-02 + 1 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 + 2 1.18509233e+02 4.21908054e-03 8.88243614e-01 4.59372705e-01 + 3 8.37986825e+01 5.96668092e-03 9.19616372e-01 3.92817678e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 11.5251 + ghost atom cutoff = 11.5251 + binsize = 5.76255, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.121 | 3.121 | 3.121 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] f_1[11] f_1[12] f_1[13] f_1[14] f_1[15] Volume Press + 0 0 0 10.794425 -7.3457072 4.3005229 -21.877018 -8.7249482 2.9571502 -1743.5332 -698.49808 -172.07477 0 0 0.033460054 -0.37064378 4.216227 13402.228 -191.02389 + 100 426.01705 10.958338 12.206372 -7.8040582 42.886648 -23.396327 -1.980193 2.954003 -1888.0547 -1648.7118 -332.0298 -0.099139345 0.11500091 0.033044702 -0.3701566 42.83112 13235.861 464.39271 + 200 414.52703 10.662783 11.934129 -8.2331312 41.690123 -22.521598 -4.273021 2.9600599 -1906.2904 -1609.02 -265.94404 -0.20527926 0.49305948 0.031504957 -0.36829556 41.729191 12619.125 502.87052 + 300 424.85622 10.928478 11.681713 -8.357621 43.180131 -21.755813 -7.7032433 2.9714114 -1968.7685 290.49656 251.72564 -0.21935745 0.56300721 0.029467915 -0.36568855 43.236828 11803.2 1058.1162 + 400 485.80103 12.496148 12.255827 -8.3658975 49.109699 -24.824142 2.9744597 2.9794185 -2335.993 1368.7398 570.03286 -0.028366234 0.0094148316 0.028338146 -0.36416383 49.028096 11350.678 1570.2486 + 500 462.99006 11.909386 11.187609 -8.6934698 45.427771 -22.825143 16.22356 2.9684828 -2113.91 -272.84753 185.53392 0.091614289 0.098205455 0.028793585 -0.36478567 45.368325 11533.101 1014.2134 + 600 465.24407 11.967366 11.168375 -8.4422887 47.783726 -22.456104 6.837575 2.967236 -2023.8117 -918.27943 -2.4106994 0.093360761 0.10198539 0.029589188 -0.36584873 47.725157 11851.775 864.12413 + 700 426.16111 10.962044 11.000011 -8.2855512 42.626187 -20.571698 -5.7252564 2.9560528 -1806.9448 -1418.2247 -148.41657 0.075011202 0.065835696 0.030359455 -0.36685105 42.558523 12160.301 614.76939 + 800 454.53159 11.691811 10.834606 -8.0654281 45.160336 -21.885719 -6.7745694 2.9575472 -1894.3641 -1329.3179 -136.42193 0.011114896 0.0014455064 0.030808183 -0.3674233 45.076543 12340.037 684.85907 + 900 441.72064 11.362278 10.4492 -8.0786302 45.604542 -21.816625 5.586068 2.9578604 -1890.4653 -1271.1107 -111.89061 -0.020285587 0.0048148677 0.030774258 -0.36738033 45.521594 12326.448 659.68525 + 1000 429.90929 11.058457 11.851933 -8.1578394 45.264242 -22.833545 6.9260573 2.960122 -2007.6188 -1179.7125 -70.907567 -0.062733519 0.046047757 0.030329191 -0.36681215 45.191633 12148.179 698.73278 +Loop time of 0.248175 on 1 procs for 1000 steps with 200 atoms + +Performance: 348.141 ns/day, 0.069 hours/ns, 4029.409 timesteps/s, 805.882 katom-step/s +98.1% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.14919 | 0.14919 | 0.14919 | 0.0 | 60.12 +Neigh | 0.00099112 | 0.00099112 | 0.00099112 | 0.0 | 0.40 +Comm | 0.0040992 | 0.0040992 | 0.0040992 | 0.0 | 1.65 +Output | 0.0001723 | 0.0001723 | 0.0001723 | 0.0 | 0.07 +Modify | 0.092299 | 0.092299 | 0.092299 | 0.0 | 37.19 +Other | | 0.00142 | | | 0.57 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1346 ave 1346 max 1346 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 10332 ave 10332 max 10332 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 10332 +Ave neighs/atom = 51.66 +Neighbor list builds = 4 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_metal_units/run.sh b/examples/PACKAGES/pimd/langevin_metal_units/run.sh new file mode 100644 index 0000000000..2580ef1a41 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_metal_units/run.sh @@ -0,0 +1 @@ +mpirun -np 4 $LMP -in in.lmp -p 4x1 -log log -screen screen diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 new file mode 100644 index 0000000000..e3d6b816a3 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj01 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 2000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +108 1 -2.7795690566068996 -2.0367677788080942 3.4238258338844894 2 1 -1 +102 1 -2.609481280743025 -1.8912619121268304 -2.399753092988466 1 -1 -1 +141 1 -3.140749645549514 -2.8903241627869427 -2.7071762462261537 2 0 0 +49 1 -2.3658136681990007 -3.088812044820056 3.4760124445890623 0 1 -1 +88 1 -1.6158710173914035 -2.3369020600614756 3.233517474511907 0 1 -1 +192 1 -1.2960228223928079 -3.237522585981233 -3.1506262911155765 1 1 2 +113 1 -0.5058112539671865 -2.175265580488635 -2.895948573481031 -1 0 0 +147 1 -0.22721902013037146 -3.2095321965856187 -2.5444416457809185 0 1 0 +55 1 0.6250447384071113 -2.6446349401275255 -2.959767417439857 -1 0 -1 +63 1 1.6783992808137906 -3.22203513406057 -3.1652676844989256 -1 1 1 +95 1 1.3579478870419064 -2.684729254303277 -2.052496056604152 0 2 -1 +105 1 1.4496281787006915 -1.9673030959679096 -3.332658945278261 0 0 0 +84 1 2.4045875426768606 -1.8297724699275564 -2.7874627893944544 0 0 0 +65 1 -2.68682939849047 -0.8114540186440395 -3.126687818057689 0 -1 0 +112 1 -1.7203801180145006 -0.8038481618523634 -2.0163240721427838 0 0 0 +174 1 -1.4968933339977661 -1.3290620346554367 -3.064010040861048 -1 0 -1 +189 1 -0.6249709402997541 -1.252931712435372 -1.9882716349469658 0 0 2 +9 1 -0.23886293275872486 -1.0612344376875333 -3.025432389188406 0 0 1 +146 1 -0.9802936024515303 -0.3953988402073487 -2.8364522494017708 2 1 2 +171 1 0.39730078560778914 -1.7846492070113664 -2.443607407553737 0 2 -1 +140 1 0.5573788374911133 -0.5990036144148324 -2.402963062521378 -1 0 0 +152 1 3.4379847727225346 -1.3055938268830742 -2.4905074589410936 -2 -1 0 +11 1 3.1992117767992068 -1.191883736793153 -3.4723419170834338 -1 2 1 +69 1 2.6376153053668867 -0.2845436411244765 -2.788279844473203 0 -2 0 +173 1 -1.967038944001471 0.06098718735032446 -2.58940519609616 1 0 1 +190 1 -2.8711350478349926 0.9129034739862979 -3.477848194666021 0 0 0 +164 1 -2.8409776961511124 1.1599509265598786 -2.2464830240939375 0 0 1 +161 1 -1.6469671018177567 0.9360204597700993 -3.3491365145788827 1 0 2 +74 1 -0.028453987680887038 0.3739399392930446 -2.9891764409930484 1 -1 1 +162 1 -0.9152119867762214 1.8538003710645874 -2.0787458665529313 0 0 1 +165 1 0.20472499231506947 0.41157279287578097 -1.7804952487691292 0 0 0 +28 1 0.9556568956317052 0.9070586383550882 -3.051580171737043 0 -1 -1 +107 1 0.27101548210140264 1.6697625775553313 3.256398876364515 -1 1 0 +53 1 -2.2768986954542476 1.9520208666344268 -2.905899876141582 -1 -1 1 +60 1 -2.3748565234893153 3.1415519659534046 -2.6903226937570888 1 1 0 +172 1 -1.3831407623603917 2.6439383680022495 -2.988114399273657 0 0 2 +35 1 -1.9040946957475922 2.4850230251463294 -1.8238074088896814 1 -1 0 +90 1 -0.6407155002729499 2.891205873820353 -2.184576201275668 0 -1 1 +183 1 -0.7452468270399182 1.6958511415691964 -3.2646018242495516 1 0 0 +46 1 -0.22701759376730096 2.672935498985858 -3.2296828094464414 1 -1 -1 +26 1 0.3607641531328818 1.9915770180932266 -2.4322620664253045 0 -1 1 +41 1 0.6373758855225722 3.1576967379383136 -2.2076729513672273 0 0 1 +62 1 1.2599715479139464 2.4637352645229535 -2.996655642771261 0 0 1 +114 1 0.7095094175128512 3.3529225376529834 -3.446569928809617 0 -1 1 +29 1 -3.4441516076858747 3.186682881361427 -3.164290558791177 1 -1 0 +120 1 -2.7699397214807666 -3.0679149510930377 -1.4586405778286127 2 1 1 +166 1 -2.9639598123456348 -1.8230569851379879 -1.1336421298957986 0 1 0 +19 1 -2.219481001384856 -2.718720936926987 -0.17152653954078959 1 1 -1 +143 1 -3.3367462911096637 -2.646710289319255 -0.08639804580378332 1 1 0 +14 1 -0.8080539703460301 -3.3138674801902015 -1.5513416052298858 -1 0 1 +17 1 -1.2519028473371163 -1.9834151764617522 -0.4751925051419198 -2 0 0 +7 1 -0.6422036076119758 -2.1822637849150257 -1.309964136714573 -1 0 1 +76 1 0.002896678458885543 -2.2620445897063184 -0.2330303144789453 0 0 0 +25 1 0.3195487317939559 -2.5915964162672633 -1.6847661018972104 -1 0 1 +122 1 0.9437732996524034 -3.076308154774796 -1.0301951566376644 1 0 -1 +188 1 1.3149323047475332 -2.0202232851439175 -0.9332517483120624 -1 0 0 +196 1 2.4252816482051065 -2.9991133261256717 -0.2915609413585816 0 2 1 +154 1 1.617010887740887 -2.199305270305938 0.15712874770371849 -1 2 0 +64 1 2.934967635633404 -1.92620475221537 -0.7077313528493354 0 1 0 +79 1 -2.8111804533557017 -0.5176533778232942 -2.0486672107634094 0 1 0 +80 1 -2.079807139196039 -1.2506968999173758 -0.6878784167189951 0 0 1 +12 1 -2.996784469690298 -1.494057160171672 -0.09378065633433766 0 0 1 +87 1 -1.4786937501974577 -0.24572242955022147 -1.0411298155891553 0 -1 1 +118 1 -1.5219571471797697 -0.6469152337096267 0.07790607124041445 0 1 0 +106 1 1.1039107347748043 -0.9982945968846851 -1.4358613477546331 -1 0 0 +6 1 0.2994229743009 -1.5755502164022743 -1.1025451212735877 2 0 0 +98 1 0.14422647245316755 -0.4562748967814887 -1.1288823927075846 -1 0 0 +36 1 1.117403260546369 -0.6258611972204157 -0.45746732579129296 1 -1 0 +133 1 0.859517194013173 -1.4579095853876511 0.2223121798831755 1 1 1 +1 1 1.9750704226304612 -1.2226584851722493 -0.5050391499153623 0 -1 0 +91 1 2.930212504963826 -0.8900603772487206 0.31326990070574257 0 -1 -1 +135 1 -1.8704119131145511 1.4151617424236407 -2.0299493395071555 1 0 0 +145 1 -2.5978280185456044 0.23771261564216897 -0.6973478660383656 0 -2 -1 +194 1 -0.802106175542123 1.5380363524561962 -1.0014646333327863 0 1 -1 +177 1 -0.4209642163497379 1.4081511815239465 0.048786606404428355 0 1 -1 +56 1 0.1655081354187105 0.488612868229853 -0.6685586469118172 0 0 1 +137 1 1.0403444543974962 0.29392106264506496 -1.157047853549803 -1 1 -1 +3 1 1.426791637331859 1.1994824011018168 -0.7391487398561316 0 -1 1 +125 1 0.6384933993980926 1.4087406696008793 -0.04513978672724809 0 1 0 +85 1 3.492386221258323 -0.022918569575539983 -0.18415289757087 1 0 1 +37 1 1.9446560065460998 0.32690249887078415 -1.557848909197346 1 0 1 +157 1 2.2693311785439514 1.4234672203444076 -1.3950756204319474 -1 -1 1 +81 1 2.2043144165939133 0.7734976358785483 -0.1443989261496442 -1 0 1 +193 1 -2.800913203549158 3.3913795040038752 -0.3002902442199323 1 0 0 +127 1 -1.832485514575906 -3.475177695698571 -1.0143919033965547 0 0 0 +104 1 -0.9864189902172598 -3.128510029811542 -0.3946109581791233 0 0 -1 +72 1 -1.091863924309645 2.651695772194485 -1.1525574140711645 1 -1 0 +99 1 -1.376188772302252 2.1367308970905112 -0.22414000562735564 0 -1 0 +24 1 1.0798151658945965 1.8088284522753606 -1.611839691529319 1 -1 0 +42 1 3.3099578488331143 2.7636832208891664 -0.11775790598994411 -1 1 -1 +38 1 -2.6469918571054945 -2.446265188540552 0.8006326688775777 1 0 1 +86 1 -3.3982593364606077 -1.9911707046121028 1.4129412590921573 -1 0 0 +116 1 -3.3782151164102614 3.3939134790192074 0.6418244028431277 1 0 0 +144 1 -2.152212571536467 -2.8119708535854224 1.6778364082976118 0 1 0 +179 1 -0.8263021362457004 -1.7214596406733806 0.6812305480127513 -1 3 1 +151 1 -1.5217298498042864 -2.5933593936403763 0.7963122225368328 0 1 2 +130 1 -0.41366866285633624 -2.851509016203123 0.6773665297002652 -1 1 0 +149 1 -0.8196954968551895 -2.4620140380344058 1.6681749543249536 1 1 0 +123 1 0.42149982032625755 -2.3318080821151144 1.1400194349387576 -1 1 -1 +142 1 1.7676090653529768 -2.7694388971884765 1.0411093428968425 1 1 0 +43 1 1.2651581412723922 -1.7350310325188918 1.2119129817343088 -1 -1 1 +156 1 2.796603060966876 -1.975811297437484 0.5269881248554414 0 -1 0 +30 1 -2.572197786362113 -0.5211520888332514 0.06478473226429171 1 -1 0 +200 1 -2.796037525463158 -1.2242406753887405 0.9147806710233006 -1 0 0 +75 1 -3.264195451754593 -0.2758623474229462 0.8501703715118789 1 -1 0 +199 1 -1.8606891200301348 -0.81109530705794 1.234068196576104 1 -1 1 +119 1 -1.8952925629684365 -1.6742391291961565 0.3056526633582653 0 -1 0 +153 1 -0.6179778569135823 -0.6812551828045249 0.8822634033092613 1 1 0 +31 1 0.1434804396367878 -0.5352374975985325 0.00065681711961239 0 -1 0 +8 1 0.9896949675708329 -0.5825805499366115 0.8390036708294969 0 0 0 +198 1 0.20957042666083733 -1.2300305579788615 1.1505092305231928 0 0 1 +22 1 0.11282413745771128 -0.029722367543426716 1.1299864513218787 -1 0 -1 +195 1 2.9662277270739343 -0.9097471611972223 1.378968815531931 1 0 2 +32 1 1.9176581701385829 -1.0963885598161285 0.612637989357651 1 0 -1 +139 1 2.2034635745403706 -0.09403988556633318 0.8645554281632429 -1 2 0 +77 1 1.7035877859699526 -0.8133688575022073 1.6318409740615665 0 -1 1 +111 1 -3.223221512681343 0.8515794477136406 0.5304444380887284 1 1 1 +138 1 -2.102339643808083 0.3205080511040257 0.6397061187151873 0 1 -1 +103 1 -2.8441279458234914 0.5800051690180812 1.512417106043963 -1 1 0 +184 1 -2.4512811422970944 1.4407376078485292 1.024840909070544 0 0 1 +73 1 -1.2083083753201984 0.16913042396249212 1.31830897028215 0 -2 0 +89 1 -0.622943103836138 0.15695545887374523 0.03344907944561345 0 0 -1 +93 1 -0.6871612783719626 1.4782545941619265 1.7130745398216136 0 -1 0 +94 1 -1.209899480419889 1.1419050120740204 0.768566708093127 0 0 0 +181 1 0.8338139283938067 0.2955625473112081 0.1708175991674893 -1 1 -1 +129 1 1.1355758059362249 0.3630461551808931 1.290797674214222 -1 0 0 +182 1 0.08831527814343061 0.9709201913937692 0.9217855950625892 0 1 -1 +158 1 1.4062820374169525 1.1517166598840343 0.6269036353613398 0 0 0 +100 1 2.8360458941172935 1.5280995172170748 0.62642849190607 0 1 0 +59 1 3.120666407088228 0.49773318717092796 1.2390797462592613 0 -1 1 +40 1 2.1784673001300465 0.9493086808156442 1.37690657576216 0 0 0 +110 1 3.092811420136352 1.457598231264991 1.8333488137634408 0 0 -2 +71 1 -2.704068160468349 3.198799130983575 1.5420861670955985 0 -1 -1 +187 1 -3.3809787804159894 2.339193447924602 0.9253127201661663 1 1 0 +58 1 -1.8161128905276918 3.295453805825648 0.4419286058239596 0 -1 0 +39 1 -1.9288855291902436 2.399541640622866 1.1856795461879515 0 -2 0 +115 1 -1.3188418056778684 -3.426962627878111 1.3071043811339145 1 1 0 +109 1 0.7422148102651713 1.9772692916114134 0.8946623229549697 -1 1 0 +48 1 1.212990075236676 2.7637861839630933 1.668138216427735 0 0 -1 +44 1 1.8875283020177747 2.01954806585405 0.15097670327664356 -1 -1 1 +16 1 2.5088486436667465 3.2867062332187165 0.5352876678637931 0 -2 1 +150 1 2.339993315563226 2.225227215494749 1.201791196292386 0 -1 1 +101 1 -2.7232595674410254 -2.5310321070553594 2.520173028347837 1 3 1 +121 1 -0.1371595891679715 -2.734037361783574 3.2547541081110136 -1 1 -1 +131 1 -1.616105025949218 -1.97873290984862 2.2250110182725185 1 0 0 +50 1 -0.9774458776093428 -3.080336575399165 2.647294574069851 0 1 0 +78 1 -0.6388640381972747 -1.8358994538797384 3.0793625374288474 1 -1 1 +126 1 0.2617829860592282 -3.185635897887874 2.046978007125428 0 1 -1 +185 1 0.3910180046792306 -1.7476201774885758 3.460179487049301 -2 1 -1 +27 1 0.9216706073777299 -2.620009754961919 2.980059759810019 0 0 1 +5 1 0.14805884420723833 -2.060999311749248 2.194803632818035 0 -1 -1 +10 1 1.3885697256222325 -2.5811721069430047 1.960299612344295 0 0 1 +68 1 1.2305537223759786 3.452417391198064 2.5060768204562396 0 0 1 +92 1 3.2579931163558924 -3.0623298587917547 1.8252693484803535 0 2 -1 +178 1 2.26419751848874 -1.7585846281228215 1.7123805014943867 1 1 0 +96 1 2.599921016729558 -2.6427367710738228 3.4145177684858803 -2 2 -1 +57 1 3.2402592062064213 -1.9899576048001384 2.7907002699370937 1 0 0 +155 1 2.209613988042176 -1.7162524781709796 2.7271827572979834 0 0 -1 +168 1 3.477326382335708 -3.4068959852573992 2.821891114170504 -1 1 -2 +175 1 -3.1260125076640937 -0.1261845495956751 3.231607373653429 0 0 0 +117 1 -2.5082381499858095 -1.6201356456498082 1.916360867966056 0 0 0 +4 1 -3.1142920073981517 -0.7023062901592412 1.8555906719306698 0 0 -1 +51 1 -1.9626772134484154 -1.4010881760394245 3.033958867461655 0 0 -1 +148 1 -3.011516485433896 -1.1469037793442038 2.7610753028279933 0 0 0 +197 1 -2.0048159662329326 -0.6749211621392989 2.344679442661877 0 -1 -1 +70 1 -1.8654941392471802 -0.3319695813423535 3.329224742630753 0 1 1 +23 1 -1.0720302561208543 -0.8796307974060223 2.9652586368172633 0 0 -2 +134 1 -0.9769774773292339 -1.023866537972646 1.8133872200496586 -1 0 0 +66 1 0.0812156007450339 -1.0967406204476347 2.677696992399577 -1 -1 -1 +33 1 -0.42833987516917704 0.2127920276630183 3.0504271041557827 0 -1 -1 +18 1 0.8738459806171345 -0.7301638515378504 3.451151027750579 0 -1 -2 +167 1 1.1687036142366616 -1.4517802174625138 2.5014340704062015 0 1 -1 +136 1 1.795137560517328 -0.5623222017058748 2.761148573575212 0 -1 -2 +176 1 0.8667263057428289 -0.39855552371320657 2.157386135628261 0 0 0 +132 1 2.7791570748849397 -0.1854473725861777 3.06331164881256 0 0 -1 +163 1 2.861161516036147 -0.9653887253660198 2.3742914745631665 -1 -1 0 +159 1 -1.638440405488927 1.040992844593558 1.6945368306541542 0 0 0 +34 1 -2.319980614869211 0.615010700172925 2.607891496520952 1 0 -1 +67 1 -1.8758084270870021 1.7856292006021222 2.9794597615239873 1 0 0 +82 1 3.450078342208421 0.43347862445962865 2.3965330453749276 -1 -1 -1 +20 1 -0.3345634991984191 0.4474749361055883 2.021125197093307 1 0 -1 +160 1 -1.337826167757788 0.19507650189296638 2.4559469377176044 0 0 0 +191 1 -0.9433598322448645 1.0765639185970945 2.7978676989244713 1 -1 0 +97 1 1.4995074975439164 1.4827775589636611 2.8582397165142885 0 -1 -1 +83 1 0.7440931705195399 0.28485269404070884 2.8824261695219513 0 -2 0 +186 1 0.4501325900005473 1.1817617584793225 2.171005382838285 1 1 0 +21 1 1.5799209373811796 0.5165927484280916 2.197344395644513 1 0 -1 +170 1 1.781383760665039 0.4589516263468447 3.2606047972968697 -1 1 -1 +15 1 2.5264882009659457 -0.10271458568953422 1.9429509270634897 -1 0 -1 +54 1 2.4907565610148112 1.0443458588262453 2.659572052524602 0 -1 -1 +45 1 -2.3851170089162586 2.7278135027281576 3.2923683043438063 1 0 -1 +47 1 -2.417816843075144 1.911767591397239 2.070179319067279 0 1 0 +52 1 -3.4931268842957652 2.50155605132379 2.127865658713496 0 -1 0 +180 1 -1.9509177290095516 3.309670529089689 2.349688492929276 1 -1 1 +13 1 -0.12240867021598209 3.2141258686958913 2.833411182871058 -1 -1 1 +2 1 -1.340442106022601 2.2849149851767008 2.069093746173476 1 -2 -1 +124 1 -0.41265942682553436 2.1334074442091007 2.592421577863454 1 -1 -1 +61 1 0.7799049336891462 2.500510040165389 2.633457440959517 -1 -2 0 +128 1 2.8514020342376654 2.399755896897204 3.251183881976271 0 0 -2 +169 1 2.1185477137097575 2.27540363851787 2.3296903855745934 0 0 0 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 new file mode 100644 index 0000000000..aab14fd30f --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/data.lj02 @@ -0,0 +1,219 @@ +LAMMPS data file via write_data, version 8 Feb 2023, timestep = 8000 + +200 atoms +1 atom types + +-3.4945130603740377 3.4945130603740377 xlo xhi +-3.4945130603740377 3.4945130603740377 ylo yhi +-3.4945130603740377 3.4945130603740377 zlo zhi + +Masses + +1 1 + +Pair Coeffs # lj/cut + +1 1 1 + +Atoms # atomic + +141 1 -1.763209980389579 -2.6156484242195064 -2.931843780833984 2 0 0 +152 1 -1.5928871542954757 3.3501884422702433 -1.8656866405706811 -1 -2 0 +49 1 -2.7539752553137182 -3.2181862303090325 -3.2982185001231508 0 1 0 +113 1 -0.7003027892165357 -2.1799819378730754 -2.999588953057854 -1 0 0 +147 1 -0.9066147762335637 -3.0721536393085946 -3.451497569202878 0 1 0 +25 1 -0.8348129272923334 -3.2010555139777104 -2.4342714727995403 -1 0 1 +7 1 -1.155032969500839 -2.109409697780318 -2.01960214884411 -1 0 1 +122 1 -0.11210230788570166 -2.6275713274626975 -1.900506384406081 1 0 -1 +55 1 0.23346664931542635 -2.573966195106371 -3.0437128589517024 -1 0 -1 +95 1 0.716981854784511 -1.7560064219465084 -1.6999612600924723 0 2 -1 +105 1 1.1248014998718883 -1.7403082354703703 -3.356758018801178 0 0 0 +84 1 2.225043764737794 -2.1031554472806464 -3.42558560520243 0 0 0 +65 1 -2.8977942390562763 -2.1977837904725823 -3.370623324950664 0 -1 0 +175 1 -3.151432241251456 -0.37515180280237564 3.4437485581764316 0 0 0 +173 1 -2.3157350741156972 -0.12943144237356516 -2.753320161369244 1 0 1 +174 1 -1.4393153013859372 -1.4595317956467175 -2.895392195630071 -1 0 -1 +189 1 -0.9035292808774392 -0.8049470303120404 -2.0013910310988474 0 0 2 +171 1 -0.09043747063992294 -1.5712222691835853 -2.3464524824680155 0 2 -1 +9 1 -0.38933479997274456 -0.745737254721562 -3.0928316849953847 0 0 1 +37 1 0.8181444837942082 -0.7091668788083872 -2.594933610756206 1 0 1 +170 1 1.3754078695474516 -0.09950193181623739 -3.3522400330808644 -1 1 0 +69 1 1.8294621328196188 -1.0504767914076205 -2.8686605757666803 0 -2 0 +11 1 3.053917621871791 -1.2494689141836135 -3.2389748560412586 -1 2 1 +132 1 2.7977059570311695 -0.2496088420677755 -3.341775035063612 0 0 0 +190 1 3.4919178496580034 0.673724849434539 3.4160908466980175 -1 0 -1 +146 1 -0.6231884714133011 0.14913282842463038 -2.641949381637644 2 1 2 +135 1 -1.5674517925968012 0.6290709302591437 -2.3856462153486317 1 0 0 +183 1 -0.49431360672463004 1.4890871743231773 -2.7350680810605428 1 0 0 +74 1 0.37022638217671316 0.08409992531451556 -3.033741105582725 1 -1 1 +26 1 0.4574609043057575 1.0299917975368564 -2.3172978982485737 0 -1 1 +28 1 1.1181699312197082 1.1244486490934802 -3.1866832135712855 0 -1 -1 +29 1 -2.5977690868714194 2.5288932865762908 -3.4450145823917615 1 -1 0 +60 1 -1.7983398047844672 3.3151201773371946 -2.9557747417019304 1 1 0 +35 1 -2.341675516391612 2.5752707942079995 -2.1932303039293837 1 -1 0 +172 1 -1.5906394201515217 2.0015866768978423 -2.97713376733703 0 0 2 +90 1 -0.9570316941978154 2.7341944347748575 -2.39704430602322 0 -1 1 +41 1 0.17097469683906785 3.422589740764926 -2.7250117611585174 0 0 1 +102 1 -2.1834144246935057 -1.9708341062049972 -1.651792998752301 1 -1 -1 +19 1 -2.799899482947646 -2.4762586983196475 -0.30170497621753223 1 1 -1 +193 1 -1.8524344777477728 -2.9040612754975954 -0.9352876177978476 1 1 0 +76 1 -0.14754768813509733 -2.534237145454477 -0.5903298333231304 0 0 0 +104 1 -1.4292162927828058 -1.8887180032986757 -0.7510048521253992 0 0 -1 +14 1 -0.7531800111600084 -3.202737076324235 -1.3992046647831564 -1 0 1 +188 1 1.0895178734825146 -2.3416281855941414 0.09937021752979631 -1 0 0 +157 1 1.53648073670157 -2.278353849103656 -0.9969007844888839 -1 -1 1 +64 1 3.2685116460755688 -1.7040641958682559 -0.168149877537844 0 1 0 +196 1 3.243226770875574 -2.735431073745969 -0.24543333692900807 0 2 1 +120 1 -2.7480834527815015 -1.2726347498238166 -0.7010605053509458 2 1 1 +166 1 -2.5409778907446827 -0.09698240322803402 -1.3435121782531134 0 1 0 +30 1 -2.536346720442665 -0.46539641115594493 0.008770351469747525 1 -1 0 +80 1 -1.716490207148261 -0.7528793181105096 -0.6170398381312646 0 0 1 +17 1 -0.8652064576231921 -1.1974714632304932 -0.15888843807113082 -2 0 0 +98 1 -0.5496242692202938 -0.5939149881300675 -0.9303624863402448 -1 0 0 +6 1 -0.45332547354146785 -1.6738816451677578 -1.1232699958219994 2 0 0 +140 1 0.09381666738090248 -0.533597973200848 -1.8865070415277823 -1 0 0 +106 1 0.5488648307350995 -1.2535162508826685 -0.8256886196074045 -1 0 0 +36 1 0.7889198394938511 -0.3476398702185327 -0.04547023889787161 1 -1 0 +24 1 1.3300945978662577 -0.35153772413771023 -0.9700284287655409 1 -1 0 +81 1 2.0630098337462903 -0.9138666208698583 -0.13962068859670462 -1 0 1 +91 1 -3.4535066291698033 -0.4796384079540839 -0.5221884185889151 1 -1 -1 +164 1 -1.8003776637651108 1.3095354466285742 -0.9389018844249196 0 0 1 +87 1 -1.8547858498275616 0.3065099544053662 -0.4980768850921695 0 -1 1 +145 1 -3.090772587596814 0.5837989607708169 -0.6251810283740868 0 -2 -1 +111 1 -2.534664983415859 1.34688446772606 0.11460128889340086 1 1 1 +79 1 -1.380899470765548 0.24370827853097413 -1.4854169578503262 0 1 0 +162 1 -1.1815902722068103 1.6597770188121743 -1.9852434376303232 0 0 1 +112 1 -0.32558743037491716 0.7106169572157139 -1.615285962267308 0 0 0 +56 1 -0.8283072702254036 0.4564624534306639 -0.5700689028075459 0 0 1 +182 1 0.04863074266364189 0.7978824700683131 -0.008284573593351257 0 1 -1 +177 1 -0.6481696376748467 1.7650890642565358 -0.05338043165294714 0 1 -1 +137 1 0.32639925685778487 -0.05353328668133155 -0.9586895874383917 -1 1 -1 +165 1 0.9387159980444888 0.2522291776639033 -1.8478441123660552 0 0 0 +3 1 1.0844300875316264 0.6025889724525081 -0.4582563908829376 0 -1 1 +194 1 0.8662415299163716 1.2219273986337442 -1.3857941220556813 0 1 -1 +158 1 2.0486184184859972 0.9634063040985638 -0.3354215045861158 0 0 0 +42 1 -1.5693584560601268 2.9075068816274467 -0.8387140667909673 0 1 -1 +99 1 -1.6113116181616747 2.147179220461499 0.1775215873578245 0 -1 0 +72 1 -0.6293873725016741 2.630010118252137 -0.9564776518035689 1 -1 0 +38 1 -2.8640470065198236 -2.2435586739017785 1.3910743129711478 1 0 1 +143 1 -3.0743396057883414 -3.212849746838124 0.5259359570888149 1 1 0 +58 1 -1.9981958681612715 -3.1822656548185346 0.09920225142503952 0 0 0 +144 1 -2.279979967578157 -3.0851896187054515 1.4084093697981352 0 1 0 +151 1 -2.0216078245666655 -2.2216580360079643 0.7457122321748793 0 1 2 +130 1 -0.17493166269242383 -2.4315359476317373 0.444080856211588 -1 1 0 +149 1 -1.3750250274960272 -1.974930490228725 1.5829454078902832 1 1 0 +115 1 -1.2118995350185076 -2.9035919135907267 0.8179968023020373 1 1 0 +126 1 -0.25733050703242866 -2.3407760209116555 1.6674720764378244 0 1 -1 +123 1 0.5187414713973443 -1.8755931680751559 1.2290889493691715 -1 1 -1 +92 1 3.2842270894719214 -2.336991573654636 0.7621232582722934 0 2 -1 +142 1 2.8537576665436712 -3.369110508718591 0.5560526759827451 1 1 0 +1 1 2.08557845839204 -2.010493903326111 0.46603456602394955 0 -1 0 +12 1 -2.813558556370972 -1.5225310581093578 0.39881007051362743 0 0 1 +200 1 -2.620780645842095 -0.6334500549042138 1.1697962611458572 -1 0 0 +117 1 -2.3409262065663707 -1.4262844598718953 1.577896400637549 0 0 0 +199 1 -1.6721028915736709 -0.3937836671461621 1.764496832035196 1 -1 1 +119 1 -1.3702172421751233 -0.982726844411586 0.8109159599445125 0 -1 0 +118 1 -1.22523977151256 0.049111500972962366 0.34422431168243056 0 1 0 +179 1 -0.48400468992080004 -1.5634732075160336 0.9724005879568145 -1 3 1 +153 1 -0.7754078116015299 -0.12746028844271876 1.3139844087365358 1 1 0 +31 1 -0.21960550339589976 -0.3692535839546128 0.27760883173133294 0 -1 0 +154 1 1.1892001894282327 -1.234463776085168 0.4980011557336487 -1 2 0 +198 1 0.208959161472621 -0.7925251742172552 1.1981697813594612 0 0 1 +133 1 0.2021894978277857 -1.321629803385425 0.21342138424976495 1 1 1 +8 1 1.290866486655316 -0.32315323656178685 1.238429676489808 0 0 0 +43 1 1.4755875560077207 -1.5038423322367462 1.5696783276393578 -1 -1 1 +178 1 2.5595353005590473 -1.8548623704973153 1.5265130435507075 1 1 0 +156 1 3.10009336795942 -1.1347768292920712 0.7103971454931245 0 -1 0 +195 1 3.0488535895478486 -0.3819070637556806 1.6994009663148437 1 0 2 +32 1 2.1785721999000907 -0.8868183892594861 1.0608219538420214 1 0 -1 +75 1 -3.330023312049968 -0.13053199225722137 0.5772143324801579 1 -1 0 +138 1 -2.126928513622699 0.2705982397065681 0.9031685365715656 0 1 -1 +103 1 -2.5233875332738447 1.119832203926971 1.7143082124863906 -1 1 0 +89 1 -1.5625051595744621 1.0842527403417836 0.48114251556352683 0 0 -1 +73 1 -1.3841491529474708 0.7735632155517752 1.4917172788469495 0 -2 0 +93 1 -0.8459409435273203 1.6986071717879083 1.233579181789839 0 -1 0 +22 1 0.23130054165086983 0.3973595019638049 1.136265889331469 -1 0 -1 +181 1 1.6715679048902568 0.38189497066002065 0.5813616713777726 -1 1 -1 +125 1 0.7657348058398646 1.4638634812356126 0.3595929949039634 0 1 0 +129 1 1.187621376432971 0.7432781269466477 1.4756104377419834 -1 0 0 +186 1 0.12119836338531766 1.4258158866314226 1.7139997055217806 1 1 0 +44 1 3.246466614044557 0.935266979887072 0.09504504915790167 -1 -1 1 +139 1 2.294764083473655 0.2623628592978102 1.523064327633417 -1 2 0 +85 1 2.6715078057197426 -0.13923978779568133 0.48921080221894214 1 0 1 +100 1 2.179445623029225 1.1813699866412055 0.929258254331208 0 1 0 +59 1 3.199013987449739 0.7056213255691308 1.3011789902622373 0 -1 1 +184 1 -3.3541957825280964 1.6540170153788636 1.314525393258615 0 0 1 +116 1 -2.5607854807212633 2.8662954762956563 0.2561876654735037 1 0 0 +94 1 -2.209938696472392 1.817908573668992 0.9714554983444477 0 0 0 +16 1 3.462148790854558 2.750688132987863 1.1678814516580918 0 -2 1 +127 1 -0.6724215018270191 2.910608435174655 0.1393721830184081 0 -1 0 +39 1 -1.4963936644183389 2.8490269023893804 1.0397387839630663 0 -2 0 +109 1 1.2282064333649392 2.002097356660932 1.219647219360347 -1 1 0 +13 1 -0.038761589919005045 2.283368111259498 0.6285508805046305 -1 -1 1 +68 1 1.8122507294414043 2.919628635322565 1.388388027502655 0 0 1 +187 1 2.839543107439997 1.9712312705165291 0.44701965347775696 0 1 0 +150 1 2.6350933896773805 2.228885886643039 1.6430472643318494 0 -1 1 +101 1 -2.9845915106276357 -2.643240276070094 2.6131611879137338 1 3 1 +180 1 -2.4664624391703636 3.2461534604898077 2.2991216200041777 1 -1 1 +131 1 -2.1198879143055582 -2.5254800707290985 2.2468458013290475 1 0 0 +88 1 -1.8261664412558902 -3.2761989619835945 3.0217607589697706 0 1 -1 +51 1 -1.7527244407627123 -2.1114193587023125 3.178648460302574 0 0 -1 +121 1 -0.8632847382707834 -2.364486787477818 2.5298242427842235 -1 1 -1 +50 1 -1.3127850841438964 -3.332989957578539 1.7903541140988317 0 1 0 +63 1 1.6040989853168577 -2.8917377487223326 2.9749125296584396 -1 1 0 +27 1 0.22872838010698016 -2.994984028716655 2.6653598205127595 0 0 1 +10 1 0.9362147196804173 -2.581105523755157 1.9878669654444103 0 0 1 +185 1 0.06742724446398485 -1.8726052150227481 3.179787889614259 -2 1 -1 +62 1 0.9381874848569671 3.2183812476038773 2.122950032967029 0 0 0 +108 1 3.2075816395574557 -2.6473251670969744 3.3899630726255054 1 1 -1 +168 1 -3.4886505297786643 -3.024902771510678 1.648075348189236 0 1 -2 +96 1 2.193516168781477 -3.220451114036294 2.031971070369377 -2 2 -1 +57 1 2.897670474066688 -1.7869273194590956 2.7802854592878443 1 0 0 +155 1 2.0203257801003764 -2.093908363815807 2.3651374010253265 0 0 -1 +70 1 -2.289198729241698 -1.0693505000499786 3.3341581014665116 0 1 1 +86 1 3.4317154036170927 -1.33629793948954 1.5868690985104916 -2 0 0 +4 1 -2.642034929204445 -0.5735696636076526 2.24988074624273 0 0 -1 +148 1 -2.7958435550832177 -1.6271830272245196 2.4651167378398258 0 0 0 +197 1 -1.6297637248397103 -1.2496732630952756 2.4653302717640746 0 -1 -1 +23 1 -1.4165843839294037 -0.23332219410733462 -3.3887252652014874 0 0 -1 +78 1 -0.8539129642965406 -1.4368914881460948 3.1097976169270467 1 -1 1 +134 1 -0.7681520363929484 -1.1354013495310054 1.8538106613640677 -1 0 0 +66 1 -0.23373724912576396 -0.5882558302750734 2.5656269999794135 -1 -1 -1 +160 1 -1.1132775718863501 0.16126595419727965 2.3994619853672896 0 0 0 +18 1 0.6168554097448792 -0.8675105647197154 3.3233443940314107 0 -1 -2 +5 1 0.21124689546372627 -1.527936340282886 2.128421015823146 0 -1 -1 +167 1 1.157996163161525 -1.3890474926504965 2.5930120556899743 0 1 -1 +176 1 0.7227757787132028 -0.4265054817409199 2.130677354553178 0 0 0 +77 1 2.0007502274099562 -0.6930768409753575 2.0562080526704536 0 -1 1 +136 1 2.059758900185651 -1.052357318680519 3.1194387358517117 0 -1 -2 +163 1 3.3650479388293877 -0.7812523229666395 2.7231341802578797 -1 -1 0 +53 1 -2.3141819292399695 1.20855609162257 -3.127003289906138 -1 -1 1 +34 1 -2.2520285035649175 0.34377072469492165 3.2433897655354262 1 0 -1 +82 1 -3.1361148993392707 0.2917712829104399 2.508598507937298 0 -1 -1 +47 1 -2.903472142580087 1.2996380231419302 2.6614912616951822 0 1 0 +159 1 -1.8421866316781088 1.3742261871908503 2.7832166426856038 0 0 0 +161 1 -1.2319440636738626 0.9387211724622819 -3.4892930122068617 1 0 2 +33 1 -0.4449542140900899 0.2769280403688486 3.289217283277774 0 -1 -1 +191 1 -0.8687075277531521 1.281273999295463 2.3493691514045447 1 -1 0 +20 1 -0.12835229617409075 0.4001437971686418 2.091186274425671 1 0 -1 +21 1 1.5590447736292827 0.23116165627532026 2.4331182207698356 1 0 -1 +83 1 0.6019872094726322 0.17868421219256525 2.965010196172179 0 -2 0 +107 1 -0.09314344901480053 1.8386195873289717 2.9198165047206524 -1 1 0 +97 1 0.9500008570521725 1.1147256892756756 2.5445482565685626 0 -1 -1 +15 1 2.6866827472081427 0.05611542822496954 2.621280841687164 -1 0 -1 +40 1 2.0535009935702107 1.3482348414084473 2.153119101811638 0 0 0 +110 1 3.037377950690711 1.1454318013031137 2.4602998295324308 0 0 -2 +54 1 2.1368310833242825 0.6989281938007096 3.190545712320829 0 -1 -1 +71 1 -2.6906257490825327 2.3188264822083675 1.851572369390678 0 -1 -1 +45 1 -1.8822606439217724 2.5464355632785174 2.887157746831732 1 0 -1 +2 1 -1.527738763941238 2.1784215473644295 1.8498426738676617 1 -2 -1 +67 1 -1.014923597719753 2.0522310481028465 3.091487536680741 1 0 0 +192 1 -0.8672155474955553 3.087168735274927 2.6165250257240618 1 0 1 +124 1 -0.37769468839105996 2.5506571887551175 1.8053870882842125 1 -1 -1 +46 1 -0.2092884053324724 2.562694157698328 -3.2372195292692605 1 -1 -1 +114 1 -0.2001222858286487 -3.429888000295159 1.8301280696628333 0 0 0 +61 1 0.5140644440329998 2.208326878392573 2.2153556959139413 -1 -2 0 +169 1 1.5629071468921552 2.2983930760888316 2.2366483189031316 0 0 0 +128 1 -3.438885935852406 3.376929578988928 3.002455750479755 1 0 -2 +52 1 -3.4549495641597217 2.178628786705743 2.923210719991474 0 -1 0 +48 1 2.502392696348409 2.9340155922847346 2.5991521468190113 0 0 -1 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp new file mode 100644 index 0000000000..80bfbe4956 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/in.lmp @@ -0,0 +1,26 @@ +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ new file mode 100644 index 0000000000..4ed421dddb --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++ @@ -0,0 +1,2 @@ +LAMMPS (28 Mar 2023) +Running on 2 partitions of processors diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 new file mode 100644 index 0000000000..d219e20845 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.0 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 0 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj01 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 01 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 0 -875.67022 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -1.3810467 + 100 14.815998 4422.5753 0 -534.91485 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 12.561531 + 200 13.762526 4108.114 0 -535.07896 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 12.1757 + 300 12.566448 3751.0847 0 -493.13907 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 12.245009 + 400 11.843976 3535.4267 0 -515.14836 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 11.61585 + 500 11.100239 3313.4214 0 -521.49831 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 10.991018 + 600 9.9616183 2973.5431 0 -462.72888 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 11.071546 + 700 9.3388468 2787.6458 0 -501.33865 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 10.129991 + 800 8.9069211 2658.716 0 -523.1858 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 9.3513467 + 900 8.5046965 2538.6519 0 -543.75602 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 8.6389792 + 1000 8.0725601 2409.6592 0 -571.72872 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 7.8375753 +Loop time of 0.201181 on 1 procs for 1000 steps with 200 atoms + +Performance: 192854.150 tau/day, 4970.640 timesteps/s, 994.128 katom-step/s +98.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.11949 | 0.11949 | 0.11949 | 0.0 | 59.39 +Neigh | 0.011868 | 0.011868 | 0.011868 | 0.0 | 5.90 +Comm | 0.0041169 | 0.0041169 | 0.0041169 | 0.0 | 2.05 +Output | 0.00011916 | 0.00011916 | 0.00011916 | 0.0 | 0.06 +Modify | 0.064249 | 0.064249 | 0.064249 | 0.0 | 31.94 +Other | | 0.00134 | | | 0.67 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7492 ave 7492 max 7492 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7492 +Ave neighs/atom = 37.46 +Neighbor list builds = 55 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 new file mode 100644 index 0000000000..0804a3488a --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/log.14Jun23.langevin.reduced.g++.1 @@ -0,0 +1,97 @@ +LAMMPS (28 Mar 2023) +Processor partition = 1 + using 1 OpenMP thread(s) per MPI task +variable ibead uloop 32 pad + +units lj +atom_style atomic +atom_modify map yes +boundary p p p +pair_style lj/cut 2.8015 +read_data data.lj${ibead} +read_data data.lj02 +Reading data file ... + orthogonal box = (-3.4945131 -3.4945131 -3.4945131) to (3.4945131 3.4945131 3.4945131) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 200 atoms + read_data CPU = 0.001 seconds + +pair_coeff * * 1.0 1.0 +pair_modify shift yes + +mass 1 1.0 + +timestep 0.00044905847 + +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L ${ibead} +fix 1 all pimd/langevin ensemble nvt integrator obabo temp 1.00888 lj 0.00965188 3.4 39.948 4.135667403e-3 1.03646168908e-4 thermostat PILE_L 02 + +thermo_style custom step temp f_1[*] vol press +thermo 100 +thermo_modify norm no + +#dump dcd all custom 1 ${ibead}.lammpstrj id type x y z vx vy vz ix iy iz fx fy fz +#dump_modify dcd sort id format line "%d %d %.16f %.16f %.16f %.16f %.16f %.16f %d %d %d %.16f %.16f %.16f" + +run 1000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule + +Initializing PI Langevin equation thermostat... +Bead ID | omega | tau | c1 | c2 + 0 0.00000000e+00 1.00000000e+00 9.99775496e-01 2.11886210e-02 + 1 1.31777963e+02 3.79426112e-03 9.42540858e-01 3.34090903e-01 +PILE_L thermostat successfully initialized! + +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 3.1015 + ghost atom cutoff = 3.1015 + binsize = 1.55075, bins = 5 5 5 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.117 | 3.117 | 3.117 Mbytes + Step Temp f_1[1] f_1[2] f_1[3] f_1[4] f_1[5] f_1[6] f_1[7] f_1[8] f_1[9] f_1[10] Volume Press + 0 0 0 843646.47 -904.74343 841866.06 -843041.14 253.30998 382.47517 -1646.2945 -1.9663356 -0.82731217 341.38937 -0.58528882 + 100 3.1994696 955.04167 1014.3663 -520.08788 5336.9805 -409.03828 7790.9787 306.80845 -0.79877176 13.250868 8.3263811 341.38937 5.9400539 + 200 2.0518234 612.46927 541.77919 -550.11284 4177.1707 63.548813 -8225.489 308.68383 0.1240984 12.723365 8.0800159 341.38937 5.1568532 + 300 2.0005565 597.16612 636.76107 -492.53916 3999.3337 -31.433066 8675.7059 309.21599 -0.061382631 14.105486 8.6052841 341.38937 6.1061183 + 400 2.1301774 635.85796 629.2996 -501.35894 3784.077 -23.971605 -81.467506 309.02093 -0.046811856 13.638064 8.2470184 341.38937 6.0950651 + 500 2.1090509 629.55171 661.4048 -527.18699 3555.6926 -56.076799 648.94757 309.45936 -0.10950702 12.805213 7.7261445 341.38937 5.6641225 + 600 2.1073653 629.04855 563.33543 -484.13719 3219.061 41.992567 3171.6576 309.48724 0.082003271 13.759365 8.0375919 341.38937 6.2053973 + 700 1.9719777 588.63535 524.29409 -497.78822 2901.4483 81.033913 2000.5159 309.02619 0.15824338 12.744135 7.4580508 341.38937 5.9107525 + 800 2.0469949 611.02799 634.76301 -516.64387 2864.6773 -29.435005 2329.1521 308.67617 -0.057480808 11.604242 6.8135454 341.38937 5.445481 + 900 1.9587942 584.70008 554.57541 -536.62232 2597.5491 50.752591 601.47078 308.62547 0.099109884 10.497389 6.2142574 341.38937 4.9080572 + 1000 2.0978185 626.19882 628.7595 -559.41879 2533.47 -23.431499 -1267.4683 308.58765 -0.045757135 9.421094 5.5928021 341.38937 4.5477372 +Loop time of 0.20118 on 1 procs for 1000 steps with 200 atoms + +Performance: 192855.450 tau/day, 4970.674 timesteps/s, 994.135 katom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.12009 | 0.12009 | 0.12009 | 0.0 | 59.69 +Neigh | 0.012807 | 0.012807 | 0.012807 | 0.0 | 6.37 +Comm | 0.0040331 | 0.0040331 | 0.0040331 | 0.0 | 2.00 +Output | 0.00012271 | 0.00012271 | 0.00012271 | 0.0 | 0.06 +Modify | 0.062764 | 0.062764 | 0.062764 | 0.0 | 31.20 +Other | | 0.001361 | | | 0.68 + +Nlocal: 200 ave 200 max 200 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1117 ave 1117 max 1117 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 7460 ave 7460 max 7460 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 7460 +Ave neighs/atom = 37.3 +Neighbor list builds = 57 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/pimd/langevin_reduced_units/run.sh b/examples/PACKAGES/pimd/langevin_reduced_units/run.sh new file mode 100644 index 0000000000..adc7f4b955 --- /dev/null +++ b/examples/PACKAGES/pimd/langevin_reduced_units/run.sh @@ -0,0 +1 @@ +mpirun -np 2 $LMP -in in.lmp -p 2x1 -log log -screen screen diff --git a/examples/body/log.14Jun23.body.g++.1 b/examples/body/log.14Jun23.body.g++.1 new file mode 100644 index 0000000000..e016e88b0b --- /dev/null +++ b/examples/body/log.14Jun23.body.g++.1 @@ -0,0 +1,180 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d polygon nparticle bodies + +units lj +dimension 2 +atom_style body nparticle 2 6 + +read_data data.body +Reading data file ... + orthogonal box = (-15.532225 -15.532225 -0.5) to (15.532225 15.532225 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 100 atoms + 100 bodies + read_data CPU = 0.002 seconds + +velocity all create 1.44 87287 loop geom + +pair_style body/nparticle 5.0 +pair_coeff * * 1.0 1.0 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +fix 1 all nve/body +#fix 1 all nvt/body temp 1.44 1.44 1.0 +fix 2 all enforce2d + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] + +#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 +#dump_modify 2 pad 5 + +thermo 100 +run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.5 + ghost atom cutoff = 5.5 + binsize = 2.75, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/nparticle, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.279 | 5.279 | 5.279 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 1.44 -0.63799525 0 0.78760475 -0.15028724 + 100 1.6423694 -1.0001516 0 0.62579417 0.16116443 + 200 1.4802187 -1.2479519 0 0.21746458 0.35445329 + 300 1.4734223 -1.3213583 0 0.1373298 0.45266192 + 400 1.5118818 -1.5924889 0 -0.095725867 0.13296961 + 500 1.5471951 -1.630886 0 -0.099162814 0.12439793 + 600 1.6264248 -1.6468162 0 -0.03665568 0.43392484 + 700 1.597475 -1.6539821 0 -0.072481849 0.13128147 + 800 1.6841531 -1.775776 0 -0.10846445 -0.032960346 + 900 1.556262 -1.6750139 0 -0.1343146 0.53484605 + 1000 1.6272373 -1.7572956 0 -0.14633067 0.18431831 + 1100 1.6448235 -1.7176556 0 -0.089280316 0.25900065 + 1200 1.5486928 -1.6481004 0 -0.11489454 0.036934194 + 1300 1.7449183 -1.6039068 0 0.12356231 -0.071099427 + 1400 1.668581 -1.5939776 0 0.057917584 0.02239666 + 1500 1.6514223 -1.7086624 0 -0.073754397 0.39021328 + 1600 1.8367415 -1.808017 0 0.010357066 0.1405097 + 1700 1.6439993 -1.7711084 0 -0.14354908 0.37488252 + 1800 1.8105437 -1.7312044 0 0.061233893 0.033817829 + 1900 1.7745557 -1.7184539 0 0.038356243 0.26826112 + 2000 1.4919032 -1.7635799 0 -0.28659575 0.32901186 + 2100 1.5086111 -1.5151192 0 -0.021594146 0.37082072 + 2200 1.4464813 -1.5702682 0 -0.13825163 -0.043079808 + 2300 1.398236 -1.5359564 0 -0.15170277 0.14467017 + 2400 1.5050139 -1.6002694 0 -0.11030569 0.30358205 + 2500 1.5549789 -1.652805 0 -0.11337589 0.2916046 + 2600 1.4774593 -1.5406116 0 -0.077926888 0.020921323 + 2700 1.3700851 -1.5855698 0 -0.22918557 0.22226615 + 2800 1.4656869 -1.629742 0 -0.17871195 -0.0090503155 + 2900 1.4355808 -1.6486992 0 -0.22747424 0.12741636 + 3000 1.5859288 -1.5467092 0 0.023360382 0.23081334 + 3100 1.6099287 -1.4917881 0 0.10204129 0.22085916 + 3200 1.6814814 -1.554998 0 0.10966853 0.10312492 + 3300 1.5319494 -1.4723195 0 0.044310484 0.18583117 + 3400 1.5124418 -1.499312 0 -0.0019945387 0.15564425 + 3500 1.6106798 -1.5568215 0 0.037751529 0.27433785 + 3600 1.460087 -1.5530078 0 -0.10752165 0.0073889211 + 3700 1.5744452 -1.5720821 0 -0.013381308 0.27735962 + 3800 1.7290106 -1.6504739 0 0.061246632 0.48173619 + 3900 1.611197 -1.6452216 0 -0.05013663 0.4286963 + 4000 1.6715425 -1.6409258 0 0.013901267 0.017020657 + 4100 1.6913694 -1.5885259 0 0.085929717 0.13679669 + 4200 1.5347633 -1.6316222 0 -0.11220653 0.024396005 + 4300 1.5221369 -1.5924627 0 -0.085547139 0.29634927 + 4400 1.7020273 -1.7069204 0 -0.021913362 0.12700619 + 4500 1.7176336 -1.7439335 0 -0.043476251 0.14745343 + 4600 1.4409943 -1.6121558 0 -0.18557152 0.018887675 + 4700 1.7868207 -1.6707762 0 0.098176247 0.20004565 + 4800 1.8720226 -1.7000206 0 0.15328178 0.25661867 + 4900 1.7128343 -1.7289913 0 -0.033285317 0.24698662 + 5000 1.7242114 -1.6662075 0 0.040761785 0.18935677 + 5100 1.7589418 -1.7267393 0 0.014613086 0.40918365 + 5200 1.7138074 -1.778402 0 -0.081732715 0.39679805 + 5300 1.8149032 -1.7708654 0 0.025888786 0.29874434 + 5400 1.7140097 -1.6444743 0 0.052395323 0.62588743 + 5500 1.8076873 -1.7276245 0 0.061985946 0.25434646 + 5600 1.7137948 -1.678778 0 0.017878859 0.21062182 + 5700 1.8625614 -1.7114074 0 0.1325284 0.14365823 + 5800 1.667941 -1.6462142 0 0.0050473638 0.36134037 + 5900 1.7080521 -1.6919526 0 -0.00098107526 0.27472252 + 6000 1.7180315 -1.6677683 0 0.033082909 0.29905397 + 6100 1.8264687 -1.6837934 0 0.12441065 0.033504487 + 6200 1.757998 -1.634503 0 0.10591508 0.14360478 + 6300 1.6444838 -1.5734502 0 0.05458881 0.50314779 + 6400 1.7213235 -1.705482 0 -0.0013717454 -0.063375271 + 6500 1.5454026 -1.7236013 0 -0.19365272 0.21355367 + 6600 1.7550617 -1.7304462 0 0.0070648556 0.1782743 + 6700 1.6931304 -1.7005361 0 -0.024337029 0.31165135 + 6800 1.7953505 -1.7377126 0 0.039684354 0.27052592 + 6900 1.6547086 -1.6971987 0 -0.059037125 0.26390513 + 7000 1.678321 -1.6343689 0 0.027168906 0.23632145 + 7100 1.6389472 -1.690589 0 -0.068031265 0.26471258 + 7200 1.6772509 -1.7305397 0 -0.070061301 0.16013956 + 7300 1.7401473 -1.7461921 0 -0.023446315 0.14462402 + 7400 1.7381776 -1.6586839 0 0.06211186 0.47746891 + 7500 1.7184021 -1.8309755 0 -0.1297574 0.27706616 + 7600 1.8404039 -1.7957552 0 0.026244663 0.12898128 + 7700 1.8474196 -1.7118818 0 0.11706359 0.1959609 + 7800 1.7635506 -1.6119363 0 0.1339788 0.086260229 + 7900 1.5873929 -1.5651473 0 0.0063716922 0.0010935251 + 8000 1.6394989 -1.5900851 0 0.033018817 0.41301427 + 8100 1.6731865 -1.6981463 0 -0.041691712 0.46624156 + 8200 1.7728067 -1.7515658 0 0.0035128109 0.16520115 + 8300 1.6142221 -1.8030321 0 -0.20495225 0.039485737 + 8400 1.6775678 -1.8266472 0 -0.16585509 0.074514313 + 8500 1.8399403 -1.8100014 0 0.011539538 0.38126754 + 8600 1.8259529 -1.6641902 0 0.14350318 0.80219793 + 8700 1.8454807 -1.68448 0 0.14254593 0.18855669 + 8800 1.7017088 -1.7219601 0 -0.037268433 0.36465692 + 8900 1.612135 -1.5813013 0 0.014712431 0.21657263 + 9000 1.5992353 -1.7093785 0 -0.12613559 0.038933966 + 9100 1.7486466 -1.7024749 0 0.028685202 0.28688996 + 9200 1.546781 -1.6512407 0 -0.1199275 0.16188207 + 9300 1.8424683 -1.7304781 0 0.093565478 0.35295164 + 9400 1.7646311 -1.7795324 0 -0.032547636 0.39114207 + 9500 1.8061763 -1.8458669 0 -0.057752329 0.18930255 + 9600 1.6953348 -1.7144901 0 -0.036108734 0.18392219 + 9700 1.693168 -1.5860306 0 0.090205689 0.18749665 + 9800 1.6057784 -1.6478049 0 -0.05808426 0.28339031 + 9900 1.712654 -1.6566387 0 0.038888773 0.52108885 + 10000 1.7102385 -1.6670768 0 0.026059337 0.073458218 +Loop time of 1.09582 on 1 procs for 10000 steps with 100 atoms + +Performance: 3942257.351 tau/day, 9125.596 timesteps/s, 912.560 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.95651 | 0.95651 | 0.95651 | 0.0 | 87.29 +Neigh | 0.0064365 | 0.0064365 | 0.0064365 | 0.0 | 0.59 +Comm | 0.015238 | 0.015238 | 0.015238 | 0.0 | 1.39 +Output | 0.00059554 | 0.00059554 | 0.00059554 | 0.0 | 0.05 +Modify | 0.10993 | 0.10993 | 0.10993 | 0.0 | 10.03 +Other | | 0.007113 | | | 0.65 + +Nlocal: 100 ave 100 max 100 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 80 ave 80 max 80 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 448 ave 448 max 448 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 448 +Ave neighs/atom = 4.48 +Neighbor list builds = 463 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/examples/body/log.14Jun23.body.g++.4 b/examples/body/log.14Jun23.body.g++.4 new file mode 100644 index 0000000000..54ae630872 --- /dev/null +++ b/examples/body/log.14Jun23.body.g++.4 @@ -0,0 +1,180 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d polygon nparticle bodies + +units lj +dimension 2 +atom_style body nparticle 2 6 + +read_data data.body +Reading data file ... + orthogonal box = (-15.532225 -15.532225 -0.5) to (15.532225 15.532225 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 100 atoms + 100 bodies + read_data CPU = 0.001 seconds + +velocity all create 1.44 87287 loop geom + +pair_style body/nparticle 5.0 +pair_coeff * * 1.0 1.0 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +fix 1 all nve/body +#fix 1 all nvt/body temp 1.44 1.44 1.0 +fix 2 all enforce2d + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] + +#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 +#dump_modify 2 pad 5 + +thermo 100 +run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.5 + ghost atom cutoff = 5.5 + binsize = 2.75, bins = 12 12 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/nparticle, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.268 | 5.268 | 5.268 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 1.44 -0.63799525 0 0.78760475 -0.15028724 + 100 1.6423663 -1.000111 0 0.62583161 0.16116978 + 200 1.4802732 -1.2478364 0 0.21763407 0.35464152 + 300 1.4735433 -1.3211072 0 0.13770068 0.45307413 + 400 1.5119491 -1.5930779 0 -0.096248286 0.13119532 + 500 1.5449834 -1.6300143 0 -0.10048065 0.12635421 + 600 1.621105 -1.6459036 0 -0.041009639 0.43837884 + 700 1.5959719 -1.6348501 0 -0.054837867 0.13233006 + 800 1.6862723 -1.6902254 0 -0.020815854 0.20072937 + 900 1.6771131 -1.6544493 0 0.0058926625 0.34898089 + 1000 1.5867 -1.6797024 0 -0.10886943 0.33511593 + 1100 1.7842277 -1.6814985 0 0.084886913 0.23634574 + 1200 1.7089241 -1.6766866 0 0.015148192 0.40440454 + 1300 1.6195529 -1.6078381 0 -0.004480726 0.12193834 + 1400 1.5967912 -1.563198 0 0.017625291 0.2233618 + 1500 1.6131091 -1.5731367 0 0.023841282 0.13856054 + 1600 1.6096972 -1.5741595 0 0.01944073 0.096081201 + 1700 1.6099281 -1.5875363 0 0.0062924683 0.28628509 + 1800 1.7328539 -1.5696894 0 0.14583598 0.2202503 + 1900 1.6433157 -1.6659757 0 -0.039093124 0.12006746 + 2000 1.8262234 -1.778379 0 0.029582122 0.17815935 + 2100 1.7441298 -1.704871 0 0.021817442 0.30772022 + 2200 1.7933363 -1.7246149 0 0.050788098 0.11323852 + 2300 1.7458809 -1.7186101 0 0.0098120012 0.0034260299 + 2400 1.8202324 -1.7777769 0 0.024253178 0.089077551 + 2500 1.691512 -1.6976236 0 -0.023026761 0.23901369 + 2600 1.6221153 -1.639172 0 -0.033277785 0.36881214 + 2700 1.5532388 -1.7286197 0 -0.19091334 0.1714534 + 2800 1.6648128 -1.7298542 0 -0.081689467 0.0077427265 + 2900 1.6548465 -1.7126766 0 -0.074378524 0.096972027 + 3000 1.604345 -1.7210036 0 -0.13270205 0.25227471 + 3100 1.67823 -1.6537385 0 0.0077092269 0.13198555 + 3200 1.4695581 -1.5609142 0 -0.10605159 0.28909806 + 3300 1.6778332 -1.7396206 0 -0.078565681 0.25069132 + 3400 1.7588934 -1.680043 0 0.061261505 0.28609454 + 3500 1.6699117 -1.7762865 0 -0.12307397 0.2584648 + 3600 1.5951406 -1.6611845 0 -0.081995282 0.35801267 + 3700 1.5267137 -1.6371603 0 -0.12571366 0.6116418 + 3800 1.6792717 -1.638182 0 0.024296953 0.43447072 + 3900 1.5857658 -1.6607833 0 -0.09087513 0.19479457 + 4000 1.6062152 -1.5436014 0 0.046551586 0.55118141 + 4100 1.5505892 -1.5259333 0 0.0091500726 0.49075107 + 4200 1.6933 -1.6314975 0 0.044869524 0.032970187 + 4300 1.6498743 -1.7298746 0 -0.096499053 0.14837573 + 4400 1.6535324 -1.7095911 0 -0.072593998 0.24207879 + 4500 1.835466 -1.7677327 0 0.049378652 0.18168744 + 4600 1.7346556 -1.6379956 0 0.07931344 0.49973778 + 4700 1.8050359 -1.8354358 0 -0.048450223 -0.037354111 + 4800 1.6361661 -1.7741414 0 -0.15433697 0.36409064 + 4900 1.6511224 -1.7703808 0 -0.13576956 0.23794467 + 5000 1.6249047 -1.6516641 0 -0.043008453 0.15155643 + 5100 1.6842561 -1.7128485 0 -0.045434914 0.30999124 + 5200 1.6153583 -1.630441 0 -0.031236245 -0.0083460068 + 5300 1.6806066 -1.6907533 0 -0.026952801 0.16886559 + 5400 1.7541932 -1.7161908 0 0.020460503 0.16560614 + 5500 1.8643473 -1.7810235 0 0.064680293 0.061200837 + 5600 1.5963536 -1.6145484 0 -0.034158307 0.47888104 + 5700 1.7385482 -1.7214092 0 -0.00024648083 0.22078849 + 5800 1.6726308 -1.6987799 0 -0.042875376 0.46131938 + 5900 1.7830081 -1.7766484 0 -0.011470422 0.12597212 + 6000 1.9057941 -1.719849 0 0.16688715 0.37367068 + 6100 1.6882353 -1.6888488 0 -0.0174959 0.33635307 + 6200 1.8644261 -1.7435021 0 0.10227973 0.54157135 + 6300 1.8043895 -1.8169618 0 -0.030616242 0.20596562 + 6400 1.8745855 -1.7752732 0 0.080566434 0.18365661 + 6500 1.8330698 -1.6984304 0 0.11630864 0.058109254 + 6600 1.8006644 -1.7398524 0 0.042805376 0.17509961 + 6700 1.7471279 -1.7009995 0 0.0286571 0.13439557 + 6800 1.7077006 -1.7462928 0 -0.055669263 0.16474264 + 6900 1.7602738 -1.8336138 0 -0.090942793 0.37533762 + 7000 1.6962037 -1.7746381 0 -0.095396485 0.28764793 + 7100 1.6040275 -1.652448 0 -0.064460796 0.47621288 + 7200 1.7595892 -1.6260406 0 0.11595278 0.55174207 + 7300 1.8031743 -1.7436876 0 0.041454978 0.35699364 + 7400 1.6575485 -1.5994276 0 0.041545422 0.38389368 + 7500 1.8539985 -1.6888181 0 0.14664046 0.25524239 + 7600 1.6721617 -1.6819419 0 -0.026501825 0.18077253 + 7700 1.4696976 -1.5368001 0 -0.081799475 0.37392274 + 7800 1.6532125 -1.6604679 0 -0.023787555 0.25683053 + 7900 1.5890818 -1.711541 0 -0.13834993 0.28943398 + 8000 1.6729844 -1.674981 0 -0.01872644 0.1725141 + 8100 1.6041427 -1.7188678 0 -0.13076654 0.22948004 + 8200 1.7000012 -1.5584259 0 0.12457532 0.82913741 + 8300 1.6662649 -1.8411986 0 -0.19159634 0.40893581 + 8400 1.6031593 -1.8225478 0 -0.23542004 0.21287004 + 8500 1.6615542 -1.685667 0 -0.040728376 0.40063656 + 8600 1.6094262 -1.7942547 0 -0.20092282 0.28738874 + 8700 1.6040855 -1.6483081 0 -0.060263486 0.22614876 + 8800 1.6658931 -1.6751256 0 -0.025891437 0.027723314 + 8900 1.7989105 -1.7318497 0 0.049071648 0.27645866 + 9000 1.8242262 -1.6879124 0 0.11807158 0.21701732 + 9100 1.6795701 -1.6926952 0 -0.029920813 0.28702517 + 9200 1.8093352 -1.8430841 0 -0.051842329 0.04182244 + 9300 1.7654746 -1.7580453 0 -0.010225436 0.41460279 + 9400 1.9494599 -1.7162713 0 0.21369396 0.22445951 + 9500 1.8650839 -1.6517629 0 0.19467014 0.34042974 + 9600 1.8080088 -1.651068 0 0.13886064 0.38597156 + 9700 1.757349 -1.6397227 0 0.10005277 0.12075072 + 9800 1.8111959 -1.7155458 0 0.077538075 0.023545696 + 9900 1.7255423 -1.7364511 0 -0.02816423 0.24284116 + 10000 1.794001 -1.7545014 0 0.021559597 0.15092078 +Loop time of 0.461554 on 4 procs for 10000 steps with 100 atoms + +Performance: 9359693.727 tau/day, 21665.958 timesteps/s, 2.167 Matom-step/s +93.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.21335 | 0.24947 | 0.30554 | 7.2 | 54.05 +Neigh | 0.0016861 | 0.0018238 | 0.0019357 | 0.2 | 0.40 +Comm | 0.078727 | 0.14542 | 0.19247 | 10.9 | 31.51 +Output | 0.00086191 | 0.0026451 | 0.0079866 | 6.0 | 0.57 +Modify | 0.028228 | 0.029642 | 0.030811 | 0.5 | 6.42 +Other | | 0.03255 | | | 7.05 + +Nlocal: 25 ave 28 max 21 min +Histogram: 1 0 0 0 0 1 0 1 0 1 +Nghost: 47.5 ave 50 max 46 min +Histogram: 2 0 0 0 0 1 0 0 0 1 +Neighs: 117.25 ave 144 max 91 min +Histogram: 1 0 0 1 0 0 1 0 0 1 + +Total # of neighbors = 469 +Ave neighs/atom = 4.69 +Neighbor list builds = 494 +Dangerous builds = 0 +Total wall time: 0:00:00 diff --git a/examples/body/log.27Nov18.cubes.g++.1 b/examples/body/log.14Jun23.cubes.g++.1 similarity index 52% rename from examples/body/log.27Nov18.cubes.g++.1 rename to examples/body/log.14Jun23.cubes.g++.1 index 588f95f69d..4010d1013b 100644 --- a/examples/body/log.27Nov18.cubes.g++.1 +++ b/examples/body/log.14Jun23.cubes.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (28 Mar 2023 - Development) using 1 OpenMP thread(s) per MPI task # 3d rounded cubes @@ -11,20 +11,23 @@ dimension 3 atom_style body rounded/polyhedron 1 10 read_data data.cubes +Reading data file ... orthogonal box = (0 0 0) to (6 6 6) 1 by 1 by 1 MPI processor grid reading atoms ... 2 atoms 2 bodies + read_data CPU = 0.001 seconds replicate $r $r $r replicate 3 $r $r replicate 3 3 $r replicate 3 3 3 +Replication is creating a 3x3x3 = 27 times larger system... orthogonal box = (0 0 0) to (18 18 18) 1 by 1 by 1 MPI processor grid 54 atoms - Time spent = 0.000426769 secs + replicate CPU = 0.001 seconds velocity all create 1.2 187287 dist gaussian mom yes rot yes @@ -71,56 +74,57 @@ thermo 1000 run ${steps} run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 0 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 3.9641 - ghost atom cutoff = 3.9641 - binsize = 1.98205, bins = 10 10 10 + master list distance cutoff = 3.9641016 + ghost atom cutoff = 3.9641016 + binsize = 1.9820508, bins = 10 10 10 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair body/rounded/polyhedron, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.953 | 4.953 | 4.953 Mbytes -Step KinEng PotEng TotEng c_p2 c_1_temp - 0 1.7666667 0 1.7666667 0.01090535 0.59439252 - 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 - 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 - 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 - 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 - 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 - 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 - 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 - 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 - 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 - 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 -Loop time of 51.5779 on 1 procs for 10000 steps with 54 atoms +Per MPI rank memory allocation (min/avg/max) = 5.973 | 5.973 | 5.973 Mbytes + Step KinEng PotEng TotEng c_p2 c_1_temp + 0 1.7666667 0 1.7666667 0.01090535 0.59439252 + 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 + 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 + 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 + 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 + 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 + 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 + 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 + 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 + 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 + 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 +Loop time of 33.0201 on 1 procs for 10000 steps with 54 atoms -Performance: 16751.376 tau/day, 193.882 timesteps/s +Performance: 26165.890 tau/day, 302.846 timesteps/s, 16.354 katom-step/s 99.8% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 51.377 | 51.377 | 51.377 | 0.0 | 99.61 -Neigh | 0.0063686 | 0.0063686 | 0.0063686 | 0.0 | 0.01 -Comm | 0.072127 | 0.072127 | 0.072127 | 0.0 | 0.14 -Output | 0.0002768 | 0.0002768 | 0.0002768 | 0.0 | 0.00 -Modify | 0.10849 | 0.10849 | 0.10849 | 0.0 | 0.21 -Other | | 0.01404 | | | 0.03 +Pair | 32.897 | 32.897 | 32.897 | 0.0 | 99.63 +Neigh | 0.0028124 | 0.0028124 | 0.0028124 | 0.0 | 0.01 +Comm | 0.034404 | 0.034404 | 0.034404 | 0.0 | 0.10 +Output | 0.00017643 | 0.00017643 | 0.00017643 | 0.0 | 0.00 +Modify | 0.078202 | 0.078202 | 0.078202 | 0.0 | 0.24 +Other | | 0.00767 | | | 0.02 -Nlocal: 54 ave 54 max 54 min +Nlocal: 54 ave 54 max 54 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 96 ave 96 max 96 min +Nghost: 96 ave 96 max 96 min Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 100 ave 100 max 100 min +Neighs: 100 ave 100 max 100 min Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 100 -Ave neighs/atom = 1.85185 +Ave neighs/atom = 1.8518519 Neighbor list builds = 268 Dangerous builds = 0 -Total wall time: 0:00:51 +Total wall time: 0:00:33 diff --git a/examples/body/log.27Nov18.cubes.g++.4 b/examples/body/log.14Jun23.cubes.g++.4 similarity index 50% rename from examples/body/log.27Nov18.cubes.g++.4 rename to examples/body/log.14Jun23.cubes.g++.4 index f10a4c8a0a..1439af95a0 100644 --- a/examples/body/log.27Nov18.cubes.g++.4 +++ b/examples/body/log.14Jun23.cubes.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (27 Nov 2018) +LAMMPS (28 Mar 2023 - Development) using 1 OpenMP thread(s) per MPI task # 3d rounded cubes @@ -11,20 +11,23 @@ dimension 3 atom_style body rounded/polyhedron 1 10 read_data data.cubes +Reading data file ... orthogonal box = (0 0 0) to (6 6 6) 1 by 2 by 2 MPI processor grid reading atoms ... 2 atoms 2 bodies + read_data CPU = 0.001 seconds replicate $r $r $r replicate 3 $r $r replicate 3 3 $r replicate 3 3 3 +Replication is creating a 3x3x3 = 27 times larger system... orthogonal box = (0 0 0) to (18 18 18) 1 by 2 by 2 MPI processor grid 54 atoms - Time spent = 0.000776052 secs + replicate CPU = 0.001 seconds velocity all create 1.2 187287 dist gaussian mom yes rot yes @@ -71,56 +74,57 @@ thermo 1000 run ${steps} run 10000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Neighbor list info ... - update every 1 steps, delay 0 steps, check yes + update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 3.9641 - ghost atom cutoff = 3.9641 - binsize = 1.98205, bins = 10 10 10 + master list distance cutoff = 3.9641016 + ghost atom cutoff = 3.9641016 + binsize = 1.9820508, bins = 10 10 10 1 neighbor lists, perpetual/occasional/extra = 1 0 0 (1) pair body/rounded/polyhedron, perpetual attributes: half, newton on pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton + stencil: half/bin/3d bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.879 | 5.068 | 5.256 Mbytes -Step KinEng PotEng TotEng c_p2 c_1_temp - 0 1.7666667 0 1.7666667 0.01090535 0.59439252 - 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 - 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 - 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 - 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 - 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 - 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 - 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 - 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 - 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 - 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 -Loop time of 25.5798 on 4 procs for 10000 steps with 54 atoms +Per MPI rank memory allocation (min/avg/max) = 5.901 | 5.902 | 5.904 Mbytes + Step KinEng PotEng TotEng c_p2 c_1_temp + 0 1.7666667 0 1.7666667 0.01090535 0.59439252 + 1000 3.1462962 0.17392649 3.3202227 0.02361912 1.1654694 + 2000 2.9311648 0.13836102 3.0695258 0.021748224 1.1950624 + 3000 3.090491 0.16511199 3.255603 0.018691142 1.23672 + 4000 2.7401565 0.17792155 2.9180781 0.015093853 1.1180839 + 5000 3.0880849 0.17587085 3.2639557 0.030563042 1.2831154 + 6000 3.2180776 0.19732251 3.4154001 0.028338151 1.258839 + 7000 2.9514882 0.25088882 3.202377 0.025296925 1.1746326 + 8000 3.0101226 0.28825968 3.2983823 0.027273454 1.2138056 + 9000 3.0164253 0.1901733 3.2065986 0.033228915 1.3095914 + 10000 2.3780401 0.34082434 2.7188644 0.031838531 1.0208679 +Loop time of 16.4904 on 4 procs for 10000 steps with 54 atoms -Performance: 33776.718 tau/day, 390.934 timesteps/s -97.1% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 52394.037 tau/day, 606.412 timesteps/s, 32.746 katom-step/s +95.4% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 9.256 | 13.423 | 24.653 | 177.1 | 52.47 -Neigh | 0.0021949 | 0.0024942 | 0.0031152 | 0.7 | 0.01 -Comm | 0.73678 | 11.948 | 16.096 | 187.4 | 46.71 -Output | 0.00023246 | 0.00041932 | 0.0009768 | 0.0 | 0.00 -Modify | 0.12505 | 0.15661 | 0.18165 | 6.0 | 0.61 -Other | | 0.04968 | | | 0.19 +Pair | 5.8583 | 8.5985 | 15.966 | 145.2 | 52.14 +Neigh | 0.00098311 | 0.0011219 | 0.0014163 | 0.5 | 0.01 +Comm | 0.39088 | 7.7607 | 10.504 | 152.9 | 47.06 +Output | 0.00016175 | 0.00044056 | 0.0012766 | 0.0 | 0.00 +Modify | 0.084729 | 0.094756 | 0.10558 | 2.8 | 0.57 +Other | | 0.0349 | | | 0.21 -Nlocal: 13.5 ave 17 max 9 min +Nlocal: 13.5 ave 17 max 9 min Histogram: 1 0 0 1 0 0 0 0 1 1 -Nghost: 63.5 ave 68 max 58 min +Nghost: 63.5 ave 68 max 58 min Histogram: 1 0 0 1 0 0 0 0 0 2 -Neighs: 25 ave 38 max 6 min +Neighs: 25 ave 38 max 6 min Histogram: 1 0 0 0 0 1 0 0 1 1 Total # of neighbors = 100 -Ave neighs/atom = 1.85185 +Ave neighs/atom = 1.8518519 Neighbor list builds = 268 Dangerous builds = 0 -Total wall time: 0:00:25 +Total wall time: 0:00:16 diff --git a/examples/body/log.14Jun23.pour3d.g++.1 b/examples/body/log.14Jun23.pour3d.g++.1 new file mode 100644 index 0000000000..3bca25ee6b --- /dev/null +++ b/examples/body/log.14Jun23.pour3d.g++.1 @@ -0,0 +1,148 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# pouring 3d rounded polyhedron bodies + +variable steps index 6000 + +units lj +boundary p p fm +comm_modify vel yes + +atom_style body rounded/polyhedron 1 8 +atom_modify map array + +region reg block 0 50 0 50 0 50 units box +create_box 4 reg +Created orthogonal box = (0 0 0) to (50 50 50) + 1 by 1 by 1 MPI processor grid + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 5 +variable c_n equal 20 +variable c_t equal 5 +variable mu equal 0 +variable A_ua equal 1 + +pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 5 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +fix 1 all nve/body +fix 2 all gravity 1.0 spherical 0.0 -180.0 + +molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 1 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 2 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 3 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 4 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +region slab block 5 45 5 45 25 35 units box +fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 +Particle insertion: 134 every 4472 steps, 500 by step 13417 + +fix 4 all wall/body/polyhedron 2000 50 50 zplane 0.0 NULL + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 1000 dump.polyhedron index c_1[1] c_1[2] c_1[3] c_1[4] +#dump 10 all custom 1000 tmp.dump id type x y z radius + +thermo_style custom step atoms ke pe etotal press + +thermo 1000 + +#dump 2 all image 500 image.*.jpg type type # zoom 1.5 adiam 1.5 body type 0 0 view 75 15 +#dump_modify 2 pad 6 + +run ${steps} +run 6000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 20 20 20 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polyhedron, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.508 | 0.508 | 0.508 Mbytes + Step Atoms KinEng PotEng TotEng Press + 0 0 -0 0 0 0 + 1000 134 -0 0.0038737172 0.0038737172 -3.395325e-06 + 2000 134 -0 -0.0009235483 -0.0009235483 -6.5977025e-07 + 3000 134 -0 0.004338364 0.004338364 -1.4565607e-05 + 4000 134 -0 0.0028464278 0.0028464278 -7.6723299e-06 + 5000 268 -0 0.017425002 0.017425002 0.000175191 + 6000 268 -0 0.035730061 0.035730061 0.00019697961 +Loop time of 0.432886 on 1 procs for 6000 steps with 268 atoms + +Performance: 1197543.331 tau/day, 13860.455 timesteps/s, 3.715 Matom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.29261 | 0.29261 | 0.29261 | 0.0 | 67.59 +Neigh | 0.0040123 | 0.0040123 | 0.0040123 | 0.0 | 0.93 +Comm | 0.0019937 | 0.0019937 | 0.0019937 | 0.0 | 0.46 +Output | 5.8179e-05 | 5.8179e-05 | 5.8179e-05 | 0.0 | 0.01 +Modify | 0.12864 | 0.12864 | 0.12864 | 0.0 | 29.72 +Other | | 0.005574 | | | 1.29 + +Nlocal: 268 ave 268 max 268 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 2 ave 2 max 2 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 95 ave 95 max 95 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 95 +Ave neighs/atom = 0.35447761 +Neighbor list builds = 167 +Dangerous builds = 0 + + +Total wall time: 0:00:00 diff --git a/examples/body/log.14Jun23.pour3d.g++.4 b/examples/body/log.14Jun23.pour3d.g++.4 new file mode 100644 index 0000000000..5a8206b95a --- /dev/null +++ b/examples/body/log.14Jun23.pour3d.g++.4 @@ -0,0 +1,148 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# pouring 3d rounded polyhedron bodies + +variable steps index 6000 + +units lj +boundary p p fm +comm_modify vel yes + +atom_style body rounded/polyhedron 1 8 +atom_modify map array + +region reg block 0 50 0 50 0 50 units box +create_box 4 reg +Created orthogonal box = (0 0 0) to (50 50 50) + 1 by 2 by 2 MPI processor grid + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 5 +variable c_n equal 20 +variable c_t equal 5 +variable mu equal 0 +variable A_ua equal 1 + +pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} +pair_style body/rounded/polyhedron 20 5 0 1 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 5 + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +fix 1 all nve/body +fix 2 all gravity 1.0 spherical 0.0 -180.0 + +molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 1 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 2 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 3 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +Read molecule template object: + 1 molecules + 0 fragments + 1 atoms with max type 4 + 0 bonds with max type 0 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +region slab block 5 45 5 45 25 35 units box +fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 +Particle insertion: 134 every 4472 steps, 500 by step 13417 + +fix 4 all wall/body/polyhedron 2000 50 50 zplane 0.0 NULL + +#compute 1 all body/local type 1 2 3 +#dump 1 all local 1000 dump.polyhedron index c_1[1] c_1[2] c_1[3] c_1[4] +#dump 10 all custom 1000 tmp.dump id type x y z radius + +thermo_style custom step atoms ke pe etotal press + +thermo 1000 + +#dump 2 all image 500 image.*.jpg type type # zoom 1.5 adiam 1.5 body type 0 0 view 75 15 +#dump_modify 2 pad 6 + +run ${steps} +run 6000 +Generated 0 of 6 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 20 20 20 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polyhedron, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 0.4666 | 0.4666 | 0.4666 Mbytes + Step Atoms KinEng PotEng TotEng Press + 0 0 -0 0 0 0 + 1000 134 -0 0.0038737172 0.0038737172 -3.395325e-06 + 2000 134 -0 -0.0009235483 -0.0009235483 -6.5977025e-07 + 3000 134 -0 0.004338364 0.004338364 -1.4565607e-05 + 4000 134 -0 0.0028464278 0.0028464278 -7.6723299e-06 + 5000 268 -0 0.017425002 0.017425002 0.000175191 + 6000 268 -0 0.035730061 0.035730061 0.00019697961 +Loop time of 0.266391 on 4 procs for 6000 steps with 268 atoms + +Performance: 1946012.521 tau/day, 22523.293 timesteps/s, 6.036 Matom-step/s +92.6% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.024599 | 0.072944 | 0.14627 | 18.6 | 27.38 +Neigh | 0.0011942 | 0.0013474 | 0.0014323 | 0.3 | 0.51 +Comm | 0.047438 | 0.11992 | 0.17106 | 14.8 | 45.02 +Output | 7.6297e-05 | 0.00017637 | 0.00044875 | 0.0 | 0.07 +Modify | 0.029377 | 0.035972 | 0.040396 | 2.4 | 13.50 +Other | | 0.03603 | | | 13.52 + +Nlocal: 67 ave 89 max 43 min +Histogram: 1 1 0 0 0 0 0 0 1 1 +Nghost: 38 ave 53 max 25 min +Histogram: 1 1 0 0 0 0 0 1 0 1 +Neighs: 23.75 ave 42 max 7 min +Histogram: 1 0 1 0 0 0 0 1 0 1 + +Total # of neighbors = 95 +Ave neighs/atom = 0.35447761 +Neighbor list builds = 167 +Dangerous builds = 0 + + +Total wall time: 0:00:00 diff --git a/examples/body/log.14Jun23.squares.g++.1 b/examples/body/log.14Jun23.squares.g++.1 new file mode 100644 index 0000000000..4588481dc6 --- /dev/null +++ b/examples/body/log.14Jun23.squares.g++.1 @@ -0,0 +1,226 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 1 by 1 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 1 +variable c_t equal 1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 + +fix 2 all enforce2d + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.386 | 5.386 | 5.386 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.39720235 0.0015845731 0.39878692 0.00223489 + 2000 0.42893425 0.011718891 0.44065314 0.0027413224 + 3000 0.57823511 0.012407489 0.5906426 0.0025306081 + 4000 0.71610647 0.028149437 0.74425591 0.0016504948 + 5000 0.84027279 0.018917017 0.8591898 0.0037451875 + 6000 0.72410001 0.073495378 0.79759539 0.00018672875 + 7000 0.53886484 0.077723366 0.61658821 0.004729216 + 8000 0.66196054 0.05502242 0.71698296 0.0054997323 + 9000 0.93104065 0.071628784 1.0026694 0.011330629 + 10000 0.75494389 0.15204106 0.90698495 0.021702117 + 11000 0.72349154 0.11102332 0.83451486 0.019264158 + 12000 0.56216531 0.117059 0.67922431 -0.028295891 + 13000 0.63793498 0.11701868 0.75495366 0.029470631 + 14000 0.62996509 0.020871971 0.65083706 0.0086224023 + 15000 0.6403927 0.0091092209 0.64950192 0.016897685 + 16000 0.70288045 0.046856749 0.7497372 0.02312871 + 17000 0.6820593 0.038994474 0.72105377 0.0068705173 + 18000 0.75623543 0.0069908315 0.76322626 0.025170959 + 19000 0.85962145 0.059005169 0.91862661 0.012725758 + 20000 0.73334823 0.033043489 0.76639172 0.023661433 + 21000 0.60850654 0.081277767 0.68978431 0.021031136 + 22000 0.38251144 0.27624263 0.65875407 0.047336318 + 23000 0.4288127 0.30632792 0.73514062 0.034108416 + 24000 0.4452138 0.13179024 0.57700404 0.010303821 + 25000 0.48091107 0.1816109 0.66252197 0.021201342 + 26000 0.67970784 0.088616708 0.76832455 0.034997245 + 27000 0.8223642 0.08699442 0.90935862 0.023508839 + 28000 0.60062179 0.1119578 0.71257959 -0.0010008016 + 29000 0.54629437 0.1202995 0.66659387 0.040613547 + 30000 0.28102412 0.38657163 0.66759575 -0.0086538064 + 31000 0.12433474 0.18824131 0.31257605 0.049899211 + 32000 0.089510322 0.20890679 0.29841711 0.045555094 + 33000 0.12657665 0.17720119 0.30377784 0.028306214 + 34000 0.18400652 0.17677189 0.36077841 0.034628531 + 35000 0.24048631 0.11010844 0.35059475 0.029848365 + 36000 0.33435006 0.077341882 0.41169194 0.055963098 + 37000 0.46088842 0.1210638 0.58195222 0.072006022 + 38000 0.76551752 0.07037755 0.83589507 0.018204686 + 39000 0.89388464 0.080990198 0.97487484 0.038361105 + 40000 0.65618718 0.078644754 0.73483193 0.040567246 + 41000 0.47284043 0.16391389 0.63675432 0.027523843 + 42000 0.52454668 0.057988616 0.58253529 0.03122996 + 43000 0.78769394 0.08405077 0.87174471 0.044743697 + 44000 0.92932837 0.093922981 1.0232514 0.042510479 + 45000 0.5722596 0.17607834 0.74833794 0.034646914 + 46000 0.54352389 0.085652886 0.62917677 0.033203865 + 47000 0.45608912 0.25183842 0.70792754 0.08370224 + 48000 0.47530886 0.10106466 0.57637352 0.046113986 + 49000 0.67945305 0.0065249477 0.68597799 0.054743491 + 50000 0.49661922 0.097381596 0.59400082 0.006998965 + 51000 0.60992235 0.059017331 0.66893968 0.09445106 + 52000 0.69563455 0.18702969 0.88266424 0.034154598 + 53000 0.87598532 0.18260917 1.0585945 0.065734536 + 54000 0.58822846 0.27562038 0.86384884 0.0764045 + 55000 0.43454899 0.17174441 0.6062934 0.026434052 + 56000 0.4004495 0.12778644 0.52823594 0.065986005 + 57000 0.36272102 0.09849578 0.4612168 0.064217596 + 58000 0.40987214 0.21777618 0.62764832 0.058625636 + 59000 0.64813089 0.1479689 0.79609979 0.033378701 + 60000 0.90328265 0.11049926 1.0137819 0.055828397 + 61000 0.82921839 0.074638688 0.90385707 0.062488824 + 62000 0.63223087 0.094386302 0.72661718 0.054784559 + 63000 0.62946839 0.087807829 0.71727622 0.058398323 + 64000 0.79784108 0.094756776 0.89259786 0.065765914 + 65000 0.87500942 0.13514078 1.0101502 0.068123475 + 66000 0.66961949 0.19942965 0.86904914 0.065587832 + 67000 0.61612396 0.11436282 0.73048678 0.061233427 + 68000 0.74149449 0.03129016 0.77278465 0.072517897 + 69000 0.84060202 0.027261803 0.86786382 0.063374451 + 70000 0.78182528 0.023528774 0.80535405 0.07431822 + 71000 0.71611101 0.023512727 0.73962374 0.069575276 + 72000 0.68437263 0.023941199 0.70831382 0.069821154 + 73000 0.75652323 0.023580324 0.78010355 0.075046425 + 74000 0.92077658 0.023272419 0.944049 0.070992373 + 75000 0.75277766 0.023186631 0.77596429 0.074859227 + 76000 0.59333539 0.024276648 0.61761204 0.076132037 + 77000 0.68243436 0.024600726 0.70703508 0.075525977 + 78000 0.79699751 0.024238959 0.82123647 0.078255526 + 79000 0.77318109 0.024249895 0.79743099 0.078223339 + 80000 0.72004911 0.024522473 0.74457159 0.079009398 + 81000 0.71732947 0.024702988 0.74203245 0.080902007 + 82000 0.73395391 0.024817681 0.75877159 0.081203115 + 83000 0.74389794 0.02487774 0.76877568 0.082273058 + 84000 0.73219737 0.024967311 0.75716468 0.08359401 + 85000 0.66523255 0.025299293 0.69053184 0.084260931 + 86000 0.67031201 0.02564609 0.6959581 0.085495986 + 87000 0.81345283 0.025297963 0.8387508 0.086292085 + 88000 0.85008513 0.024879647 0.87496478 0.087116741 + 89000 0.62893149 0.025674927 0.65460642 0.088514693 + 90000 0.58336052 0.026632218 0.60999274 0.089459637 + 91000 0.72615388 0.026181899 0.75233578 0.090289473 + 92000 0.76593408 0.025893082 0.79182717 0.091294308 + 93000 0.73475998 0.026113022 0.76087301 0.092256366 + 94000 0.68995562 0.026409704 0.71636532 0.093332419 + 95000 0.69491284 0.026726159 0.721639 0.094314615 + 96000 0.83274635 0.026420125 0.85916648 0.09513317 + 97000 0.85486073 0.025941089 0.88080181 0.096122793 + 98000 0.63095894 0.027021709 0.65798064 0.097348373 + 99000 0.60847495 0.027908563 0.63638351 0.098362493 + 100000 0.75867487 0.027331375 0.78600625 0.099184572 +Loop time of 3.87848 on 1 procs for 100000 steps with 32 atoms + +Performance: 2227674.150 tau/day, 25783.266 timesteps/s, 825.065 katom-step/s +97.7% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 2.9048 | 2.9048 | 2.9048 | 0.0 | 74.90 +Neigh | 0.0027304 | 0.0027304 | 0.0027304 | 0.0 | 0.07 +Comm | 0.071653 | 0.071653 | 0.071653 | 0.0 | 1.85 +Output | 0.00069287 | 0.00069287 | 0.00069287 | 0.0 | 0.02 +Modify | 0.85771 | 0.85771 | 0.85771 | 0.0 | 22.11 +Other | | 0.04088 | | | 1.05 + +Nlocal: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 57 ave 57 max 57 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 57 +Ave neighs/atom = 1.78125 +Neighbor list builds = 1379 +Dangerous builds = 0 +Total wall time: 0:00:03 diff --git a/examples/body/log.14Jun23.squares.g++.4 b/examples/body/log.14Jun23.squares.g++.4 new file mode 100644 index 0000000000..51f1a0c7e9 --- /dev/null +++ b/examples/body/log.14Jun23.squares.g++.4 @@ -0,0 +1,226 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 2 by 2 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 1 +variable c_t equal 1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 + +fix 2 all enforce2d + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.379 | 5.379 | 5.379 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.39720235 0.0015845731 0.39878692 0.00223489 + 2000 0.42893425 0.011718891 0.44065314 0.0027413224 + 3000 0.57823511 0.012407489 0.5906426 0.0025306081 + 4000 0.71610647 0.028149437 0.74425591 0.0016504948 + 5000 0.84027279 0.018917017 0.8591898 0.0037451875 + 6000 0.72410001 0.073495378 0.79759539 0.00018672875 + 7000 0.53886484 0.077723366 0.61658821 0.004729216 + 8000 0.66196054 0.05502242 0.71698296 0.0054997327 + 9000 0.93104065 0.071628784 1.0026694 0.011330629 + 10000 0.75494389 0.15204106 0.90698496 0.021702127 + 11000 0.72349155 0.11102332 0.83451487 0.019264192 + 12000 0.56216536 0.11705898 0.67922434 -0.028296196 + 13000 0.63793556 0.11701866 0.75495421 0.029469295 + 14000 0.62999448 0.020866813 0.65086129 0.008609569 + 15000 0.6404504 0.0090011224 0.64945152 0.01706906 + 16000 0.70195749 0.044735201 0.74669269 0.0179597 + 17000 0.69097976 0.03894214 0.72992191 0.015704476 + 18000 0.75303457 0.0019263825 0.75496095 0.021536711 + 19000 0.6459718 0.10419136 0.75016317 0.033861092 + 20000 0.73026363 0.13023974 0.86050337 0.022207497 + 21000 0.77107035 0.30464112 1.0757115 0.013967631 + 22000 0.44134768 0.22883887 0.67018655 0.014202518 + 23000 0.53410601 0.16702381 0.70112983 0.009305779 + 24000 0.5144312 0.19041122 0.70484242 -0.0059836303 + 25000 0.60922681 0.15475207 0.76397888 0.016370526 + 26000 0.70922367 0.25374443 0.9629681 0.027301754 + 27000 0.67289133 0.39287626 1.0657676 0.025562031 + 28000 0.62112601 0.017177715 0.63830372 0.018556767 + 29000 0.56492546 0.087573524 0.65249898 0.025132036 + 30000 0.62612507 -0.01835118 0.60777389 0.050139664 + 31000 0.69157641 0.064849873 0.75642628 0.033954585 + 32000 0.72648211 0.08597545 0.81245756 0.038082388 + 33000 0.58608821 0.13013111 0.71621932 0.054766043 + 34000 0.49330983 0.080490598 0.57380043 0.034154681 + 35000 0.54570666 0.075020466 0.62072713 0.03879264 + 36000 0.60305736 0.10717781 0.71023516 0.030701059 + 37000 0.52801767 0.12516316 0.65318083 0.007411688 + 38000 0.5838277 0.12569072 0.70951842 0.03272916 + 39000 0.53999819 0.043261294 0.58325949 0.084115917 + 40000 0.64957099 0.040023268 0.68959426 0.027021958 + 41000 0.59235949 0.10449793 0.69685742 0.045773377 + 42000 0.71752786 0.043289363 0.76081722 0.040926021 + 43000 0.78581005 0.024363927 0.81017398 0.034694164 + 44000 0.6396541 0.06004252 0.69969662 0.037227348 + 45000 0.35753293 0.11456039 0.47209332 0.033569048 + 46000 0.11031158 0.11831834 0.22862991 0.076545681 + 47000 0.11720754 0.035471414 0.15267896 0.022093929 + 48000 0.13370328 0.031802339 0.16550562 0.053298269 + 49000 0.2700883 0.15584422 0.42593252 0.057108168 + 50000 0.53837779 0.13398219 0.67235998 0.047704986 + 51000 0.38133073 0.011372933 0.39270366 0.04696367 + 52000 0.32448241 0.009137008 0.33361942 0.033573259 + 53000 0.25798301 -0.016530605 0.2414524 0.04623663 + 54000 0.2842707 0.054504088 0.33877479 0.03751156 + 55000 0.28895106 0.025307766 0.31425882 0.03935955 + 56000 0.19130753 0.099678989 0.29098652 0.051888728 + 57000 0.12237303 0.057536458 0.17990949 0.09984021 + 58000 0.17962003 0.012450682 0.19207072 0.028644351 + 59000 0.21667262 -0.013693164 0.20297945 0.048086277 + 60000 0.4298123 -0.012970819 0.41684148 0.019347498 + 61000 0.69591654 -0.027048452 0.66886809 0.069793861 + 62000 1.0040382 -0.044228622 0.95980957 0.056563167 + 63000 0.78189663 -0.053045577 0.72885106 0.059491526 + 64000 0.57051419 -0.050757181 0.51975701 0.061863162 + 65000 0.62584243 -0.050616328 0.5752261 0.068924362 + 66000 0.85558894 -0.051396155 0.80419278 0.059309337 + 67000 0.86314978 -0.052635701 0.81051408 0.071855924 + 68000 0.65427495 -0.05147951 0.60279544 0.064001735 + 69000 0.60658011 -0.050623824 0.55595629 0.0715805 + 70000 0.76353932 -0.050863795 0.71267553 0.06771349 + 71000 0.87559332 -0.051720153 0.82387317 0.071884106 + 72000 0.71924774 -0.051167456 0.66808029 0.071010747 + 73000 0.6100998 -0.050025233 0.56007457 0.073319802 + 74000 0.71838075 -0.049907287 0.66847346 0.07314982 + 75000 0.91863251 -0.051069435 0.86756308 0.07493433 + 76000 0.78459189 -0.050803207 0.73378868 0.075397431 + 77000 0.70827012 -0.049701237 0.65856888 0.076901086 + 78000 0.72333497 -0.04940986 0.67392511 0.077456938 + 79000 0.76543474 -0.049588137 0.7158466 0.078792278 + 80000 0.77759003 -0.049596899 0.72799313 0.079470668 + 81000 0.67474562 -0.048929658 0.62581596 0.080740407 + 82000 0.60162355 -0.047698966 0.55392459 0.081758686 + 83000 0.7602675 -0.047827179 0.71244032 0.082547083 + 84000 0.9061851 -0.049481366 0.85670374 0.083443845 + 85000 0.74071256 -0.048645397 0.69206717 0.084605474 + 86000 0.67634638 -0.046894309 0.62945207 0.085608904 + 87000 0.71669859 -0.046524067 0.67017453 0.086561551 + 88000 0.77025498 -0.047090994 0.72316398 0.087515495 + 89000 0.76590655 -0.047083362 0.71882319 0.088522842 + 90000 0.61372503 -0.045529779 0.56819526 0.08963777 + 91000 0.58583927 -0.043777544 0.54206173 0.093090208 + 92000 0.80507421 -0.04423346 0.76084075 0.093861418 + 93000 0.84631942 -0.046878171 0.79944125 0.093279847 + 94000 0.70915593 -0.04570489 0.66345104 0.092425564 + 95000 0.66813988 -0.043460537 0.62467934 0.093467021 + 96000 0.71739316 -0.042402374 0.67499079 0.095183179 + 97000 0.74132854 -0.042457291 0.69887124 0.096665917 + 98000 0.74033914 -0.042269007 0.69807013 0.097869908 + 99000 0.72447372 -0.041519159 0.68295457 0.098825459 + 100000 0.6968193 -0.040321034 0.65649827 0.099797629 +Loop time of 2.55809 on 4 procs for 100000 steps with 32 atoms + +Performance: 3377521.712 tau/day, 39091.686 timesteps/s, 1.251 Matom-step/s +91.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.53547 | 0.78258 | 1.0169 | 21.0 | 30.59 +Neigh | 0.0010868 | 0.0011973 | 0.0013608 | 0.3 | 0.05 +Comm | 0.57019 | 0.78963 | 1.0091 | 19.2 | 30.87 +Output | 0.00075581 | 0.0030547 | 0.0098741 | 7.1 | 0.12 +Modify | 0.80723 | 0.81855 | 0.83849 | 1.3 | 32.00 +Other | | 0.1631 | | | 6.37 + +Nlocal: 8 ave 12 max 2 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Nghost: 15.25 ave 19 max 13 min +Histogram: 1 1 0 1 0 0 0 0 0 1 +Neighs: 12 ave 18 max 1 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 48 +Ave neighs/atom = 1.5 +Neighbor list builds = 1420 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.14Jun23.wall2d.g++.1 b/examples/body/log.14Jun23.wall2d.g++.1 new file mode 100644 index 0000000000..dd54f37c03 --- /dev/null +++ b/examples/body/log.14Jun23.wall2d.g++.1 @@ -0,0 +1,229 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 1 by 1 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +change_box all boundary p f p +Changing box ... + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 0.1 +variable c_t equal 0.1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 + +fix 2 all enforce2d +fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.376 | 5.376 | 5.376 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.51464289 0.00099012638 0.51563301 0.013444625 + 2000 0.55653313 0.0040982283 0.56063136 0.0034505512 + 3000 0.75323998 0.023578898 0.77681887 0.0036652891 + 4000 0.70044978 0.092406287 0.79285607 0.0089262842 + 5000 0.54548803 0.096501313 0.64198934 0.0051379523 + 6000 0.48208829 0.097798861 0.57988715 0.015298049 + 7000 0.68219182 0.038843941 0.72103576 0.016842202 + 8000 0.53792445 0.012983807 0.55090825 0.0066797902 + 9000 0.49980359 0.029397948 0.52920154 0.0046731993 + 10000 0.48705779 0.10138799 0.58844578 -1.9696743e-05 + 11000 0.52151792 0.065893508 0.58741142 0.0049365175 + 12000 0.59066419 0.039261015 0.62992521 0.001420608 + 13000 0.46059009 0.07386532 0.53445541 0.005654565 + 14000 0.37899234 0.13421331 0.51320565 0.0097199047 + 15000 0.49566894 0.052006844 0.54767578 0.00053157628 + 16000 0.59294062 0.028393451 0.62133407 0.0057809461 + 17000 0.51260882 0.1266054 0.63921422 0.0021637817 + 18000 0.45603179 0.15710959 0.61314138 0.017707488 + 19000 0.52137969 0.1123825 0.63376219 0.015894031 + 20000 0.64553686 0.11579772 0.76133459 0.013239309 + 21000 0.38581837 0.17867419 0.56449256 0.0048572535 + 22000 0.42776514 0.12979071 0.55755585 0.008093469 + 23000 0.490055 0.14197765 0.63203265 -0.003575896 + 24000 0.57689881 0.10164831 0.67854712 0.022418321 + 25000 0.45630031 0.057905852 0.51420616 0.007959034 + 26000 0.59497685 0.193113 0.78808985 0.0076331679 + 27000 0.40943362 0.098595954 0.50802958 0.0016863757 + 28000 0.34512273 0.15696637 0.50208909 0.037435926 + 29000 0.59187862 0.1845377 0.77641632 0.014563665 + 30000 0.69204623 0.16392147 0.8559677 0.031708423 + 31000 0.40436029 0.34429435 0.74865464 0.073818847 + 32000 0.47580383 0.22708448 0.70288831 0.015795198 + 33000 0.48923447 0.23636413 0.72559861 0.025932606 + 34000 0.51960128 0.15145893 0.67106021 -0.00079607564 + 35000 0.44792834 0.19927109 0.64719943 -0.0063461505 + 36000 0.54265821 0.17924788 0.72190609 0.017916439 + 37000 0.56020344 0.24977507 0.80997851 0.057844411 + 38000 0.28874871 0.21399353 0.50274224 0.022675277 + 39000 0.39030236 0.30170176 0.69200411 0.037482614 + 40000 0.4699469 0.20663643 0.67658333 -0.014082215 + 41000 0.50202447 0.21510708 0.71713155 -0.0063284222 + 42000 0.43029593 0.23511818 0.6654141 0.046478372 + 43000 0.41628842 0.21031596 0.62660438 -0.0053073644 + 44000 0.51101573 0.15862165 0.66963738 0.010251868 + 45000 0.56984114 0.18071709 0.75055823 0.021333409 + 46000 0.45510513 0.15385488 0.60896001 0.048441048 + 47000 0.41229547 0.20577222 0.61806769 0.027485704 + 48000 0.64114797 0.33672519 0.97787315 0.13522091 + 49000 0.44298056 0.27708867 0.72006923 0.026660315 + 50000 0.43250082 0.17778506 0.61028588 0.02714938 + 51000 0.59697891 0.25460003 0.85157894 0.026959715 + 52000 0.63110331 0.21528376 0.84638707 0.023157155 + 53000 0.46085491 0.25375607 0.71461099 0.024933391 + 54000 0.50772891 0.29280628 0.80053519 0.010621547 + 55000 0.67213557 0.2071375 0.87927307 0.061770903 + 56000 0.61184167 0.34686662 0.95870829 0.095262009 + 57000 0.42364554 0.29899934 0.72264488 -0.0080865129 + 58000 0.5033641 0.39810693 0.90147103 0.081474225 + 59000 0.61363438 0.25296035 0.86659472 0.041921315 + 60000 0.64600872 0.36997737 1.0159861 0.053833686 + 61000 0.43392277 0.29276613 0.7266889 0.054911225 + 62000 0.38910577 0.27714798 0.66625375 -0.0141031 + 63000 0.42343097 0.21637816 0.63980913 -1.6862315e-05 + 64000 0.52512516 0.38797726 0.91310242 0.03170217 + 65000 0.48930994 0.4863269 0.97563684 0.025108671 + 66000 0.68354817 0.3629732 1.0465214 0.066714362 + 67000 0.5361863 0.44003399 0.97622029 0.1063525 + 68000 0.3605148 0.40138904 0.76190383 0.03287684 + 69000 0.62747502 0.49229352 1.1197685 0.053648724 + 70000 0.51326037 0.36561885 0.87887922 0.070871008 + 71000 0.45429341 0.38458357 0.83887698 0.010485881 + 72000 0.55377877 0.36434231 0.91812107 0.10507819 + 73000 0.6857324 0.45242968 1.1381621 0.022470322 + 74000 0.46349397 0.39082798 0.85432196 0.067650912 + 75000 0.59216869 0.32893138 0.92110008 0.0196582 + 76000 0.42985327 0.40674342 0.83659669 0.025700762 + 77000 0.54319568 0.55627833 1.099474 0.067233159 + 78000 0.59244798 0.5121155 1.1045635 0.12063624 + 79000 0.61140864 0.45505083 1.0664595 0.088578795 + 80000 0.64308346 0.4143502 1.0574337 0.038537249 + 81000 0.55053046 0.43357659 0.98410705 0.053930256 + 82000 0.54049882 0.41354335 0.95404217 -0.036458392 + 83000 0.47517728 0.30128468 0.77646196 0.0019488841 + 84000 0.57452781 0.1949493 0.76947711 0.039244382 + 85000 0.7907368 0.51406164 1.3047984 0.12766082 + 86000 0.59488507 0.50084726 1.0957323 0.080232158 + 87000 0.43071262 0.4682738 0.89898642 0.1266876 + 88000 0.53305256 0.55941308 1.0924656 0.17062068 + 89000 0.60672487 0.64951209 1.256237 0.17194524 + 90000 0.7134227 0.57323404 1.2866567 0.074617282 + 91000 0.65670871 0.58567381 1.2423825 0.025281565 + 92000 0.72364891 0.59755693 1.3212058 0.092201188 + 93000 0.69254418 0.75766186 1.450206 0.16036111 + 94000 0.56326058 0.6398442 1.2031048 0.26280736 + 95000 0.47480145 0.57734551 1.052147 0.039940021 + 96000 0.56909151 0.73081903 1.2999105 0.030223516 + 97000 0.53198039 0.71808155 1.2500619 0.033191485 + 98000 0.63572731 0.86931519 1.5050425 0.20901135 + 99000 0.64477038 0.76771721 1.4124876 0.059732095 + 100000 0.71275398 0.66613673 1.3788907 0.020038364 +Loop time of 2.21223 on 1 procs for 100000 steps with 32 atoms + +Performance: 3905566.671 tau/day, 45203.318 timesteps/s, 1.447 Matom-step/s +96.4% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.1162 | 1.1162 | 1.1162 | 0.0 | 50.45 +Neigh | 0.0049629 | 0.0049629 | 0.0049629 | 0.0 | 0.22 +Comm | 0.045069 | 0.045069 | 0.045069 | 0.0 | 2.04 +Output | 0.00060169 | 0.00060169 | 0.00060169 | 0.0 | 0.03 +Modify | 1.0017 | 1.0017 | 1.0017 | 0.0 | 45.28 +Other | | 0.04368 | | | 1.97 + +Nlocal: 32 ave 32 max 32 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 19 ave 19 max 19 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 59 ave 59 max 59 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 59 +Ave neighs/atom = 1.84375 +Neighbor list builds = 3214 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.14Jun23.wall2d.g++.4 b/examples/body/log.14Jun23.wall2d.g++.4 new file mode 100644 index 0000000000..0d0005c6ef --- /dev/null +++ b/examples/body/log.14Jun23.wall2d.g++.4 @@ -0,0 +1,229 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# 2d rounded polygon bodies + +variable r index 4 +variable steps index 100000 +variable T index 0.5 +variable P index 0.1 +variable seed index 980411 + +units lj +dimension 2 + +atom_style body rounded/polygon 1 6 +atom_modify map array +read_data data.squares +Reading data file ... + orthogonal box = (0 0 -0.5) to (12 12 0.5) + 2 by 2 by 1 MPI processor grid + reading atoms ... + 2 atoms + 2 bodies + read_data CPU = 0.001 seconds + +replicate $r $r 1 +replicate 4 $r 1 +replicate 4 4 1 +Replication is creating a 4x4x1 = 16 times larger system... + orthogonal box = (0 0 -0.5) to (48 48 0.5) + 2 by 2 by 1 MPI processor grid + 32 atoms + replicate CPU = 0.001 seconds + +velocity all create $T ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 ${seed} dist gaussian mom yes rot yes +velocity all create 0.5 980411 dist gaussian mom yes rot yes + +change_box all boundary p f p +Changing box ... + +variable cut_inner equal 0.5 +variable k_n equal 100 +variable k_na equal 2 +variable c_n equal 0.1 +variable c_t equal 0.1 +variable mu equal 0.1 +variable delta_ua equal 0.5 + +pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} +pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 +pair_coeff * * ${k_n} ${k_na} +pair_coeff * * 100 ${k_na} +pair_coeff * * 100 2 + +comm_modify vel yes + +neighbor 0.5 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.001 + +#fix 1 all nve/body +#fix 1 all nvt/body temp $T $T 1.0 +fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 +fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 + +fix 2 all enforce2d +fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 + +#compute 1 all body/local id 1 2 3 +#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] + +thermo_style custom step ke pe etotal press +thermo 1000 + +#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 +#dump_modify 2 pad 6 + +run ${steps} +run 100000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.1568542 + ghost atom cutoff = 6.1568542 + binsize = 3.0784271, bins = 16 16 1 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair body/rounded/polygon, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/2d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 5.378 | 5.378 | 5.379 Mbytes + Step KinEng PotEng TotEng Press + 0 0.484375 0.25 0.734375 0.0067274306 + 1000 0.51464289 0.00099012638 0.51563301 0.013444625 + 2000 0.55653313 0.0040982283 0.56063136 0.0034505512 + 3000 0.75323998 0.023578898 0.77681887 0.0036652891 + 4000 0.70044978 0.092406287 0.79285607 0.0089262842 + 5000 0.54548803 0.096501313 0.64198934 0.0051379522 + 6000 0.48208828 0.097798868 0.57988715 0.01529805 + 7000 0.68219182 0.038843949 0.72103577 0.016842202 + 8000 0.53792445 0.01298383 0.55090828 0.0066797984 + 9000 0.49980358 0.029397965 0.52920155 0.0046731992 + 10000 0.48705755 0.10138831 0.58844586 -1.9690665e-05 + 11000 0.52151879 0.065897951 0.58741674 0.0049324908 + 12000 0.59065198 0.03929683 0.62994881 0.0014198454 + 13000 0.46076897 0.073363984 0.53413295 0.0057849056 + 14000 0.38058168 0.16336914 0.54395082 0.0099910111 + 15000 0.58924494 0.13219579 0.72144074 0.012781632 + 16000 0.65163924 0.10979538 0.76143462 0.015088945 + 17000 0.51431594 0.036344433 0.55066037 0.001446035 + 18000 0.42677394 0.093297234 0.52007117 0.00093775852 + 19000 0.62399853 0.13309136 0.75708989 0.0095351169 + 20000 0.52835966 0.085936455 0.61429611 0.013158115 + 21000 0.42999051 0.12857394 0.55856445 0.024369485 + 22000 0.56770038 0.19738636 0.76508675 0.024211788 + 23000 0.55137392 0.18212359 0.7334975 0.024095463 + 24000 0.6225794 0.13091248 0.75349189 0.032707954 + 25000 0.47106345 0.10241626 0.57347971 0.0059731265 + 26000 0.60567231 0.055894222 0.66156653 0.010614697 + 27000 0.49075416 0.13914345 0.62989761 0.00048442735 + 28000 0.48902573 0.21423204 0.70325777 0.021295043 + 29000 0.42728391 0.24136135 0.66864527 0.031633766 + 30000 0.64658635 0.15368867 0.80027502 0.0084616839 + 31000 0.71370199 0.18014549 0.89384748 0.02367184 + 32000 0.40141173 0.1833294 0.58474113 0.034918949 + 33000 0.55780706 0.14130843 0.69911549 0.012266172 + 34000 0.36544303 0.15788143 0.52332446 0.0084938225 + 35000 0.56844142 0.17507842 0.74351984 0.061506713 + 36000 0.5048707 0.15834563 0.66321633 0.0286909 + 37000 0.4371274 0.087735559 0.52486296 -0.0016289252 + 38000 0.49941117 0.22576207 0.72517324 0.059233327 + 39000 0.69480051 0.15465372 0.84945423 0.039061293 + 40000 0.52881719 0.29110071 0.8199179 0.032439208 + 41000 0.56931201 0.38596881 0.95528082 0.045284803 + 42000 0.46759969 0.21337568 0.68097537 0.086759715 + 43000 0.63416318 0.44687151 1.0810347 0.072272415 + 44000 0.43914666 0.20832735 0.64747401 0.026280272 + 45000 0.38329718 0.25407815 0.63737533 0.017356403 + 46000 0.59511045 0.32148788 0.91659833 -0.0076184601 + 47000 0.50635988 0.37243112 0.878791 0.025435347 + 48000 0.42316224 0.29368731 0.71684954 0.00067040329 + 49000 0.40194259 0.26659105 0.66853364 0.069225504 + 50000 0.4740342 0.305674 0.77970819 0.014813566 + 51000 0.57279011 0.32080139 0.8935915 0.0091332017 + 52000 0.54543481 0.34482955 0.89026435 -0.021131696 + 53000 0.39241519 0.36432403 0.75673922 0.0077163816 + 54000 0.62021406 0.32010094 0.940315 0.044477965 + 55000 0.45160485 0.29442122 0.74602607 0.02563201 + 56000 0.41737028 0.31207675 0.72944704 0.050342936 + 57000 0.53454189 0.29192181 0.8264637 0.068452573 + 58000 0.65449932 0.33567481 0.99017413 0.055352019 + 59000 0.58742699 0.37317432 0.96060131 0.012805462 + 60000 0.42430458 0.33744246 0.76174704 0.018744436 + 61000 0.65433333 0.40723506 1.0615684 0.019757611 + 62000 0.64472397 0.34658649 0.99131047 0.090688735 + 63000 0.65381774 0.47452792 1.1283457 0.2090513 + 64000 0.44107995 0.60507044 1.0461504 0.03144844 + 65000 0.38159186 0.45527276 0.83686462 0.090856608 + 66000 0.48842595 0.49445721 0.98288316 0.08753844 + 67000 0.65088575 0.4611542 1.11204 0.066602605 + 68000 0.5155131 0.38693864 0.90245174 0.0062596909 + 69000 0.41477899 0.45120406 0.86598306 0.037396561 + 70000 0.60305022 0.47624271 1.0792929 0.040607751 + 71000 0.67077877 0.51044906 1.1812278 0.029084971 + 72000 0.50912034 0.34340114 0.85252148 0.055767674 + 73000 0.55167778 0.43795801 0.98963579 0.083371911 + 74000 0.53603549 0.37357862 0.90961411 0.058762722 + 75000 0.47521522 0.529749 1.0049642 0.12419171 + 76000 0.48952134 0.63953611 1.1290574 0.09709472 + 77000 0.63445283 0.57542295 1.2098758 0.11868116 + 78000 0.62184463 0.60025138 1.222096 0.079417229 + 79000 0.52715665 0.54847579 1.0756324 0.033981154 + 80000 0.6264593 0.39323366 1.019693 0.05627332 + 81000 0.78582235 0.47541992 1.2612423 0.031287815 + 82000 0.69665491 0.58355423 1.2802091 -0.04433392 + 83000 0.4994351 0.40089694 0.90033204 -0.0019687817 + 84000 0.50932093 0.62716285 1.1364838 0.095177695 + 85000 0.56251638 0.56010929 1.1226257 0.013989132 + 86000 0.67155822 0.51326814 1.1848264 0.10616402 + 87000 0.61317511 0.52704394 1.140219 0.076578899 + 88000 0.57436568 0.60641096 1.1807766 0.042050421 + 89000 0.62350614 0.65896923 1.2824754 0.15949038 + 90000 0.57445242 0.65085438 1.2253068 0.034123951 + 91000 0.50043488 0.69213026 1.1925651 -0.076403957 + 92000 0.57345231 0.74801993 1.3214722 0.033715387 + 93000 0.63056204 0.64474627 1.2753083 0.051205732 + 94000 0.70948937 0.61081243 1.3203018 -0.0069457836 + 95000 0.66048722 0.61001641 1.2705036 0.16072266 + 96000 0.48720026 0.64888522 1.1360855 0.12573765 + 97000 0.41570988 0.68810987 1.1038198 -0.033070846 + 98000 0.53689925 0.83787736 1.3747766 0.098173219 + 99000 0.5147061 0.92360546 1.4383116 0.12155736 + 100000 0.5793939 0.63393822 1.2133321 0.090967465 +Loop time of 2.08698 on 4 procs for 100000 steps with 32 atoms + +Performance: 4139957.491 tau/day, 47916.175 timesteps/s, 1.533 Matom-step/s +92.1% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.31 | 0.33594 | 0.35254 | 2.8 | 16.10 +Neigh | 0.001991 | 0.0021241 | 0.0022581 | 0.2 | 0.10 +Comm | 0.40717 | 0.43106 | 0.46731 | 3.4 | 20.65 +Output | 0.00076842 | 0.002908 | 0.0092082 | 6.7 | 0.14 +Modify | 1.1389 | 1.1624 | 1.1753 | 1.3 | 55.70 +Other | | 0.1525 | | | 7.31 + +Nlocal: 8 ave 9 max 7 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 14 ave 16 max 12 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 13.25 ave 17 max 11 min +Histogram: 1 1 0 1 0 0 0 0 0 1 + +Total # of neighbors = 53 +Ave neighs/atom = 1.65625 +Neighbor list builds = 3000 +Dangerous builds = 0 +Total wall time: 0:00:02 diff --git a/examples/body/log.27Nov18.body.g++.1 b/examples/body/log.27Nov18.body.g++.1 deleted file mode 100644 index adb2c5dd6f..0000000000 --- a/examples/body/log.27Nov18.body.g++.1 +++ /dev/null @@ -1,177 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d polygon nparticle bodies - -units lj -dimension 2 -atom_style body nparticle 2 6 - -read_data data.body - orthogonal box = (-15.5322 -15.5322 -0.5) to (15.5322 15.5322 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 100 atoms - 100 bodies - -velocity all create 1.44 87287 loop geom - -pair_style body/nparticle 5.0 -pair_coeff * * 1.0 1.0 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -fix 1 all nve/body -#fix 1 all nvt/body temp 1.44 1.44 1.0 -fix 2 all enforce2d - -#compute 1 all body/local type 1 2 3 -#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] - -#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 -#dump_modify 2 pad 5 - -thermo 100 -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.5 - ghost atom cutoff = 5.5 - binsize = 2.75, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/nparticle, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.772 | 4.772 | 4.772 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 1.44 -0.63799525 0 0.78760475 -0.15028724 - 100 1.642337 -1.0003869 0 0.62552682 0.16140818 - 200 1.470473 -1.2465469 0 0.20922135 0.35146925 - 300 1.4834687 -1.3464946 0 0.12213946 0.40783535 - 400 1.5075814 -1.6170041 0 -0.12449852 0.11302717 - 500 1.5681124 -1.6060641 0 -0.053632801 0.23819933 - 600 1.7129405 -1.6939468 0 0.0018642497 0.46490776 - 700 1.5803869 -1.6182998 0 -0.053716823 0.36807869 - 800 1.6454324 -1.6537709 0 -0.024792836 0.21305673 - 900 1.5454528 -1.6310447 0 -0.10104644 0.22323772 - 1000 1.7596217 -1.7290976 0 0.012927885 0.12600944 - 1100 1.3845533 -1.635035 0 -0.26432721 0.31778997 - 1200 1.6448321 -1.6985254 0 -0.070141617 0.14347958 - 1300 1.6158541 -1.581817 0 0.017878542 0.16186588 - 1400 1.4702758 -1.5210898 0 -0.065516797 0.35241206 - 1500 1.5746718 -1.5427933 0 0.016131764 0.21832857 - 1600 1.5276572 -1.6755951 0 -0.16321447 -0.046196207 - 1700 1.8182153 -1.7471337 0 0.052899504 0.14576284 - 1800 1.8054446 -1.8814075 0 -0.094017352 0.11678153 - 1900 1.6318148 -1.636557 0 -0.021060353 0.29300401 - 2000 1.6187604 -1.5563087 0 0.046264125 0.35910875 - 2100 1.8270056 -1.9189599 0 -0.11022441 -0.031374982 - 2200 1.8203075 -1.8672658 0 -0.065161309 0.38667462 - 2300 2.1336292 -1.8962621 0 0.2160309 0.13286893 - 2400 1.79223 -1.7128682 0 0.061439536 0.30570635 - 2500 1.7208941 -1.6955053 0 0.0081798834 0.24562038 - 2600 1.7755824 -1.7744614 0 -0.016634836 0.11148721 - 2700 1.7308273 -1.744062 0 -0.030542972 0.17938105 - 2800 1.7059134 -1.6131603 0 0.075694024 0.06746694 - 2900 1.7152544 -1.665102 0 0.032999854 0.14918116 - 3000 1.7917767 -1.6654545 0 0.10840436 0.22990289 - 3100 1.7153899 -1.8140872 0 -0.11585128 0.1070804 - 3200 1.5704305 -1.5645642 0 -0.0098380461 0.30331339 - 3300 1.6707504 -1.6224865 0 0.03155641 0.21402203 - 3400 1.7390711 -1.6969145 0 0.024765924 0.25633302 - 3500 1.7601895 -1.7159833 0 0.026604288 0.10350991 - 3600 1.7796243 -1.6848496 0 0.076978483 0.24287746 - 3700 1.8883198 -1.7216992 0 0.14773748 0.071179538 - 3800 1.5757461 -1.6445584 0 -0.084569808 0.23580968 - 3900 1.5509957 -1.6221122 0 -0.086626425 0.2208604 - 4000 1.7403415 -1.6515882 0 0.071349901 0.171317 - 4100 1.6394046 -1.69549 0 -0.072479406 0.18077211 - 4200 1.788413 -1.6410039 0 0.12952501 0.41737981 - 4300 1.7211754 -1.6535323 0 0.050431306 0.1688929 - 4400 1.6034779 -1.7771275 0 -0.18968442 0.091947982 - 4500 1.5692666 -1.6176359 0 -0.064061965 0.31716418 - 4600 1.6454802 -1.5764942 0 0.052531194 0.021026463 - 4700 1.4715049 -1.582096 0 -0.12530612 0.17687943 - 4800 1.5615071 -1.6276031 0 -0.081711137 0.077798682 - 4900 1.6407636 -1.622773 0 0.0015829265 0.28751203 - 5000 1.6390013 -1.7257036 0 -0.10309236 0.35133795 - 5100 1.6540912 -1.7056399 0 -0.068089648 0.52254354 - 5200 1.6438013 -1.7568895 0 -0.12952624 0.16423828 - 5300 1.6791806 -1.756297 0 -0.093908192 0.3151943 - 5400 1.7527095 -1.729977 0 0.0052053655 0.29874227 - 5500 1.7604924 -1.6920395 0 0.050847912 0.2062502 - 5600 1.8225025 -1.6746221 0 0.12965535 0.29423091 - 5700 1.6896356 -1.6591445 0 0.013594822 0.41582329 - 5800 1.575776 -1.6605307 0 -0.10051246 0.17434812 - 5900 1.6893771 -1.6046258 0 0.067857462 0.188486 - 6000 1.6506959 -1.6295482 0 0.0046407782 0.18737656 - 6100 1.8137143 -1.6634096 0 0.13216758 0.22425414 - 6200 1.6337368 -1.6016206 0 0.015778794 0.17026591 - 6300 1.6232904 -1.7102709 0 -0.10321339 0.22621086 - 6400 1.8146767 -1.7354533 0 0.061076657 0.25907309 - 6500 1.5565608 -1.8652953 0 -0.32430015 0.096916202 - 6600 1.6366532 -1.65732 0 -0.037033272 0.30276466 - 6700 1.6612051 -1.6621545 0 -0.017561423 0.16685109 - 6800 1.5574268 -1.6082827 0 -0.066430166 0.37630931 - 6900 1.6556225 -1.6744213 0 -0.035355078 0.11599545 - 7000 1.5078585 -1.6049482 0 -0.11216833 0.37716682 - 7100 1.6147622 -1.7044793 0 -0.10586467 0.48915924 - 7200 1.8022216 -1.7117836 0 0.072415791 0.24007939 - 7300 1.6302834 -1.8522784 0 -0.23829784 0.19326557 - 7400 1.7108472 -1.8993043 0 -0.20556558 0.34554364 - 7500 1.8570536 -1.7135598 0 0.12492326 0.53728185 - 7600 1.7812105 -1.7239897 0 0.039408716 0.44348124 - 7700 1.8724942 -1.7871204 0 0.066648837 0.2529344 - 7800 1.8237412 -1.6467621 0 0.15874169 0.2354529 - 7900 1.7222899 -1.7254585 0 -0.02039155 0.13271481 - 8000 1.6839 -1.5913695 0 0.075691547 0.011932379 - 8100 1.599835 -1.672507 0 -0.088670351 0.11203274 - 8200 1.8369376 -1.7464532 0 0.072115105 0.21380276 - 8300 1.9603301 -1.9121791 0 0.02854768 0.18178367 - 8400 1.7903688 -1.8798475 0 -0.10738231 0.37173469 - 8500 1.687183 -1.760587 0 -0.090275846 0.23751647 - 8600 1.6515772 -1.7918091 0 -0.15674775 0.099895142 - 8700 1.7083909 -1.7297068 0 -0.038399775 0.57093506 - 8800 1.6150569 -1.6976608 0 -0.098754502 0.15348519 - 8900 1.5452011 -1.7517421 0 -0.22199306 0.22143091 - 9000 1.7498686 -1.8569695 0 -0.12459962 0.1989093 - 9100 1.6287336 -1.7505293 0 -0.13808305 0.23881397 - 9200 1.5431194 -1.6845999 0 -0.15691169 0.10646288 - 9300 1.4900229 -1.5671955 0 -0.092072887 0.31588548 - 9400 1.523362 -1.5531592 0 -0.045030785 0.21546483 - 9500 1.5783775 -1.65292 0 -0.090326215 0.25980559 - 9600 1.9192786 -1.9303222 0 -0.030236392 -0.0046632743 - 9700 1.747544 -1.7886479 0 -0.058579385 0.38543046 - 9800 1.6713187 -1.6842507 0 -0.029645137 0.17982115 - 9900 1.7707351 -1.6638268 0 0.089200949 0.2983883 - 10000 1.6466807 -1.592436 0 0.037777866 0.12761693 -Loop time of 1.76365 on 1 procs for 10000 steps with 100 atoms - -Performance: 2449465.017 tau/day, 5670.058 timesteps/s -98.9% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.5533 | 1.5533 | 1.5533 | 0.0 | 88.08 -Neigh | 0.01155 | 0.01155 | 0.01155 | 0.0 | 0.65 -Comm | 0.042146 | 0.042146 | 0.042146 | 0.0 | 2.39 -Output | 0.00089574 | 0.00089574 | 0.00089574 | 0.0 | 0.05 -Modify | 0.14124 | 0.14124 | 0.14124 | 0.0 | 8.01 -Other | | 0.01448 | | | 0.82 - -Nlocal: 100 ave 100 max 100 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 82 ave 82 max 82 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 467 ave 467 max 467 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 467 -Ave neighs/atom = 4.67 -Neighbor list builds = 468 -Dangerous builds = 0 -Total wall time: 0:00:01 diff --git a/examples/body/log.27Nov18.body.g++.4 b/examples/body/log.27Nov18.body.g++.4 deleted file mode 100644 index 24ed0a5436..0000000000 --- a/examples/body/log.27Nov18.body.g++.4 +++ /dev/null @@ -1,177 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d polygon nparticle bodies - -units lj -dimension 2 -atom_style body nparticle 2 6 - -read_data data.body - orthogonal box = (-15.5322 -15.5322 -0.5) to (15.5322 15.5322 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 100 atoms - 100 bodies - -velocity all create 1.44 87287 loop geom - -pair_style body/nparticle 5.0 -pair_coeff * * 1.0 1.0 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -fix 1 all nve/body -#fix 1 all nvt/body temp 1.44 1.44 1.0 -fix 2 all enforce2d - -#compute 1 all body/local type 1 2 3 -#dump 1 all local 100 dump.body index c_1[1] c_1[2] c_1[3] c_1[4] - -#dump 2 all image 1000 image.*.jpg type type # zoom 1.6 adiam 1.5 body type 1.0 0 -#dump_modify 2 pad 5 - -thermo 100 -run 10000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.5 - ghost atom cutoff = 5.5 - binsize = 2.75, bins = 12 12 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/nparticle, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.759 | 4.759 | 4.759 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 1.44 -0.63799525 0 0.78760475 -0.15028724 - 100 1.642337 -1.0003869 0 0.62552682 0.16140818 - 200 1.470473 -1.2465469 0 0.20922135 0.35146925 - 300 1.4834687 -1.3464946 0 0.12213946 0.40783535 - 400 1.5075814 -1.6170041 0 -0.12449852 0.11302717 - 500 1.5681124 -1.6060641 0 -0.053632801 0.23819933 - 600 1.7129405 -1.6939468 0 0.0018642497 0.46490776 - 700 1.5803869 -1.6182998 0 -0.053716823 0.36807869 - 800 1.6454324 -1.6537709 0 -0.024792836 0.21305673 - 900 1.5454528 -1.6310447 0 -0.10104644 0.22323772 - 1000 1.7596217 -1.7290976 0 0.012927885 0.12600944 - 1100 1.3845533 -1.635035 0 -0.26432721 0.31778997 - 1200 1.6448321 -1.6985254 0 -0.070141617 0.14347958 - 1300 1.6158541 -1.581817 0 0.017878542 0.16186588 - 1400 1.4702758 -1.5210898 0 -0.065516796 0.35241206 - 1500 1.5746718 -1.5427933 0 0.016131765 0.21832856 - 1600 1.5276572 -1.6755951 0 -0.16321446 -0.046196204 - 1700 1.8182153 -1.7471336 0 0.052899516 0.14576285 - 1800 1.8054446 -1.8814074 0 -0.094017286 0.11678173 - 1900 1.6318146 -1.636557 0 -0.021060549 0.2930043 - 2000 1.6187614 -1.5563095 0 0.046264283 0.3591072 - 2100 1.8270046 -1.9189568 0 -0.11022215 -0.031366859 - 2200 1.8203171 -1.8672823 0 -0.065168391 0.38665482 - 2300 2.1336582 -1.8962717 0 0.21604988 0.13283887 - 2400 1.7923604 -1.7129915 0 0.061445317 0.30554793 - 2500 1.7207328 -1.694912 0 0.008613452 0.24608272 - 2600 1.7761079 -1.7743463 0 -0.015999568 0.11128836 - 2700 1.7327782 -1.7433093 0 -0.027858862 0.17923355 - 2800 1.6869096 -1.6050313 0 0.065009255 0.082020625 - 2900 1.723365 -1.6453122 0 0.06081914 0.11381101 - 3000 1.759037 -1.7499957 0 -0.008549105 0.12711249 - 3100 1.7608876 -1.8502753 0 -0.10699653 0.10597269 - 3200 1.6030658 -1.6772861 0 -0.090250949 0.16058698 - 3300 1.6136204 -1.6247049 0 -0.027220627 0.27194341 - 3400 1.7126562 -1.6002267 0 0.095302885 0.034174254 - 3500 1.5286242 -1.5693205 0 -0.055982557 -0.028526272 - 3600 1.5529814 -1.6309948 0 -0.093543248 0.25627254 - 3700 1.4066962 -1.4583439 0 -0.06571463 0.36890582 - 3800 1.5736098 -1.5849626 0 -0.027088852 0.19376983 - 3900 1.5819362 -1.6452885 0 -0.07917158 0.17494451 - 4000 1.806905 -1.7114262 0 0.077409698 0.059568431 - 4100 1.7116803 -1.7160461 0 -0.02148265 0.12178783 - 4200 1.8262315 -1.6682893 0 0.13967987 0.25082769 - 4300 1.7548351 -1.6835554 0 0.053731392 0.39252317 - 4400 1.7564816 -1.8020325 0 -0.063115749 0.18973764 - 4500 1.727529 -1.771176 0 -0.06092227 0.51752631 - 4600 1.633861 -1.7554104 0 -0.13788808 0.43310585 - 4700 1.6678523 -1.8066719 0 -0.15549814 -0.086702533 - 4800 1.5903598 -1.7410621 0 -0.1666059 0.064914366 - 4900 1.4894085 -1.5982645 0 -0.12375007 0.23124626 - 5000 1.5422574 -1.6830449 0 -0.15621011 0.12943511 - 5100 1.6123243 -1.6577202 0 -0.061519159 0.26031057 - 5200 1.6815554 -1.6889534 0 -0.024213484 0.1747903 - 5300 1.6502994 -1.5929462 0 0.040850243 0.25623758 - 5400 1.5900521 -1.8240806 0 -0.24992903 0.17822148 - 5500 1.6976803 -1.8370034 0 -0.15629992 0.30793026 - 5600 1.737085 -1.6873775 0 0.032336607 0.32235718 - 5700 1.6995769 -1.6328398 0 0.04974131 0.22932613 - 5800 1.6299367 -1.6582188 0 -0.044581533 0.33036589 - 5900 1.6232041 -1.6456588 0 -0.038686805 0.20701623 - 6000 1.6912228 -1.6401907 0 0.034119867 0.091519693 - 6100 1.6314651 -1.6045998 0 0.010550658 0.32331621 - 6200 1.7575091 -1.7271281 0 0.012805903 0.14214943 - 6300 1.6830653 -1.7955472 0 -0.12931258 0.38730996 - 6400 1.6323392 -1.7470603 0 -0.13104448 0.16724215 - 6500 1.537874 -1.7277794 0 -0.20528423 0.28976791 - 6600 1.8375539 -1.8388229 0 -0.019644528 0.31704541 - 6700 1.7519102 -1.7739002 0 -0.039509043 0.19065098 - 6800 1.4602447 -1.6902787 0 -0.24463645 0.20244553 - 6900 1.6734836 -1.72224 0 -0.065491224 0.27092829 - 7000 1.8166001 -1.7288037 0 0.069630392 0.43514063 - 7100 1.9080746 -1.7849767 0 0.10401717 0.086258744 - 7200 1.6346559 -1.602179 0 0.016130393 0.37208486 - 7300 1.669382 -1.594527 0 0.058161153 0.12543161 - 7400 1.5858819 -1.447937 0 0.12208615 0.42666321 - 7500 1.6947983 -1.637715 0 0.040135322 -0.020875259 - 7600 1.7085903 -1.6810854 0 0.010419044 0.1341074 - 7700 1.5780919 -1.6213683 0 -0.059057356 0.3826822 - 7800 1.8079476 -1.761193 0 0.028675183 0.034143718 - 7900 1.836977 -1.8401332 0 -0.021525986 0.21458105 - 8000 1.9135057 -1.8302694 0 0.064101272 0.23217665 - 8100 1.8606829 -1.6984146 0 0.14366143 0.18168582 - 8200 1.7474236 -1.7574166 0 -0.027467252 0.26529178 - 8300 1.7637155 -1.7861969 0 -0.040118627 0.12298468 - 8400 1.6564242 -1.477104 0 0.16275596 0.14143164 - 8500 1.5868929 -1.6520125 0 -0.080988476 0.22461508 - 8600 1.7556628 -1.7647169 0 -0.026610688 0.19913257 - 8700 1.804704 -1.7892113 0 -0.0025543811 0.2825016 - 8800 1.6511248 -1.8632147 0 -0.22860119 0.041019097 - 8900 1.8323591 -1.7923506 0 0.021684941 0.21335945 - 9000 1.9100569 -1.955559 0 -0.064602644 0.158775 - 9100 1.7562572 -1.8720716 0 -0.13337695 0.19662119 - 9200 1.6566561 -1.9406507 0 -0.30056122 0.12296597 - 9300 1.8367792 -1.9060138 0 -0.087602325 0.19447518 - 9400 1.8420592 -1.6318148 0 0.19182383 0.50726082 - 9500 1.7773475 -1.6973532 0 0.062220818 0.2487172 - 9600 1.6545313 -1.701977 0 -0.063991036 0.20549434 - 9700 1.7463358 -1.8329845 0 -0.10411212 0.15498427 - 9800 1.7799071 -1.7889616 0 -0.026853542 0.3169291 - 9900 1.5838158 -1.718909 0 -0.15093133 0.46050618 - 10000 1.6100625 -1.7018091 0 -0.10784725 0.10312591 -Loop time of 0.715445 on 4 procs for 10000 steps with 100 atoms - -Performance: 6038199.147 tau/day, 13977.313 timesteps/s -95.9% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.35395 | 0.40307 | 0.45588 | 5.9 | 56.34 -Neigh | 0.0033705 | 0.0036112 | 0.0039394 | 0.4 | 0.50 -Comm | 0.17564 | 0.22399 | 0.26912 | 7.8 | 31.31 -Output | 0.0014601 | 0.0024824 | 0.0054784 | 3.5 | 0.35 -Modify | 0.038037 | 0.039219 | 0.04163 | 0.7 | 5.48 -Other | | 0.04308 | | | 6.02 - -Nlocal: 25 ave 28 max 23 min -Histogram: 1 0 1 0 1 0 0 0 0 1 -Nghost: 47.25 ave 49 max 42 min -Histogram: 1 0 0 0 0 0 0 0 0 3 -Neighs: 113.25 ave 132 max 104 min -Histogram: 2 0 1 0 0 0 0 0 0 1 - -Total # of neighbors = 453 -Ave neighs/atom = 4.53 -Neighbor list builds = 483 -Dangerous builds = 0 -Total wall time: 0:00:00 diff --git a/examples/body/log.27Nov18.pour3d.g++.1 b/examples/body/log.27Nov18.pour3d.g++.1 deleted file mode 100644 index 10a4999d14..0000000000 --- a/examples/body/log.27Nov18.pour3d.g++.1 +++ /dev/null @@ -1,74 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# pouring 3d rounded polyhedron bodies - -variable steps index 6000 - -units lj -boundary p p fm -comm_modify vel yes - -atom_style body rounded/polyhedron 1 8 -atom_modify map array - -region reg block 0 50 0 50 0 50 units box -create_box 4 reg -Created orthogonal box = (0 0 0) to (50 50 50) - 1 by 1 by 1 MPI processor grid - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 5 -variable c_n equal 20 -variable c_t equal 5 -variable mu equal 0 -variable A_ua equal 1 - -pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 5 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -fix 1 all nve/body -fix 2 all gravity 1.0 spherical 0.0 -180.0 - -molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 -Read molecule object: - 1 atoms with max type 1 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 2 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 3 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 4 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -region slab block 5 45 5 45 25 35 units box -fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 -ERROR: Unknown fix style pour (src/modify.cpp:898) -Last command: fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 diff --git a/examples/body/log.27Nov18.pour3d.g++.4 b/examples/body/log.27Nov18.pour3d.g++.4 deleted file mode 100644 index eb65f99bc2..0000000000 --- a/examples/body/log.27Nov18.pour3d.g++.4 +++ /dev/null @@ -1,74 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# pouring 3d rounded polyhedron bodies - -variable steps index 6000 - -units lj -boundary p p fm -comm_modify vel yes - -atom_style body rounded/polyhedron 1 8 -atom_modify map array - -region reg block 0 50 0 50 0 50 units box -create_box 4 reg -Created orthogonal box = (0 0 0) to (50 50 50) - 1 by 2 by 2 MPI processor grid - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 5 -variable c_n equal 20 -variable c_t equal 5 -variable mu equal 0 -variable A_ua equal 1 - -pair_style body/rounded/polyhedron ${c_n} ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 ${c_t} ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 ${mu} ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 ${A_ua} ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 ${cut_inner} -pair_style body/rounded/polyhedron 20 5 0 1 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 5 - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -fix 1 all nve/body -fix 2 all gravity 1.0 spherical 0.0 -180.0 - -molecule object molecule.cube molecule.tetra toff 1 molecule.rod3d toff 2 molecule.point3d toff 3 -Read molecule object: - 1 atoms with max type 1 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 2 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 3 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 -Read molecule object: - 1 atoms with max type 4 - 0 bonds with max type 0 - 0 angles with max type 0 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -region slab block 5 45 5 45 25 35 units box -fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 -ERROR: Unknown fix style pour (src/modify.cpp:898) -Last command: fix ins all pour 500 0 4767548 vol 0.4 10 region slab mol object molfrac 0.25 0.25 0.25 0.25 diff --git a/examples/body/log.27Nov18.squares.g++.1 b/examples/body/log.27Nov18.squares.g++.1 deleted file mode 100644 index cc334b416c..0000000000 --- a/examples/body/log.27Nov18.squares.g++.1 +++ /dev/null @@ -1,222 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 1 by 1 by 1 MPI processor grid - 32 atoms - Time spent = 0.000279665 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 1 -variable c_t equal 1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 - -fix 2 all enforce2d - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.781 | 4.781 | 4.781 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.38428256 0.0014168922 0.38569945 0.0020468171 - 2000 0.41372193 0.015263236 0.42898517 0.0029343462 - 3000 0.54844547 0.014870378 0.56331585 0.001978353 - 4000 0.73816048 0.031668204 0.76982869 0.0025939718 - 5000 0.84536165 0.011504649 0.8568663 0.0037990517 - 6000 0.73776478 0.14445932 0.8822241 0.0086538113 - 7000 0.52022565 0.069507637 0.58973329 0.0072098694 - 8000 0.72653213 0.12783368 0.85436581 0.023907183 - 9000 0.87685727 0.1239819 1.0008392 0.0064590959 - 10000 0.7250918 0.097243508 0.82233531 0.0012448267 - 11000 0.62302234 0.05597557 0.67899791 0.00080239872 - 12000 0.57159363 0.18199602 0.75358965 0.01033626 - 13000 0.7505295 0.071545266 0.82207477 0.011480236 - 14000 0.84703598 0.15914379 1.0061798 0.032814039 - 15000 0.41905013 0.090552572 0.5096027 0.015717153 - 16000 0.41805189 0.042916881 0.46096877 0.020702707 - 17000 0.59966233 0.05285043 0.65251275 0.016526024 - 18000 0.54282285 0.20835047 0.75117332 0.036414059 - 19000 0.777922 0.034754101 0.8126761 0.036467537 - 20000 0.54703924 0.14633506 0.6933743 0.012917248 - 21000 0.49337931 0.1858754 0.67925471 0.037890735 - 22000 0.64916623 0.19281344 0.84197967 0.011996773 - 23000 0.66958738 0.20459682 0.8741842 0.023639466 - 24000 0.63729755 0.1111959 0.74849345 0.025049919 - 25000 0.60094316 0.13375799 0.73470115 0.035286376 - 26000 0.35419589 0.22049451 0.5746904 0.0024215291 - 27000 0.33789786 0.18494942 0.52284728 0.0066457643 - 28000 0.32376056 0.13151726 0.45527782 0.010773856 - 29000 0.36198203 0.11044834 0.47243037 0.063012638 - 30000 0.22624436 0.19690087 0.42314523 0.037422734 - 31000 0.32284312 0.059623656 0.38246677 0.0287682 - 32000 0.4457193 0.042396136 0.48811544 0.022025252 - 33000 0.61078662 0.059447221 0.67023384 0.030335089 - 34000 0.63157762 0.062056279 0.6936339 0.044624352 - 35000 0.69577644 0.086216204 0.78199264 0.0319995 - 36000 0.76814336 0.062105963 0.83024933 0.044316891 - 37000 0.58641664 0.095034548 0.68145119 0.03234133 - 38000 0.48772813 0.12911854 0.61684667 0.038732146 - 39000 0.74957742 0.09823432 0.84781174 0.053181162 - 40000 0.57881374 0.2932491 0.87206284 0.065740126 - 41000 0.4415176 0.22899179 0.67050939 0.026159841 - 42000 0.5260339 0.2048105 0.7308444 0.046294432 - 43000 0.33493572 0.32500572 0.65994144 -0.01250241 - 44000 0.46467243 0.07907132 0.54374375 0.13386238 - 45000 0.48135518 0.2618908 0.74324598 -0.016767159 - 46000 0.27223209 0.24562643 0.51785852 0.052118439 - 47000 0.26402739 0.1838767 0.44790409 -0.0015878764 - 48000 0.10229166 0.25519169 0.35748335 -0.033927088 - 49000 0.24313495 0.16578185 0.40891679 0.12414926 - 50000 0.27400066 0.27688032 0.55088098 0.10421157 - 51000 0.43081855 0.18111733 0.61193587 0.16373371 - 52000 0.81969298 0.060995894 0.88068887 0.057285357 - 53000 0.99936159 0.029137886 1.0284995 0.19425015 - 54000 0.69750047 0.038079774 0.73558024 -0.089236384 - 55000 0.54823746 0.056369886 0.60460734 -0.021320579 - 56000 0.6752322 0.050322917 0.72555512 0.25303548 - 57000 0.90328009 0.061107142 0.96438723 -0.1962713 - 58000 0.81463148 0.050387847 0.86501933 0.35952157 - 59000 0.61636455 0.064910223 0.68127478 -0.27208497 - 60000 0.62573918 0.052264617 0.67800379 0.4493407 - 61000 0.81065726 0.071269668 0.88192693 -0.34643283 - 62000 0.86420318 0.052799365 0.91700254 0.48308047 - 63000 0.67848508 0.069087342 0.74757242 -0.31814526 - 64000 0.61430417 0.052109373 0.66641354 0.38336646 - 65000 0.75782937 0.063488206 0.82131757 -0.19113322 - 66000 0.88735857 0.051779306 0.93913787 0.29410996 - 67000 0.70684373 0.061786313 0.76863005 -0.16503578 - 68000 0.58571951 0.052402151 0.63812166 0.30173228 - 69000 0.64997491 0.064435462 0.71441037 -0.1920633 - 70000 0.75071821 0.053416991 0.8041352 0.3846747 - 71000 0.8124718 0.06877986 0.88125166 -0.26852566 - 72000 0.71352066 0.05358784 0.7671085 0.41321806 - 73000 0.55151827 0.066470642 0.61798891 -0.2211738 - 74000 0.65473635 0.061946814 0.71668316 0.29536873 - 75000 0.88704613 0.059476353 0.94652248 -0.0312656 - 76000 0.76899803 0.057351665 0.8263497 0.017885214 - 77000 0.65149455 0.05407174 0.70556629 0.25192449 - 78000 0.68614394 0.074251169 0.76039511 -0.19369404 - 79000 0.97451567 0.06262739 1.0371431 0.4217182 - 80000 0.88207775 0.070157004 0.95223476 -0.27318477 - 81000 0.69294455 0.062623957 0.75556851 0.40150141 - 82000 0.70748016 0.073924331 0.78140449 -0.17128794 - 83000 0.78180774 0.063513978 0.84532172 0.22033652 - 84000 0.80170993 0.065812223 0.86752216 0.083202913 - 85000 0.64788122 0.070348079 0.7182293 -0.066913668 - 86000 0.56575431 0.064865112 0.63061942 0.33905786 - 87000 0.78205358 0.07983702 0.8618906 -0.22844912 - 88000 0.87426443 0.065703482 0.93996791 0.448573 - 89000 0.73269893 0.079827385 0.81252632 -0.24183162 - 90000 0.66703106 0.065630146 0.73266121 0.35410109 - 91000 0.73107154 0.07402702 0.80509856 -0.085492997 - 92000 1.043635 0.067156523 1.1107915 0.14311135 - 93000 0.86063344 0.065607238 0.92624068 0.20750649 - 94000 0.68304235 0.075962239 0.75900459 -0.14594625 - 95000 0.7069191 0.067125732 0.77404483 0.39459759 - 96000 0.79860046 0.090957588 0.88955805 -0.24202125 - 97000 0.81366777 0.071387081 0.88505485 0.32217266 - 98000 0.61885746 0.041524228 0.66038169 0.31635364 - 99000 0.57007759 0.055438456 0.62551604 -0.21172902 - 100000 0.80462394 0.045542313 0.85016626 0.099207503 -Loop time of 6.34495 on 1 procs for 100000 steps with 32 atoms - -Performance: 1361713.788 tau/day, 15760.576 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 5.0158 | 5.0158 | 5.0158 | 0.0 | 79.05 -Neigh | 0.0072868 | 0.0072868 | 0.0072868 | 0.0 | 0.11 -Comm | 0.18669 | 0.18669 | 0.18669 | 0.0 | 2.94 -Output | 0.00098681 | 0.00098681 | 0.00098681 | 0.0 | 0.02 -Modify | 1.0417 | 1.0417 | 1.0417 | 0.0 | 16.42 -Other | | 0.09245 | | | 1.46 - -Nlocal: 32 ave 32 max 32 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 35 ave 35 max 35 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 61 ave 61 max 61 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 61 -Ave neighs/atom = 1.90625 -Neighbor list builds = 1545 -Dangerous builds = 0 -Total wall time: 0:00:06 diff --git a/examples/body/log.27Nov18.squares.g++.4 b/examples/body/log.27Nov18.squares.g++.4 deleted file mode 100644 index 62c6206677..0000000000 --- a/examples/body/log.27Nov18.squares.g++.4 +++ /dev/null @@ -1,222 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 2 by 2 by 1 MPI processor grid - 32 atoms - Time spent = 0.000400782 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 1 -variable c_t equal 1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 1 1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 $P 1.0 couple xy fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 y 0.001 0.1 1.0 couple xy fixedpoint 0 0 0 - -fix 2 all enforce2d - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.774 | 4.774 | 4.774 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.38428256 0.0014168922 0.38569945 0.0020468171 - 2000 0.41372193 0.015263236 0.42898517 0.0029343462 - 3000 0.54844547 0.014870378 0.56331585 0.001978353 - 4000 0.73816048 0.031668204 0.76982869 0.0025939718 - 5000 0.84536165 0.011504649 0.8568663 0.0037990517 - 6000 0.73776478 0.14445932 0.8822241 0.0086538113 - 7000 0.52022565 0.069507637 0.58973329 0.0072098694 - 8000 0.72653213 0.12783367 0.85436581 0.023907185 - 9000 0.87685728 0.12398193 1.0008392 0.0064591005 - 10000 0.72509641 0.097241969 0.82233837 0.0012418726 - 11000 0.62314955 0.056042914 0.67919247 0.0018880786 - 12000 0.57157436 0.18187429 0.75344865 0.0096135623 - 13000 0.7489742 0.08262775 0.83160195 0.009183917 - 14000 0.78835138 0.18761048 0.97596186 0.023684357 - 15000 0.40408761 0.079431327 0.48351893 0.025285348 - 16000 0.4071013 0.13207058 0.53917188 0.02015488 - 17000 0.48417067 0.16699781 0.65116848 0.059188189 - 18000 0.60038567 0.18317457 0.78356024 -0.046456387 - 19000 0.73796958 0.064271521 0.8022411 0.090257204 - 20000 0.62508659 0.14486336 0.76994994 0.04948543 - 21000 0.5596837 0.10018831 0.65987201 0.044961962 - 22000 0.30731517 0.1386103 0.44592547 0.015096596 - 23000 0.34371843 0.1486761 0.49239453 0.026100892 - 24000 0.33484204 0.25428479 0.58912683 0.01974393 - 25000 0.48714744 0.32743616 0.8145836 0.037925893 - 26000 0.33255994 0.29851422 0.63107417 0.049419529 - 27000 0.21735889 0.18816203 0.40552093 0.050622152 - 28000 0.31911317 0.12559898 0.44471215 -0.0036236361 - 29000 0.53280161 0.055185441 0.58798705 0.083856225 - 30000 0.52916941 0.28697284 0.81614225 0.055873213 - 31000 0.47861645 0.21932568 0.69794214 0.02762301 - 32000 0.46786314 0.041856438 0.50971958 0.029923804 - 33000 0.69944716 0.039356744 0.7388039 0.028174645 - 34000 0.39964317 0.1027175 0.50236068 0.039495865 - 35000 0.70199237 0.10421859 0.80621095 0.015943417 - 36000 0.45053533 0.078626602 0.52916193 0.0073950287 - 37000 0.41587918 0.056551665 0.47243084 0.034091318 - 38000 0.58663473 0.039228671 0.6258634 0.033093641 - 39000 0.72480658 0.14792564 0.87273222 0.030903741 - 40000 0.51163285 0.13445292 0.64608577 -0.03114559 - 41000 0.56273761 0.16720374 0.72994135 0.027968528 - 42000 0.61850184 0.10584389 0.72434573 -0.036301799 - 43000 0.60039772 0.11984289 0.72024062 0.080894236 - 44000 0.57499839 0.068211092 0.64320948 0.049726122 - 45000 0.69937239 0.16287141 0.8622438 0.044921114 - 46000 0.23303785 0.2391726 0.47221045 0.021668935 - 47000 0.27051781 0.10690378 0.37742159 0.11963476 - 48000 0.408895 0.079919688 0.48881469 0.087484004 - 49000 0.74363181 0.040819422 0.78445123 0.011937456 - 50000 0.84482316 0.10205256 0.94687572 0.064133262 - 51000 0.84923574 0.089882984 0.93911872 0.062696388 - 52000 0.66278324 0.0331554 0.69593864 0.035150337 - 53000 0.64737251 0.039608076 0.68698058 0.057687461 - 54000 0.68931435 0.042661403 0.73197576 0.069664795 - 55000 0.84523308 0.10293275 0.94816583 0.047343755 - 56000 0.80033937 0.1534797 0.95381907 0.070206074 - 57000 0.6214799 0.1174575 0.7389374 0.078530452 - 58000 0.64228495 0.088089896 0.73037485 0.060245994 - 59000 0.89376363 0.065171887 0.95893552 0.071658895 - 60000 0.90162992 0.016564761 0.91819468 0.089245946 - 61000 0.72439995 0.0076508835 0.73205083 0.031430213 - 62000 0.71590702 0.0046728326 0.72057986 0.10153514 - 63000 0.74491219 0.0046757926 0.74958798 0.077145851 - 64000 0.77173614 0.008265632 0.78000178 -0.049932265 - 65000 0.72789092 0.0053605745 0.73325149 0.27060389 - 66000 0.63001101 0.013871945 0.64388296 -0.17766692 - 67000 0.65887071 0.0069105692 0.66578128 0.31632918 - 68000 0.89042862 0.0026334652 0.89306209 -0.050495873 - 69000 0.83442374 0.0059232957 0.84034703 -0.21871692 - 70000 0.65149642 0.004885383 0.65638181 0.50428108 - 71000 0.66888808 0.01125057 0.68013865 -0.29575772 - 72000 0.74941609 0.0026616299 0.75207772 0.34800716 - 73000 0.7898844 0.0048982026 0.7947826 -0.096872644 - 74000 0.68823538 0.0021467794 0.69038216 0.12272852 - 75000 0.5238808 0.0046112795 0.52849208 0.25760316 - 76000 0.65512889 0.014567969 0.66969686 -0.24622674 - 77000 0.82292373 0.0092471048 0.83217083 0.4002304 - 78000 0.76305221 0.01101937 0.77407158 -0.10704945 - 79000 0.66279814 0.0090486405 0.67184678 0.037466134 - 80000 0.65808885 0.010000569 0.66808942 0.31742291 - 81000 0.91357798 0.046226814 0.95980479 -0.20945693 - 82000 0.87611859 -0.016794871 0.85932372 0.31759733 - 83000 0.66285455 -0.017921021 0.64493353 0.27065273 - 84000 0.67460715 -0.0076174891 0.66698966 -0.024772659 - 85000 0.77786135 0.0014316505 0.779293 -0.21635327 - 86000 0.83246393 0.087489797 0.91995372 -0.13431455 - 87000 0.62935573 0.045088823 0.67444455 0.037766395 - 88000 0.55264538 -0.024625272 0.52802011 0.18121213 - 89000 0.74171392 -0.012629926 0.729084 -0.27666424 - 90000 0.82542165 -0.02296567 0.80245598 -0.30497174 - 91000 0.72958657 -0.026275093 0.70331147 -0.27624518 - 92000 0.6319558 0.022568297 0.65452409 -0.33539318 - 93000 0.66685301 0.021889807 0.68874282 -0.39890762 - 94000 0.91243243 0.0078218509 0.92025428 -0.27213648 - 95000 0.81125179 -0.0096756295 0.80157616 -0.099802335 - 96000 0.63354907 -0.018329423 0.61521965 0.18199604 - 97000 0.66812347 -0.016650228 0.65147324 0.49878257 - 98000 0.81490013 -0.0049164866 0.80998365 -0.13473106 - 99000 0.82131147 0.0043198846 0.82563136 -0.3083957 - 100000 0.50880983 -0.010467027 0.4983428 0.060606332 -Loop time of 4.3169 on 4 procs for 100000 steps with 32 atoms - -Performance: 2001435.573 tau/day, 23164.764 timesteps/s -95.1% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.2078 | 1.3972 | 1.6653 | 15.1 | 32.36 -Neigh | 0.0030954 | 0.003284 | 0.0034814 | 0.3 | 0.08 -Comm | 1.074 | 1.3595 | 1.6003 | 16.2 | 31.49 -Output | 0.001703 | 0.0030067 | 0.0068843 | 4.1 | 0.07 -Modify | 1.2071 | 1.2647 | 1.3062 | 3.6 | 29.30 -Other | | 0.2893 | | | 6.70 - -Nlocal: 8 ave 9 max 6 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Nghost: 17.75 ave 20 max 16 min -Histogram: 1 0 1 0 0 1 0 0 0 1 -Neighs: 14 ave 18 max 7 min -Histogram: 1 0 0 0 0 0 0 1 1 1 - -Total # of neighbors = 56 -Ave neighs/atom = 1.75 -Neighbor list builds = 1566 -Dangerous builds = 0 -Total wall time: 0:00:04 diff --git a/examples/body/log.27Nov18.wall2d.g++.1 b/examples/body/log.27Nov18.wall2d.g++.1 deleted file mode 100644 index 1987280bee..0000000000 --- a/examples/body/log.27Nov18.wall2d.g++.1 +++ /dev/null @@ -1,224 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 1 by 1 by 1 MPI processor grid - 32 atoms - Time spent = 0.000318766 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -change_box all boundary p f p - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 0.1 -variable c_t equal 0.1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 - -fix 2 all enforce2d -fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.771 | 4.771 | 4.771 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.51467204 0.00099202506 0.51566407 0.013452386 - 2000 0.55674899 0.0040762275 0.56082522 0.0034529066 - 3000 0.7546177 0.02259362 0.77721132 0.003650781 - 4000 0.72710218 0.10284108 0.82994326 0.0059629371 - 5000 0.5771012 0.069052145 0.64615335 0.00053937622 - 6000 0.53848154 0.041891239 0.58037277 0.0018693312 - 7000 0.61777556 0.033379829 0.65115538 0.0027584418 - 8000 0.47427227 0.059558934 0.5338312 0.017087187 - 9000 0.46822364 0.064382578 0.53260622 0.023258465 - 10000 0.46511051 0.027799371 0.49290988 0.015319493 - 11000 0.58686703 0.088016891 0.67488392 0.0088428936 - 12000 0.49962603 0.09879099 0.59841702 0.00074311497 - 13000 0.53160049 0.069625775 0.60122626 0.017019775 - 14000 0.49574902 0.041214164 0.53696318 0.0060355978 - 15000 0.56620415 0.13621516 0.70241931 0.045583297 - 16000 0.40942564 0.11469877 0.52412441 0.029905784 - 17000 0.608066 0.096938921 0.70500493 0.018509814 - 18000 0.45622168 0.057018077 0.51323975 0.0034035281 - 19000 0.48763322 0.057832224 0.54546545 0.0022972169 - 20000 0.41577025 0.14480819 0.56057844 0.023882542 - 21000 0.58565738 0.1601676 0.74582498 0.01702799 - 22000 0.60430354 0.16740706 0.7717106 -0.0047632836 - 23000 0.45659601 0.13740896 0.59400497 0.0191143 - 24000 0.42741367 0.25490516 0.68231884 0.051459175 - 25000 0.40851048 0.077823072 0.48633355 0.024392284 - 26000 0.53392894 0.14504323 0.67897217 0.028964572 - 27000 0.39775205 0.13101153 0.52876358 0.0080564916 - 28000 0.63138106 0.17706612 0.80844718 0.017594524 - 29000 0.57897788 0.26855503 0.84753292 0.019310624 - 30000 0.37401002 0.2274666 0.60147663 0.0044804008 - 31000 0.60924323 0.23142663 0.84066986 0.088271242 - 32000 0.60310397 0.35719837 0.96030234 0.0096762289 - 33000 0.47468105 0.17727177 0.65195282 0.0078486602 - 34000 0.42270829 0.20131235 0.62402064 0.090216203 - 35000 0.49578606 0.1697981 0.66558416 0.079099134 - 36000 0.50744538 0.29600416 0.80344954 0.018819487 - 37000 0.66728184 0.28166655 0.94894838 -0.01679437 - 38000 0.38972905 0.25798163 0.64771068 0.040442456 - 39000 0.38292839 0.21774389 0.60067228 0.016754932 - 40000 0.61770336 0.34202184 0.9597252 0.10986262 - 41000 0.42252651 0.13424708 0.5567736 0.040987711 - 42000 0.67513868 0.29515562 0.9702943 0.0013757417 - 43000 0.36768915 0.20349753 0.57118668 0.031443504 - 44000 0.49371025 0.095615653 0.5893259 0.032289477 - 45000 0.42144079 0.28894639 0.71038718 0.040302569 - 46000 0.36360136 0.33117431 0.69477567 0.010881881 - 47000 0.4206309 0.19557595 0.61620685 0.051137535 - 48000 0.4131465 0.37027912 0.78342561 0.11903042 - 49000 0.544703 0.38013565 0.92483865 0.054939742 - 50000 0.47394272 0.32384493 0.79778764 0.088363602 - 51000 0.55377533 0.38103395 0.93480927 0.097981664 - 52000 0.60648433 0.30877364 0.91525797 0.088877781 - 53000 0.62933509 0.33187159 0.96120668 0.10275954 - 54000 0.55077522 0.39050008 0.94127529 0.066721412 - 55000 0.41646397 0.34545572 0.76191969 0.011056796 - 56000 0.44244954 0.39274744 0.83519698 0.039963853 - 57000 0.41963092 0.33483982 0.75447073 0.032555938 - 58000 0.37941475 0.36905323 0.74846798 0.043952263 - 59000 0.53008564 0.32843795 0.85852359 0.080787301 - 60000 0.43408908 0.19840268 0.63249176 0.06421165 - 61000 0.56287814 0.31500577 0.87788391 0.12031895 - 62000 0.5185192 0.18275672 0.70127592 -0.0086212356 - 63000 0.57275413 0.45147395 1.0242281 0.054617465 - 64000 0.28322907 0.33687722 0.62010629 0.07268947 - 65000 0.40230876 0.37989067 0.78219943 -0.029604066 - 66000 0.58601209 0.52721274 1.1132248 -0.00037054404 - 67000 0.52669356 0.44276199 0.96945554 0.18969356 - 68000 0.41566831 0.47320489 0.8888732 0.040635264 - 69000 0.52140574 0.4261935 0.94759923 0.016566201 - 70000 0.42034133 0.55867009 0.97901142 0.047465899 - 71000 0.48720036 0.43749264 0.924693 0.15984789 - 72000 0.5244238 0.55854139 1.0829652 0.10155994 - 73000 0.69990219 0.57313852 1.2730407 0.11108648 - 74000 0.38274347 0.23359664 0.61634011 0.027968087 - 75000 0.47493369 0.49472607 0.96965976 0.10961568 - 76000 0.57064727 0.37996383 0.9506111 0.034746271 - 77000 0.50401727 0.34437588 0.84839315 0.015116686 - 78000 0.59504118 0.44154772 1.0365889 0.059341875 - 79000 0.4920801 0.58935767 1.0814378 0.12139906 - 80000 0.56992818 0.38916606 0.95909424 0.073618074 - 81000 0.38446945 0.77314417 1.1576136 0.12173381 - 82000 0.48734531 0.56198203 1.0493273 0.1080115 - 83000 0.5516933 0.56743096 1.1191243 0.13936805 - 84000 0.53336893 0.62914863 1.1625176 0.0084970895 - 85000 0.46456977 0.77446084 1.2390306 0.18024688 - 86000 0.58067599 0.53109608 1.1117721 0.012492021 - 87000 0.55096446 0.61715622 1.1681207 0.13264723 - 88000 0.56548774 0.74463701 1.3101247 0.14491188 - 89000 0.52492634 0.58482194 1.1097483 0.21155245 - 90000 0.64973565 0.85514474 1.5048804 0.036911953 - 91000 0.55367722 0.74046971 1.2941469 0.23918851 - 92000 0.44863249 0.56773761 1.0163701 0.00042860088 - 93000 0.64728356 0.66594086 1.3132244 0.0022850006 - 94000 0.65255497 0.82136644 1.4739214 0.10037643 - 95000 0.62266654 0.82642147 1.449088 0.11964602 - 96000 0.50656004 0.83312844 1.3396885 0.078491084 - 97000 0.47126712 0.70469684 1.175964 0.12956056 - 98000 0.48661103 1.0121726 1.4987837 0.043537851 - 99000 0.48379797 0.9520931 1.4358911 0.082047522 - 100000 0.54266361 1.0959698 1.6386334 -0.13092175 -Loop time of 3.8532 on 1 procs for 100000 steps with 32 atoms - -Performance: 2242290.202 tau/day, 25952.433 timesteps/s -98.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 2.3917 | 2.3917 | 2.3917 | 0.0 | 62.07 -Neigh | 0.012386 | 0.012386 | 0.012386 | 0.0 | 0.32 -Comm | 0.11307 | 0.11307 | 0.11307 | 0.0 | 2.93 -Output | 0.0010369 | 0.0010369 | 0.0010369 | 0.0 | 0.03 -Modify | 1.246 | 1.246 | 1.246 | 0.0 | 32.34 -Other | | 0.08895 | | | 2.31 - -Nlocal: 32 ave 32 max 32 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 21 ave 21 max 21 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 55 ave 55 max 55 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 55 -Ave neighs/atom = 1.71875 -Neighbor list builds = 2886 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/body/log.27Nov18.wall2d.g++.4 b/examples/body/log.27Nov18.wall2d.g++.4 deleted file mode 100644 index d9a27cb1e4..0000000000 --- a/examples/body/log.27Nov18.wall2d.g++.4 +++ /dev/null @@ -1,224 +0,0 @@ -LAMMPS (27 Nov 2018) - using 1 OpenMP thread(s) per MPI task -# 2d rounded polygon bodies - -variable r index 4 -variable steps index 100000 -variable T index 0.5 -variable P index 0.1 -variable seed index 980411 - -units lj -dimension 2 - -atom_style body rounded/polygon 1 6 -atom_modify map array -read_data data.squares - orthogonal box = (0 0 -0.5) to (12 12 0.5) - 2 by 2 by 1 MPI processor grid - reading atoms ... - 2 atoms - 2 bodies - -replicate $r $r 1 -replicate 4 $r 1 -replicate 4 4 1 - orthogonal box = (0 0 -0.5) to (48 48 0.5) - 2 by 2 by 1 MPI processor grid - 32 atoms - Time spent = 0.000329733 secs - -velocity all create $T ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 ${seed} dist gaussian mom yes rot yes -velocity all create 0.5 980411 dist gaussian mom yes rot yes - -change_box all boundary p f p - -variable cut_inner equal 0.5 -variable k_n equal 100 -variable k_na equal 2 -variable c_n equal 0.1 -variable c_t equal 0.1 -variable mu equal 0.1 -variable delta_ua equal 0.5 - -pair_style body/rounded/polygon ${c_n} ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 ${c_t} ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 ${mu} ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 ${delta_ua} ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 ${cut_inner} -pair_style body/rounded/polygon 0.1 0.1 0.1 0.5 0.5 -pair_coeff * * ${k_n} ${k_na} -pair_coeff * * 100 ${k_na} -pair_coeff * * 100 2 - -comm_modify vel yes - -neighbor 0.5 bin -neigh_modify every 1 delay 0 check yes - -timestep 0.001 - -#fix 1 all nve/body -#fix 1 all nvt/body temp $T $T 1.0 -fix 1 all npt/body temp $T $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 $T 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 $P 1.0 fixedpoint 0 0 0 -fix 1 all npt/body temp 0.5 0.5 1.0 x 0.001 0.1 1.0 fixedpoint 0 0 0 - -fix 2 all enforce2d -fix 3 all wall/body/polygon 2000 50 50 yplane 0.0 48.0 - -#compute 1 all body/local id 1 2 3 -#dump 1 all local 100000 dump.polygon.* index c_1[1] c_1[2] c_1[3] c_1[4] - -thermo_style custom step ke pe etotal press -thermo 1000 - -#dump 2 all image 10000 image.*.jpg type type zoom 2.0 # adiam 1.5 body type 0 0 -#dump_modify 2 pad 6 - -run ${steps} -run 100000 -Neighbor list info ... - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.15685 - ghost atom cutoff = 6.15685 - binsize = 3.07843, bins = 16 16 1 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair body/rounded/polygon, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/2d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 4.773 | 4.773 | 4.773 Mbytes -Step KinEng PotEng TotEng Press - 0 0.484375 0.25 0.734375 0.0067274306 - 1000 0.51467204 0.00099202506 0.51566407 0.013452386 - 2000 0.55674899 0.0040762275 0.56082522 0.0034529066 - 3000 0.7546177 0.02259362 0.77721132 0.003650781 - 4000 0.72710218 0.10284108 0.82994326 0.0059629371 - 5000 0.57710119 0.069052154 0.64615335 0.00053937664 - 6000 0.53848104 0.041891152 0.58037219 0.0018693259 - 7000 0.61777485 0.033380825 0.65115568 0.0027584782 - 8000 0.47427732 0.059553658 0.53383098 0.017087698 - 9000 0.46820943 0.064379697 0.53258913 0.02325702 - 10000 0.46605511 0.02332689 0.489382 0.013699209 - 11000 0.57547516 0.090133398 0.66560855 0.0083913962 - 12000 0.465348 0.084853345 0.55020135 0.006231552 - 13000 0.55340889 0.07116165 0.62457054 0.030622563 - 14000 0.58866362 0.052281859 0.64094548 0.0079106838 - 15000 0.51757672 0.12255618 0.6401329 0.014005369 - 16000 0.42696011 0.086987541 0.51394765 -0.0017128649 - 17000 0.37612579 0.13054778 0.50667357 0.0046284992 - 18000 0.47659682 0.14670523 0.62330205 0.02206928 - 19000 0.47897909 0.15540332 0.63438241 0.02544138 - 20000 0.59377323 0.15357757 0.7473508 0.030262926 - 21000 0.52781204 0.22074491 0.74855695 -0.0022170167 - 22000 0.44843285 0.12779345 0.5762263 0.0097268482 - 23000 0.60400735 0.18098124 0.78498858 0.05778325 - 24000 0.58254338 0.1570243 0.73956769 0.022530491 - 25000 0.60524318 0.23660272 0.8418459 0.062530421 - 26000 0.45892702 0.34294121 0.80186823 0.038657393 - 27000 0.58418023 0.19551937 0.7796996 -0.0055396645 - 28000 0.45655369 0.26718934 0.72374303 0.006593108 - 29000 0.50277299 0.1747088 0.67748179 0.016059369 - 30000 0.38640717 0.1631573 0.54956447 0.036055723 - 31000 0.46944541 0.22076826 0.69021367 0.014334038 - 32000 0.53862858 0.26867594 0.80730452 0.057406282 - 33000 0.45666352 0.21796554 0.67462906 0.056555205 - 34000 0.51644038 0.21866786 0.73510824 0.015713 - 35000 0.50489584 0.1596236 0.66451945 0.040400644 - 36000 0.41723489 0.16227853 0.57951342 0.02863261 - 37000 0.481638 0.28830624 0.76994424 0.038381986 - 38000 0.6036094 0.33479287 0.93840227 0.0032059452 - 39000 0.47822122 0.18876355 0.66698476 0.029252649 - 40000 0.54949607 0.35011086 0.89960693 0.093909148 - 41000 0.54876522 0.27501735 0.82378257 -0.0084167014 - 42000 0.67801592 0.18102522 0.85904114 -0.0058395209 - 43000 0.54342066 0.34322081 0.88664146 0.12263806 - 44000 0.46672513 0.29749157 0.76421671 0.051073701 - 45000 0.4679867 0.25820875 0.72619545 0.069790993 - 46000 0.59598501 0.22285276 0.81883777 0.050578807 - 47000 0.48858341 0.29811577 0.78669917 0.080971431 - 48000 0.41238073 0.29362937 0.7060101 0.031893588 - 49000 0.61516435 0.33082609 0.94599044 -0.010710982 - 50000 0.57576635 0.37137185 0.94713819 0.062160249 - 51000 0.54614001 0.36960628 0.91574629 -0.0083424769 - 52000 0.42232354 0.25214442 0.67446796 0.028666126 - 53000 0.43025129 0.24479385 0.67504514 0.030342054 - 54000 0.54614922 0.29602426 0.84217348 0.083070642 - 55000 0.60719748 0.3577285 0.96492598 0.053799744 - 56000 0.47073149 0.31070429 0.78143579 0.083895368 - 57000 0.56861582 0.33249784 0.90111366 0.032324233 - 58000 0.75061035 0.33313728 1.0837476 0.031039937 - 59000 0.59473893 0.48870773 1.0834467 0.039503585 - 60000 0.55252481 0.38350562 0.93603043 0.0027643882 - 61000 0.45010855 0.43945065 0.8895592 0.028168222 - 62000 0.63942467 0.53372899 1.1731537 0.13790959 - 63000 0.69407873 0.37980402 1.0738828 0.035919608 - 64000 0.54898275 0.39910419 0.94808693 0.0015016851 - 65000 0.58229838 0.42300361 1.005302 0.089787193 - 66000 0.53443537 0.5597136 1.094149 -0.015781756 - 67000 0.59212426 0.56172146 1.1538457 0.030464683 - 68000 0.68164926 0.48724393 1.1688932 0.071465948 - 69000 0.59721737 0.49476309 1.0919805 0.07575647 - 70000 0.52314551 0.31950477 0.84265028 0.11206672 - 71000 0.53230509 0.53846575 1.0707708 0.0047204701 - 72000 0.71341933 0.4924749 1.2058942 0.116568 - 73000 0.70498496 0.54121008 1.246195 0.11210249 - 74000 0.54188682 0.61729607 1.1591829 0.044083048 - 75000 0.44073609 0.42072284 0.86145893 -0.041508511 - 76000 0.51225567 0.36848317 0.88073884 -0.028636748 - 77000 0.6517329 0.5503086 1.2020415 0.049605026 - 78000 0.60053898 0.52760266 1.1281416 0.094361256 - 79000 0.51560788 0.46563043 0.98123832 -0.03336136 - 80000 0.53357884 0.60743981 1.1410186 0.027259883 - 81000 0.6256228 0.40412923 1.029752 0.083274981 - 82000 0.6903519 0.69599412 1.386346 0.168747 - 83000 0.62621394 0.50082841 1.1270424 0.12294403 - 84000 0.5682146 0.73827702 1.3064916 0.085884707 - 85000 0.48179077 0.73669563 1.2184864 0.065002035 - 86000 0.61101399 0.80673836 1.4177523 0.037555163 - 87000 0.52278725 0.71608722 1.2388745 0.020943688 - 88000 0.53318823 0.50916748 1.0423557 -0.01946691 - 89000 0.56428713 0.56042234 1.1247095 0.040998134 - 90000 0.58720508 0.66023073 1.2474358 0.040313529 - 91000 0.61509407 0.86254343 1.4776375 0.15215034 - 92000 0.5640475 0.57694543 1.1409929 0.10238679 - 93000 0.60586378 0.67978456 1.2856483 -0.043948113 - 94000 0.75406595 0.74795347 1.5020194 0.015341415 - 95000 0.4974314 0.60192267 1.0993541 -0.018173218 - 96000 0.50048302 0.82845218 1.3289352 0.045394283 - 97000 0.65335222 0.6470855 1.3004377 0.011624967 - 98000 0.65693072 0.45222133 1.109152 0.13763684 - 99000 0.60573344 0.50284289 1.1085763 0.12853674 - 100000 0.50677068 0.58143063 1.0882013 0.11351254 -Loop time of 3.24642 on 4 procs for 100000 steps with 32 atoms - -Performance: 2661396.711 tau/day, 30803.203 timesteps/s -94.4% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.64148 | 0.70244 | 0.76391 | 6.5 | 21.64 -Neigh | 0.0049012 | 0.0050417 | 0.0052478 | 0.2 | 0.16 -Comm | 0.79447 | 0.88412 | 0.97443 | 8.1 | 27.23 -Output | 0.001776 | 0.0031438 | 0.0072262 | 4.2 | 0.10 -Modify | 1.325 | 1.3684 | 1.4049 | 2.4 | 42.15 -Other | | 0.2833 | | | 8.73 - -Nlocal: 8 ave 9 max 7 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Nghost: 14 ave 15 max 13 min -Histogram: 1 0 0 0 0 2 0 0 0 1 -Neighs: 13.25 ave 16 max 11 min -Histogram: 1 0 1 0 0 0 1 0 0 1 - -Total # of neighbors = 53 -Ave neighs/atom = 1.65625 -Neighbor list builds = 2654 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/mc/log.14Jun23.widom.lj.g++.1 b/examples/mc/log.14Jun23.widom.lj.g++.1 new file mode 100644 index 0000000000..6cbbae89ed --- /dev/null +++ b/examples/mc/log.14Jun23.widom.lj.g++.1 @@ -0,0 +1,91 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) + +units lj +atom_style atomic + +pair_style lj/cut 2.5 +pair_modify shift yes + +read_data data.widom.lj +Reading data file ... + orthogonal box = (0 0 0) to (9.4 9.4 9.4) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 1000 atoms + reading velocities ... + 1000 velocities + read_data CPU = 0.006 seconds + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 1 2 1.5 0.8 2.0 +pair_coeff 2 2 0.5 0.88 2.2 + +neighbor 0.3 bin +neigh_modify delay 0 every 5 check yes + +fix mywidom all widom 10 100000 2 29494 0.75 + +fix 1 all langevin 0.75 0.75 0.1 48279 zero yes +fix 2 all nve + +timestep 0.002 + +thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] +thermo 10 + +run 100 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 5 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 7 7 7 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.181 | 3.181 | 3.181 Mbytes + Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 + 10 0.7358936 -6.4405082 -5.3377717 7.1699962 830.584 1.2039721 -3.8577501 171.3429 830.584 + 20 0.75426414 -6.4267946 -5.2965298 7.2833985 830.584 1.2039721 -4.0708206 227.63895 830.584 + 30 0.72947489 -6.4064078 -5.3132896 7.3872583 830.584 1.2039721 -4.4304803 367.7146 830.584 + 40 0.73504751 -6.4248725 -5.3234038 7.2927069 830.584 1.2039721 -4.1904189 266.99373 830.584 + 50 0.76497439 -6.4352472 -5.2889331 7.3046861 830.584 1.2039721 -3.8628472 172.51133 830.584 + 60 0.75752861 -6.4147051 -5.2795485 7.4416 830.584 1.2039721 -3.5355467 111.5042 830.584 + 70 0.77775078 -6.4210798 -5.2556202 7.4473703 830.584 1.2039721 -3.4754802 102.92223 830.584 + 80 0.80937104 -6.4320008 -5.2191583 7.4121087 830.584 1.2039721 -3.9287513 188.35625 830.584 + 90 0.76321255 -6.4203633 -5.2766893 7.4307727 830.584 1.2039721 -4.2257529 279.87337 830.584 + 100 0.74561743 -6.4010576 -5.2837499 7.52907 830.584 1.2039721 -3.6817835 135.5099 830.584 +Loop time of 10.2362 on 1 procs for 100 steps with 1000 atoms + +Performance: 1688.128 tau/day, 9.769 timesteps/s, 9.769 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.058411 | 0.058411 | 0.058411 | 0.0 | 0.57 +Neigh | 0.017611 | 0.017611 | 0.017611 | 0.0 | 0.17 +Comm | 0.001774 | 0.001774 | 0.001774 | 0.0 | 0.02 +Output | 0.00029892 | 0.00029892 | 0.00029892 | 0.0 | 0.00 +Modify | 10.158 | 10.158 | 10.158 | 0.0 | 99.23 +Other | | 0.0003838 | | | 0.00 + +Nlocal: 1000 ave 1000 max 1000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3049 ave 3049 max 3049 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46176 ave 46176 max 46176 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46176 +Ave neighs/atom = 46.176 +Neighbor list builds = 10 +Dangerous builds = 0 +Total wall time: 0:00:10 diff --git a/examples/mc/log.14Jun23.widom.lj.g++.4 b/examples/mc/log.14Jun23.widom.lj.g++.4 new file mode 100644 index 0000000000..7a1171f1b8 --- /dev/null +++ b/examples/mc/log.14Jun23.widom.lj.g++.4 @@ -0,0 +1,91 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) + +units lj +atom_style atomic + +pair_style lj/cut 2.5 +pair_modify shift yes + +read_data data.widom.lj +Reading data file ... + orthogonal box = (0 0 0) to (9.4 9.4 9.4) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 1000 atoms + reading velocities ... + 1000 velocities + read_data CPU = 0.009 seconds + +pair_coeff 1 1 1.0 1.0 2.5 +pair_coeff 1 2 1.5 0.8 2.0 +pair_coeff 2 2 0.5 0.88 2.2 + +neighbor 0.3 bin +neigh_modify delay 0 every 5 check yes + +fix mywidom all widom 10 100000 2 29494 0.75 + +fix 1 all langevin 0.75 0.75 0.1 48279 zero yes +fix 2 all nve + +timestep 0.002 + +thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] +thermo 10 + +run 100 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 5 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2.8 + ghost atom cutoff = 2.8 + binsize = 1.4, bins = 7 7 7 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.13 | 3.13 | 3.131 Mbytes + Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 + 10 0.74279259 -6.4332442 -5.3201696 7.2071344 830.584 1.2039721 -3.4462258 98.984938 830.584 + 20 0.73016272 -6.4222911 -5.3281423 7.2714238 830.584 1.2039721 -4.4887329 397.41346 830.584 + 30 0.74416342 -6.429139 -5.3140101 7.2713375 830.584 1.2039721 -4.3313574 322.19056 830.584 + 40 0.73295457 -6.4370942 -5.3387618 7.227091 830.584 1.2039721 -4.7419281 557.00309 830.584 + 50 0.76914235 -6.4473959 -5.2948361 7.2179148 830.584 1.2039721 -3.1794069 69.352982 830.584 + 60 0.74099083 -6.4433012 -5.3329265 7.204973 830.584 1.2039721 -3.5231065 109.66994 830.584 + 70 0.74514671 -6.4288463 -5.312244 7.2771269 830.584 1.2039721 -1.0154832 3.8727995 830.584 + 80 0.72787097 -6.4457574 -5.3550427 7.1130709 830.584 1.2039721 -3.6691709 133.2501 830.584 + 90 0.78452846 -6.5034376 -5.3278217 6.8238659 830.584 1.2039721 -2.0798339 16.008373 830.584 + 100 0.77188499 -6.487313 -5.3306433 6.9133194 830.584 1.2039721 -2.066579 15.727938 830.584 +Loop time of 1.59209 on 4 procs for 100 steps with 1000 atoms + +Performance: 10853.637 tau/day, 62.810 timesteps/s, 62.810 katom-step/s +96.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.014713 | 0.015481 | 0.016154 | 0.4 | 0.97 +Neigh | 0.0045952 | 0.0047537 | 0.0048917 | 0.2 | 0.30 +Comm | 0.026382 | 0.086811 | 0.14145 | 13.9 | 5.45 +Output | 0.00022704 | 0.0002596 | 0.00035704 | 0.0 | 0.02 +Modify | 1.4299 | 1.4845 | 1.5447 | 3.4 | 93.24 +Other | | 0.0003365 | | | 0.02 + +Nlocal: 250 ave 256 max 242 min +Histogram: 1 0 0 0 1 0 0 0 1 1 +Nghost: 1666 ave 1670 max 1659 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Neighs: 11538 ave 11832 max 11091 min +Histogram: 1 0 0 0 0 0 1 1 0 1 + +Total # of neighbors = 46152 +Ave neighs/atom = 46.152 +Neighbor list builds = 10 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/examples/mc/log.14Jun23.widom.spce.g++.1 b/examples/mc/log.14Jun23.widom.spce.g++.1 new file mode 100644 index 0000000000..712566985d --- /dev/null +++ b/examples/mc/log.14Jun23.widom.spce.g++.1 @@ -0,0 +1,139 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +units real +dimension 3 +boundary p p p +atom_style full + +pair_style lj/cut/coul/long 10.0 +bond_style harmonic +angle_style harmonic + +read_data data.spce +Reading data file ... + orthogonal box = (-0.031613 -0.023523 -0.085255) to (43.234352 44.939753 42.306533) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 8640 atoms + scanning bonds ... + 2 = max bonds/atom + scanning angles ... + 1 = max angles/atom + reading bonds ... + 5760 bonds + reading angles ... + 2880 angles +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 2 = max # of 1-2 neighbors + 1 = max # of 1-3 neighbors + 1 = max # of 1-4 neighbors + 2 = max # of special neighbors + special bonds CPU = 0.002 seconds + read_data CPU = 0.048 seconds + +molecule h2omol H2O.txt +Read molecule template h2omol: + 1 molecules + 0 fragments + 3 atoms with max type 2 + 2 bonds with max type 1 + 1 angles with max type 1 + 0 dihedrals with max type 0 + 0 impropers with max type 0 + +### Flexible SPC/E Potential Parameters ### +### Zhang et al., Fluid Phase Equilibria, 262 (2007) 210-216 ### +pair_coeff 1 1 0.1502629 3.1169 +pair_coeff 1 2 0.0341116368 2.04845 +pair_coeff 2 2 0.00774378 0.98 + +bond_coeff 1 176.864 0.9611 +angle_coeff 1 42.1845 109.4712 +kspace_style pppm 1.0e-4 + +fix mywidom all widom 10 20 0 29494 298 mol h2omol + +fix 2 all nvt temp 298.0 298.0 100.0 + +neighbor 2.0 bin +neigh_modify delay 10 every 2 check yes + + +#run variables +timestep 0.5 + +thermo 10 +thermo_style custom step etotal pe temp press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] + +run 100 +PPPM initialization ... + using 12-bit tables for long-range coulomb (src/kspace.cpp:342) + G vector (1/distance) = 0.2690183 + grid = 24 24 24 + stencil order = 5 + estimated absolute RMS force accuracy = 0.024843102 + estimated relative force accuracy = 7.4814263e-05 + using double precision KISS FFT + 3d grid and FFT values/proc = 29791 13824 +Generated 0 of 1 mixed pair_coeff terms from geometric mixing rule +WARNING: Fix widom using full_energy option (src/MC/fix_widom.cpp:320) +0 atoms in group FixWidom:widom_exclusion_group:mywidom +0 atoms in group FixWidom:rotation_gas_atoms:mywidom +WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:654) +Neighbor list info ... + update: every = 2 steps, delay = 10 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 12 + ghost atom cutoff = 12 + binsize = 6, bins = 8 8 8 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cut/coul/long, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 29.66 | 29.66 | 29.66 Mbytes + Step TotEng PotEng Temp Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] + 0 -29703.973 -29703.973 0 -4764.5901 82468.116 1.0447118 0 0 82468.116 + 10 -29718 -32598.944 111.87604 -498.88935 82468.116 1.0447118 200.15526 1.6274344e-147 82468.116 + 20 -29698.227 -32625.357 113.6696 -3120.7115 82468.116 1.0447118 -1.0295764 5.6893637 82468.116 + 30 -29668.463 -33188.922 136.71037 -8129.0179 82468.116 1.0447118 5.5971294 7.856256e-05 82468.116 + 40 -29654.066 -34017.797 169.45726 -5730.6427 82468.116 1.0447118 128.14313 1.0550462e-94 82468.116 + 50 -29627.714 -33214.549 139.28799 -3954.0179 82468.116 1.0447118 122.28545 2.0851209e-90 82468.116 + 60 -29602.616 -32995.039 131.73836 -8099.2136 82468.116 1.0447118 -1.4752191 12.07497 82468.116 + 70 -29591.096 -33872.451 166.25834 -7065.2821 82468.116 1.0447118 17.210054 2.3911575e-13 82468.116 + 80 -29553.631 -32971.209 132.7152 -3535.4257 82468.116 1.0447118 11.148921 6.6631697e-09 82468.116 + 90 -29530.109 -33346.146 148.18857 -5312.6414 82468.116 1.0447118 51.783293 1.055658e-38 82468.116 + 100 -29505.327 -34074.801 177.4469 -5991.0034 82468.116 1.0447118 32.415523 1.6878187e-24 82468.116 +Loop time of 55.4401 on 1 procs for 100 steps with 8640 atoms + +Performance: 0.078 ns/day, 308.000 hours/ns, 1.804 timesteps/s, 15.584 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.4117 | 5.4117 | 5.4117 | 0.0 | 9.76 +Bond | 0.029451 | 0.029451 | 0.029451 | 0.0 | 0.05 +Kspace | 0.73758 | 0.73758 | 0.73758 | 0.0 | 1.33 +Neigh | 1.4296 | 1.4296 | 1.4296 | 0.0 | 2.58 +Comm | 0.018593 | 0.018593 | 0.018593 | 0.0 | 0.03 +Output | 0.00069303 | 0.00069303 | 0.00069303 | 0.0 | 0.00 +Modify | 47.81 | 47.81 | 47.81 | 0.0 | 86.24 +Other | | 0.002525 | | | 0.00 + +Nlocal: 8640 ave 8640 max 8640 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 23534 ave 23534 max 23534 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 3.27356e+06 ave 3.27356e+06 max 3.27356e+06 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 3273560 +Ave neighs/atom = 378.88426 +Ave special neighs/atom = 2 +Neighbor list builds = 220 +Dangerous builds = 0 +Total wall time: 0:00:55 diff --git a/examples/mc/log.30Jun20.widom.lj.g++.1 b/examples/mc/log.30Jun20.widom.lj.g++.1 deleted file mode 100644 index 71621f9b4e..0000000000 --- a/examples/mc/log.30Jun20.widom.lj.g++.1 +++ /dev/null @@ -1,89 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) - -units lj -atom_style atomic - -pair_style lj/cut 2.5 -pair_modify shift yes - -read_data data.widom.lj - orthogonal box = (0.0000000 0.0000000 0.0000000) to (9.4000000 9.4000000 9.4000000) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 1000 atoms - reading velocities ... - 1000 velocities - read_data CPU = 0.003 seconds - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 1 2 1.5 0.8 2.0 -pair_coeff 2 2 0.5 0.88 2.2 - -neighbor 0.3 bin -neigh_modify delay 0 every 5 check yes - -fix mywidom all widom 10 100000 2 29494 0.75 - -fix 1 all langevin 0.75 0.75 0.1 48279 zero yes -fix 2 all nve - -timestep 0.002 - -thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] -thermo 10 - -run 100 -Neighbor list info ... - update every 5 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 7 7 7 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.181 | 3.181 | 3.181 Mbytes -Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 - 10 0.7358936 -6.4405082 -5.3377717 7.1699962 830.584 1.2039721 -3.8577501 171.3429 830.584 - 20 0.75426414 -6.4267946 -5.2965298 7.2833985 830.584 1.2039721 -4.0708206 227.63895 830.584 - 30 0.72947489 -6.4064078 -5.3132896 7.3872583 830.584 1.2039721 -4.4304803 367.7146 830.584 - 40 0.73504751 -6.4248725 -5.3234038 7.2927069 830.584 1.2039721 -4.1904189 266.99373 830.584 - 50 0.76497439 -6.4352472 -5.2889331 7.3046861 830.584 1.2039721 -3.8628472 172.51133 830.584 - 60 0.75752861 -6.4147051 -5.2795485 7.4416 830.584 1.2039721 -3.5355467 111.5042 830.584 - 70 0.77775078 -6.4210798 -5.2556202 7.4473703 830.584 1.2039721 -3.4754802 102.92223 830.584 - 80 0.80937104 -6.4320008 -5.2191583 7.4121087 830.584 1.2039721 -3.9287513 188.35625 830.584 - 90 0.76321255 -6.4203633 -5.2766893 7.4307727 830.584 1.2039721 -4.2257529 279.87337 830.584 - 100 0.74561743 -6.4010576 -5.2837499 7.52907 830.584 1.2039721 -3.6817835 135.5099 830.584 -Loop time of 25.8264 on 1 procs for 100 steps with 1000 atoms - -Performance: 669.082 tau/day, 3.872 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.08186 | 0.08186 | 0.08186 | 0.0 | 0.32 -Neigh | 0.023613 | 0.023613 | 0.023613 | 0.0 | 0.09 -Comm | 0.0053532 | 0.0053532 | 0.0053532 | 0.0 | 0.02 -Output | 0.00037837 | 0.00037837 | 0.00037837 | 0.0 | 0.00 -Modify | 25.715 | 25.715 | 25.715 | 0.0 | 99.57 -Other | | 0.0005643 | | | 0.00 - -Nlocal: 1000.00 ave 1000 max 1000 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 3049.00 ave 3049 max 3049 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 46176.0 ave 46176 max 46176 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 46176 -Ave neighs/atom = 46.176000 -Neighbor list builds = 10 -Dangerous builds = 0 -Total wall time: 0:00:25 diff --git a/examples/mc/log.30Jun20.widom.lj.g++.4 b/examples/mc/log.30Jun20.widom.lj.g++.4 deleted file mode 100644 index f726faed66..0000000000 --- a/examples/mc/log.30Jun20.widom.lj.g++.4 +++ /dev/null @@ -1,89 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -# Kob and Andersen model Phys. Rev. E 51, 4626 (1995) - -units lj -atom_style atomic - -pair_style lj/cut 2.5 -pair_modify shift yes - -read_data data.widom.lj - orthogonal box = (0.0000000 0.0000000 0.0000000) to (9.4000000 9.4000000 9.4000000) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 1000 atoms - reading velocities ... - 1000 velocities - read_data CPU = 0.002 seconds - -pair_coeff 1 1 1.0 1.0 2.5 -pair_coeff 1 2 1.5 0.8 2.0 -pair_coeff 2 2 0.5 0.88 2.2 - -neighbor 0.3 bin -neigh_modify delay 0 every 5 check yes - -fix mywidom all widom 10 100000 2 29494 0.75 - -fix 1 all langevin 0.75 0.75 0.1 48279 zero yes -fix 2 all nve - -timestep 0.002 - -thermo_style custom step temp pe etotal press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] -thermo 10 - -run 100 -Neighbor list info ... - update every 5 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 2.8 - ghost atom cutoff = 2.8 - binsize = 1.4, bins = 7 7 7 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 3.13 | 3.13 | 3.131 Mbytes -Step Temp PotEng TotEng Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 0.75021245 -6.4204308 -5.2962374 7.2962696 830.584 1.2039721 0 0 830.584 - 10 0.74279259 -6.4332442 -5.3201696 7.2071344 830.584 1.2039721 -3.4462258 98.984938 830.584 - 20 0.73016272 -6.4222911 -5.3281423 7.2714238 830.584 1.2039721 -4.4887329 397.41346 830.584 - 30 0.74416342 -6.429139 -5.3140101 7.2713375 830.584 1.2039721 -4.3313574 322.19056 830.584 - 40 0.73295457 -6.4370942 -5.3387618 7.227091 830.584 1.2039721 -4.7419281 557.00309 830.584 - 50 0.76914235 -6.4473959 -5.2948361 7.2179148 830.584 1.2039721 -3.1794069 69.352982 830.584 - 60 0.74099083 -6.4433012 -5.3329265 7.204973 830.584 1.2039721 -3.5231065 109.66994 830.584 - 70 0.74514671 -6.4288463 -5.312244 7.2771269 830.584 1.2039721 -1.0154832 3.8727995 830.584 - 80 0.72787097 -6.4457574 -5.3550427 7.1130709 830.584 1.2039721 -3.6691709 133.2501 830.584 - 90 0.78452846 -6.5034376 -5.3278217 6.8238659 830.584 1.2039721 -2.0798339 16.008373 830.584 - 100 0.77188499 -6.487313 -5.3306433 6.9133194 830.584 1.2039721 -2.066579 15.727938 830.584 -Loop time of 3.37748 on 4 procs for 100 steps with 1000 atoms - -Performance: 5116.239 tau/day, 29.608 timesteps/s -98.7% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.02025 | 0.020952 | 0.021322 | 0.3 | 0.62 -Neigh | 0.0059071 | 0.0060568 | 0.0061543 | 0.1 | 0.18 -Comm | 0.016558 | 0.059554 | 0.094282 | 12.2 | 1.76 -Output | 0.00022173 | 0.00042927 | 0.0010471 | 0.0 | 0.01 -Modify | 3.2552 | 3.2902 | 3.3335 | 1.7 | 97.42 -Other | | 0.0003003 | | | 0.01 - -Nlocal: 250.000 ave 256 max 242 min -Histogram: 1 0 0 0 1 0 0 0 1 1 -Nghost: 1666.00 ave 1670 max 1659 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Neighs: 11538.0 ave 11832 max 11091 min -Histogram: 1 0 0 0 0 0 1 1 0 1 - -Total # of neighbors = 46152 -Ave neighs/atom = 46.152000 -Neighbor list builds = 10 -Dangerous builds = 0 -Total wall time: 0:00:03 diff --git a/examples/mc/log.30Jun20.widom.spce.g++.1 b/examples/mc/log.30Jun20.widom.spce.g++.1 deleted file mode 100644 index 25aecc685d..0000000000 --- a/examples/mc/log.30Jun20.widom.spce.g++.1 +++ /dev/null @@ -1,133 +0,0 @@ -LAMMPS (30 Jun 2020) - using 1 OpenMP thread(s) per MPI task -units real -dimension 3 -boundary p p p -atom_style full - -pair_style lj/cut/coul/long 10.0 -bond_style harmonic -angle_style harmonic - -read_data data.spce - orthogonal box = (-0.031613 -0.023523 -0.085255) to (43.234352 44.939753 42.306533) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 8640 atoms - scanning bonds ... - 2 = max bonds/atom - scanning angles ... - 1 = max angles/atom - reading bonds ... - 5760 bonds - reading angles ... - 2880 angles - 2 = max # of 1-2 neighbors - 1 = max # of 1-3 neighbors - 1 = max # of 1-4 neighbors - 2 = max # of special neighbors - special bonds CPU = 0.008 seconds - read_data CPU = 0.028 seconds - -molecule h2omol H2O.txt -Read molecule template h2omol: - 1 molecules - 3 atoms with max type 2 - 2 bonds with max type 1 - 1 angles with max type 1 - 0 dihedrals with max type 0 - 0 impropers with max type 0 - -### Flexible SPC/E Potential Parameters ### -### Zhang et al., Fluid Phase Equilibria, 262 (2007) 210-216 ### -pair_coeff 1 1 0.1502629 3.1169 -pair_coeff 1 2 0.0341116368 2.04845 -pair_coeff 2 2 0.00774378 0.98 - -bond_coeff 1 176.864 0.9611 -angle_coeff 1 42.1845 109.4712 -kspace_style pppm 1.0e-4 - -fix mywidom all widom 10 20 0 29494 298 mol h2omol - -fix 2 all nvt temp 298.0 298.0 100.0 - -neighbor 2.0 bin -neigh_modify delay 10 every 2 check yes - - -#run variables -timestep 0.5 - -thermo 10 -thermo_style custom step etotal pe temp press vol density f_mywidom[1] f_mywidom[2] f_mywidom[3] - -run 100 -PPPM initialization ... - using 12-bit tables for long-range coulomb (src/kspace.cpp:330) - G vector (1/distance) = 0.2690183 - grid = 24 24 24 - stencil order = 5 - estimated absolute RMS force accuracy = 0.024843102 - estimated relative force accuracy = 7.4814263e-05 - using double precision FFTW3 - 3d grid and FFT values/proc = 29791 13824 -WARNING: Fix Widom using full_energy option (src/MC/fix_widom.cpp:297) -0 atoms in group FixWidom:widom_exclusion_group:mywidom -0 atoms in group FixWidom:rotation_gas_atoms:mywidom -WARNING: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies (src/neighbor.cpp:487) -Neighbor list info ... - update every 2 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 12 - ghost atom cutoff = 12 - binsize = 6, bins = 8 8 8 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cut/coul/long, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 29.66 | 29.66 | 29.66 Mbytes -Step TotEng PotEng Temp Press Volume Density f_mywidom[1] f_mywidom[2] f_mywidom[3] - 0 -29703.973 -29703.973 0 -4764.5901 82468.116 1.9140713 0 0 82468.116 - 10 -29712.131 -31110.041 54.285179 -3154.4423 82468.116 1.9140713 241.93348 3.7366217e-178 82468.116 - 20 -29711.939 -32614.429 112.71273 -4216.1592 82468.116 1.9140713 16.095006 1.5716469e-12 82468.116 - 30 -29688.142 -32368.506 104.08688 -4093.6515 82468.116 1.9140713 5.7862327 5.7086352e-05 82468.116 - 40 -29662.343 -32252.144 100.57005 -1458.5339 82468.116 1.9140713 126.68071 1.2467216e-93 82468.116 - 50 -29646.78 -32837.635 123.91081 -4607.1155 82468.116 1.9140713 74.622397 1.8790479e-55 82468.116 - 60 -29628.968 -33001.229 130.9554 -4589.5296 82468.116 1.9140713 3.6575433 0.0020780497 82468.116 - 70 -29602.78 -32816.28 124.79023 -3082.1133 82468.116 1.9140713 13.983097 5.561247e-11 82468.116 - 80 -29577.552 -33141.454 138.39742 -6332.8138 82468.116 1.9140713 41.98931 1.6075608e-31 82468.116 - 90 -29550.865 -33792.115 164.70094 -4607.6419 82468.116 1.9140713 68.690681 4.2082269e-51 82468.116 - 100 -29515.107 -34052.782 176.21207 -3609.5709 82468.116 1.9140713 41.090597 7.3326206e-31 82468.116 -Loop time of 163.407 on 1 procs for 100 steps with 8640 atoms - -Performance: 0.026 ns/day, 907.819 hours/ns, 0.612 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 8.5495 | 8.5495 | 8.5495 | 0.0 | 5.23 -Bond | 0.031981 | 0.031981 | 0.031981 | 0.0 | 0.02 -Kspace | 2.3995 | 2.3995 | 2.3995 | 0.0 | 1.47 -Neigh | 5.0542 | 5.0542 | 5.0542 | 0.0 | 3.09 -Comm | 0.051965 | 0.051965 | 0.051965 | 0.0 | 0.03 -Output | 0.0018802 | 0.0018802 | 0.0018802 | 0.0 | 0.00 -Modify | 147.31 | 147.31 | 147.31 | 0.0 | 90.15 -Other | | 0.003614 | | | 0.00 - -Nlocal: 8640.00 ave 8640 max 8640 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 23499.0 ave 23499 max 23499 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 3.27380e+06 ave 3.2738e+06 max 3.2738e+06 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 3273800 -Ave neighs/atom = 378.91204 -Ave special neighs/atom = 2.0000000 -Neighbor list builds = 220 -Dangerous builds = 0 -Total wall time: 0:02:44 diff --git a/examples/reaxff/HNS/in.reaxc.hns b/examples/reaxff/HNS/in.reaxc.hns index 775a389eca..5b83698917 100644 --- a/examples/reaxff/HNS/in.reaxc.hns +++ b/examples/reaxff/HNS/in.reaxc.hns @@ -37,4 +37,4 @@ velocity all create 300.0 41279 loop geom fix 1 all nve fix 2 all qeq/reax 1 0.0 10.0 1e-6 reax/c -run 100 +run $t diff --git a/examples/snap/C_SNAP_2021.10.15.quadratic.snapcoeff b/examples/snap/C_SNAP_2021.10.15.quadratic.snapcoeff new file mode 120000 index 0000000000..b0383dc323 --- /dev/null +++ b/examples/snap/C_SNAP_2021.10.15.quadratic.snapcoeff @@ -0,0 +1 @@ +../../potentials/C_SNAP_2021.10.15.quadratic.snapcoeff \ No newline at end of file diff --git a/examples/snap/C_SNAP_2021.10.15.quadratic.snapparam b/examples/snap/C_SNAP_2021.10.15.quadratic.snapparam new file mode 120000 index 0000000000..bac9725d0d --- /dev/null +++ b/examples/snap/C_SNAP_2021.10.15.quadratic.snapparam @@ -0,0 +1 @@ +../../potentials/C_SNAP_2021.10.15.quadratic.snapparam \ No newline at end of file diff --git a/examples/snap/in.C_SNAP b/examples/snap/in.C_SNAP new file mode 100644 index 0000000000..de2f09d637 --- /dev/null +++ b/examples/snap/in.C_SNAP @@ -0,0 +1,31 @@ +#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K + +units metal +atom_style atomic +boundary p p p + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Crystal orientation and MD box creation # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +lattice diamond 2.845 +region Bbox block 0 3 0 3 0 3 +create_box 1 Bbox +create_atoms 1 region Bbox basis 1 1 + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Interatomic potential parameters # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb + +pair_style hybrid/overlay zbl 0.1 0.2 snap +pair_coeff 1 1 zbl 10 10 +pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C + +mass * 12.01 +velocity all create 8000.0 3412461 loop geom + +fix NVE all nve +fix NVT all langevin 5000.0 5000.0 0.1 3216548 +thermo 50 +thermo_style custom step temp ke pe etotal press pxx pyy pzz +run 500 diff --git a/examples/snap/log.30May23.C_SNAP.g++.1 b/examples/snap/log.30May23.C_SNAP.g++.1 new file mode 100644 index 0000000000..65f6d152a4 --- /dev/null +++ b/examples/snap/log.30May23.C_SNAP.g++.1 @@ -0,0 +1,105 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K + +units metal +atom_style atomic +boundary p p p + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Crystal orientation and MD box creation # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +lattice diamond 2.845 +Lattice spacing in x,y,z = 2.845 2.845 2.845 +region Bbox block 0 3 0 3 0 3 +create_box 1 Bbox +Created orthogonal box = (0 0 0) to (8.535 8.535 8.535) + 1 by 1 by 1 MPI processor grid +create_atoms 1 region Bbox basis 1 1 +Created 216 atoms + using lattice units in orthogonal box = (0 0 0) to (8.535 8.535 8.535) + create_atoms CPU = 0.000 seconds + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Interatomic potential parameters # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb + +pair_style hybrid/overlay zbl 0.1 0.2 snap +pair_coeff 1 1 zbl 10 10 +pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C +SNAP Element = C, Radius 0.5, Weight 1 +SNAP keyword rcutfac 2.7 +SNAP keyword twojmax 8 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0.0 +SNAP keyword bzeroflag 0 +SNAP keyword quadraticflag 1 + +mass * 12.01 +velocity all create 8000.0 3412461 loop geom + +fix NVE all nve +fix NVT all langevin 5000.0 5000.0 0.1 3216548 +thermo 50 +thermo_style custom step temp ke pe etotal press pxx pyy pzz +run 500 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 4.7 + ghost atom cutoff = 4.7 + binsize = 2.35, bins = 4 4 4 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full trim from (2) + attributes: half, newton on, cut 2.2 + pair build: halffull/newton/trim + stencil: none + bin: none + (2) pair snap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.835 | 4.835 | 4.835 Mbytes + Step Temp KinEng PotEng TotEng Press Pxx Pyy Pzz + 0 8000 222.32745 -846.66062 -624.33318 10234249 10210805 10267435 10224506 + 50 4199.4229 116.70587 -723.2423 -606.53643 10256033 10157803 10280166 10330129 + 100 3820.2509 106.16833 -710.43537 -604.26704 10232872 10216484 10241309 10240825 + 150 4413.2948 122.64957 -710.09702 -587.44745 10254093 10323013 10265454 10173810 + 200 4688.024 130.28455 -702.26198 -571.97742 10306186 10281632 10342390 10294536 + 250 4997.165 138.87587 -720.58476 -581.70889 10284438 10220856 10360231 10272226 + 300 4640.4911 128.96357 -710.75063 -581.78706 10263301 10264007 10290526 10235369 + 350 4929.5117 136.99572 -707.2526 -570.25688 10290742 10359920 10284236 10228071 + 400 4700.9354 130.64337 -697.90277 -567.2594 10250682 10277287 10246032 10228729 + 450 5108.4971 141.96989 -700.57144 -558.60155 10289765 10323648 10306588 10239058 + 500 5146.7039 143.03169 -700.33221 -557.30052 10334303 10349736 10358785 10294387 +Loop time of 36.7771 on 1 procs for 500 steps with 216 atoms + +Performance: 1.175 ns/day, 20.432 hours/ns, 13.595 timesteps/s, 2.937 katom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 36.766 | 36.766 | 36.766 | 0.0 | 99.97 +Neigh | 0.0010226 | 0.0010226 | 0.0010226 | 0.0 | 0.00 +Comm | 0.0033205 | 0.0033205 | 0.0033205 | 0.0 | 0.01 +Output | 0.00020657 | 0.00020657 | 0.00020657 | 0.0 | 0.00 +Modify | 0.0047621 | 0.0047621 | 0.0047621 | 0.0 | 0.01 +Other | | 0.001464 | | | 0.00 + +Nlocal: 216 ave 216 max 216 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1746 ave 1746 max 1746 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 1767 ave 1767 max 1767 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 32846 ave 32846 max 32846 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 32846 +Ave neighs/atom = 152.06481 +Neighbor list builds = 1 +Dangerous builds = 0 +Total wall time: 0:00:36 diff --git a/examples/snap/log.30May23.C_SNAP.g++.4 b/examples/snap/log.30May23.C_SNAP.g++.4 new file mode 100644 index 0000000000..f7a71b5b41 --- /dev/null +++ b/examples/snap/log.30May23.C_SNAP.g++.4 @@ -0,0 +1,105 @@ +LAMMPS (28 Mar 2023 - Development) + using 1 OpenMP thread(s) per MPI task +#Carbon SNAP example: 216 atom diamond unit cell simulated NVT at ~1,000GPa and 5,000K + +units metal +atom_style atomic +boundary p p p + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Crystal orientation and MD box creation # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +lattice diamond 2.845 +Lattice spacing in x,y,z = 2.845 2.845 2.845 +region Bbox block 0 3 0 3 0 3 +create_box 1 Bbox +Created orthogonal box = (0 0 0) to (8.535 8.535 8.535) + 1 by 2 by 2 MPI processor grid +create_atoms 1 region Bbox basis 1 1 +Created 216 atoms + using lattice units in orthogonal box = (0 0 0) to (8.535 8.535 8.535) + create_atoms CPU = 0.000 seconds + +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Interatomic potential parameters # +#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# +# Specify hybrid with SNAP, ZBL, and long-range C_SNAP_2021.10.15.quadratic.ulomb + +pair_style hybrid/overlay zbl 0.1 0.2 snap +pair_coeff 1 1 zbl 10 10 +pair_coeff * * snap C_SNAP_2021.10.15.quadratic.snapcoeff C_SNAP_2021.10.15.quadratic.snapparam C +SNAP Element = C, Radius 0.5, Weight 1 +SNAP keyword rcutfac 2.7 +SNAP keyword twojmax 8 +SNAP keyword rfac0 0.99363 +SNAP keyword rmin0 0.0 +SNAP keyword bzeroflag 0 +SNAP keyword quadraticflag 1 + +mass * 12.01 +velocity all create 8000.0 3412461 loop geom + +fix NVE all nve +fix NVT all langevin 5000.0 5000.0 0.1 3216548 +thermo 50 +thermo_style custom step temp ke pe etotal press pxx pyy pzz +run 500 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 4.7 + ghost atom cutoff = 4.7 + binsize = 2.35, bins = 4 4 4 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair zbl, perpetual, half/full trim from (2) + attributes: half, newton on, cut 2.2 + pair build: halffull/newton/trim + stencil: none + bin: none + (2) pair snap, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.681 | 4.681 | 4.681 Mbytes + Step Temp KinEng PotEng TotEng Press Pxx Pyy Pzz + 0 8000 222.32745 -846.66062 -624.33318 10234249 10210805 10267435 10224506 + 50 4382.3571 121.78978 -715.70492 -593.91513 10262157 10278549 10181545 10326376 + 100 4546.1549 126.34188 -713.11818 -586.77631 10261694 10257647 10333666 10193770 + 150 5109.4576 141.99658 -708.87952 -566.88294 10268132 10248182 10248240 10307974 + 200 4764.2181 132.40206 -712.16881 -579.76675 10329903 10238991 10379394 10371323 + 250 4989.5099 138.66313 -710.39748 -571.73435 10282678 10321057 10274124 10252854 + 300 4853.3102 134.87801 -699.98167 -565.10366 10343314 10204138 10430172 10395634 + 350 4788.1153 133.06618 -705.14381 -572.07763 10325571 10312657 10267999 10396058 + 400 5055.7813 140.50487 -707.38537 -566.8805 10323176 10357258 10310733 10301536 + 450 5182.3198 144.02149 -695.11614 -551.09465 10345564 10358486 10346325 10331881 + 500 5311.077 147.59977 -691.32767 -543.7279 10308823 10242668 10214102 10469700 +Loop time of 11.5932 on 4 procs for 500 steps with 216 atoms + +Performance: 3.726 ns/day, 6.441 hours/ns, 43.129 timesteps/s, 9.316 katom-step/s +94.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 10.241 | 10.446 | 10.695 | 5.0 | 90.11 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.87613 | 1.1187 | 1.3179 | 14.9 | 9.65 +Output | 0.0002656 | 0.0010016 | 0.0015521 | 1.5 | 0.01 +Modify | 0.0019493 | 0.0020668 | 0.0021577 | 0.2 | 0.02 +Other | | 0.02508 | | | 0.22 + +Nlocal: 54 ave 54 max 54 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 1082 ave 1082 max 1082 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 432 ave 432 max 432 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 8532 ave 8532 max 8532 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 34128 +Ave neighs/atom = 158 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:11 diff --git a/examples/ttm/log.20Apr22.ttm.mod.g++.1 b/examples/ttm/log.18May23.ttm.mod.g++.1 similarity index 70% rename from examples/ttm/log.20Apr22.ttm.mod.g++.1 rename to examples/ttm/log.18May23.ttm.mod.g++.1 index 6c0470617b..b97e8ab0ea 100644 --- a/examples/ttm/log.20Apr22.ttm.mod.g++.1 +++ b/examples/ttm/log.18May23.ttm.mod.g++.1 @@ -1,6 +1,4 @@ -LAMMPS (24 Mar 2022) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) - using 1 OpenMP thread(s) per MPI task +LAMMPS (28 Mar 2023 - Development) units metal atom_style atomic boundary p p p @@ -15,7 +13,7 @@ mass 1 28.0855 create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 1 basis 5 1 basis 6 1 basis 7 1 basis 8 1 Created 8000 atoms using lattice units in orthogonal box = (0 0 0) to (54.309 54.309 54.309) - create_atoms CPU = 0.001 seconds + create_atoms CPU = 0.002 seconds pair_style sw pair_coeff * * Si.sw Si @@ -42,12 +40,12 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- fix ttm/mod command: +- fix ttm/mod command: doi:10.1088/0953-8984/26/47/475401, doi:10.1002/ctpp.201310025 @article{Pisarev2014, author = {Pisarev, V. V. and Starikov, S. V.}, -title = {{Atomistic simulation of ion track formation in UO2.}}, -journal = {J.~Phys.:~Condens.~Matter}, +title = {Atomistic Simulation of Ion Track Formation in {UO$_2$}.}, +journal = {J.~Phys.\ Condens.\ Matter}, volume = {26}, number = {47}, pages = {475401}, @@ -56,8 +54,8 @@ year = {2014} @article{Norman2013, author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.}, -title = {{Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}}, -journal = {Contrib.~Plasm.~Phys.}, +title = {Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}, +journal = {Contrib.\ Plasma Phys.}, number = {2}, volume = {53}, pages = {129--139}, @@ -67,7 +65,7 @@ year = {2013} CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Neighbor list info ... - update every 5 steps, delay 0 steps, check yes + update: every = 5 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 5.77118 ghost atom cutoff = 5.77118 @@ -81,30 +79,30 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 4.433 | 4.433 | 4.433 Mbytes Step Temp TotEng f_twotemp[1] f_twotemp[2] 0 0 -34692.79996100604 -52.79390940511979 0 - 100 2.004897156140836 -34690.27961013186 -55.34997305431884 0.01301140393178354 - 200 2.837118035232607 -34687.74741132015 -57.93445748841878 0.02696025968760173 - 300 4.263087164947482 -34684.98084093686 -60.75945453846786 0.02175636603841567 - 400 5.568003854939066 -34682.25271040963 -63.56896518300501 0.0300061848347275 - 500 6.225602451570786 -34679.49948952029 -66.40897551884576 0.02768827702656702 - 600 7.608847536264781 -34676.69728436362 -69.32060611557266 0.05579466731854093 - 700 9.049471241531297 -34674.00093206036 -72.10055094219446 0.004335980559879027 - 800 9.826796099683211 -34671.27720242751 -74.9501061086213 0.02371649678091513 - 900 11.8609224958918 -34668.35091308811 -77.98544170794551 0.004658649791374929 - 1000 13.88037467640968 -34665.35025858006 -81.16445160194114 0.07684078334464739 -Loop time of 4.85247 on 1 procs for 1000 steps with 8000 atoms + 100 2.004897156140836 -34690.27961013186 -55.3499730543189 0.01301140393178352 + 200 2.837118035232607 -34687.74741132015 -57.93445748841876 0.02696025968760173 + 300 4.263087164947482 -34684.98084093686 -60.75945453846793 0.02175636603841567 + 400 5.568003854939066 -34682.25271040963 -63.56896518300499 0.03000618483472749 + 500 6.225602451570786 -34679.49948952029 -66.40897551884574 0.02768827702656703 + 600 7.608847536264781 -34676.69728436362 -69.32060611557282 0.05579466731854091 + 700 9.049471241531297 -34674.00093206036 -72.10055094219462 0.004335980559879032 + 800 9.826796099683211 -34671.27720242751 -74.95010610862134 0.02371649678091515 + 900 11.8609224958918 -34668.35091308811 -77.98544170794545 0.004658649791374908 + 1000 13.88037467640968 -34665.35025858006 -81.16445160194111 0.07684078334464743 +Loop time of 2.48942 on 1 procs for 1000 steps with 8000 atoms -Performance: 1.781 ns/day, 13.479 hours/ns, 206.081 timesteps/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 3.471 ns/day, 6.915 hours/ns, 401.700 timesteps/s, 3.214 Matom-step/s +100.0% CPU use with 1 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 4.1286 | 4.1286 | 4.1286 | 0.0 | 85.08 +Pair | 2.126 | 2.126 | 2.126 | 0.0 | 85.40 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.030972 | 0.030972 | 0.030972 | 0.0 | 0.64 -Output | 0.0026351 | 0.0026351 | 0.0026351 | 0.0 | 0.05 -Modify | 0.67848 | 0.67848 | 0.67848 | 0.0 | 13.98 -Other | | 0.01182 | | | 0.24 +Comm | 0.016147 | 0.016147 | 0.016147 | 0.0 | 0.65 +Output | 0.0013116 | 0.0013116 | 0.0013116 | 0.0 | 0.05 +Modify | 0.33864 | 0.33864 | 0.33864 | 0.0 | 13.60 +Other | | 0.007318 | | | 0.29 Nlocal: 8000 ave 8000 max 8000 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -119,4 +117,4 @@ Total # of neighbors = 272000 Ave neighs/atom = 34 Neighbor list builds = 0 Dangerous builds = 0 -Total wall time: 0:00:04 +Total wall time: 0:00:02 diff --git a/examples/ttm/log.20Apr22.ttm.mod.g++.4 b/examples/ttm/log.18May23.ttm.mod.g++.4 similarity index 71% rename from examples/ttm/log.20Apr22.ttm.mod.g++.4 rename to examples/ttm/log.18May23.ttm.mod.g++.4 index fdf9b0cfb5..ea675c8594 100644 --- a/examples/ttm/log.20Apr22.ttm.mod.g++.4 +++ b/examples/ttm/log.18May23.ttm.mod.g++.4 @@ -1,6 +1,5 @@ -LAMMPS (24 Mar 2022) -OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) - using 1 OpenMP thread(s) per MPI task +LAMMPS (28 Mar 2023 - Development) +WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:531) units metal atom_style atomic boundary p p p @@ -15,7 +14,7 @@ mass 1 28.0855 create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 1 basis 5 1 basis 6 1 basis 7 1 basis 8 1 Created 8000 atoms using lattice units in orthogonal box = (0 0 0) to (54.309 54.309 54.309) - create_atoms CPU = 0.000 seconds + create_atoms CPU = 0.001 seconds pair_style sw pair_coeff * * Si.sw Si @@ -42,12 +41,12 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- fix ttm/mod command: +- fix ttm/mod command: doi:10.1088/0953-8984/26/47/475401, doi:10.1002/ctpp.201310025 @article{Pisarev2014, author = {Pisarev, V. V. and Starikov, S. V.}, -title = {{Atomistic simulation of ion track formation in UO2.}}, -journal = {J.~Phys.:~Condens.~Matter}, +title = {Atomistic Simulation of Ion Track Formation in {UO$_2$}.}, +journal = {J.~Phys.\ Condens.\ Matter}, volume = {26}, number = {47}, pages = {475401}, @@ -56,8 +55,8 @@ year = {2014} @article{Norman2013, author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.}, -title = {{Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}}, -journal = {Contrib.~Plasm.~Phys.}, +title = {Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}, +journal = {Contrib.\ Plasma Phys.}, number = {2}, volume = {53}, pages = {129--139}, @@ -67,7 +66,7 @@ year = {2013} CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Neighbor list info ... - update every 5 steps, delay 0 steps, check yes + update: every = 5 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 5.77118 ghost atom cutoff = 5.77118 @@ -81,30 +80,30 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 3.436 | 3.436 | 3.436 Mbytes Step Temp TotEng f_twotemp[1] f_twotemp[2] 0 0 -34692.79996100361 -52.79390940511979 0 - 100 1.852689977101411 -34690.49204900486 -55.14271612882062 0.027261886765771 - 200 2.735750477179192 -34688.11139028054 -57.57110998717796 0.03387986355513582 - 300 3.931848271449558 -34685.54667417785 -60.18684521127226 0.02261256315262404 - 400 5.462009198576365 -34682.74455105668 -63.05420336037231 0.002402241637719583 - 500 6.267811692893873 -34679.96493887379 -65.93304222280049 0.02448378880218699 - 600 7.21148216150661 -34677.41455784726 -68.58391420045932 0.04114045759945373 - 700 8.84660534187052 -34674.40610468235 -71.68798344296847 0.0237298402743454 - 800 10.1748456457686 -34671.08749605772 -75.11943618276236 0.007538225788030298 - 900 11.27479036162859 -34668.4118066423 -77.92921692176769 0.02537529314475071 - 1000 13.26881394868076 -34665.56617589539 -80.91544540266329 0.03112665440209921 -Loop time of 1.60214 on 4 procs for 1000 steps with 8000 atoms + 100 1.852689977101411 -34690.49204900486 -55.14271612882064 0.02726188676577098 + 200 2.735750477179192 -34688.11139028054 -57.57110998717798 0.03387986355513584 + 300 3.931848271449558 -34685.54667417785 -60.18684521127231 0.02261256315262403 + 400 5.462009198576365 -34682.74455105668 -63.05420336037233 0.002402241637719578 + 500 6.267811692893873 -34679.96493887379 -65.93304222280051 0.02448378880218699 + 600 7.21148216150661 -34677.41455784726 -68.58391420045926 0.04114045759945374 + 700 8.84660534187052 -34674.40610468235 -71.68798344296859 0.02372984027434538 + 800 10.1748456457686 -34671.08749605772 -75.11943618276216 0.007538225788030307 + 900 11.27479036162859 -34668.4118066423 -77.92921692176756 0.02537529314475071 + 1000 13.26881394868076 -34665.56617589539 -80.91544540266317 0.03112665440209921 +Loop time of 0.995347 on 4 procs for 1000 steps with 8000 atoms -Performance: 5.393 ns/day, 4.450 hours/ns, 624.165 timesteps/s -99.7% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 8.680 ns/day, 2.765 hours/ns, 1004.675 timesteps/s, 8.037 Matom-step/s +97.9% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.0424 | 1.0558 | 1.0696 | 1.0 | 65.90 +Pair | 0.65351 | 0.6616 | 0.66783 | 0.8 | 66.47 Neigh | 0 | 0 | 0 | 0.0 | 0.00 -Comm | 0.05072 | 0.063773 | 0.079458 | 4.9 | 3.98 -Output | 0.0024362 | 0.0024703 | 0.0025297 | 0.1 | 0.15 -Modify | 0.47018 | 0.47332 | 0.48004 | 0.6 | 29.54 -Other | | 0.006786 | | | 0.42 +Comm | 0.041606 | 0.048314 | 0.056589 | 2.9 | 4.85 +Output | 0.0014609 | 0.0014742 | 0.0014968 | 0.0 | 0.15 +Modify | 0.27934 | 0.28016 | 0.28089 | 0.1 | 28.15 +Other | | 0.003798 | | | 0.38 Nlocal: 2000 ave 2000 max 2000 min Histogram: 4 0 0 0 0 0 0 0 0 0 diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 index cb7adfd34b..ba3997ac8e 100644 --- a/fortran/lammps.f90 +++ b/fortran/lammps.f90 @@ -44,11 +44,12 @@ MODULE LIBLAMMPS ! Data type constants for extracting data from global, atom, compute, and fix ! ! Must be kept in sync with the equivalent declarations in - ! src/library.h, python/lammps/constants.py, tools/swig/lammps.i, + ! src/library.h, src/lmptype.h, python/lammps/constants.py, tools/swig/lammps.i, ! and examples/COUPLE/plugin/liblammpsplugin.h ! ! These are NOT part of the API (the part the user sees) INTEGER(c_int), PARAMETER :: & + LAMMPS_NONE = -1, & ! no data type assigned (yet) LAMMPS_INT = 0, & ! 32-bit integer (or array) LAMMPS_INT_2D = 1, & ! two-dimensional 32-bit integer array LAMMPS_DOUBLE = 2, & ! 64-bit double (or array) @@ -87,10 +88,15 @@ MODULE LIBLAMMPS INTEGER(c_int) :: scalar, vector, array END TYPE lammps_type + TYPE lammps_dtype + INTEGER(c_int) :: i32, i64, r64, str + END TYPE lammps_dtype + TYPE lammps TYPE(c_ptr) :: handle = c_null_ptr TYPE(lammps_style) :: style TYPE(lammps_type) :: type + TYPE(lammps_dtype) :: dtype CONTAINS PROCEDURE :: close => lmp_close PROCEDURE :: error => lmp_error @@ -100,6 +106,7 @@ MODULE LIBLAMMPS PROCEDURE :: commands_string => lmp_commands_string PROCEDURE :: get_natoms => lmp_get_natoms PROCEDURE :: get_thermo => lmp_get_thermo + PROCEDURE :: last_thermo => lmp_last_thermo PROCEDURE :: extract_box => lmp_extract_box PROCEDURE :: reset_box => lmp_reset_box PROCEDURE :: memory_usage => lmp_memory_usage @@ -243,7 +250,7 @@ MODULE LIBLAMMPS END TYPE lammps_data_baseclass ! Derived type for receiving LAMMPS data (in lieu of the ability to type cast - ! pointers). Used for extract_compute, extract_atom + ! pointers). Used for extract_compute, extract_atom, last_thermo TYPE, EXTENDS(lammps_data_baseclass) :: lammps_data INTEGER(c_int), POINTER :: i32 => NULL() INTEGER(c_int), DIMENSION(:), POINTER :: i32_vec => NULL() @@ -439,6 +446,15 @@ MODULE LIBLAMMPS TYPE(c_ptr), INTENT(IN), VALUE :: name END FUNCTION lammps_get_thermo + FUNCTION lammps_last_thermo(handle,what,index) BIND(C) + IMPORT :: c_ptr, c_int + IMPLICIT NONE + TYPE(c_ptr) :: lammps_last_thermo + TYPE(c_ptr), INTENT(IN), VALUE :: handle + TYPE(c_ptr), INTENT(IN), VALUE :: what + INTEGER(c_int), INTENT(IN), VALUE :: index + END FUNCTION lammps_last_thermo + SUBROUTINE lammps_extract_box(handle,boxlo,boxhi,xy,yz,xz,pflags, & boxflag) BIND(C) IMPORT :: c_ptr, c_double, c_int @@ -995,6 +1011,10 @@ CONTAINS lmp_open%type%scalar = LMP_TYPE_SCALAR lmp_open%type%vector = LMP_TYPE_VECTOR lmp_open%type%array = LMP_TYPE_ARRAY + lmp_open%dtype%i32 = LAMMPS_INT + lmp_open%dtype%i64 = LAMMPS_INT64 + lmp_open%dtype%r64 = LAMMPS_DOUBLE + lmp_open%dtype%str = LAMMPS_STRING ! Assign constants for bigint and tagint for use elsewhere SIZE_TAGINT = lmp_extract_setting(lmp_open, 'tagint') @@ -1103,6 +1123,67 @@ CONTAINS CALL lammps_free(Cname) END FUNCTION lmp_get_thermo + ! equivalent function to lammps_last_thermo + FUNCTION lmp_last_thermo(self,what,index) RESULT(thermo_data) + CLASS(lammps), INTENT(IN), TARGET :: self + CHARACTER(LEN=*), INTENT(IN) :: what + INTEGER :: index + INTEGER(c_int) :: idx + TYPE(lammps_data) :: thermo_data, type_data + INTEGER(c_int) :: datatype + TYPE(c_ptr) :: Cname, Cptr + + idx = index - 1 + ! set data type for known cases + SELECT CASE (what) + CASE ('step') + IF (SIZE_BIGINT == 4_c_int) THEN + datatype = LAMMPS_INT + ELSE + datatype = LAMMPS_INT64 + END IF + CASE ('num') + datatype = LAMMPS_INT + CASE ('type') + datatype = LAMMPS_INT + CASE ('keyword') + datatype = LAMMPS_STRING + CASE ('data') + Cname = f2c_string('type') + Cptr = lammps_last_thermo(self%handle,Cname,idx) + type_data%lammps_instance => self + type_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, type_data%i32) + datatype = type_data%i32 + CALL lammps_free(Cname) + CASE DEFAULT + datatype = -1 + END SELECT + + Cname = f2c_string(what) + Cptr = lammps_last_thermo(self%handle,Cname,idx) + CALL lammps_free(Cname) + + thermo_data%lammps_instance => self + SELECT CASE (datatype) + CASE (LAMMPS_INT) + thermo_data%datatype = DATA_INT + CALL C_F_POINTER(Cptr, thermo_data%i32) + CASE (LAMMPS_INT64) + thermo_data%datatype = DATA_INT64 + CALL C_F_POINTER(Cptr, thermo_data%i64) + CASE (LAMMPS_DOUBLE) + thermo_data%datatype = DATA_DOUBLE + CALL C_F_POINTER(Cptr, thermo_data%r64) + CASE (LAMMPS_STRING) + thermo_data%datatype = DATA_STRING + thermo_data%str = c2f_string(Cptr) + CASE DEFAULT + CALL lmp_error(self, LMP_ERROR_ALL + LMP_ERROR_WORLD, & + 'Unknown pointer type in last_thermo') + END SELECT + END FUNCTION lmp_last_thermo + ! equivalent subroutine to lammps_extract_box SUBROUTINE lmp_extract_box(self, boxlo, boxhi, xy, yz, xz, pflags, boxflag) CLASS(lammps), INTENT(IN) :: self diff --git a/lib/colvars/Makefile.common b/lib/colvars/Makefile.common index 356a7f4a91..9e7be12958 100644 --- a/lib/colvars/Makefile.common +++ b/lib/colvars/Makefile.common @@ -50,7 +50,9 @@ COLVARS_SRCS = \ colvarparams.cpp \ colvarparse.cpp \ colvarproxy.cpp \ + colvarproxy_io.cpp \ colvarproxy_replicas.cpp \ + colvarproxy_system.cpp \ colvarproxy_tcl.cpp \ colvarproxy_volmaps.cpp \ colvarscript.cpp \ diff --git a/lib/colvars/Makefile.deps b/lib/colvars/Makefile.deps index 6619653af0..6bf5171710 100644 --- a/lib/colvars/Makefile.deps +++ b/lib/colvars/Makefile.deps @@ -1,371 +1,140 @@ $(COLVARS_OBJ_DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvarparse.h colvarparams.h \ - colvaratoms.h colvardeps.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvarparse.h colvarparams.h colvaratoms.h \ + colvardeps.h $(COLVARS_OBJ_DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h \ colvars_version.h colvar.h colvarvalue.h colvartypes.h colvarparse.h \ - colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarbias_abf.h colvarproxy.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvarbias.h colvargrid.h \ - colvar_UIestimator.h + colvarparams.h colvardeps.h colvarbias_abf.h colvarproxy.h \ + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvarbias.h colvargrid.h colvar_UIestimator.h $(COLVARS_OBJ_DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h \ colvars_version.h colvarbias.h colvar.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarbias_alb.h + colvarparse.h colvarparams.h colvardeps.h colvarbias_alb.h $(COLVARS_OBJ_DIR)colvarbias.o: colvarbias.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvarbias.h colvar.h \ - colvarparse.h colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvargrid.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvarbias.h colvar.h colvarparse.h colvarparams.h \ + colvardeps.h colvargrid.h $(COLVARS_OBJ_DIR)colvarbias_histogram.o: colvarbias_histogram.cpp \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ - colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h \ - colvarparse.h colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarbias_histogram.h colvarbias.h \ - colvargrid.h + colvarvalue.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar.h colvarparse.h colvarparams.h colvardeps.h \ + colvarbias_histogram.h colvarbias.h colvargrid.h $(COLVARS_OBJ_DIR)colvarbias_histogram_reweight_amd.o: \ colvarbias_histogram_reweight_amd.cpp \ colvarbias_histogram_reweight_amd.h colvarbias_histogram.h colvarbias.h \ colvar.h colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvargrid.h colvarproxy.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h + colvarparse.h colvarparams.h colvardeps.h colvargrid.h colvarproxy.h \ + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h $(COLVARS_OBJ_DIR)colvarbias_meta.o: colvarbias_meta.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \ - colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarbias_meta.h colvarbias.h \ - colvargrid.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar.h colvarparse.h colvarparams.h colvardeps.h \ + colvarbias_meta.h colvarbias.h colvargrid.h $(COLVARS_OBJ_DIR)colvarbias_restraint.o: colvarbias_restraint.cpp \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ - colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvarbias_restraint.h colvarbias.h colvar.h colvarparse.h \ - colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h + colvarvalue.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvarbias_restraint.h colvarbias.h colvar.h \ + colvarparse.h colvarparams.h colvardeps.h $(COLVARS_OBJ_DIR)colvarcomp_alchlambda.o: colvarcomp_alchlambda.cpp \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvar.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ + colvaratoms.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ + colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_angles.o: colvarcomp_angles.cpp \ colvarmodule.h colvars_version.h colvar.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h \ + colvarproxy.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_apath.o: colvarcomp_apath.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ - colvarparams.h colvar.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ + colvarproxy.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp \ colvarmodule.h colvars_version.h colvarparse.h colvarvalue.h \ colvartypes.h colvarparams.h colvaratoms.h colvarproxy.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvar.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvar_arithmeticpath.h \ - colvar_geometricpath.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvardeps.h colvar.h colvarcomp.h \ + colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h colvar.h colvarparse.h \ - colvarparams.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h \ + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_distances.o: colvarcomp_distances.cpp \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvar.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ + colvaratoms.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ + colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_gpath.o: colvarcomp_gpath.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ - colvarparams.h colvar.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ + colvarproxy.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_neuralnetwork.o: \ colvarcomp_neuralnetwork.cpp colvarmodule.h colvars_version.h \ colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \ - colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ + colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_io.h \ + colvarproxy_system.h colvarproxy_tcl.h colvarproxy_volmaps.h \ colvar_arithmeticpath.h colvar_geometricpath.h \ colvar_neuralnetworkcompute.h $(COLVARS_OBJ_DIR)colvarcomp_combination.o: colvarcomp_combination.cpp \ colvarcomp.h colvarmodule.h colvars_version.h colvar.h colvarvalue.h \ - colvartypes.h colvarparse.h colvarparams.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvaratoms.h colvarproxy.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ - colvar_geometricpath.h + colvartypes.h colvarparse.h colvarparams.h colvardeps.h colvaratoms.h \ + colvarproxy.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_protein.o: colvarcomp_protein.cpp \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvar.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ + colvaratoms.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ + colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvar.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ + colvaratoms.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ + colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvarcomp_volmaps.o: colvarcomp_volmaps.cpp \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ - colvarparse.h colvarparams.h colvar.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h + colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ + colvaratoms.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ + colvar_geometricpath.h $(COLVARS_OBJ_DIR)colvar.o: colvar.cpp colvarmodule.h colvars_version.h \ colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \ - colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ + colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_io.h \ + colvarproxy_system.h colvarproxy_tcl.h colvarproxy_volmaps.h \ colvar_arithmeticpath.h colvar_geometricpath.h colvarscript.h \ colvarbias.h colvarscript_commands.h colvarscript_commands_colvar.h \ colvarscript_commands_bias.h $(COLVARS_OBJ_DIR)colvardeps.o: colvardeps.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \ - colvarparams.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h $(COLVARS_OBJ_DIR)colvargrid.o: colvargrid.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ - colvarparams.h colvar.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarcomp.h colvaratoms.h \ - colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar_arithmeticpath.h colvar_geometricpath.h colvargrid.h + colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ + colvarproxy.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h \ + colvargrid.h colvargrid_def.h $(COLVARS_OBJ_DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h \ colvars_version.h colvarparse.h colvarvalue.h colvartypes.h \ - colvarparams.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ - colvar.h colvardeps.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarbias.h colvarbias_abf.h \ - colvargrid.h colvar_UIestimator.h colvarbias_alb.h \ - colvarbias_histogram.h colvarbias_histogram_reweight_amd.h \ - colvarbias_meta.h colvarbias_restraint.h colvarscript.h \ - colvarscript_commands.h colvarscript_commands_colvar.h \ - colvarscript_commands_bias.h colvaratoms.h colvarcomp.h \ - colvar_arithmeticpath.h colvar_geometricpath.h colvarmodule_refs.h + colvarparams.h colvarproxy.h colvarproxy_io.h colvarproxy_system.h \ + colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvardeps.h \ + colvarbias.h colvarbias_abf.h colvargrid.h colvar_UIestimator.h \ + colvarbias_alb.h colvarbias_histogram.h \ + colvarbias_histogram_reweight_amd.h colvarbias_meta.h \ + colvarbias_restraint.h colvarscript.h colvarscript_commands.h \ + colvarscript_commands_colvar.h colvarscript_commands_bias.h \ + colvaratoms.h colvarcomp.h colvar_arithmeticpath.h \ + colvar_geometricpath.h colvarmodule_refs.h $(COLVARS_OBJ_DIR)colvarparams.o: colvarparams.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparams.h $(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \ @@ -373,97 +142,53 @@ $(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \ colvarparams.h $(COLVARS_OBJ_DIR)colvarproxy.o: colvarproxy.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvarscript.h colvarbias.h \ - colvar.h colvarparse.h colvarparams.h colvardeps.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarscript_commands.h \ + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvarscript.h colvarbias.h colvar.h colvarparse.h \ + colvarparams.h colvardeps.h colvarscript_commands.h \ colvarscript_commands_colvar.h colvarscript_commands_bias.h \ colvaratoms.h colvarmodule_utils.h +$(COLVARS_OBJ_DIR)colvarproxy_io.o: colvarproxy_io.cpp colvarmodule.h \ + colvars_version.h colvarproxy_io.h $(COLVARS_OBJ_DIR)colvarproxy_replicas.o: colvarproxy_replicas.cpp \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ - colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h + colvarvalue.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h +$(COLVARS_OBJ_DIR)colvarproxy_system.o: colvarproxy_system.cpp \ + colvarmodule.h colvars_version.h colvartypes.h colvarproxy_system.h $(COLVARS_OBJ_DIR)colvarproxy_tcl.o: colvarproxy_tcl.cpp colvarmodule.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvaratoms.h colvarparse.h \ - colvarparams.h colvardeps.h + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvaratoms.h colvarparse.h colvarparams.h \ + colvardeps.h $(COLVARS_OBJ_DIR)colvarproxy_volmaps.o: colvarproxy_volmaps.cpp \ colvarmodule.h colvars_version.h colvarproxy_volmaps.h \ colvarmodule_utils.h $(COLVARS_OBJ_DIR)colvarscript.o: colvarscript.cpp colvarproxy.h \ colvarmodule.h colvars_version.h colvartypes.h colvarvalue.h \ - colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \ - colvarparams.h colvarscript.h colvarbias.h colvar.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarscript_commands.h \ + colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ + colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \ colvarscript_commands_colvar.h colvarscript_commands_bias.h $(COLVARS_OBJ_DIR)colvarscript_commands.o: colvarscript_commands.cpp \ colvarproxy.h colvarmodule.h colvars_version.h colvartypes.h \ - colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h \ - colvarparse.h colvarparams.h colvarscript.h colvarbias.h colvar.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarscript_commands.h \ + colvarvalue.h colvarproxy_io.h colvarproxy_system.h colvarproxy_tcl.h \ + colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ + colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \ colvarscript_commands_colvar.h colvarscript_commands_bias.h $(COLVARS_OBJ_DIR)colvarscript_commands_bias.o: \ colvarscript_commands_bias.cpp colvarproxy.h colvarmodule.h \ - colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \ - colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ - colvarscript.h colvarbias.h colvar.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarscript_commands.h \ - colvarscript_commands_colvar.h colvarscript_commands_bias.h + colvars_version.h colvartypes.h colvarvalue.h colvarproxy_io.h \ + colvarproxy_system.h colvarproxy_tcl.h colvarproxy_volmaps.h \ + colvardeps.h colvarparse.h colvarparams.h colvarscript.h colvarbias.h \ + colvar.h colvarscript_commands.h colvarscript_commands_colvar.h \ + colvarscript_commands_bias.h $(COLVARS_OBJ_DIR)colvarscript_commands_colvar.o: \ colvarscript_commands_colvar.cpp colvarproxy.h colvarmodule.h \ - colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \ - colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ - colvarscript.h colvarbias.h colvar.h ../lepton/include/Lepton.h \ - ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarscript_commands.h \ - colvarscript_commands_colvar.h colvarscript_commands_bias.h + colvars_version.h colvartypes.h colvarvalue.h colvarproxy_io.h \ + colvarproxy_system.h colvarproxy_tcl.h colvarproxy_volmaps.h \ + colvardeps.h colvarparse.h colvarparams.h colvarscript.h colvarbias.h \ + colvar.h colvarscript_commands.h colvarscript_commands_colvar.h \ + colvarscript_commands_bias.h $(COLVARS_OBJ_DIR)colvartypes.o: colvartypes.cpp colvarmodule.h \ colvars_version.h colvartypes.h colvarparse.h colvarvalue.h \ colvarparams.h ../../src/math_eigen_impl.h @@ -471,15 +196,6 @@ $(COLVARS_OBJ_DIR)colvarvalue.o: colvarvalue.cpp colvarmodule.h \ colvars_version.h colvarvalue.h colvartypes.h $(COLVARS_OBJ_DIR)colvar_neuralnetworkcompute.o: \ colvar_neuralnetworkcompute.cpp colvar_neuralnetworkcompute.h \ - ../lepton/include/Lepton.h ../lepton/include/lepton/CompiledExpression.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/windowsIncludes.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/ExpressionProgram.h \ - ../lepton/include/lepton/ExpressionTreeNode.h \ - ../lepton/include/lepton/Operation.h \ - ../lepton/include/lepton/CustomFunction.h \ - ../lepton/include/lepton/Exception.h \ - ../lepton/include/lepton/ParsedExpression.h \ - ../lepton/include/lepton/Parser.h colvarparse.h colvarmodule.h \ - colvars_version.h colvarvalue.h colvartypes.h colvarparams.h + colvarparse.h colvarmodule.h colvars_version.h colvarvalue.h \ + colvartypes.h colvarparams.h colvarproxy.h colvarproxy_io.h \ + colvarproxy_system.h colvarproxy_tcl.h colvarproxy_volmaps.h diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index 85b8443d72..700d3752ac 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include "colvarmodule.h" #include "colvarvalue.h" @@ -24,8 +26,6 @@ std::mapproxy; get_keyval_feature(this, conf, "extendedLagrangian", f_cv_extended_Lagrangian, false); if (is_enabled(f_cv_extended_Lagrangian)) { @@ -646,7 +646,8 @@ int colvar::init_extended_Lagrangian(std::string const &conf) x_ext.type(colvarvalue::type_notset); v_ext.type(value()); fr.type(value()); - const bool temp_provided = get_keyval(conf, "extendedTemp", temp, cvm::temperature()); + const bool temp_provided = get_keyval(conf, "extendedTemp", temp, + proxy->target_temperature()); if (is_enabled(f_cv_external)) { // In the case of an "external" coordinate, there is no coupling potential: // only the fictitious mass is meaningful @@ -669,14 +670,14 @@ int colvar::init_extended_Lagrangian(std::string const &conf) cvm::error("Error: \"extendedFluctuation\" must be positive.\n", COLVARS_INPUT_ERROR); return COLVARS_INPUT_ERROR; } - ext_force_k = cvm::boltzmann() * temp / (tolerance * tolerance); + ext_force_k = proxy->boltzmann() * temp / (tolerance * tolerance); cvm::log("Computed extended system force constant: " + cvm::to_str(ext_force_k) + " [E]/U^2\n"); get_keyval(conf, "extendedTimeConstant", extended_period, 200.0); if (extended_period <= 0.0) { cvm::error("Error: \"extendedTimeConstant\" must be positive.\n", COLVARS_INPUT_ERROR); } - ext_mass = (cvm::boltzmann() * temp * extended_period * extended_period) + ext_mass = (proxy->boltzmann() * temp * extended_period * extended_period) / (4.0 * PI * PI * tolerance * tolerance); cvm::log("Computed fictitious mass: " + cvm::to_str(ext_mass) + " [E]/(U/fs)^2 (U: colvar unit)\n"); } @@ -697,7 +698,7 @@ int colvar::init_extended_Lagrangian(std::string const &conf) enable(f_cv_Langevin); ext_gamma *= 1.0e-3; // correct as long as input is required in ps-1 and cvm::dt() is in fs // Adjust Langevin sigma for slow time step if time_step_factor != 1 - ext_sigma = cvm::sqrt(2.0 * cvm::boltzmann() * temp * ext_gamma * ext_mass / (cvm::dt() * cvm::real(time_step_factor))); + ext_sigma = cvm::sqrt(2.0 * proxy->boltzmann() * temp * ext_gamma * ext_mass / (cvm::dt() * cvm::real(time_step_factor))); } get_keyval_feature(this, conf, "reflectingLowerBoundary", f_cv_reflecting_lower_boundary, false); @@ -1664,6 +1665,7 @@ int colvar::calc_cvc_Jacobians(int first_cvc, size_t num_cvcs) int colvar::collect_cvc_Jacobians() { + colvarproxy *proxy = cvm::main()->proxy; if (is_enabled(f_cv_Jacobian)) { fj.reset(); for (size_t i = 0; i < cvcs.size(); i++) { @@ -1676,7 +1678,7 @@ int colvar::collect_cvc_Jacobians() // linear combination is assumed fj += (cvcs[i])->Jacobian_derivative() * (cvcs[i])->sup_coeff / active_cvc_square_norm; } - fj *= cvm::boltzmann() * cvm::temperature(); + fj *= proxy->boltzmann() * proxy->target_temperature(); } return COLVARS_OK; @@ -2411,8 +2413,8 @@ std::ostream & colvar::write_state(std::ostream &os) { os << "}\n\n"; - if (runave_os) { - cvm::main()->proxy->flush_output_stream(runave_os); + if (runave_outfile.size() > 0) { + cvm::main()->proxy->flush_output_stream(runave_outfile); } return os; @@ -2536,9 +2538,13 @@ int colvar::write_output_files() } cvm::log("Writing correlation function to file \""+acf_outfile+"\".\n"); cvm::backup_file(acf_outfile.c_str()); - std::ostream *acf_os = cvm::proxy->output_stream(acf_outfile); - if (!acf_os) return cvm::get_error(); - error_code |= write_acf(*acf_os); + std::ostream &acf_os = cvm::proxy->output_stream(acf_outfile, + "colvar ACF file"); + if (!acf_os) { + error_code |= COLVARS_FILE_ERROR; + } else { + error_code |= write_acf(acf_os); + } cvm::proxy->close_output_stream(acf_outfile); } } @@ -2807,6 +2813,7 @@ int colvar::write_acf(std::ostream &os) int colvar::calc_runave() { int error_code = COLVARS_OK; + colvarproxy *proxy = cvm::main()->proxy; if (x_history.empty()) { @@ -2831,22 +2838,22 @@ int colvar::calc_runave() if ((*x_history_p).size() >= runave_length-1) { - if (runave_os == NULL) { - if (runave_outfile.size() == 0) { - runave_outfile = std::string(cvm::output_prefix()+"."+ - this->name+".runave.traj"); - } + if (runave_outfile.size() == 0) { + runave_outfile = std::string(cvm::output_prefix()+"."+ + this->name+".runave.traj"); + } + if (! proxy->output_stream_exists(runave_outfile)) { size_t const this_cv_width = x.output_width(cvm::cv_width); - cvm::proxy->backup_file(runave_outfile); - runave_os = cvm::proxy->output_stream(runave_outfile); - runave_os->setf(std::ios::scientific, std::ios::floatfield); - *runave_os << "# " << cvm::wrap_string("step", cvm::it_width-2) - << " " - << cvm::wrap_string("running average", this_cv_width) - << " " - << cvm::wrap_string("running stddev", this_cv_width) - << "\n"; + std::ostream &runave_os = proxy->output_stream(runave_outfile, + "colvar running average"); + runave_os.setf(std::ios::scientific, std::ios::floatfield); + runave_os << "# " << cvm::wrap_string("step", cvm::it_width-2) + << " " + << cvm::wrap_string("running average", this_cv_width) + << " " + << cvm::wrap_string("running stddev", this_cv_width) + << "\n"; } runave = x; @@ -2866,12 +2873,17 @@ int colvar::calc_runave() } runave_variance *= 1.0 / cvm::real(runave_length-1); - *runave_os << std::setw(cvm::it_width) << cvm::step_relative() - << " " - << std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width) - << runave << " " - << std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width) - << cvm::sqrt(runave_variance) << "\n"; + if (runave_outfile.size() > 0) { + std::ostream &runave_os = proxy->output_stream(runave_outfile); + runave_os << std::setw(cvm::it_width) << cvm::step_relative() + << " " + << std::setprecision(cvm::cv_prec) + << std::setw(cvm::cv_width) + << runave << " " + << std::setprecision(cvm::cv_prec) + << std::setw(cvm::cv_width) + << cvm::sqrt(runave_variance) << "\n"; + } } history_add_value(runave_length, *x_history_p, x); diff --git a/lib/colvars/colvar.h b/lib/colvars/colvar.h index 7b2863a3b5..9af26dedd3 100644 --- a/lib/colvars/colvar.h +++ b/lib/colvars/colvar.h @@ -551,8 +551,6 @@ protected: size_t runave_stride; /// Name of the file to write the running average std::string runave_outfile; - /// File to write the running average - std::ostream *runave_os; /// Current value of the running average colvarvalue runave; /// Current value of the square deviation from the running average diff --git a/lib/colvars/colvar_UIestimator.h b/lib/colvars/colvar_UIestimator.h index ca1ecc8c43..30a90a5799 100644 --- a/lib/colvars/colvar_UIestimator.h +++ b/lib/colvars/colvar_UIestimator.h @@ -1,4 +1,4 @@ -// -*- c++ -*- +// -*- Mode:c++; c-basic-offset: 4; -*- // This file is part of the Collective Variables module (Colvars). // The original version of Colvars and its updates are located at: @@ -21,6 +21,7 @@ // only for colvar module! // when integrated into other code, just remove this line and "...cvm::backup_file(...)" #include "colvarmodule.h" +#include "colvarproxy.h" namespace UIestimator { const int Y_SIZE = 21; // defines the range of extended CV with respect to a given CV @@ -380,6 +381,8 @@ namespace UIestimator { public: // calculate gradients from the internal variables void calc_pmf() { + colvarproxy *proxy = cvm::main()->proxy; + int norm; int i, j, k; @@ -455,7 +458,7 @@ namespace UIestimator { std::vector grad_temp(dimension, 0); for (k = 0; k < dimension; k++) { diff_av[k] /= (norm > 0 ? norm : 1); - av[k] = cvm::boltzmann() * temperature * av[k] / (norm > 0 ? norm : 1); + av[k] = proxy->boltzmann() * temperature * av[k] / (norm > 0 ? norm : 1); grad_temp[k] = av[k] - krestr[k] * diff_av[k]; } grad.set_value(loop_flag_x, grad_temp); @@ -515,15 +518,16 @@ namespace UIestimator { // only for colvars module! if (written_1D) cvm::backup_file(pmf_filename.c_str()); - std::ostream* ofile_pmf = cvm::proxy->output_stream(pmf_filename.c_str()); + std::ostream &ofile_pmf = cvm::proxy->output_stream(pmf_filename, + "PMF file"); std::vector position(1, 0); for (double i = lowerboundary[0]; i < upperboundary[0] + EPSILON; i += width[0]) { - *ofile_pmf << i << " "; + ofile_pmf << i << " "; position[0] = i + EPSILON; - *ofile_pmf << oneD_pmf.get_value(position) << std::endl; + ofile_pmf << oneD_pmf.get_value(position) << std::endl; } - cvm::proxy->close_output_stream(pmf_filename.c_str()); + cvm::proxy->close_output_stream(pmf_filename); written_1D = true; } @@ -541,7 +545,8 @@ namespace UIestimator { void write_interal_data() { std::string internal_filename = output_filename + ".UI.internal"; - std::ostream* ofile_internal = cvm::proxy->output_stream(internal_filename.c_str()); + std::ostream &ofile_internal = cvm::proxy->output_stream(internal_filename, + "UI internal file"); std::vector loop_flag(dimension, 0); for (int i = 0; i < dimension; i++) { @@ -551,11 +556,11 @@ namespace UIestimator { int n = 0; while (n >= 0) { for (int j = 0; j < dimension; j++) { - *ofile_internal << loop_flag[j] + 0.5 * width[j] << " "; + ofile_internal << loop_flag[j] + 0.5 * width[j] << " "; } for (int k = 0; k < dimension; k++) { - *ofile_internal << grad.get_value(loop_flag)[k] << " "; + ofile_internal << grad.get_value(loop_flag)[k] << " "; } std::vector ii(dimension,0); @@ -563,10 +568,10 @@ namespace UIestimator { for (double j = loop_flag[1] - 10; j< loop_flag[1] + 10 + EPSILON; j+=width[1]) { ii[0] = i; ii[1] = j; - *ofile_internal << i <<" "<output_stream(grad_filename.c_str()); - std::ostream* ofile_hist = cvm::proxy->output_stream(hist_filename.c_str(), std::ios::app); - std::ostream* ofile_count = cvm::proxy->output_stream(count_filename.c_str()); + std::ostream &ofile = cvm::proxy->output_stream(grad_filename, + "gradient file"); + std::ostream &ofile_hist = cvm::proxy->output_stream(hist_filename, + "gradient history file"); + std::ostream &ofile_count = cvm::proxy->output_stream(count_filename, + "count file"); - writehead(*ofile); - writehead(*ofile_hist); - writehead(*ofile_count); + writehead(ofile); + writehead(ofile_hist); + writehead(ofile_count); if (dimension == 1) { calc_1D_pmf(); @@ -617,19 +625,19 @@ namespace UIestimator { i = 0; while (i >= 0) { for (j = 0; j < dimension; j++) { - *ofile << loop_flag[j] + 0.5 * width[j] << " "; - *ofile_hist << loop_flag[j] + 0.5 * width[j] << " "; - *ofile_count << loop_flag[j] + 0.5 * width[j] << " "; + ofile << loop_flag[j] + 0.5 * width[j] << " "; + ofile_hist << loop_flag[j] + 0.5 * width[j] << " "; + ofile_count << loop_flag[j] + 0.5 * width[j] << " "; } if (restart == false) { for (j = 0; j < dimension; j++) { - *ofile << grad.get_value(loop_flag)[j] << " "; - *ofile_hist << grad.get_value(loop_flag)[j] << " "; + ofile << grad.get_value(loop_flag)[j] << " "; + ofile_hist << grad.get_value(loop_flag)[j] << " "; } - *ofile << std::endl; - *ofile_hist << std::endl; - *ofile_count << count.get_value(loop_flag) << " " < upperboundary[i] - width[i] + EPSILON) { loop_flag[i] = lowerboundary[i]; i--; - *ofile << std::endl; - *ofile_hist << std::endl; - *ofile_count << std::endl; + ofile << std::endl; + ofile_hist << std::endl; + ofile_count << std::endl; } else break; } } cvm::proxy->close_output_stream(grad_filename.c_str()); - cvm::proxy->close_output_stream(hist_filename.c_str()); + // cvm::proxy->close_output_stream(hist_filename.c_str()); cvm::proxy->close_output_stream(count_filename.c_str()); written = true; @@ -677,6 +685,7 @@ namespace UIestimator { int dimension_temp; int i, j, k, l, m; + colvarproxy *proxy = cvm::main()->proxy; std::vector loop_bin_size(dimension, 0); std::vector position_temp(dimension, 0); std::vector grad_temp(dimension, 0); @@ -687,8 +696,14 @@ namespace UIestimator { std::string count_filename = filename[i] + ".UI.count"; std::string grad_filename = filename[i] + ".UI.grad"; - std::ifstream count_file(count_filename.c_str(), std::ios::in); - std::ifstream grad_file(grad_filename.c_str(), std::ios::in); + std::istream &count_file = + proxy->input_stream(count_filename, "count filename"); + std::istream &grad_file = + proxy->input_stream(grad_filename, "gradient filename"); + + if (!count_file || !grad_file) { + return; + } count_file >> sharp >> dimension_temp; grad_file >> sharp >> dimension_temp; @@ -724,8 +739,8 @@ namespace UIestimator { input_count.increase_value(position_temp, count_temp); } - count_file.close(); - grad_file.close(); + proxy->close_input_stream(count_filename); + proxy->close_input_stream(grad_filename); } } }; diff --git a/lib/colvars/colvar_arithmeticpath.h b/lib/colvars/colvar_arithmeticpath.h index cf613af389..bea86a1014 100644 --- a/lib/colvars/colvar_arithmeticpath.h +++ b/lib/colvars/colvar_arithmeticpath.h @@ -5,7 +5,6 @@ #include #include -#include #include #include diff --git a/lib/colvars/colvar_geometricpath.h b/lib/colvars/colvar_geometricpath.h index 7f8acfd233..9ff78261f2 100644 --- a/lib/colvars/colvar_geometricpath.h +++ b/lib/colvars/colvar_geometricpath.h @@ -12,10 +12,8 @@ #include #include -#include #include #include -#include namespace GeometricPathCV { diff --git a/lib/colvars/colvar_neuralnetworkcompute.cpp b/lib/colvars/colvar_neuralnetworkcompute.cpp index d0f9633652..a1ad717946 100644 --- a/lib/colvars/colvar_neuralnetworkcompute.cpp +++ b/lib/colvars/colvar_neuralnetworkcompute.cpp @@ -1,6 +1,19 @@ +// -*- Mode:c++; c-basic-offset: 4; -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + +#include +#include + #if (__cplusplus >= 201103L) #include "colvar_neuralnetworkcompute.h" #include "colvarparse.h" +#include "colvarproxy.h" namespace neuralnetworkCV { std::map, std::function>> activation_function_map @@ -124,12 +137,10 @@ void denseLayer::readFromFile(const std::string& weights_file, const std::string m_weights.clear(); m_biases.clear(); std::string line; - std::ifstream ifs_weights(weights_file.c_str()); - if (!ifs_weights) { - throw std::runtime_error("Cannot open file " + weights_file); - } + colvarproxy *proxy = cvm::main()->proxy; + auto &ifs_weights = proxy->input_stream(weights_file, "weights file"); while (std::getline(ifs_weights, line)) { - if (ifs_weights.bad()) { + if (!ifs_weights) { throw std::runtime_error("I/O error while reading " + weights_file); } std::vector splitted_data; @@ -146,13 +157,12 @@ void denseLayer::readFromFile(const std::string& weights_file, const std::string m_weights.push_back(weights_tmp); } } + proxy->close_input_stream(weights_file); + // parse biases file - std::ifstream ifs_biases(biases_file.c_str()); - if (!ifs_biases) { - throw std::runtime_error("Cannot open file " + biases_file); - } + auto &ifs_biases = proxy->input_stream(biases_file, "biases file"); while (std::getline(ifs_biases, line)) { - if (ifs_biases.bad()) { + if (!ifs_biases) { throw std::runtime_error("I/O error while reading " + biases_file); } std::vector splitted_data; @@ -167,6 +177,8 @@ void denseLayer::readFromFile(const std::string& weights_file, const std::string m_biases.push_back(bias); } } + proxy->close_input_stream(biases_file); + m_input_size = m_weights[0].size(); m_output_size = m_weights.size(); } diff --git a/lib/colvars/colvar_neuralnetworkcompute.h b/lib/colvars/colvar_neuralnetworkcompute.h index a48f8c7f14..5a56887431 100644 --- a/lib/colvars/colvar_neuralnetworkcompute.h +++ b/lib/colvars/colvar_neuralnetworkcompute.h @@ -1,3 +1,12 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + #if (__cplusplus >= 201103L) #ifndef NEURALNETWORKCOMPUTE_H #define NEURALNETWORKCOMPUTE_H @@ -5,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index f950bf5965..e31041ea6b 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include "colvarmodule.h" #include "colvarproxy.h" @@ -29,12 +31,8 @@ cvm::atom::atom() cvm::atom::atom(int atom_number) { - colvarproxy *p = cvm::proxy; + colvarproxy *p = cvm::main()->proxy; index = p->init_atom(atom_number); - if (cvm::debug()) { - cvm::log("The index of this atom in the colvarproxy arrays is "+ - cvm::to_str(index)+".\n"); - } id = p->get_atom_id(index); update_mass(); update_charge(); @@ -46,12 +44,8 @@ cvm::atom::atom(cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id) { - colvarproxy *p = cvm::proxy; + colvarproxy *p = cvm::main()->proxy; index = p->init_atom(residue, atom_name, segment_id); - if (cvm::debug()) { - cvm::log("The index of this atom in the colvarproxy_namd arrays is "+ - cvm::to_str(index)+".\n"); - } id = p->get_atom_id(index); update_mass(); update_charge(); @@ -62,7 +56,9 @@ cvm::atom::atom(cvm::residue_id const &residue, cvm::atom::atom(atom const &a) : index(a.index) { - id = (cvm::proxy)->get_atom_id(index); + colvarproxy *p = cvm::main()->proxy; + id = p->get_atom_id(index); + p->increase_refcount(index); update_mass(); update_charge(); reset_data(); @@ -72,7 +68,7 @@ cvm::atom::atom(atom const &a) cvm::atom::~atom() { if (index >= 0) { - (cvm::proxy)->clear_atom(index); + (cvm::main()->proxy)->clear_atom(index); } } @@ -80,7 +76,7 @@ cvm::atom::~atom() cvm::atom & cvm::atom::operator = (cvm::atom const &a) { index = a.index; - id = (cvm::proxy)->get_atom_id(index); + id = (cvm::main()->proxy)->get_atom_id(index); update_mass(); update_charge(); reset_data(); @@ -113,7 +109,7 @@ cvm::atom_group::atom_group(std::vector const &atoms_in) cvm::atom_group::~atom_group() { if (is_enabled(f_ag_scalable) && !b_dummy) { - (cvm::proxy)->clear_atom_group(index); + (cvm::main()->proxy)->clear_atom_group(index); index = -1; } @@ -330,7 +326,7 @@ void cvm::atom_group::update_total_mass() } if (is_enabled(f_ag_scalable)) { - total_mass = (cvm::proxy)->get_atom_group_mass(index); + total_mass = (cvm::main()->proxy)->get_atom_group_mass(index); } else { total_mass = 0.0; for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) { @@ -351,7 +347,7 @@ void cvm::atom_group::update_total_charge() } if (is_enabled(f_ag_scalable)) { - total_charge = (cvm::proxy)->get_atom_group_charge(index); + total_charge = (cvm::main()->proxy)->get_atom_group_charge(index); } else { total_charge = 0.0; for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) { diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index bb2f2310f7..18969fc531 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -7,7 +7,7 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. -#include +#include #include #include "colvarmodule.h" @@ -42,6 +42,8 @@ colvarbias::colvarbias(char const *key) int colvarbias::init(std::string const &conf) { + int error_code = COLVARS_OK; + name = bias_type + cvm::to_str(rank); colvarparse::set_string(conf); @@ -59,9 +61,9 @@ int colvarbias::init(std::string const &conf) if (bias_with_name != NULL) { if ((bias_with_name->rank != this->rank) || (bias_with_name->bias_type != this->bias_type)) { - cvm::error("Error: this bias cannot have the same name, \""+this->name+ - "\", as another bias.\n", COLVARS_INPUT_ERROR); - return COLVARS_INPUT_ERROR; + error_code |= cvm::error("Error: this bias cannot have the same name, \""+ + this->name+"\", as another bias.\n", + COLVARS_INPUT_ERROR); } } description = "bias " + name; @@ -71,9 +73,9 @@ int colvarbias::init(std::string const &conf) std::vector colvar_names; if (get_keyval(conf, "colvars", colvar_names)) { if (num_variables()) { - cvm::error("Error: cannot redefine the colvars that a bias was already defined on.\n", - COLVARS_INPUT_ERROR); - return COLVARS_INPUT_ERROR; + error_code |= cvm::error("Error: cannot redefine the colvars that " + "a bias was already defined on.\n", + COLVARS_INPUT_ERROR); } for (i = 0; i < colvar_names.size(); i++) { add_colvar(colvar_names[i]); @@ -82,8 +84,8 @@ int colvarbias::init(std::string const &conf) } if (!num_variables()) { - cvm::error("Error: no collective variables specified.\n", COLVARS_INPUT_ERROR); - return COLVARS_INPUT_ERROR; + error_code |= cvm::error("Error: no collective variables specified.\n", + COLVARS_INPUT_ERROR); } } else { @@ -112,8 +114,8 @@ int colvarbias::init(std::string const &conf) get_keyval(conf, "timeStepFactor", time_step_factor, time_step_factor); if (time_step_factor < 1) { - cvm::error("Error: timeStepFactor must be 1 or greater.\n"); - return COLVARS_ERROR; + error_code |= cvm::error("Error: timeStepFactor must be 1 or greater.\n", + COLVARS_INPUT_ERROR); } // Use the scaling factors from a grid? @@ -124,25 +126,17 @@ int colvarbias::init(std::string const &conf) std::string biasing_force_scaling_factors_in_filename; get_keyval(conf, "scaledBiasingForceFactorsGrid", biasing_force_scaling_factors_in_filename, std::string()); - std::ifstream is; - cvm::log("Reading scaling factors for the forces of bias " + - name + " from " + biasing_force_scaling_factors_in_filename); - is.open(biasing_force_scaling_factors_in_filename.c_str()); - if (!is.is_open()) { - cvm::error("Error opening the grid file " + - biasing_force_scaling_factors_in_filename + " for reading"); - } biasing_force_scaling_factors = new colvar_grid_scalar(colvars); - biasing_force_scaling_factors->read_multicol(is, true); + error_code |= biasing_force_scaling_factors->read_multicol(biasing_force_scaling_factors_in_filename, + "grid file"); biasing_force_scaling_factors_bin.assign(num_variables(), 0); - is.close(); } // Now that children are defined, we can solve dependencies enable(f_cvb_active); if (cvm::debug()) print_state(); - return COLVARS_OK; + return error_code; } @@ -377,10 +371,11 @@ int colvarbias::calc_forces(std::vector const *) } -void colvarbias::communicate_forces() +int colvarbias::communicate_forces() { + int error_code = COLVARS_OK; if (! is_enabled(f_cvb_apply_force)) { - return; + return error_code; } cvm::real biasing_force_factor = 1.0; size_t i = 0; @@ -409,6 +404,7 @@ void colvarbias::communicate_forces() } previous_colvar_forces[i] = colvar_forces[i]; } + return error_code; } @@ -573,11 +569,11 @@ int colvarbias::write_state_prefix(std::string const &prefix) { std::string const filename = cvm::state_file_prefix(prefix.c_str())+".colvars.state"; - std::ostream *os = cvm::proxy->output_stream(filename.c_str()); + std::ostream &os = cvm::proxy->output_stream(filename.c_str(), "bias state file"); int error_code = COLVARS_OK; - if (os != NULL) { - os->setf(std::ios::scientific, std::ios::floatfield); - error_code = write_state(*os).good() ? COLVARS_OK : COLVARS_FILE_ERROR; + if (os) { + os.setf(std::ios::scientific, std::ios::floatfield); + error_code = write_state(os) ? COLVARS_OK : COLVARS_FILE_ERROR; } else { error_code = COLVARS_FILE_ERROR; } @@ -600,17 +596,19 @@ int colvarbias::write_state_string(std::string &output) int colvarbias::read_state_prefix(std::string const &prefix) { - std::string filename((prefix+std::string(".colvars.state")).c_str()); - std::ifstream is(filename.c_str()); - if (!is.good()) { - // try without the suffix - is.clear(); + std::string filename(prefix+std::string(".colvars.state")); + std::istream *is = &(cvm::main()->proxy->input_stream(filename, + "bias state file", + false)); + if (!*is) { filename = prefix; - is.open(filename.c_str()); + is = &(cvm::main()->proxy->input_stream(filename, "bias state file")); } - return read_state(is).good() ? COLVARS_OK : - cvm::error("Error: in reading state for \""+name+"\" from input file \""+ - std::string(filename)+"\".\n", COLVARS_FILE_ERROR); + + if (read_state(*is)) { + return cvm::main()->proxy->close_input_stream(filename); + } + return COLVARS_FILE_ERROR; } @@ -899,6 +897,8 @@ std::istream & colvarbias_ti::read_state_data(std::istream &is) int colvarbias_ti::write_output_files() { + int error_code = COLVARS_OK; + if (!has_data) { // nothing to write return COLVARS_OK; @@ -906,38 +906,30 @@ int colvarbias_ti::write_output_files() std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name; - std::ostream *os = NULL; - if (is_enabled(f_cvb_write_ti_samples)) { std::string const ti_count_file_name(ti_output_prefix+".ti.count"); - os = cvm::proxy->output_stream(ti_count_file_name); - if (os) { - ti_count->write_multicol(*os); - cvm::proxy->close_output_stream(ti_count_file_name); - } + error_code |= ti_count->write_multicol(ti_count_file_name, "TI count file"); std::string const ti_grad_file_name(ti_output_prefix+".ti.force"); - os = cvm::proxy->output_stream(ti_grad_file_name); - if (os) { - ti_avg_forces->write_multicol(*os); - cvm::proxy->close_output_stream(ti_grad_file_name); - } + error_code |= ti_avg_forces->write_multicol(ti_grad_file_name, "TI gradient file"); } if (is_enabled(f_cvb_write_ti_pmf)) { std::string const pmf_file_name(ti_output_prefix+".ti.pmf"); cvm::log("Writing TI PMF to file \""+pmf_file_name+"\".\n"); - os = cvm::proxy->output_stream(pmf_file_name); + std::ostream &os = cvm::proxy->output_stream(pmf_file_name, "TI PMF"); if (os) { // get the FE gradient ti_avg_forces->multiply_constant(-1.0); - ti_avg_forces->write_1D_integral(*os); + ti_avg_forces->write_1D_integral(os); ti_avg_forces->multiply_constant(-1.0); cvm::proxy->close_output_stream(pmf_file_name); + } else { + error_code |= COLVARS_FILE_ERROR; } } - return COLVARS_OK; + return error_code; } diff --git a/lib/colvars/colvarbias.h b/lib/colvars/colvarbias.h index ecb3e1eff1..e865902be6 100644 --- a/lib/colvars/colvarbias.h +++ b/lib/colvars/colvarbias.h @@ -73,7 +73,7 @@ public: virtual int calc_forces(std::vector const *values); /// Send forces to the collective variables - void communicate_forces(); + int communicate_forces(); /// Carry out operations needed before next step is run virtual int end_of_step(); diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index 5cb5e7af24..7d6b7b7fef 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -7,6 +7,8 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include + #include "colvarmodule.h" #include "colvar.h" #include "colvarbias_abf.h" @@ -38,17 +40,17 @@ colvarbias_abf::colvarbias_abf(char const *key) int colvarbias_abf::init(std::string const &conf) { + colvarproxy *proxy = cvm::main()->proxy; + colvarbias::init(conf); cvm::main()->cite_feature("ABF colvar bias implementation"); - colvarproxy *proxy = cvm::main()->proxy; - enable(f_cvb_scalar_variables); enable(f_cvb_calc_pmf); - // TODO relax this in case of VMD plugin - if (cvm::temperature() == 0.0) + if ((proxy->target_temperature() == 0.0) && proxy->simulation_running()) { cvm::log("WARNING: ABF should not be run without a thermostat or at 0 Kelvin!\n"); + } // ************* parsing general ABF options *********************** @@ -277,7 +279,7 @@ int colvarbias_abf::init(std::string const &conf) cvm::restart_out_freq, UI_restart, // whether restart from a .count and a .grad file input_prefix, // the prefixes of input files - cvm::temperature()); + proxy->target_temperature()); } } @@ -599,17 +601,17 @@ int colvarbias_abf::replica_share() { template int colvarbias_abf::write_grid_to_file(T const *grid, std::string const &filename, bool close) { - std::ostream *os = cvm::proxy->output_stream(filename); + std::ostream &os = cvm::proxy->output_stream(filename); if (!os) { return cvm::error("Error opening file " + filename + " for writing.\n", COLVARS_ERROR | COLVARS_FILE_ERROR); } - grid->write_multicol(*os); + grid->write_multicol(os); if (close) { cvm::proxy->close_output_stream(filename); } else { // Insert empty line between frames in history files - *os << std::endl; - cvm::proxy->flush_output_stream(os); + os << std::endl; + cvm::proxy->flush_output_stream(filename); } // In dimension higher than 2, dx is easier to handle and visualize @@ -617,11 +619,11 @@ template int colvarbias_abf::write_grid_to_file(T const *grid, // (could be implemented as multiple dx files) if (num_variables() > 2 && close) { std::string dx = filename + ".dx"; - std::ostream *dx_os = cvm::proxy->output_stream(dx); + std::ostream &dx_os = cvm::proxy->output_stream(dx); if (!dx_os) { return cvm::error("Error opening file " + dx + " for writing.\n", COLVARS_ERROR | COLVARS_FILE_ERROR); } - grid->write_opendx(*dx_os); + grid->write_opendx(dx_os); // if (close) { cvm::proxy->close_output_stream(dx); // } @@ -637,6 +639,8 @@ template int colvarbias_abf::write_grid_to_file(T const *grid, void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool close) { + colvarproxy *proxy = cvm::main()->proxy; + write_grid_to_file(samples, prefix + ".count", close); write_grid_to_file(gradients, prefix + ".grad", close); @@ -660,7 +664,7 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool clo czar_gradients->index_ok(ix); czar_gradients->incr(ix)) { for (size_t n = 0; n < czar_gradients->multiplicity(); n++) { czar_gradients->set_value(ix, z_gradients->value_output(ix, n) - - cvm::temperature() * cvm::boltzmann() * z_samples->log_gradient_finite_diff(ix, n), n); + - proxy->target_temperature() * proxy->boltzmann() * z_samples->log_gradient_finite_diff(ix, n), n); } } write_grid_to_file(czar_gradients, prefix + ".czar.grad", close); @@ -698,8 +702,10 @@ int colvarbias_abf::bin_count(int bin_index) { } -void colvarbias_abf::read_gradients_samples() +int colvarbias_abf::read_gradients_samples() { + int error_code = COLVARS_OK; + std::string samples_in_name, gradients_in_name, z_samples_in_name, z_gradients_in_name; for ( size_t i = 0; i < input_prefix.size(); i++ ) { @@ -708,43 +714,30 @@ void colvarbias_abf::read_gradients_samples() z_samples_in_name = input_prefix[i] + ".zcount"; z_gradients_in_name = input_prefix[i] + ".zgrad"; // For user-provided files, the per-bias naming scheme may not apply + cvm::log("Reading sample count from " + samples_in_name + + " and gradient from " + gradients_in_name); - std::ifstream is; + error_code |= samples->read_multicol(samples_in_name, + "ABF samples file", + true); - cvm::log("Reading sample count from " + samples_in_name + " and gradient from " + gradients_in_name); - is.open(samples_in_name.c_str()); - if (!is.is_open()) cvm::error("Error opening ABF samples file " + samples_in_name + " for reading"); - samples->read_multicol(is, true); - is.close(); - is.clear(); - - is.open(gradients_in_name.c_str()); - if (!is.is_open()) { - cvm::error("Error opening ABF gradient file " + - gradients_in_name + " for reading", COLVARS_INPUT_ERROR); - } else { - gradients->read_multicol(is, true); - is.close(); - } + error_code |= gradients->read_multicol(gradients_in_name, + "ABF gradient file", + true); if (b_CZAR_estimator) { // Read eABF z-averaged data for CZAR cvm::log("Reading z-histogram from " + z_samples_in_name + " and z-gradient from " + z_gradients_in_name); - - is.clear(); - is.open(z_samples_in_name.c_str()); - if (!is.is_open()) cvm::error("Error opening eABF z-histogram file " + z_samples_in_name + " for reading"); - z_samples->read_multicol(is, true); - is.close(); - is.clear(); - - is.open(z_gradients_in_name.c_str()); - if (!is.is_open()) cvm::error("Error opening eABF z-gradient file " + z_gradients_in_name + " for reading"); - z_gradients->read_multicol(is, true); - is.close(); + error_code |= z_samples->read_multicol(z_samples_in_name, + "eABF z-histogram file", + true); + error_code |= z_gradients->read_multicol(z_gradients_in_name, + "eABF z-gradient file", + true); } } - return; + + return error_code; } diff --git a/lib/colvars/colvarbias_abf.h b/lib/colvars/colvarbias_abf.h index 3a3120a058..f5d5bd267f 100644 --- a/lib/colvars/colvarbias_abf.h +++ b/lib/colvars/colvarbias_abf.h @@ -155,7 +155,7 @@ private: void write_gradients_samples(const std::string &prefix, bool close = true); /// Read human-readable FE gradients and sample count (if not using restart) - void read_gradients_samples(); + int read_gradients_samples(); /// Template used in write_gradient_samples() template int write_grid_to_file(T const *grid, diff --git a/lib/colvars/colvarbias_alb.cpp b/lib/colvars/colvarbias_alb.cpp index 5f39b0d93a..b432659bf4 100644 --- a/lib/colvars/colvarbias_alb.cpp +++ b/lib/colvars/colvarbias_alb.cpp @@ -7,9 +7,12 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include +#include #include #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvarbias.h" #include "colvarbias_alb.h" @@ -36,6 +39,7 @@ colvarbias_alb::colvarbias_alb(char const *key) int colvarbias_alb::init(std::string const &conf) { + colvarproxy *proxy = cvm::main()->proxy; colvarbias::init(conf); cvm::main()->cite_feature("ALB colvar bias implementation"); @@ -110,10 +114,12 @@ int colvarbias_alb::init(std::string const &conf) if (!get_keyval(conf, "forceRange", max_coupling_range, max_coupling_range)) { //set to default for (i = 0; i < num_variables(); i++) { - if (cvm::temperature() > 0) - max_coupling_range[i] = 3 * cvm::temperature() * cvm::boltzmann(); - else - max_coupling_range[i] = 3 * cvm::boltzmann(); + if (proxy->target_temperature() > 0.0) { + max_coupling_range[i] = 3 * proxy->target_temperature() * + proxy->boltzmann(); + } else { + max_coupling_range[i] = 3 * proxy->boltzmann(); + } } } @@ -139,6 +145,7 @@ colvarbias_alb::~colvarbias_alb() int colvarbias_alb::update() { + colvarproxy *proxy = cvm::main()->proxy; bias_energy = 0.0; update_calls++; @@ -214,10 +221,11 @@ int colvarbias_alb::update() temp = 2. * (means[i] / (static_cast (colvar_centers[i])) - 1) * ssd[i] / (update_calls - 1); - if (cvm::temperature() > 0) - step_size = temp / (cvm::temperature() * cvm::boltzmann()); - else - step_size = temp / cvm::boltzmann(); + if (proxy->target_temperature() > 0.0) { + step_size = temp / (proxy->target_temperature() * proxy->boltzmann()); + } else { + step_size = temp / proxy->boltzmann(); + } means[i] = 0; ssd[i] = 0; diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 2719489560..84f1a5bdee 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -179,31 +179,19 @@ int colvarbias_histogram::write_output_files() return COLVARS_OK; } + int error_code = COLVARS_OK; + if (out_name.size() && out_name != "none") { cvm::log("Writing the histogram file \""+out_name+"\".\n"); - cvm::backup_file(out_name.c_str()); - std::ostream *grid_os = cvm::proxy->output_stream(out_name); - if (!grid_os) { - return cvm::error("Error opening histogram file "+out_name+ - " for writing.\n", COLVARS_FILE_ERROR); - } - grid->write_multicol(*grid_os); - cvm::proxy->close_output_stream(out_name); + error_code |= grid->write_multicol(out_name, "histogram output file"); } if (out_name_dx.size() && out_name_dx != "none") { cvm::log("Writing the histogram file \""+out_name_dx+"\".\n"); - cvm::backup_file(out_name_dx.c_str()); - std::ostream *grid_os = cvm::proxy->output_stream(out_name_dx); - if (!grid_os) { - return cvm::error("Error opening histogram file "+out_name_dx+ - " for writing.\n", COLVARS_FILE_ERROR); - } - grid->write_opendx(*grid_os); - cvm::proxy->close_output_stream(out_name_dx); + error_code |= grid->write_opendx(out_name_dx, "histogram DX output file"); } - return COLVARS_OK; + return error_code; } diff --git a/lib/colvars/colvarbias_histogram_reweight_amd.cpp b/lib/colvars/colvarbias_histogram_reweight_amd.cpp index 97c278abcb..85f1bde35c 100644 --- a/lib/colvars/colvarbias_histogram_reweight_amd.cpp +++ b/lib/colvars/colvarbias_histogram_reweight_amd.cpp @@ -81,6 +81,7 @@ int colvarbias_reweightaMD::init(std::string const &conf) { } int colvarbias_reweightaMD::update() { + colvarproxy *proxy = cvm::main()->proxy; int error_code = COLVARS_OK; if (cvm::step_relative() >= start_after_steps) { // update base class @@ -110,7 +111,7 @@ int colvarbias_reweightaMD::update() { grid->acc_value(previous_bin, reweighting_factor); if (b_use_cumulant_expansion) { const cvm::real dV = cvm::logn(reweighting_factor) * - cvm::temperature() * cvm::boltzmann(); + proxy->target_temperature() * proxy->boltzmann(); grid_dV->acc_value(previous_bin, dV); grid_dV_square->acc_value(previous_bin, dV * dV); } @@ -129,7 +130,7 @@ int colvarbias_reweightaMD::update() { grid->acc_value(previous_bin, reweighting_factor); if (b_use_cumulant_expansion) { const cvm::real dV = cvm::logn(reweighting_factor) * - cvm::temperature() * cvm::boltzmann(); + proxy->target_temperature() * proxy->boltzmann(); grid_dV->acc_value(previous_bin, dV); grid_dV_square->acc_value(previous_bin, dV * dV); } @@ -138,10 +139,6 @@ int colvarbias_reweightaMD::update() { } previous_bin.assign(num_variables(), 0); - if (output_freq && (cvm::step_absolute() % output_freq) == 0) { - write_output_files(); - } - error_code |= cvm::get_error(); } return error_code; @@ -160,7 +157,7 @@ int colvarbias_reweightaMD::write_output_files() { (cvm::step_absolute() % history_freq) == 0; if (write_history) { error_code |= write_exponential_reweighted_pmf( - out_name_pmf + ".hist", (cvm::step_relative() > 0)); + out_name_pmf + ".hist", true); error_code |= write_count(out_count_prefix + ".hist", (cvm::step_relative() > 0)); } @@ -170,7 +167,7 @@ int colvarbias_reweightaMD::write_output_files() { error_code |= write_cumulant_expansion_pmf(out_name_cumulant_pmf); if (write_history) { error_code |= write_cumulant_expansion_pmf( - out_name_cumulant_pmf + ".hist", (cvm::step_relative() > 0)); + out_name_cumulant_pmf + ".hist", true); } } error_code |= cvm::get_error(); @@ -178,17 +175,13 @@ int colvarbias_reweightaMD::write_output_files() { } int colvarbias_reweightaMD::write_exponential_reweighted_pmf( - const std::string& p_output_prefix, bool append) { + const std::string& p_output_prefix, bool keep_open) { const std::string output_pmf = p_output_prefix + ".pmf"; + cvm::log("Writing the accelerated MD PMF file \"" + output_pmf + "\".\n"); - if (!append) { - cvm::backup_file(output_pmf.c_str()); - } - const std::ios::openmode mode = (append ? std::ios::app : std::ios::out); - std::ostream *pmf_grid_os = cvm::proxy->output_stream(output_pmf, mode); + std::ostream &pmf_grid_os = cvm::proxy->output_stream(output_pmf, "PMF file"); if (!pmf_grid_os) { - return cvm::error("Error opening PMF file " + output_pmf + - " for writing.\n", COLVARS_FILE_ERROR); + return COLVARS_FILE_ERROR; } pmf_grid_exp_avg->copy_grid(*grid); // compute the average @@ -200,19 +193,18 @@ int colvarbias_reweightaMD::write_exponential_reweighted_pmf( } } hist_to_pmf(pmf_grid_exp_avg, grid_count); - pmf_grid_exp_avg->write_multicol(*pmf_grid_os); - cvm::proxy->close_output_stream(output_pmf); + pmf_grid_exp_avg->write_multicol(pmf_grid_os); + if (!keep_open) { + cvm::proxy->close_output_stream(output_pmf); + } + if (b_write_gradients) { const std::string output_grad = p_output_prefix + ".grad"; cvm::log("Writing the accelerated MD gradients file \"" + output_grad + "\".\n"); - if (!append) { - cvm::backup_file(output_grad.c_str()); - } - std::ostream *grad_grid_os = cvm::proxy->output_stream(output_grad, mode); + std::ostream &grad_grid_os = cvm::proxy->output_stream(output_grad, "gradient file"); if (!grad_grid_os) { - return cvm::error("Error opening grad file " + output_grad + - " for writing.\n", COLVARS_FILE_ERROR); + return COLVARS_FILE_ERROR; } for (std::vector ix = grad_grid_exp_avg->new_index(); grad_grid_exp_avg->index_ok(ix); grad_grid_exp_avg->incr(ix)) { @@ -221,38 +213,37 @@ int colvarbias_reweightaMD::write_exponential_reweighted_pmf( ix, pmf_grid_exp_avg->gradient_finite_diff(ix, n), n); } } - grad_grid_exp_avg->write_multicol(*grad_grid_os); - cvm::proxy->close_output_stream(output_grad); + grad_grid_exp_avg->write_multicol(grad_grid_os); + if (!keep_open) { + cvm::proxy->close_output_stream(output_grad); + } } + return COLVARS_OK; } int colvarbias_reweightaMD::write_cumulant_expansion_pmf( - const std::string& p_output_prefix, bool append) { + const std::string& p_output_prefix, bool keep_open) { const std::string output_pmf = p_output_prefix + ".pmf"; cvm::log("Writing the accelerated MD PMF file using cumulant expansion: \"" + output_pmf + "\".\n"); - if (!append) cvm::backup_file(output_pmf.c_str()); - const std::ios::openmode mode = (append ? std::ios::app : std::ios::out); - std::ostream *pmf_grid_cumulant_os = cvm::proxy->output_stream(output_pmf, mode); + std::ostream &pmf_grid_cumulant_os = cvm::proxy->output_stream(output_pmf, "PMF file"); if (!pmf_grid_cumulant_os) { - return cvm::error("Error opening PMF file " + output_pmf + - " for writing.\n", COLVARS_FILE_ERROR); + return COLVARS_FILE_ERROR; } compute_cumulant_expansion_factor(grid_dV, grid_dV_square, grid_count, pmf_grid_cumulant); hist_to_pmf(pmf_grid_cumulant, grid_count); - pmf_grid_cumulant->write_multicol(*pmf_grid_cumulant_os); - cvm::proxy->close_output_stream(output_pmf); + pmf_grid_cumulant->write_multicol(pmf_grid_cumulant_os); + if (!keep_open) { + cvm::proxy->close_output_stream(output_pmf); + } + if (b_write_gradients) { const std::string output_grad = p_output_prefix + ".grad"; cvm::log("Writing the accelerated MD gradients file \"" + output_grad + "\".\n"); - if (!append) { - cvm::backup_file(output_grad.c_str()); - } - std::ostream *grad_grid_os = cvm::proxy->output_stream(output_grad, mode); + std::ostream &grad_grid_os = cvm::proxy->output_stream(output_grad, "grad file"); if (!grad_grid_os) { - return cvm::error("Error opening grad file " + output_grad + - " for writing.\n", COLVARS_FILE_ERROR); + return COLVARS_FILE_ERROR; } for (std::vector ix = grad_grid_cumulant->new_index(); grad_grid_cumulant->index_ok(ix); grad_grid_cumulant->incr(ix)) { @@ -261,31 +252,33 @@ int colvarbias_reweightaMD::write_cumulant_expansion_pmf( ix, pmf_grid_cumulant->gradient_finite_diff(ix, n), n); } } - grad_grid_cumulant->write_multicol(*grad_grid_os); + grad_grid_cumulant->write_multicol(grad_grid_os); cvm::proxy->close_output_stream(output_grad); } return COLVARS_OK; } -int colvarbias_reweightaMD::write_count(const std::string& p_output_prefix, bool append) { +int colvarbias_reweightaMD::write_count(const std::string& p_output_prefix, bool keep_open) { const std::string output_name = p_output_prefix + ".count"; cvm::log("Writing the accelerated MD count file \""+output_name+"\".\n"); - if (!append) cvm::backup_file(output_name.c_str()); - const std::ios::openmode mode = (append ? std::ios::app : std::ios::out); - std::ostream *grid_count_os = cvm::proxy->output_stream(output_name, mode); + std::ostream &grid_count_os = cvm::proxy->output_stream(output_name, "count file"); if (!grid_count_os) { - return cvm::error("Error opening count file "+output_name+ - " for writing.\n", COLVARS_FILE_ERROR); + return COLVARS_FILE_ERROR; + } + grid_count->write_multicol(grid_count_os); + if (!keep_open) { + cvm::proxy->close_output_stream(output_name); } - grid_count->write_multicol(*grid_count_os); - cvm::proxy->close_output_stream(output_name); return COLVARS_OK; } void colvarbias_reweightaMD::hist_to_pmf( - colvar_grid_scalar* hist, const colvar_grid_scalar* hist_count) const { + colvar_grid_scalar* hist, + const colvar_grid_scalar* hist_count) const +{ + colvarproxy *proxy = cvm::main()->proxy; if (hist->raw_data_num() == 0) return; - const cvm::real kbt = cvm::boltzmann() * cvm::temperature(); + const cvm::real kbt = proxy->boltzmann() * proxy->target_temperature(); bool first_min_element = true; bool first_max_element = true; cvm::real min_element = 0; @@ -329,12 +322,15 @@ void colvarbias_reweightaMD::hist_to_pmf( } } + void colvarbias_reweightaMD::compute_cumulant_expansion_factor( const colvar_grid_scalar* hist_dV, const colvar_grid_scalar* hist_dV_square, const colvar_grid_scalar* hist_count, - colvar_grid_scalar* cumulant_expansion_factor) const { - const cvm::real beta = 1.0 / (cvm::boltzmann() * cvm::temperature()); + colvar_grid_scalar* cumulant_expansion_factor) const +{ + colvarproxy *proxy = cvm::main()->proxy; + const cvm::real beta = 1.0 / (proxy->boltzmann() * proxy->target_temperature()); size_t i = 0; for (i = 0; i < hist_dV->raw_data_num(); ++i) { const cvm::real count = hist_count->value(i); diff --git a/lib/colvars/colvarbias_histogram_reweight_amd.h b/lib/colvars/colvarbias_histogram_reweight_amd.h index 8d74b5315d..f126738305 100644 --- a/lib/colvars/colvarbias_histogram_reweight_amd.h +++ b/lib/colvars/colvarbias_histogram_reweight_amd.h @@ -51,21 +51,21 @@ public: /// @brief output the PMF by the exponential average estimator /// @param[in] p_output_prefix the prefix of the output file - /// @param[in] append append the output to a .hist file if true + /// @param[in] keep_open Allow writing the history of the PMF virtual int write_exponential_reweighted_pmf( - const std::string& p_output_prefix, bool append = false); + const std::string& p_output_prefix, bool keep_open = false); /// @brief output the PMF by the cumulant expansion estimator /// @param[in] p_output_prefix the prefix of the output file - /// @param[in] append append the output to a .hist file if true + /// @param[in] keep_open Allow writing the history of the expansion virtual int write_cumulant_expansion_pmf( - const std::string& p_output_prefix, bool append = false); + const std::string& p_output_prefix, bool keep_open = false); /// @brief output the biased sampling /// @param[in] p_output_prefix the prefix of the output file - /// @param[in] append append the output to a .hist file if true + /// @param[in] keep_open Allow writing the history of the samples virtual int write_count( - const std::string& p_output_prefix, bool append = false); + const std::string& p_output_prefix, bool keep_open = false); protected: /// Current accelMD factor is the from previous frame std::vector previous_bin; diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 0b31479276..90497bf150 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -36,7 +36,6 @@ colvarbias_meta::colvarbias_meta(char const *key) : colvarbias(key), colvarbias_ti(key) { new_hills_begin = hills.end(); - hills_traj_os = NULL; hill_weight = 0.0; hill_width = 0.0; @@ -268,28 +267,31 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf) int colvarbias_meta::init_ebmeta_params(std::string const &conf) { + int error_code = COLVARS_OK; // for ebmeta target_dist = NULL; get_keyval(conf, "ebMeta", ebmeta, false); if(ebmeta){ cvm::main()->cite_feature("Ensemble-biased metadynamics (ebMetaD)"); if (use_grids && expand_grids) { - cvm::error("Error: expandBoundaries is not supported with " - "ebMeta please allocate wide enough boundaries for " - "each colvar ahead of time and set targetdistfile " - "accordingly.\n", COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: expandBoundaries is not supported with " + "ebMeta; please allocate wide enough boundaries " + "for each colvar ahead of time and set " + "targetDistFile accordingly.\n", + COLVARS_INPUT_ERROR); } target_dist = new colvar_grid_scalar(); - target_dist->init_from_colvars(colvars); + error_code |= target_dist->init_from_colvars(colvars); std::string target_dist_file; get_keyval(conf, "targetDistFile", target_dist_file); - std::ifstream targetdiststream(target_dist_file.c_str()); - target_dist->read_multicol(targetdiststream); + error_code |= target_dist->read_multicol(target_dist_file, + "ebMeta target histogram"); cvm::real min_val = target_dist->minimum_value(); cvm::real max_val = target_dist->maximum_value(); - if(min_val<0){ - cvm::error("Error: Target distribution of EBMetaD " - "has negative values!.\n", COLVARS_INPUT_ERROR); + if (min_val < 0.0) { + error_code |= cvm::error("Error: Target distribution of EBMetaD " + "has negative values!.\n", + COLVARS_INPUT_ERROR); } cvm::real target_dist_min_val; get_keyval(conf, "targetDistMinVal", target_dist_min_val, 1/1000000.0); @@ -301,17 +303,19 @@ int colvarbias_meta::init_ebmeta_params(std::string const &conf) cvm::log("NOTE: targetDistMinVal is set to zero, the minimum value of the target \n"); cvm::log(" distribution will be set as the minimum positive value.\n"); cvm::real min_pos_val = target_dist->minimum_pos_value(); - if(min_pos_val<=0){ - cvm::error("Error: Target distribution of EBMetaD has negative " - "or zero minimum positive value!.\n", COLVARS_INPUT_ERROR); + if (min_pos_val <= 0.0){ + error_code |= cvm::error("Error: Target distribution of EBMetaD has " + "negative or zero minimum positive value.\n", + COLVARS_INPUT_ERROR); } - if(min_val==0){ + if (min_val == 0.0){ cvm::log("WARNING: Target distribution has zero values.\n"); cvm::log("Zeros will be converted to the minimum positive value.\n"); target_dist->remove_small_values(min_pos_val); } } else { - cvm::error("Error: targetDistMinVal must be a value between 0 and 1!.\n", COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: targetDistMinVal must be a value " + "between 0 and 1.\n", COLVARS_INPUT_ERROR); } } // normalize target distribution and multiply by effective volume = exp(differential entropy) @@ -321,23 +325,18 @@ int colvarbias_meta::init_ebmeta_params(std::string const &conf) get_keyval(conf, "ebMetaEquilSteps", ebmeta_equil_steps, ebmeta_equil_steps); } - return COLVARS_OK; + return error_code; } colvarbias_meta::~colvarbias_meta() { colvarbias_meta::clear_state_data(); - colvarproxy *proxy = cvm::proxy; + colvarproxy *proxy = cvm::main()->proxy; - if (proxy->get_output_stream(replica_hills_file)) { - proxy->close_output_stream(replica_hills_file); - } + proxy->close_output_stream(replica_hills_file); - if (hills_traj_os) { - proxy->close_output_stream(hills_traj_file_name()); - hills_traj_os = NULL; - } + proxy->close_output_stream(hills_traj_file_name()); if (target_dist) { delete target_dist; @@ -392,9 +391,12 @@ colvarbias_meta::add_hill(colvarbias_meta::hill const &h) } // output to trajectory (if specified) - if (hills_traj_os) { - *hills_traj_os << (hills.back()).output_traj(); - cvm::proxy->flush_output_stream(hills_traj_os); + if (b_hills_traj) { + // Open trajectory file or access the one already open + std::ostream &hills_traj_os = + cvm::proxy->output_stream(hills_traj_file_name()); + hills_traj_os << (hills.back()).output_traj(); + cvm::proxy->flush_output_stream(hills_traj_file_name()); } has_data = true; @@ -424,12 +426,14 @@ colvarbias_meta::delete_hill(hill_iter &h) } } - if (hills_traj_os) { + if (b_hills_traj) { // output to the trajectory - *hills_traj_os << "# DELETED this hill: " - << (hills.back()).output_traj() - << "\n"; - cvm::proxy->flush_output_stream(hills_traj_os); + std::ostream &hills_traj_os = + cvm::proxy->output_stream(hills_traj_file_name()); + hills_traj_os << "# DELETED this hill: " + << (hills.back()).output_traj() + << "\n"; + cvm::proxy->flush_output_stream(hills_traj_file_name()); } return hills.erase(h); @@ -573,6 +577,7 @@ int colvarbias_meta::update_grid_params() int colvarbias_meta::update_bias() { + colvarproxy *proxy = cvm::main()->proxy; // add a new hill if the required time interval has passed if (((cvm::step_absolute() % new_hill_freq) == 0) && can_accumulate_data() && is_enabled(f_cvb_history_dependent)) { @@ -603,7 +608,7 @@ int colvarbias_meta::update_bias() } else { calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL); } - hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann())); + hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*proxy->boltzmann())); } switch (comm) { @@ -618,10 +623,10 @@ int colvarbias_meta::update_bias() case multiple_replicas: add_hill(hill(cvm::step_absolute(), hill_weight*hills_scale, colvar_values, colvar_sigmas, replica_id)); - std::ostream *replica_hills_os = - cvm::proxy->get_output_stream(replica_hills_file); + std::ostream &replica_hills_os = + cvm::proxy->output_stream(replica_hills_file); if (replica_hills_os) { - *replica_hills_os << hills.back(); + replica_hills_os << hills.back(); } else { return cvm::error("Error: in metadynamics bias \""+this->name+"\""+ ((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+ @@ -979,25 +984,24 @@ void colvarbias_meta::recount_hills_off_grid(colvarbias_meta::hill_iter h_first int colvarbias_meta::replica_share() { + int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; // sync with the other replicas (if needed) if (comm == multiple_replicas) { // reread the replicas registry - update_replicas_registry(); + error_code |= update_replicas_registry(); // empty the output buffer - std::ostream *replica_hills_os = - proxy->get_output_stream(replica_hills_file); - if (replica_hills_os) { - proxy->flush_output_stream(replica_hills_os); - } - read_replica_files(); + error_code |= proxy->flush_output_stream(replica_hills_file); + error_code |= read_replica_files(); } - return COLVARS_OK; + return error_code; } -void colvarbias_meta::update_replicas_registry() +int colvarbias_meta::update_replicas_registry() { + int error_code = COLVARS_OK; + if (cvm::debug()) cvm::log("Metadynamics bias \""+this->name+"\""+ ": updating the list of replicas, currently containing "+ @@ -1012,8 +1016,9 @@ void colvarbias_meta::update_replicas_registry() while (colvarparse::getline_nocomments(reg_file, line)) replicas_registry.append(line+"\n"); } else { - cvm::error("Error: failed to open file \""+replicas_registry_file+ - "\" for reading.\n", COLVARS_FILE_ERROR); + error_code |= cvm::error("Error: failed to open file \""+ + replicas_registry_file+"\" for reading.\n", + COLVARS_FILE_ERROR); } } @@ -1081,8 +1086,8 @@ void colvarbias_meta::update_replicas_registry() } } } else { - cvm::error("Error: cannot read the replicas registry file \""+ - replicas_registry+"\".\n", COLVARS_FILE_ERROR); + error_code |= cvm::error("Error: cannot read the replicas registry file \""+ + replicas_registry+"\".\n", COLVARS_FILE_ERROR); } // now (re)read the list file of each replica @@ -1122,10 +1127,12 @@ void colvarbias_meta::update_replicas_registry() if (cvm::debug()) cvm::log("Metadynamics bias \""+this->name+"\": the list of replicas contains "+ cvm::to_str(replicas.size())+" elements.\n"); + + return error_code; } -void colvarbias_meta::read_replica_files() +int colvarbias_meta::read_replica_files() { // Note: we start from the 2nd replica. for (size_t ir = 1; ir < replicas.size(); ir++) { @@ -1250,6 +1257,7 @@ void colvarbias_meta::read_replica_files() " steps. Ensure that it is still running.\n"); } } + return COLVARS_OK; } @@ -1413,6 +1421,10 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) size_t const old_hills_size = hills.size(); hill_iter old_hills_end = hills.end(); hill_iter old_hills_off_grid_end = hills_off_grid.end(); + if (cvm::debug()) { + cvm::log("Before reading hills from the state file, there are "+ + cvm::to_str(hills.size())+" hills in memory.\n"); + } // Read any hills following the grid data (if any) while (read_hill(is)) { @@ -1431,6 +1443,10 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is) if (existing_hills) { hills.erase(hills.begin(), old_hills_end); hills_off_grid.erase(hills_off_grid.begin(), old_hills_off_grid_end); + if (cvm::debug()) { + cvm::log("After pruning the old hills, there are now "+ + cvm::to_str(hills.size())+" hills in memory.\n"); + } } if (rebin_grids) { @@ -1614,6 +1630,8 @@ std::istream & colvarbias_meta::read_hill(std::istream &is) int colvarbias_meta::setup_output() { + int error_code = COLVARS_OK; + output_prefix = cvm::output_prefix(); if (cvm::main()->num_biases_feature(colvardeps::f_cvb_calc_pmf) > 1) { // if this is not the only free energy integrator, append @@ -1626,8 +1644,11 @@ int colvarbias_meta::setup_output() // TODO: one may want to specify the path manually for intricated filesystems? char *pwd = new char[3001]; - if (GETCWD(pwd, 3000) == NULL) - cvm::error("Error: cannot get the path of the current working directory.\n"); + if (GETCWD(pwd, 3000) == NULL) { + return cvm::error("Error: cannot get the path of the current working directory.\n", + COLVARS_BUG_ERROR); + } + replica_list_file = (std::string(pwd)+std::string(PATHSEP)+ this->name+"."+replica_id+".files.txt"); @@ -1680,38 +1701,35 @@ int colvarbias_meta::setup_output() // if we're running without grids, use a growing list of "hills" files // otherwise, just one state file and one "hills" file as buffer - std::ostream *list_os = - cvm::proxy->output_stream(replica_list_file, - (use_grids ? std::ios_base::trunc : - std::ios_base::app)); - if (!list_os) { - return cvm::get_error(); + std::ostream &list_os = cvm::proxy->output_stream(replica_list_file); + if (list_os) { + list_os << "stateFile " << replica_state_file << "\n"; + list_os << "hillsFile " << replica_hills_file << "\n"; + cvm::proxy->close_output_stream(replica_list_file); + } else { + error_code |= COLVARS_FILE_ERROR; } - *list_os << "stateFile " << replica_state_file << "\n"; - *list_os << "hillsFile " << replica_hills_file << "\n"; - cvm::proxy->close_output_stream(replica_list_file); // finally, add a new record for this replica to the registry if (! registered_replica) { - std::ostream *reg_os = - cvm::proxy->output_stream(replicas_registry_file, - std::ios::app); + std::ofstream reg_os(replicas_registry_file.c_str(), std::ios::app); if (!reg_os) { return cvm::get_error(); } - *reg_os << replica_id << " " << replica_list_file << "\n"; + reg_os << replica_id << " " << replica_list_file << "\n"; cvm::proxy->close_output_stream(replicas_registry_file); } } if (b_hills_traj) { + std::ostream &hills_traj_os = + cvm::proxy->output_stream(hills_traj_file_name()); if (!hills_traj_os) { - hills_traj_os = cvm::proxy->output_stream(hills_traj_file_name()); - if (!hills_traj_os) return cvm::get_error(); + error_code |= COLVARS_FILE_ERROR; } } - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return error_code; } @@ -1804,6 +1822,7 @@ int colvarbias_meta::write_output_files() void colvarbias_meta::write_pmf() { + colvarproxy *proxy = cvm::main()->proxy; // allocate a new grid to store the pmf colvar_grid_scalar *pmf = new colvar_grid_scalar(*hills_energy); pmf->setup(); @@ -1820,7 +1839,7 @@ void colvarbias_meta::write_pmf() cvm::real target_val=target_dist->value(i); if (target_val>0) { pmf_val=pmf->value(i); - pmf_val=pmf_val+cvm::temperature() * cvm::boltzmann() * cvm::logn(target_val); + pmf_val=pmf_val + proxy->target_temperature() * proxy->boltzmann() * cvm::logn(target_val); } pmf->set_value(i,pmf_val); } @@ -1830,7 +1849,7 @@ void colvarbias_meta::write_pmf() pmf->add_constant(-1.0 * max); pmf->multiply_constant(-1.0); if (well_tempered) { - cvm::real const well_temper_scale = (bias_temperature + cvm::temperature()) / bias_temperature; + cvm::real const well_temper_scale = (bias_temperature + proxy->target_temperature()) / bias_temperature; pmf->multiply_constant(well_temper_scale); } { @@ -1839,10 +1858,7 @@ void colvarbias_meta::write_pmf() (dump_fes_save ? "."+cvm::to_str(cvm::step_absolute()) : "") + ".pmf"); - cvm::proxy->backup_file(fes_file_name); - std::ostream *fes_os = cvm::proxy->output_stream(fes_file_name); - pmf->write_multicol(*fes_os); - cvm::proxy->close_output_stream(fes_file_name); + pmf->write_multicol(fes_file_name, "PMF file"); } } @@ -1861,7 +1877,7 @@ void colvarbias_meta::write_pmf() cvm::real target_val=target_dist->value(i); if (target_val>0) { pmf_val=pmf->value(i); - pmf_val=pmf_val+cvm::temperature() * cvm::boltzmann() * cvm::logn(target_val); + pmf_val=pmf_val + proxy->target_temperature() * proxy->boltzmann() * cvm::logn(target_val); } pmf->set_value(i,pmf_val); } @@ -1871,17 +1887,14 @@ void colvarbias_meta::write_pmf() pmf->add_constant(-1.0 * max); pmf->multiply_constant(-1.0); if (well_tempered) { - cvm::real const well_temper_scale = (bias_temperature + cvm::temperature()) / bias_temperature; + cvm::real const well_temper_scale = (bias_temperature + proxy->target_temperature()) / bias_temperature; pmf->multiply_constant(well_temper_scale); } std::string const fes_file_name(this->output_prefix + (dump_fes_save ? "."+cvm::to_str(cvm::step_absolute()) : "") + ".pmf"); - cvm::proxy->backup_file(fes_file_name); - std::ostream *fes_os = cvm::proxy->output_stream(fes_file_name); - pmf->write_multicol(*fes_os); - cvm::proxy->close_output_stream(fes_file_name); + pmf->write_multicol(fes_file_name, "partial PMF file"); } delete pmf; @@ -1902,9 +1915,9 @@ int colvarbias_meta::write_replica_state_file() // Write to temporary state file std::string const tmp_state_file(replica_state_file+".tmp"); error_code |= proxy->remove_file(tmp_state_file); - std::ostream *rep_state_os = cvm::proxy->output_stream(tmp_state_file); + std::ostream &rep_state_os = cvm::proxy->output_stream(tmp_state_file); if (rep_state_os) { - if (!write_state(*rep_state_os)) { + if (!write_state(rep_state_os)) { error_code |= cvm::error("Error: in writing to temporary file \""+ tmp_state_file+"\".\n", COLVARS_FILE_ERROR); } @@ -1921,13 +1934,13 @@ int colvarbias_meta::reopen_replica_buffer_file() { int error_code = COLVARS_OK; colvarproxy *proxy = cvm::proxy; - if (proxy->get_output_stream(replica_hills_file) != NULL) { + if (proxy->output_stream(replica_hills_file)) { error_code |= proxy->close_output_stream(replica_hills_file); } error_code |= proxy->remove_file(replica_hills_file); - std::ostream *replica_hills_os = proxy->output_stream(replica_hills_file); + std::ostream &replica_hills_os = proxy->output_stream(replica_hills_file); if (replica_hills_os) { - replica_hills_os->setf(std::ios::scientific, std::ios::floatfield); + replica_hills_os.setf(std::ios::scientific, std::ios::floatfield); } else { error_code |= COLVARS_FILE_ERROR; } diff --git a/lib/colvars/colvarbias_meta.h b/lib/colvars/colvarbias_meta.h index 565534f22b..bac2ff74d4 100644 --- a/lib/colvars/colvarbias_meta.h +++ b/lib/colvars/colvarbias_meta.h @@ -12,8 +12,7 @@ #include #include -#include -#include +#include #include "colvarbias.h" #include "colvargrid.h" @@ -84,9 +83,7 @@ protected: size_t new_hill_freq; /// Write the hill logfile - bool b_hills_traj; - /// Logfile of hill management (creation and deletion) - std::ostream *hills_traj_os; + bool b_hills_traj; /// Name of the hill logfile std::string const hills_traj_file_name() const; @@ -214,10 +211,10 @@ protected: std::string replica_file_name; /// \brief Read the existing replicas on registry - virtual void update_replicas_registry(); + virtual int update_replicas_registry(); /// \brief Read new data from replicas' files - virtual void read_replica_files(); + virtual int read_replica_files(); /// Write full state information to be read by other replicas virtual int write_replica_state_file(); diff --git a/lib/colvars/colvarbias_restraint.cpp b/lib/colvars/colvarbias_restraint.cpp index 0b374db9a8..a7963c4f8f 100644 --- a/lib/colvars/colvarbias_restraint.cpp +++ b/lib/colvars/colvarbias_restraint.cpp @@ -7,6 +7,10 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include +#include +#include + #include "colvarmodule.h" #include "colvarproxy.h" #include "colvarvalue.h" @@ -196,6 +200,8 @@ int colvarbias_restraint_moving::init(std::string const &conf) if (b_chg_centers || b_chg_force_k) { + first_step = cvm::step_absolute(); + get_keyval(conf, "targetNumSteps", target_nsteps, target_nsteps); if (!target_nsteps) { cvm::error("Error: targetNumSteps must be non-zero.\n", COLVARS_INPUT_ERROR); @@ -335,13 +341,17 @@ int colvarbias_restraint_centers_moving::update_centers(cvm::real lambda) int colvarbias_restraint_centers_moving::update() { + if (!cvm::main()->proxy->simulation_running()) { + return COLVARS_OK; + } + if (b_chg_centers) { if (target_nstages) { // Staged update if (stage <= target_nstages) { if ((cvm::step_relative() > 0) && - ((cvm::step_absolute() % target_nsteps) == 1)) { + (((cvm::step_absolute() - first_step) % target_nsteps) == 1)) { cvm::real const lambda = cvm::real(stage)/cvm::real(target_nstages); update_centers(lambda); @@ -358,9 +368,9 @@ int colvarbias_restraint_centers_moving::update() } } else { // Continuous update - if (cvm::step_absolute() <= target_nsteps) { + if (cvm::step_absolute() - first_step <= target_nsteps) { cvm::real const lambda = - cvm::real(cvm::step_absolute())/cvm::real(target_nsteps); + cvm::real(cvm::step_absolute() - first_step)/cvm::real(target_nsteps); update_centers(lambda); } else { for (size_t i = 0; i < num_variables(); i++) { @@ -389,10 +399,13 @@ int colvarbias_restraint_centers_moving::update() int colvarbias_restraint_centers_moving::update_acc_work() { + if (!cvm::main()->proxy->simulation_running()) { + return COLVARS_OK; + } if (b_chg_centers) { if (is_enabled(f_cvb_output_acc_work)) { if ((cvm::step_relative() > 0) && - (cvm::step_absolute() <= target_nsteps)) { + (cvm::step_absolute() - first_step <= target_nsteps)) { for (size_t i = 0; i < num_variables(); i++) { // project forces on the calculated increments at this step acc_work += colvar_forces[i] * centers_incr[i]; @@ -496,10 +509,11 @@ colvarbias_restraint_k_moving::colvarbias_restraint_k_moving(char const *key) colvarbias_restraint_moving(key) { b_chg_force_k = false; + b_decoupling = false; target_equil_steps = 0; target_force_k = -1.0; starting_force_k = -1.0; - force_k_exp = 1.0; + lambda_exp = 1.0; restraint_FE = 0.0; force_k_incr = 0.0; } @@ -509,18 +523,29 @@ int colvarbias_restraint_k_moving::init(std::string const &conf) { colvarbias_restraint_k::init(conf); + get_keyval(conf, "decoupling", b_decoupling, b_decoupling); + if (b_decoupling) { + starting_force_k = 0.0; + target_force_k = force_k; + b_chg_force_k = true; + } + if (get_keyval(conf, "targetForceConstant", target_force_k, target_force_k)) { + if (b_decoupling) { + cvm::error("Error: targetForceConstant may not be specified together with decoupling.\n", COLVARS_INPUT_ERROR); + return COLVARS_ERROR; + } starting_force_k = force_k; b_chg_force_k = true; } - if (b_chg_force_k) { - // parse moving restraint options - colvarbias_restraint_moving::init(conf); - } else { + if (!b_chg_force_k) { return COLVARS_OK; } + // parse moving restraint options + colvarbias_restraint_moving::init(conf); + get_keyval(conf, "targetEquilSteps", target_equil_steps, target_equil_steps); if (get_keyval(conf, "lambdaSchedule", lambda_schedule, lambda_schedule) && @@ -534,12 +559,13 @@ int colvarbias_restraint_k_moving::init(std::string const &conf) target_nstages = lambda_schedule.size() - 1; } - if (get_keyval(conf, "targetForceExponent", force_k_exp, force_k_exp)) { - if (! b_chg_force_k) - cvm::log("Warning: not changing force constant: targetForceExponent will be ignored\n"); + if ((get_keyval(conf, "targetForceExponent", lambda_exp, lambda_exp, parse_deprecated) + || get_keyval(conf, "lambdaExponent", lambda_exp, lambda_exp)) + && !b_chg_force_k) { + cvm::error("Error: cannot set lambdaExponent unless a changing force constant is active.\n", COLVARS_INPUT_ERROR); } - if (force_k_exp < 1.0) { - cvm::log("Warning: for all practical purposes, targetForceExponent should be 1.0 or greater.\n"); + if (lambda_exp < 1.0) { + cvm::log("Warning: for all practical purposes, lambdaExponent should be 1.0 or greater.\n"); } return COLVARS_OK; @@ -548,24 +574,27 @@ int colvarbias_restraint_k_moving::init(std::string const &conf) int colvarbias_restraint_k_moving::update() { + if (!cvm::main()->proxy->simulation_running()) { + return COLVARS_OK; + } if (b_chg_force_k) { cvm::real lambda; if (target_nstages) { - if (cvm::step_absolute() == 0) { + if (cvm::step_absolute() == first_step) { // Setup first stage of staged variable force constant calculation if (lambda_schedule.size()) { lambda = lambda_schedule[0]; } else { - lambda = 0.0; + lambda = (b_decoupling ? 1.0 : 0.0); } force_k = starting_force_k + (target_force_k - starting_force_k) - * cvm::pow(lambda, force_k_exp); + * cvm::pow(lambda, lambda_exp); cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda) - + ", k = " + cvm::to_str(force_k)); + + ", k = " + cvm::to_str(force_k)+"\n"); } // TI calculation: estimate free energy derivative @@ -574,9 +603,10 @@ int colvarbias_restraint_k_moving::update() lambda = lambda_schedule[stage]; } else { lambda = cvm::real(stage) / cvm::real(target_nstages); + if (b_decoupling) lambda = 1.0 - lambda; } - if (target_equil_steps == 0 || cvm::step_absolute() % target_nsteps >= target_equil_steps) { + if (target_equil_steps == 0 || (cvm::step_absolute() - first_step) % target_nsteps >= target_equil_steps) { // Start averaging after equilibration period, if requested // Derivative of energy with respect to force_k @@ -584,17 +614,17 @@ int colvarbias_restraint_k_moving::update() for (size_t i = 0; i < num_variables(); i++) { dU_dk += d_restraint_potential_dk(i); } - restraint_FE += force_k_exp * cvm::pow(lambda, force_k_exp - 1.0) + restraint_FE += lambda_exp * cvm::pow(lambda, lambda_exp - 1.0) * (target_force_k - starting_force_k) * dU_dk; } // Finish current stage... - if (cvm::step_absolute() % target_nsteps == 0 && - cvm::step_absolute() > 0) { + if ((cvm::step_absolute() - first_step) % target_nsteps == 0 && + cvm::step_absolute() > first_step) { cvm::log("Restraint " + this->name + " Lambda= " + cvm::to_str(lambda) + " dA/dLambda= " - + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps))); + + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps))+"\n"); // ...and move on to the next one if (stage < target_nstages) { @@ -605,23 +635,24 @@ int colvarbias_restraint_k_moving::update() lambda = lambda_schedule[stage]; } else { lambda = cvm::real(stage) / cvm::real(target_nstages); + if (b_decoupling) lambda = 1.0 - lambda; } force_k = starting_force_k + (target_force_k - starting_force_k) - * cvm::pow(lambda, force_k_exp); + * cvm::pow(lambda, lambda_exp); cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda) - + ", k = " + cvm::to_str(force_k)); + + ", k = " + cvm::to_str(force_k)+"\n"); } } - } else if (cvm::step_absolute() <= target_nsteps) { - + } else if (cvm::step_absolute() - first_step <= target_nsteps) { // update force constant (slow growth) - lambda = cvm::real(cvm::step_absolute()) / cvm::real(target_nsteps); + lambda = cvm::real(cvm::step_absolute() - first_step) / cvm::real(target_nsteps); + if (b_decoupling) lambda = 1.0 - lambda; cvm::real const force_k_old = force_k; force_k = starting_force_k + (target_force_k - starting_force_k) - * cvm::pow(lambda, force_k_exp); + * cvm::pow(lambda, lambda_exp); force_k_incr = force_k - force_k_old; } } @@ -632,6 +663,9 @@ int colvarbias_restraint_k_moving::update() int colvarbias_restraint_k_moving::update_acc_work() { + if (!cvm::main()->proxy->simulation_running()) { + return COLVARS_OK; + } if (b_chg_force_k) { if (is_enabled(f_cvb_output_acc_work)) { if (cvm::step_relative() > 0) { @@ -980,7 +1014,7 @@ int colvarbias_restraint_harmonic_walls::init(std::string const &conf) } // Initialize starting value of the force constant (in case it's changing) - starting_force_k = force_k; + starting_force_k = (b_decoupling ? 0.0 : force_k); if (lower_walls.size() > 0) { for (i = 0; i < num_variables(); i++) { @@ -1302,6 +1336,8 @@ colvarbias_restraint_histogram::colvarbias_restraint_histogram(char const *key) int colvarbias_restraint_histogram::init(std::string const &conf) { + int error_code = COLVARS_OK; + colvarbias::init(conf); enable(f_cvb_apply_force); @@ -1312,18 +1348,19 @@ int colvarbias_restraint_histogram::init(std::string const &conf) get_keyval(conf, "width", width, width); if (width <= 0.0) { - cvm::error("Error: \"width\" must be positive.\n", COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: \"width\" must be positive.\n", + COLVARS_INPUT_ERROR); } get_keyval(conf, "gaussianWidth", gaussian_width, 2.0 * width, colvarparse::parse_silent); get_keyval(conf, "gaussianSigma", gaussian_width, 2.0 * width); if (lower_boundary >= upper_boundary) { - cvm::error("Error: the upper boundary, "+ - cvm::to_str(upper_boundary)+ - ", is not higher than the lower boundary, "+ - cvm::to_str(lower_boundary)+".\n", - COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: the upper boundary, "+ + cvm::to_str(upper_boundary)+ + ", is not higher than the lower boundary, "+ + cvm::to_str(lower_boundary)+".\n", + COLVARS_INPUT_ERROR); } cvm::real const nbins = (upper_boundary - lower_boundary) / width; @@ -1347,22 +1384,30 @@ int colvarbias_restraint_histogram::init(std::string const &conf) get_keyval(conf, "refHistogramFile", ref_p_file, std::string("")); if (ref_p_file.size()) { if (inline_ref_p) { - cvm::error("Error: cannot specify both refHistogram and refHistogramFile at the same time.\n", - COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: cannot specify both refHistogram and refHistogramFile at the same time.\n", + COLVARS_INPUT_ERROR); } else { - std::ifstream is(ref_p_file.c_str()); + + std::istream &is = + cvm::main()->proxy->input_stream(ref_p_file, + "reference histogram file"); + std::string data_s = ""; std::string line; while (getline_nocomments(is, line)) { data_s.append(line+"\n"); } if (data_s.size() == 0) { - cvm::error("Error: file \""+ref_p_file+"\" empty or unreadable.\n", COLVARS_FILE_ERROR); + error_code |= cvm::error("Error: file \""+ref_p_file+ + "\" empty or unreadable.\n", + COLVARS_FILE_ERROR); } - is.close(); + error_code |= cvm::main()->proxy->close_input_stream(ref_p_file); + cvm::vector1d data; if (data.from_simple_string(data_s) != 0) { - cvm::error("Error: could not read histogram from file \""+ref_p_file+"\".\n"); + error_code |= cvm::error("Error: could not read histogram from file \""+ + ref_p_file+"\".\n"); } if (data.size() == 2*ref_p.size()) { // file contains both x and p(x) @@ -1373,11 +1418,13 @@ int colvarbias_restraint_histogram::init(std::string const &conf) } else if (data.size() == ref_p.size()) { ref_p = data; } else { - cvm::error("Error: file \""+ref_p_file+"\" contains a histogram of different length.\n", - COLVARS_INPUT_ERROR); + error_code |= cvm::error("Error: file \""+ref_p_file+ + "\" contains a histogram of different length.\n", + COLVARS_INPUT_ERROR); } } } + cvm::real const ref_integral = ref_p.sum() * width; if (cvm::fabs(ref_integral - 1.0) > 1.0e-03) { cvm::log("Reference distribution not normalized, normalizing to unity.\n"); @@ -1387,7 +1434,7 @@ int colvarbias_restraint_histogram::init(std::string const &conf) get_keyval(conf, "writeHistogram", b_write_histogram, false); get_keyval(conf, "forceConstant", force_k, 1.0); - return COLVARS_OK; + return error_code; } @@ -1492,27 +1539,29 @@ int colvarbias_restraint_histogram::update() int colvarbias_restraint_histogram::write_output_files() { if (b_write_histogram) { + colvarproxy *proxy = cvm::main()->proxy; std::string file_name(cvm::output_prefix()+"."+this->name+".hist.dat"); - std::ostream *os = cvm::proxy->output_stream(file_name); - *os << "# " << cvm::wrap_string(variables(0)->name, cvm::cv_width) - << " " << "p(" << cvm::wrap_string(variables(0)->name, cvm::cv_width-3) - << ")\n"; + std::ostream &os = proxy->output_stream(file_name, + "histogram output file"); + os << "# " << cvm::wrap_string(variables(0)->name, cvm::cv_width) + << " " << "p(" << cvm::wrap_string(variables(0)->name, cvm::cv_width-3) + << ")\n"; - os->setf(std::ios::fixed, std::ios::floatfield); + os.setf(std::ios::fixed, std::ios::floatfield); size_t igrid; for (igrid = 0; igrid < p.size(); igrid++) { cvm::real const x_grid = (lower_boundary + (igrid+1)*width); - *os << " " - << std::setprecision(cvm::cv_prec) - << std::setw(cvm::cv_width) - << x_grid - << " " - << std::setprecision(cvm::cv_prec) - << std::setw(cvm::cv_width) - << p[igrid] << "\n"; + os << " " + << std::setprecision(cvm::cv_prec) + << std::setw(cvm::cv_width) + << x_grid + << " " + << std::setprecision(cvm::cv_prec) + << std::setw(cvm::cv_width) + << p[igrid] << "\n"; } - cvm::proxy->close_output_stream(file_name); + proxy->close_output_stream(file_name); } return COLVARS_OK; } diff --git a/lib/colvars/colvarbias_restraint.h b/lib/colvars/colvarbias_restraint.h index b2c9055dfe..45a96d14f8 100644 --- a/lib/colvars/colvarbias_restraint.h +++ b/lib/colvars/colvarbias_restraint.h @@ -123,6 +123,9 @@ protected: /// \brief Changing force constant? bool b_chg_force_k; + /// \brief Perform decoupling of the restraint? + bool b_decoupling; + /// \brief Number of stages over which to perform the change /// If zero, perform a continuous change int target_nstages; @@ -137,6 +140,9 @@ protected: /// or restraint centers cvm::step_number target_nsteps; + /// \brief Timestep at which the restraint starts moving + cvm::step_number first_step; + /// \brief Accumulated work (computed when outputAccumulatedWork == true) cvm::real acc_work; }; @@ -207,7 +213,7 @@ protected: cvm::real starting_force_k; /// \brief Exponent for varying the force constant - cvm::real force_k_exp; + cvm::real lambda_exp; /// \brief Intermediate quantity to compute the restraint free energy /// (in TI, would be the accumulating FE derivative) diff --git a/lib/colvars/colvarcomp.h b/lib/colvars/colvarcomp.h index 9c93de4b49..87d3e27a8f 100644 --- a/lib/colvars/colvarcomp.h +++ b/lib/colvars/colvarcomp.h @@ -616,7 +616,7 @@ public: dipole_magnitude (std::string const &conf); dipole_magnitude (cvm::atom const &a1); dipole_magnitude(); - virtual inline ~dipole_magnitude() {} + virtual ~dipole_magnitude() {} virtual void calc_value(); virtual void calc_gradients(); //virtual void calc_force_invgrads(); diff --git a/lib/colvars/colvarcomp_combination.cpp b/lib/colvars/colvarcomp_combination.cpp index 8aea869983..64745b6472 100644 --- a/lib/colvars/colvarcomp_combination.cpp +++ b/lib/colvars/colvarcomp_combination.cpp @@ -141,13 +141,15 @@ void colvar::linearCombination::apply_force(colvarvalue const &force) { colvar::customColvar::customColvar(std::string const &conf): linearCombination(conf) { use_custom_function = false; // code swipe from colvar::init_custom_function -#ifdef LEPTON std::string expr_in, expr; + size_t pos = 0; // current position in config string +#ifdef LEPTON std::vector pexprs; Lepton::ParsedExpression pexpr; double *ref; - size_t pos = 0; // current position in config string +#endif if (key_lookup(conf, "customFunction", &expr_in, &pos)) { +#ifdef LEPTON use_custom_function = true; cvm::log("This colvar uses a custom function.\n"); do { @@ -208,11 +210,15 @@ colvar::customColvar::customColvar(std::string const &conf): linearCombination(c } else { x.type(colvarvalue::type_scalar); } - } else { - cvm::log(std::string{"Warning: no customFunction specified.\n"}); - cvm::log(std::string{"Warning: use linear combination instead.\n"}); - } +#else + cvm::error("customFunction requires the Lepton library, but it is not enabled during compilation.\n" + "Please refer to the Compilation Notes section of the Colvars manual for more information.\n", + COLVARS_INPUT_ERROR); #endif + } else { + cvm::log("Warning: no customFunction specified.\n"); + cvm::log("Warning: use linear combination instead.\n"); + } } colvar::customColvar::~customColvar() { @@ -227,96 +233,111 @@ colvar::customColvar::~customColvar() { } void colvar::customColvar::calc_value() { -#ifdef LEPTON - for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { - cv[i_cv]->calc_value(); - } - x.reset(); - size_t l = 0; - for (size_t i = 0; i < x.size(); ++i) { - for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { - const colvarvalue& current_cv_value = cv[i_cv]->value(); - for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { - if (current_cv_value.type() == colvarvalue::type_scalar) { - *(value_eval_var_refs[l++]) = cv[i_cv]->sup_coeff * (cvm::pow(current_cv_value.real_value, cv[i_cv]->sup_np)); - } else { - *(value_eval_var_refs[l++]) = cv[i_cv]->sup_coeff * current_cv_value[j_elem]; - } - } - } - x[i] = value_evaluators[i]->evaluate(); - } -#endif if (!use_custom_function) { colvar::linearCombination::calc_value(); + } else { +#ifdef LEPTON + for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { + cv[i_cv]->calc_value(); + } + x.reset(); + size_t l = 0; + for (size_t i = 0; i < x.size(); ++i) { + for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { + const colvarvalue& current_cv_value = cv[i_cv]->value(); + for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { + if (current_cv_value.type() == colvarvalue::type_scalar) { + *(value_eval_var_refs[l++]) = cv[i_cv]->sup_coeff * (cvm::pow(current_cv_value.real_value, cv[i_cv]->sup_np)); + } else { + *(value_eval_var_refs[l++]) = cv[i_cv]->sup_coeff * current_cv_value[j_elem]; + } + } + } + x[i] = value_evaluators[i]->evaluate(); + } +#else + cvm::error("customFunction requires the Lepton library, but it is not enabled during compilation.\n" + "Please refer to the Compilation Notes section of the Colvars manual for more information.\n", + COLVARS_INPUT_ERROR); +#endif } } void colvar::customColvar::calc_gradients() { + if (!use_custom_function) { + colvar::linearCombination::calc_gradients(); + } else { #ifdef LEPTON - size_t r = 0; // index in the vector of variable references - size_t e = 0; // index of the gradient evaluator - for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { // for each CV - cv[i_cv]->calc_gradients(); - if (cv[i_cv]->is_enabled(f_cvc_explicit_gradient)) { - const colvarvalue& current_cv_value = cv[i_cv]->value(); - const cvm::real factor_polynomial = getPolynomialFactorOfCVGradient(i_cv); - for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { // for each element in this CV - for (size_t c = 0; c < x.size(); ++c) { // for each custom function expression - for (size_t k = 0; k < cv.size(); ++k) { // this is required since we need to feed all CV values to this expression - const cvm::real factor_polynomial_k = getPolynomialFactorOfCVGradient(k); - for (size_t l = 0; l < cv[k]->value().size(); ++l) { - *(grad_eval_var_refs[r++]) = factor_polynomial_k * cv[k]->value()[l]; + size_t r = 0; // index in the vector of variable references + size_t e = 0; // index of the gradient evaluator + for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { // for each CV + cv[i_cv]->calc_gradients(); + if (cv[i_cv]->is_enabled(f_cvc_explicit_gradient)) { + const colvarvalue& current_cv_value = cv[i_cv]->value(); + const cvm::real factor_polynomial = getPolynomialFactorOfCVGradient(i_cv); + for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { // for each element in this CV + for (size_t c = 0; c < x.size(); ++c) { // for each custom function expression + for (size_t k = 0; k < cv.size(); ++k) { // this is required since we need to feed all CV values to this expression + const cvm::real factor_polynomial_k = getPolynomialFactorOfCVGradient(k); + for (size_t l = 0; l < cv[k]->value().size(); ++l) { + *(grad_eval_var_refs[r++]) = factor_polynomial_k * cv[k]->value()[l]; + } } - } - const double expr_grad = gradient_evaluators[e++]->evaluate(); - for (size_t k_ag = 0 ; k_ag < cv[i_cv]->atom_groups.size(); ++k_ag) { - for (size_t l_atom = 0; l_atom < (cv[i_cv]->atom_groups)[k_ag]->size(); ++l_atom) { - (*(cv[i_cv]->atom_groups)[k_ag])[l_atom].grad = expr_grad * factor_polynomial * (*(cv[i_cv]->atom_groups)[k_ag])[l_atom].grad; + const double expr_grad = gradient_evaluators[e++]->evaluate(); + for (size_t k_ag = 0 ; k_ag < cv[i_cv]->atom_groups.size(); ++k_ag) { + for (size_t l_atom = 0; l_atom < (cv[i_cv]->atom_groups)[k_ag]->size(); ++l_atom) { + (*(cv[i_cv]->atom_groups)[k_ag])[l_atom].grad = expr_grad * factor_polynomial * (*(cv[i_cv]->atom_groups)[k_ag])[l_atom].grad; + } } } } } } - } +#else + cvm::error("customFunction requires the Lepton library, but it is not enabled during compilation.\n" + "Please refer to the Compilation Notes section of the Colvars manual for more information.\n", + COLVARS_INPUT_ERROR); #endif - if (!use_custom_function) { - colvar::linearCombination::calc_gradients(); } } void colvar::customColvar::apply_force(colvarvalue const &force) { -#ifdef LEPTON - size_t r = 0; // index in the vector of variable references - size_t e = 0; // index of the gradient evaluator - for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { - // If this CV us explicit gradients, then atomic gradients is already calculated - // We can apply the force to atom groups directly - if (cv[i_cv]->is_enabled(f_cvc_explicit_gradient)) { - for (size_t k_ag = 0 ; k_ag < cv[i_cv]->atom_groups.size(); ++k_ag) { - (cv[i_cv]->atom_groups)[k_ag]->apply_colvar_force(force.real_value); - } - } else { - const colvarvalue& current_cv_value = cv[i_cv]->value(); - colvarvalue cv_force(current_cv_value.type()); - const cvm::real factor_polynomial = getPolynomialFactorOfCVGradient(i_cv); - for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { - for (size_t c = 0; c < x.size(); ++c) { - for (size_t k = 0; k < cv.size(); ++k) { - const cvm::real factor_polynomial_k = getPolynomialFactorOfCVGradient(k); - for (size_t l = 0; l < cv[k]->value().size(); ++l) { - *(grad_eval_var_refs[r++]) = factor_polynomial_k * cv[k]->value()[l]; - } - } - cv_force[j_elem] += factor_polynomial * gradient_evaluators[e++]->evaluate() * force.real_value; - } - } - cv[i_cv]->apply_force(cv_force); - } - } -#endif if (!use_custom_function) { colvar::linearCombination::apply_force(force); + } else { +#ifdef LEPTON + size_t r = 0; // index in the vector of variable references + size_t e = 0; // index of the gradient evaluator + for (size_t i_cv = 0; i_cv < cv.size(); ++i_cv) { + // If this CV us explicit gradients, then atomic gradients is already calculated + // We can apply the force to atom groups directly + if (cv[i_cv]->is_enabled(f_cvc_explicit_gradient)) { + for (size_t k_ag = 0 ; k_ag < cv[i_cv]->atom_groups.size(); ++k_ag) { + (cv[i_cv]->atom_groups)[k_ag]->apply_colvar_force(force.real_value); + } + } else { + const colvarvalue& current_cv_value = cv[i_cv]->value(); + colvarvalue cv_force(current_cv_value.type()); + const cvm::real factor_polynomial = getPolynomialFactorOfCVGradient(i_cv); + for (size_t j_elem = 0; j_elem < current_cv_value.size(); ++j_elem) { + for (size_t c = 0; c < x.size(); ++c) { + for (size_t k = 0; k < cv.size(); ++k) { + const cvm::real factor_polynomial_k = getPolynomialFactorOfCVGradient(k); + for (size_t l = 0; l < cv[k]->value().size(); ++l) { + *(grad_eval_var_refs[r++]) = factor_polynomial_k * cv[k]->value()[l]; + } + } + cv_force[j_elem] += factor_polynomial * gradient_evaluators[e++]->evaluate() * force.real_value; + } + } + cv[i_cv]->apply_force(cv_force); + } + } +#else + cvm::error("customFunction requires the Lepton library, but it is not enabled during compilation.\n" + "Please refer to the Compilation Notes section of the Colvars manual for more information.\n", + COLVARS_INPUT_ERROR); +#endif } } diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index 80ec3177a9..3d618ff805 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -121,12 +121,12 @@ colvar::coordnum::coordnum(std::string const &conf) } bool const b_isotropic = get_keyval(conf, "cutoff", r0, - cvm::real(4.0 * proxy->angstrom_value)); + cvm::real(proxy->angstrom_to_internal(4.0))); if (get_keyval(conf, "cutoff3", r0_vec, - cvm::rvector(4.0 * proxy->angstrom_value, - 4.0 * proxy->angstrom_value, - 4.0 * proxy->angstrom_value))) { + cvm::rvector(proxy->angstrom_to_internal(4.0), + proxy->angstrom_to_internal(4.0), + proxy->angstrom_to_internal(4.0)))) { if (b_isotropic) { cvm::error("Error: cannot specify \"cutoff\" and \"cutoff3\" " "at the same time.\n", @@ -328,7 +328,7 @@ colvar::h_bond::h_bond(std::string const &conf) atom_groups[0]->add_atom(acceptor); atom_groups[0]->add_atom(donor); - get_keyval(conf, "cutoff", r0, (3.3 * proxy->angstrom_value)); + get_keyval(conf, "cutoff", r0, proxy->angstrom_to_internal(3.3)); get_keyval(conf, "expNumer", en, 6); get_keyval(conf, "expDenom", ed, 8); @@ -405,7 +405,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf) group1 = parse_group(conf, "group1"); - get_keyval(conf, "cutoff", r0, cvm::real(4.0 * proxy->angstrom_value)); + get_keyval(conf, "cutoff", r0, cvm::real(proxy->angstrom_to_internal(4.0))); get_keyval(conf, "expNumer", en, 6); get_keyval(conf, "expDenom", ed, 12); @@ -556,7 +556,7 @@ colvar::groupcoordnum::groupcoordnum(std::string const &conf) } bool const b_scale = get_keyval(conf, "cutoff", r0, - cvm::real(4.0 * proxy->angstrom_value)); + cvm::real(proxy->angstrom_to_internal(4.0))); if (get_keyval(conf, "cutoff3", r0_vec, cvm::rvector(4.0, 4.0, 4.0), parse_silent)) { diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index fa27e5345e..d96cb33482 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -1055,6 +1055,7 @@ colvar::rmsd::rmsd(std::string const &conf) n_permutations = 1; while (key_lookup(conf, "atomPermutation", &perm_conf, &pos)) { + cvm::main()->cite_feature("Symmetry-adapted RMSD"); std::vector perm; if (perm_conf.size()) { std::istringstream is(perm_conf); diff --git a/lib/colvars/colvarcomp_gpath.cpp b/lib/colvars/colvarcomp_gpath.cpp index bff432fdbe..c73ab4f6c1 100644 --- a/lib/colvars/colvarcomp_gpath.cpp +++ b/lib/colvars/colvarcomp_gpath.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "colvarmodule.h" #include "colvarvalue.h" @@ -426,9 +427,8 @@ colvar::CVBasedPath::CVBasedPath(std::string const &conf): cvc(conf) { std::string path_filename; get_keyval(conf, "pathFile", path_filename); cvm::log(std::string("Reading path file: ") + path_filename + std::string("\n")); - std::ifstream ifs_path(path_filename); - if (!ifs_path.is_open()) { - cvm::error("Error: failed to open path file.\n"); + auto &ifs_path = cvm::main()->proxy->input_stream(path_filename); + if (!ifs_path) { return; } std::string line; @@ -459,6 +459,7 @@ colvar::CVBasedPath::CVBasedPath(std::string const &conf): cvc(conf) { ++total_reference_frames; } } + cvm::main()->proxy->close_input_stream(path_filename); if (total_reference_frames <= 1) { cvm::error("Error: there is only 1 or 0 reference frame, which doesn't constitute a path.\n"); return; diff --git a/lib/colvars/colvarcomp_protein.cpp b/lib/colvars/colvarcomp_protein.cpp index b92cb533b7..80ef9b855c 100644 --- a/lib/colvars/colvarcomp_protein.cpp +++ b/lib/colvars/colvarcomp_protein.cpp @@ -86,7 +86,7 @@ colvar::alpha_angles::alpha_angles(std::string const &conf) { cvm::real r0; size_t en, ed; - get_keyval(conf, "hBondCutoff", r0, (3.3 * proxy->angstrom_value)); + get_keyval(conf, "hBondCutoff", r0, proxy->angstrom_to_internal(3.3)); get_keyval(conf, "hBondExpNumer", en, 6); get_keyval(conf, "hBondExpDenom", ed, 8); @@ -333,10 +333,11 @@ colvar::dihedPC::dihedPC(std::string const &conf) return; } - std::ifstream vecFile; - vecFile.open(vecFileName.c_str()); - if (!vecFile.good()) { - cvm::error("Error opening dihedral PCA vector file " + vecFileName + " for reading"); + std::istream &vecFile = + cvm::main()->proxy->input_stream(vecFileName, + "dihedral PCA vector file"); + if (!vecFile) { + return; } // TODO: adapt to different formats by setting this flag @@ -375,7 +376,7 @@ colvar::dihedPC::dihedPC(std::string const &conf) } } */ - vecFile.close(); + cvm::main()->proxy->close_input_stream(vecFileName); } else { get_keyval(conf, "vector", coeffs, coeffs); diff --git a/lib/colvars/colvarcomp_rotations.cpp b/lib/colvars/colvarcomp_rotations.cpp index 2e0d25ab81..f469174a62 100644 --- a/lib/colvars/colvarcomp_rotations.cpp +++ b/lib/colvars/colvarcomp_rotations.cpp @@ -67,15 +67,17 @@ int colvar::orientation::init(std::string const &conf) } - cvm::log("Centering the reference coordinates: it is " - "assumed that each atom is the closest " - "periodic image to the center of geometry.\n"); cvm::rvector ref_cog(0.0, 0.0, 0.0); size_t i; for (i = 0; i < ref_pos.size(); i++) { ref_cog += ref_pos[i]; } ref_cog /= cvm::real(ref_pos.size()); + cvm::log("Centering the reference coordinates on the origin by subtracting " + "the center of geometry at "+ + cvm::to_str(-1.0 * ref_cog)+"; it is " + "assumed that each atom is the closest " + "periodic image to the center of geometry.\n"); for (i = 0; i < ref_pos.size(); i++) { ref_pos[i] -= ref_cog; } diff --git a/lib/colvars/colvargrid.cpp b/lib/colvars/colvargrid.cpp index 96eb7cb5e1..2fd385ccec 100644 --- a/lib/colvars/colvargrid.cpp +++ b/lib/colvars/colvargrid.cpp @@ -7,14 +7,18 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include +#include + #include "colvarmodule.h" #include "colvarvalue.h" #include "colvarparse.h" #include "colvar.h" #include "colvarcomp.h" #include "colvargrid.h" +#include "colvargrid_def.h" + -#include colvar_grid_count::colvar_grid_count() : colvar_grid() @@ -33,6 +37,42 @@ colvar_grid_count::colvar_grid_count(std::vector &colvars, : colvar_grid(colvars, def_count, 1, margin) {} +std::istream & colvar_grid_count::read_multicol(std::istream &is, bool add) +{ + return colvar_grid::read_multicol(is, add); +} + +int colvar_grid_count::read_multicol(std::string const &filename, + std::string description, + bool add) +{ + return colvar_grid::read_multicol(filename, description, add); +} + +std::ostream & colvar_grid_count::write_multicol(std::ostream &os) const +{ + return colvar_grid::write_multicol(os); +} + +int colvar_grid_count::write_multicol(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_multicol(filename, description); +} + +std::ostream & colvar_grid_count::write_opendx(std::ostream &os) const +{ + return colvar_grid::write_opendx(os); +} + +int colvar_grid_count::write_opendx(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_opendx(filename, description); +} + + + colvar_grid_scalar::colvar_grid_scalar() : colvar_grid(), samples(NULL) {} @@ -56,6 +96,41 @@ colvar_grid_scalar::~colvar_grid_scalar() { } +std::istream & colvar_grid_scalar::read_multicol(std::istream &is, bool add) +{ + return colvar_grid::read_multicol(is, add); +} + +int colvar_grid_scalar::read_multicol(std::string const &filename, + std::string description, + bool add) +{ + return colvar_grid::read_multicol(filename, description, add); +} + +std::ostream & colvar_grid_scalar::write_multicol(std::ostream &os) const +{ + return colvar_grid::write_multicol(os); +} + +int colvar_grid_scalar::write_multicol(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_multicol(filename, description); +} + +std::ostream & colvar_grid_scalar::write_opendx(std::ostream &os) const +{ + return colvar_grid::write_opendx(os); +} + +int colvar_grid_scalar::write_opendx(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_opendx(filename, description); +} + + cvm::real colvar_grid_scalar::maximum_value() const { cvm::real max = data[0]; @@ -145,10 +220,9 @@ colvar_grid_gradient::colvar_grid_gradient(std::string &filename) samples(NULL), weights(NULL) { - std::ifstream is; - is.open(filename.c_str()); - if (!is.is_open()) { - cvm::error("Error opening multicol gradient file " + filename + " for reading.\n"); + std::istream &is = cvm::main()->proxy->input_stream(filename, + "gradient file"); + if (!is) { return; } @@ -203,7 +277,42 @@ colvar_grid_gradient::colvar_grid_gradient(std::string &filename) is.clear(); is.seekg(0); read_multicol(is); - is.close(); + cvm::main()->proxy->close_input_stream(filename); +} + + +std::istream & colvar_grid_gradient::read_multicol(std::istream &is, bool add) +{ + return colvar_grid::read_multicol(is, add); +} + +int colvar_grid_gradient::read_multicol(std::string const &filename, + std::string description, + bool add) +{ + return colvar_grid::read_multicol(filename, description, add); +} + +std::ostream & colvar_grid_gradient::write_multicol(std::ostream &os) const +{ + return colvar_grid::write_multicol(os); +} + +int colvar_grid_gradient::write_multicol(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_multicol(filename, description); +} + +std::ostream & colvar_grid_gradient::write_opendx(std::ostream &os) const +{ + return colvar_grid::write_opendx(os); +} + +int colvar_grid_gradient::write_opendx(std::string const &filename, + std::string description) const +{ + return colvar_grid::write_opendx(filename, description); } diff --git a/lib/colvars/colvargrid.h b/lib/colvars/colvargrid.h index f34c5eccab..e2fc1e0fe2 100644 --- a/lib/colvars/colvargrid.h +++ b/lib/colvars/colvargrid.h @@ -732,8 +732,8 @@ public: /// \brief Return the value suitable for output purposes (so that it /// may be rescaled or manipulated without changing it permanently) - virtual inline T value_output(std::vector const &ix, - size_t const &imult = 0) const + virtual T value_output(std::vector const &ix, + size_t const &imult = 0) const { return value(ix, imult); } @@ -741,10 +741,10 @@ public: /// \brief Get the value from a formatted output and transform it /// into the internal representation (the two may be different, /// e.g. when using colvar_grid_count) - virtual inline void value_input(std::vector const &ix, - T const &t, - size_t const &imult = 0, - bool add = false) + virtual void value_input(std::vector const &ix, + T const &t, + size_t const &imult = 0, + bool add = false) { if ( add ) data[address(ix) + imult] += t; @@ -803,7 +803,7 @@ public: } } - /// \brief Write the grid parameters (number of colvars, boundaries, width and number of points) + /// Write the grid parameters (number of colvars, boundaries, width and number of points) std::ostream & write_params(std::ostream &os) { size_t i; @@ -1028,188 +1028,27 @@ public: return is; } - /// \brief Write the grid in a format which is both human readable - /// and suitable for visualization e.g. with gnuplot - void write_multicol(std::ostream &os) const - { - std::streamsize const w = os.width(); - std::streamsize const p = os.precision(); + /// Read a grid written by write_multicol(), incrementing if add is true + std::istream & read_multicol(std::istream &is, bool add = false); - // Data in the header: nColvars, then for each - // xiMin, dXi, nPoints, periodic + /// Read a grid written by write_multicol(), incrementing if add is true + int read_multicol(std::string const &filename, + std::string description = "grid file", + bool add = false); - os << std::setw(2) << "# " << nd << "\n"; - for (size_t i = 0; i < nd; i++) { - os << "# " - << std::setw(10) << lower_boundaries[i] - << std::setw(10) << widths[i] - << std::setw(10) << nx[i] << " " - << periodic[i] << "\n"; - } + /// Write grid in a format which is both human-readable and gnuplot-friendly + std::ostream & write_multicol(std::ostream &os) const; + /// Write grid in a format which is both human-readable and gnuplot-friendly + int write_multicol(std::string const &filename, + std::string description = "grid file") const; - for (std::vector ix = new_index(); index_ok(ix); incr(ix) ) { + /// Write the grid data without labels, as they are represented in memory + std::ostream & write_opendx(std::ostream &os) const; - if (ix.back() == 0) { - // if the last index is 0, add a new line to mark the new record - os << "\n"; - } - - for (size_t i = 0; i < nd; i++) { - os << " " - << std::setw(w) << std::setprecision(p) - << bin_to_value_scalar(ix[i], i); - } - os << " "; - for (size_t imult = 0; imult < mult; imult++) { - os << " " - << std::setw(w) << std::setprecision(p) - << value_output(ix, imult); - } - os << "\n"; - } - } - - /// \brief Read a grid written by colvar_grid::write_multicol() - /// Adding data if add is true, replacing if false - std::istream & read_multicol(std::istream &is, bool add = false) - { - // Data in the header: nColvars, then for each - // xiMin, dXi, nPoints, periodic flag - - std::string hash; - cvm::real lower, width, x; - size_t n, periodic_flag; - bool remap; - std::vector new_value; - std::vector nx_read; - std::vector bin; - - if ( cv.size() > 0 && cv.size() != nd ) { - cvm::error("Cannot read grid file: number of variables in file differs from number referenced by grid.\n"); - return is; - } - - if ( !(is >> hash) || (hash != "#") ) { - cvm::error("Error reading grid at position "+ - cvm::to_str(static_cast(is.tellg()))+ - " in stream(read \"" + hash + "\")\n"); - return is; - } - - is >> n; - if ( n != nd ) { - cvm::error("Error reading grid: wrong number of collective variables.\n"); - return is; - } - - nx_read.resize(n); - bin.resize(n); - new_value.resize(mult); - - if (this->has_parent_data && add) { - new_data.resize(data.size()); - } - - remap = false; - for (size_t i = 0; i < nd; i++ ) { - if ( !(is >> hash) || (hash != "#") ) { - cvm::error("Error reading grid at position "+ - cvm::to_str(static_cast(is.tellg()))+ - " in stream(read \"" + hash + "\")\n"); - return is; - } - - is >> lower >> width >> nx_read[i] >> periodic_flag; - - - if ( (cvm::fabs(lower - lower_boundaries[i].real_value) > 1.0e-10) || - (cvm::fabs(width - widths[i] ) > 1.0e-10) || - (nx_read[i] != nx[i]) ) { - cvm::log("Warning: reading from different grid definition (colvar " - + cvm::to_str(i+1) + "); remapping data on new grid.\n"); - remap = true; - } - } - - if ( remap ) { - // re-grid data - while (is.good()) { - bool end_of_file = false; - - for (size_t i = 0; i < nd; i++ ) { - if ( !(is >> x) ) end_of_file = true; - bin[i] = value_to_bin_scalar(x, i); - } - if (end_of_file) break; - - for (size_t imult = 0; imult < mult; imult++) { - is >> new_value[imult]; - } - - if ( index_ok(bin) ) { - for (size_t imult = 0; imult < mult; imult++) { - value_input(bin, new_value[imult], imult, add); - } - } - } - } else { - // do not re-grid the data but assume the same grid is used - for (std::vector ix = new_index(); index_ok(ix); incr(ix) ) { - for (size_t i = 0; i < nd; i++ ) { - is >> x; - } - for (size_t imult = 0; imult < mult; imult++) { - is >> new_value[imult]; - value_input(ix, new_value[imult], imult, add); - } - } - } - has_data = true; - return is; - } - - /// \brief Write the grid data without labels, as they are - /// represented in memory - std::ostream & write_opendx(std::ostream &os) const - { - // write the header - os << "object 1 class gridpositions counts"; - size_t icv; - for (icv = 0; icv < num_variables(); icv++) { - os << " " << number_of_points(icv); - } - os << "\n"; - - os << "origin"; - for (icv = 0; icv < num_variables(); icv++) { - os << " " << (lower_boundaries[icv].real_value + 0.5 * widths[icv]); - } - os << "\n"; - - for (icv = 0; icv < num_variables(); icv++) { - os << "delta"; - for (size_t icv2 = 0; icv2 < num_variables(); icv2++) { - if (icv == icv2) os << " " << widths[icv]; - else os << " " << 0.0; - } - os << "\n"; - } - - os << "object 2 class gridconnections counts"; - for (icv = 0; icv < num_variables(); icv++) { - os << " " << number_of_points(icv); - } - os << "\n"; - - os << "object 3 class array type double rank 0 items " - << number_of_points() << " data follows\n"; - - write_raw(os); - - os << "object \"collective variables scalar field\" class field\n"; - return os; - } + /// Write the grid data without labels, as they are represented in memory + int write_opendx(std::string const &filename, + std::string description = "grid file") const; }; @@ -1224,7 +1063,7 @@ public: colvar_grid_count(); /// Destructor - virtual inline ~colvar_grid_count() + virtual ~colvar_grid_count() {} /// Constructor @@ -1249,13 +1088,33 @@ public: return new_data[address(ix) + imult]; } - /// \brief Get the value from a formatted output and transform it - /// into the internal representation (it may have been rescaled or - /// manipulated) - virtual inline void value_input(std::vector const &ix, - size_t const &t, - size_t const &imult = 0, - bool add = false) + /// Read a grid written by write_multicol(), incrementin if data is true + std::istream & read_multicol(std::istream &is, bool add = false); + + /// Read a grid written by write_multicol(), incrementin if data is true + int read_multicol(std::string const &filename, + std::string description = "grid file", + bool add = false); + + /// Write grid in a format which is both human-readable and gnuplot-friendly + std::ostream & write_multicol(std::ostream &os) const; + + /// Write grid in a format which is both human-readable and gnuplot-friendly + int write_multicol(std::string const &filename, + std::string description = "grid file") const; + + /// Write the grid data without labels, as they are represented in memory + std::ostream & write_opendx(std::ostream &os) const; + + /// Write the grid data without labels, as they are represented in memory + int write_opendx(std::string const &filename, + std::string description = "grid file") const; + + /// Enter or add a value, but also handle parent grid + virtual void value_input(std::vector const &ix, + size_t const &t, + size_t const &imult = 0, + bool add = false) { (void) imult; if (add) { @@ -1322,7 +1181,7 @@ public: /// \brief Return the gradient of discrete count from finite differences /// on the *same* grid for dimension n inline cvm::real gradient_finite_diff(const std::vector &ix0, - int n = 0) + int n = 0) { cvm::real A0, A1, A2; std::vector ix = ix0; @@ -1380,7 +1239,7 @@ public: colvar_grid_scalar(colvar_grid_scalar const &g); /// Destructor - ~colvar_grid_scalar(); + virtual ~colvar_grid_scalar(); /// Constructor from specific sizes arrays colvar_grid_scalar(std::vector const &nx_i); @@ -1402,6 +1261,28 @@ public: has_data = true; } + /// Read a grid written by write_multicol(), incrementin if data is true + std::istream & read_multicol(std::istream &is, bool add = false); + + /// Read a grid written by write_multicol(), incrementin if data is true + int read_multicol(std::string const &filename, + std::string description = "grid file", + bool add = false); + + /// Write grid in a format which is both human-readable and gnuplot-friendly + std::ostream & write_multicol(std::ostream &os) const; + + /// Write grid in a format which is both human-readable and gnuplot-friendly + int write_multicol(std::string const &filename, + std::string description = "grid file") const; + + /// Write the grid data without labels, as they are represented in memory + std::ostream & write_opendx(std::ostream &os) const; + + /// Write the grid data without labels, as they are represented in memory + int write_opendx(std::string const &filename, + std::string description = "grid file") const; + /// \brief Return the gradient of the scalar field from finite differences /// Input coordinates are those of gradient grid, shifted wrt scalar grid /// Should not be called on edges of scalar grid, provided the latter has margins @@ -1458,7 +1339,7 @@ public: /// \brief Return the gradient of discrete count from finite differences /// on the *same* grid for dimension n inline cvm::real gradient_finite_diff(const std::vector &ix0, - int n = 0) + int n = 0) { cvm::real A0, A1, A2; std::vector ix = ix0; @@ -1517,9 +1398,7 @@ public: } } - /// \brief Get the value from a formatted output and transform it - /// into the internal representation (it may have been rescaled or - /// manipulated) + /// Enter or add value but also deal with count grid virtual void value_input(std::vector const &ix, cvm::real const &new_value, size_t const &imult = 0, @@ -1580,7 +1459,7 @@ public: colvar_grid_gradient(); /// Destructor - virtual inline ~colvar_grid_gradient() + virtual ~colvar_grid_gradient() {} /// Constructor from specific sizes arrays @@ -1592,6 +1471,28 @@ public: /// Constructor from a multicol file colvar_grid_gradient(std::string &filename); + /// Read a grid written by write_multicol(), incrementin if data is true + virtual std::istream & read_multicol(std::istream &is, bool add = false); + + /// Read a grid written by write_multicol(), incrementin if data is true + virtual int read_multicol(std::string const &filename, + std::string description = "grid file", + bool add = false); + + /// Write grid in a format which is both human-readable and gnuplot-friendly + virtual std::ostream & write_multicol(std::ostream &os) const; + + /// Write grid in a format which is both human-readable and gnuplot-friendly + virtual int write_multicol(std::string const &filename, + std::string description = "grid file") const; + + /// Write the grid data without labels, as they are represented in memory + virtual std::ostream & write_opendx(std::ostream &os) const; + + /// Write the grid data without labels, as they are represented in memory + virtual int write_opendx(std::string const &filename, + std::string description = "grid file") const; + /// \brief Get a vector with the binned value(s) indexed by ix, normalized if applicable inline void vector_value(std::vector const &ix, std::vector &v) const { @@ -1647,8 +1548,8 @@ public: /// \brief Return the value of the function at ix divided by its /// number of samples (if the count grid is defined) - virtual inline cvm::real value_output(std::vector const &ix, - size_t const &imult = 0) const + virtual cvm::real value_output(std::vector const &ix, + size_t const &imult = 0) const { if (samples) return (samples->value(ix) > 0) ? @@ -1661,10 +1562,10 @@ public: /// \brief Get the value from a formatted output and transform it /// into the internal representation (it may have been rescaled or /// manipulated) - virtual inline void value_input(std::vector const &ix, - cvm::real const &new_value, - size_t const &imult = 0, - bool add = false) + virtual void value_input(std::vector const &ix, + cvm::real const &new_value, + size_t const &imult = 0, + bool add = false) { if (add) { if (samples) diff --git a/lib/colvars/colvargrid_def.h b/lib/colvars/colvargrid_def.h new file mode 100644 index 0000000000..f2245f3d81 --- /dev/null +++ b/lib/colvars/colvargrid_def.h @@ -0,0 +1,261 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + +/// \file Definition of the more complex members of colvar_grid<> template + +#ifndef COLVARGRID_DEF_H +#define COLVARGRID_DEF_H + +#include +#include + +#include "colvarmodule.h" +#include "colvarproxy.h" +#include "colvar.h" +#include "colvargrid.h" + + +template +std::istream & colvar_grid::read_multicol(std::istream &is, bool add) +{ + // Data in the header: nColvars, then for each + // xiMin, dXi, nPoints, periodic flag + + std::string hash; + cvm::real lower, width, x; + size_t n, periodic_flag; + bool remap; + std::vector new_value; + std::vector nx_read; + std::vector bin; + + if ( cv.size() > 0 && cv.size() != nd ) { + cvm::error("Cannot read grid file: number of variables in file differs from number referenced by grid.\n"); + return is; + } + + if ( !(is >> hash) || (hash != "#") ) { + cvm::error("Error reading grid at position "+ + cvm::to_str(static_cast(is.tellg()))+ + " in stream(read \"" + hash + "\")\n", COLVARS_INPUT_ERROR); + return is; + } + + is >> n; + if ( n != nd ) { + cvm::error("Error reading grid: wrong number of collective variables.\n"); + return is; + } + + nx_read.resize(n); + bin.resize(n); + new_value.resize(mult); + + if (this->has_parent_data && add) { + new_data.resize(data.size()); + } + + remap = false; + for (size_t i = 0; i < nd; i++ ) { + if ( !(is >> hash) || (hash != "#") ) { + cvm::error("Error reading grid at position "+ + cvm::to_str(static_cast(is.tellg()))+ + " in stream(read \"" + hash + "\")\n"); + return is; + } + + is >> lower >> width >> nx_read[i] >> periodic_flag; + + + if ( (cvm::fabs(lower - lower_boundaries[i].real_value) > 1.0e-10) || + (cvm::fabs(width - widths[i] ) > 1.0e-10) || + (nx_read[i] != nx[i]) ) { + cvm::log("Warning: reading from different grid definition (colvar " + + cvm::to_str(i+1) + "); remapping data on new grid.\n"); + remap = true; + } + } + + if ( remap ) { + // re-grid data + while (is.good()) { + bool end_of_file = false; + + for (size_t i = 0; i < nd; i++ ) { + if ( !(is >> x) ) end_of_file = true; + bin[i] = value_to_bin_scalar(x, i); + } + if (end_of_file) break; + + for (size_t imult = 0; imult < mult; imult++) { + is >> new_value[imult]; + } + + if ( index_ok(bin) ) { + for (size_t imult = 0; imult < mult; imult++) { + value_input(bin, new_value[imult], imult, add); + } + } + } + } else { + // do not re-grid the data but assume the same grid is used + for (std::vector ix = new_index(); index_ok(ix); incr(ix) ) { + for (size_t i = 0; i < nd; i++ ) { + is >> x; + } + for (size_t imult = 0; imult < mult; imult++) { + is >> new_value[imult]; + value_input(ix, new_value[imult], imult, add); + } + } + } + has_data = true; + return is; +} + + +template +int colvar_grid::read_multicol(std::string const &filename, + std::string description, + bool add) +{ + std::istream &is = cvm::main()->proxy->input_stream(filename, description); + if (!is) { + return COLVARS_FILE_ERROR; + } + if (colvar_grid::read_multicol(is, add)) { + cvm::main()->proxy->close_input_stream(filename); + return COLVARS_OK; + } + return COLVARS_FILE_ERROR; +} + + +template +std::ostream & colvar_grid::write_multicol(std::ostream &os) const +{ + // Save the output formats + std::ios_base::fmtflags prev_flags(os.flags()); + + // Data in the header: nColvars, then for each + // xiMin, dXi, nPoints, periodic + + os << std::setw(2) << "# " << nd << "\n"; + // Write the floating numbers in full precision + os.setf(std::ios::scientific, std::ios::floatfield); + for (size_t i = 0; i < nd; i++) { + os << "# " + << std::setw(cvm::cv_width) << std::setprecision(cvm::cv_prec) << lower_boundaries[i] << " " + << std::setw(cvm::cv_width) << std::setprecision(cvm::cv_prec) << widths[i] << " " + << std::setw(10) << nx[i] << " " + << periodic[i] << "\n"; + } + + for (std::vector ix = new_index(); index_ok(ix); incr(ix) ) { + + if (ix.back() == 0) { + // if the last index is 0, add a new line to mark the new record + os << "\n"; + } + + for (size_t i = 0; i < nd; i++) { + os << " " + << std::setw(cvm::cv_width) << std::setprecision(cvm::cv_prec) + << bin_to_value_scalar(ix[i], i); + } + os << " "; + for (size_t imult = 0; imult < mult; imult++) { + os << " " + << std::setw(cvm::cv_width) << std::setprecision(cvm::cv_prec) + << value_output(ix, imult); + } + os << "\n"; + } + + // Restore the output formats + os.flags(prev_flags); + + return os; +} + + +template +int colvar_grid::write_multicol(std::string const &filename, + std::string description) const +{ + int error_code = COLVARS_OK; + std::ostream &os = cvm::main()->proxy->output_stream(filename, description); + if (!os) { + return COLVARS_FILE_ERROR; + } + error_code |= colvar_grid::write_multicol(os) ? COLVARS_OK : + COLVARS_FILE_ERROR; + cvm::main()->proxy->close_output_stream(filename); + return error_code; +} + + +template +std::ostream & colvar_grid::write_opendx(std::ostream &os) const +{ + // write the header + os << "object 1 class gridpositions counts"; + size_t icv; + for (icv = 0; icv < num_variables(); icv++) { + os << " " << number_of_points(icv); + } + os << "\n"; + + os << "origin"; + for (icv = 0; icv < num_variables(); icv++) { + os << " " << (lower_boundaries[icv].real_value + 0.5 * widths[icv]); + } + os << "\n"; + + for (icv = 0; icv < num_variables(); icv++) { + os << "delta"; + for (size_t icv2 = 0; icv2 < num_variables(); icv2++) { + if (icv == icv2) os << " " << widths[icv]; + else os << " " << 0.0; + } + os << "\n"; + } + + os << "object 2 class gridconnections counts"; + for (icv = 0; icv < num_variables(); icv++) { + os << " " << number_of_points(icv); + } + os << "\n"; + + os << "object 3 class array type double rank 0 items " + << number_of_points() << " data follows\n"; + + write_raw(os); + + os << "object \"collective variables scalar field\" class field\n"; + return os; +} + + +template +int colvar_grid::write_opendx(std::string const &filename, + std::string description) const +{ + int error_code = COLVARS_OK; + std::ostream &os = cvm::main()->proxy->output_stream(filename, description); + if (!os) { + return COLVARS_FILE_ERROR; + } + error_code |= colvar_grid::write_opendx(os) ? COLVARS_OK : + COLVARS_FILE_ERROR; + cvm::main()->proxy->close_output_stream(filename); + return error_code; +} + +#endif diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 6ad945202e..68cd402e1c 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -7,7 +7,10 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include +#include #include +#include #include #include #include @@ -71,8 +74,6 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) depth_s = 0; log_level_ = 10; - cv_traj_os = NULL; - xyz_reader_use_count = 0; num_biases_types_used_ = @@ -132,8 +133,6 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in) cv_traj_freq = 100; restart_out_freq = proxy->default_restart_frequency(); - // by default overwrite the existing trajectory file - cv_traj_append = false; cv_traj_write_labels = true; // Removes the need for proxy specializations to create this @@ -190,12 +189,12 @@ int colvarmodule::read_config_file(char const *config_filename) std::string(config_filename)+"\":\n"); // open the configfile - config_s.open(config_filename); - if (!config_s.is_open()) { - cvm::error("Error: in opening configuration file \""+ - std::string(config_filename)+"\".\n", - COLVARS_FILE_ERROR); - return COLVARS_ERROR; + std::istream &config_s = proxy->input_stream(config_filename, + "configuration file/string"); + if (!config_s) { + return cvm::error("Error: in opening configuration file \""+ + std::string(config_filename)+"\".\n", + COLVARS_FILE_ERROR); } // read the config file into a string @@ -206,7 +205,7 @@ int colvarmodule::read_config_file(char const *config_filename) if (line.find_first_not_of(colvarparse::white_space) != std::string::npos) conf.append(line+"\n"); } - config_s.close(); + proxy->close_input_stream(config_filename); return parse_config(conf); } @@ -299,9 +298,6 @@ int colvarmodule::parse_config(std::string &conf) cvm::log("Collective variables module (re)initialized.\n"); cvm::log(cvm::line_marker); - // Update any necessary proxy data - proxy->setup(); - if (source_Tcl_script.size() > 0) { run_tcl_script(source_Tcl_script); } @@ -385,10 +381,6 @@ int colvarmodule::parse_global_params(std::string const &conf) parse->get_keyval(conf, "colvarsRestartFrequency", restart_out_freq, restart_out_freq); - // Deprecate append flag - parse->get_keyval(conf, "colvarsTrajAppend", - cv_traj_append, cv_traj_append, colvarparse::parse_silent); - parse->get_keyval(conf, "scriptedColvarForces", use_scripted_forces, use_scripted_forces); @@ -433,6 +425,7 @@ int colvarmodule::parse_colvars(std::string const &conf) cvm::log("Error while constructing colvar number " + cvm::to_str(colvars.size()) + " : deleting."); delete colvars.back(); // the colvar destructor updates the colvars array + cvm::decrease_depth(); return COLVARS_ERROR; } cvm::decrease_depth(); @@ -855,11 +848,13 @@ int colvarmodule::calc_colvars() // so they can activate colvars as needed std::vector::iterator bi; for (bi = biases.begin(); bi != biases.end(); bi++) { - int tsf = (*bi)->get_time_step_factor(); - if (tsf > 0 && (step_absolute() % tsf == 0)) { - (*bi)->enable(colvardeps::f_cvb_awake); - } else { - (*bi)->disable(colvardeps::f_cvb_awake); + int const tsf = (*bi)->get_time_step_factor(); + if (tsf > 1) { + if (step_absolute() % tsf == 0) { + (*bi)->enable(colvardeps::f_cvb_awake); + } else { + (*bi)->disable(colvardeps::f_cvb_awake); + } } } @@ -870,12 +865,14 @@ int colvarmodule::calc_colvars() variables_active()->clear(); variables_active()->reserve(variables()->size()); for (cvi = variables()->begin(); cvi != variables()->end(); cvi++) { - // Wake up or put to sleep variables + // Wake up or put to sleep variables with MTS int tsf = (*cvi)->get_time_step_factor(); - if (tsf > 0 && (step_absolute() % tsf == 0)) { - (*cvi)->enable(colvardeps::f_cv_awake); - } else { - (*cvi)->disable(colvardeps::f_cv_awake); + if (tsf > 1) { + if (step_absolute() % tsf == 0) { + (*cvi)->enable(colvardeps::f_cv_awake); + } else { + (*cvi)->disable(colvardeps::f_cv_awake); + } } if ((*cvi)->is_enabled()) { @@ -1013,10 +1010,7 @@ int colvarmodule::update_colvar_forces() cvm::log("Collecting forces from all biases.\n"); cvm::increase_depth(); for (bi = biases_active()->begin(); bi != biases_active()->end(); bi++) { - (*bi)->communicate_forces(); - if (cvm::get_error()) { - return COLVARS_ERROR; - } + error_code |= (*bi)->communicate_forces(); } cvm::decrease_depth(); @@ -1040,9 +1034,6 @@ int colvarmodule::update_colvar_forces() for (cvi = variables()->begin(); cvi != variables()->end(); cvi++) { // Inactive colvars will only reset their forces and return 0 energy total_colvar_energy += (*cvi)->update_forces_energy(); - if (cvm::get_error()) { - return COLVARS_ERROR; - } } cvm::decrease_depth(); if (cvm::debug()) @@ -1064,7 +1055,7 @@ int colvarmodule::update_colvar_forces() } cvm::decrease_depth(); - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return error_code; } @@ -1089,17 +1080,15 @@ int colvarmodule::calc_scripted_forces() int colvarmodule::write_restart_file(std::string const &out_name) { cvm::log("Saving collective variables state to \""+out_name+"\".\n"); - proxy->backup_file(out_name); - std::ostream *restart_out_os = proxy->output_stream(out_name); - if (!restart_out_os) return cvm::get_error(); - if (!write_restart(*restart_out_os)) { + std::ostream &restart_out_os = proxy->output_stream(out_name, "state file"); + if (!restart_out_os) return COLVARS_FILE_ERROR; + if (!write_restart(restart_out_os)) { return cvm::error("Error: in writing restart file.\n", COLVARS_FILE_ERROR); } proxy->close_output_stream(out_name); - if (cv_traj_os != NULL) { - // Take the opportunity to flush colvars.traj - proxy->flush_output_stream(cv_traj_os); - } + + // Take the opportunity to flush colvars.traj + return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); } @@ -1118,38 +1107,46 @@ int colvarmodule::write_restart_string(std::string &output) int colvarmodule::write_traj_files() { + int error_code = COLVARS_OK; + if (cvm::debug()) { cvm::log("colvarmodule::write_traj_files()\n"); } - if (cv_traj_os == NULL) { - if (open_traj_file(cv_traj_name) != COLVARS_OK) { - return cvm::get_error(); - } else { - cv_traj_write_labels = true; - } + std::ostream &cv_traj_os = proxy->output_stream(cv_traj_name, + "colvars trajectory"); + + if (!cv_traj_os) { + return COLVARS_FILE_ERROR; } - // write labels in the traj file every 1000 lines and at first timestep - if ((cvm::step_absolute() % (cv_traj_freq * 1000)) == 0 || - cvm::step_relative() == 0 || - cv_traj_write_labels) { - write_traj_label(*cv_traj_os); + // Write labels in the traj file at beginning and then every 1000 lines + if ( (cvm::step_relative() == 0) || cv_traj_write_labels || + ((cvm::step_absolute() % (cv_traj_freq * 1000)) == 0) ) { + error_code |= + write_traj_label(cv_traj_os) ? COLVARS_OK : COLVARS_FILE_ERROR; + cv_traj_write_labels = false; + } + + if (cvm::debug()) { + proxy->flush_output_stream(cv_traj_name); } - cv_traj_write_labels = false; if ((cvm::step_absolute() % cv_traj_freq) == 0) { - write_traj(*cv_traj_os); + error_code |= write_traj(cv_traj_os) ? COLVARS_OK : COLVARS_FILE_ERROR; } - if (restart_out_freq && (cv_traj_os != NULL) && - ((cvm::step_absolute() % restart_out_freq) == 0)) { + if (cvm::debug()) { + proxy->flush_output_stream(cv_traj_name); + } + + if (restart_out_freq && ((cvm::step_absolute() % restart_out_freq) == 0)) { cvm::log("Synchronizing (emptying the buffer of) trajectory file \""+ cv_traj_name+"\".\n"); - proxy->flush_output_stream(cv_traj_os); + error_code |= proxy->flush_output_stream(cv_traj_name); } - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return error_code; } @@ -1208,7 +1205,7 @@ int colvarmodule::end_of_step() } -int colvarmodule::setup() +int colvarmodule::update_engine_parameters() { if (this->size() == 0) return cvm::get_error(); for (std::vector::iterator cvi = variables()->begin(); @@ -1221,8 +1218,8 @@ int colvarmodule::setup() colvarmodule::~colvarmodule() { - if ((proxy->smp_thread_id() == COLVARS_NOT_IMPLEMENTED) || - (proxy->smp_thread_id() == 0)) { + if ((proxy->smp_thread_id() < 0) || // not using threads + (proxy->smp_thread_id() == 0)) { // or this is thread 0 reset(); @@ -1250,8 +1247,6 @@ colvarmodule::~colvarmodule() int colvarmodule::reset() { - cvm::log("Resetting the Collective Variables module.\n"); - parse->clear(); // Iterate backwards because we are deleting the elements as we go @@ -1289,30 +1284,34 @@ int colvarmodule::setup_input() // Read a state file std::string restart_in_name(proxy->input_prefix()+ std::string(".colvars.state")); - std::ifstream input_is(restart_in_name.c_str()); - if (!input_is.good()) { - // Try without the suffix - input_is.clear(); + std::istream *input_is = &(proxy->input_stream(restart_in_name, + "restart file/channel", + false)); + if (!*input_is) { + // Try without the suffix ".colvars.state" restart_in_name = proxy->input_prefix(); - input_is.open(restart_in_name.c_str()); + input_is = &(proxy->input_stream(restart_in_name, + "restart file/channel")); + if (!*input_is) { + return COLVARS_FILE_ERROR; + } } - // Now that the file has been opened, clear this for the next round + // Now that the file has been opened, clear this field so that this + // function will not be called twice proxy->input_prefix().clear(); - if (!input_is.good()) { - return cvm::error("Error: in opening input state file \""+ - std::string(restart_in_name)+"\".\n", - COLVARS_FILE_ERROR); - } else { - cvm::log(cvm::line_marker); - cvm::log("Loading state from file \""+restart_in_name+"\".\n"); - read_restart(input_is); - cvm::log(cvm::line_marker); - return cvm::get_error(); - } + cvm::log(cvm::line_marker); + cvm::log("Loading state from file \""+restart_in_name+"\".\n"); + read_restart(*input_is); + cvm::log(cvm::line_marker); + + proxy->close_input_stream(restart_in_name); + + return cvm::get_error(); } + // TODO This could soon be redundant if (proxy->input_buffer() != NULL) { // Read a string buffer char const *buffer = proxy->input_buffer(); @@ -1364,10 +1363,6 @@ int colvarmodule::setup_output() std::string(output_prefix()+".colvars.traj") : std::string("")); - if (cv_traj_freq && cv_traj_name.size()) { - error_code |= open_traj_file(cv_traj_name); - } - for (std::vector::iterator bi = biases.begin(); bi != biases.end(); bi++) { @@ -1572,7 +1567,7 @@ int colvarmodule::write_output_files() error_code |= (*bi)->write_state_to_replicas(); } cvm::decrease_depth(); - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return error_code; } @@ -1582,6 +1577,9 @@ int colvarmodule::read_traj(char const *traj_filename, { cvm::log("Opening trajectory file \""+ std::string(traj_filename)+"\".\n"); + // NB: this function is not currently used, but when it will it should + // retain the ability for direct file-based access (in case traj files + // exceed memory) std::ifstream traj_is(traj_filename); while (true) { @@ -1683,42 +1681,6 @@ std::ostream & colvarmodule::write_restart(std::ostream &os) } -int colvarmodule::open_traj_file(std::string const &file_name) -{ - if (cv_traj_os != NULL) { - return COLVARS_OK; - } - - // (re)open trajectory file - if (cv_traj_append) { - cvm::log("Appending to trajectory file \""+file_name+"\".\n"); - cv_traj_os = (cvm::proxy)->output_stream(file_name, std::ios::app); - } else { - cvm::log("Opening trajectory file \""+file_name+"\".\n"); - proxy->backup_file(file_name.c_str()); - cv_traj_os = (cvm::proxy)->output_stream(file_name); - } - - if (cv_traj_os == NULL) { - cvm::error("Error: cannot write to file \""+file_name+"\".\n", - COLVARS_FILE_ERROR); - } - - return cvm::get_error(); -} - - -int colvarmodule::close_traj_file() -{ - if (cv_traj_os != NULL) { - cvm::log("Closing trajectory file \""+cv_traj_name+"\".\n"); - proxy->close_output_stream(cv_traj_name); - cv_traj_os = NULL; - } - return cvm::get_error(); -} - - std::ostream & colvarmodule::write_traj_label(std::ostream &os) { os.setf(std::ios::scientific, std::ios::floatfield); @@ -1739,10 +1701,6 @@ std::ostream & colvarmodule::write_traj_label(std::ostream &os) } os << "\n"; - if (cvm::debug()) { - proxy->flush_output_stream(&os); - } - cvm::decrease_depth(); return os; } @@ -1768,10 +1726,6 @@ std::ostream & colvarmodule::write_traj(std::ostream &os) } os << "\n"; - if (cvm::debug()) { - proxy->flush_output_stream(&os); - } - cvm::decrease_depth(); return os; } @@ -1780,12 +1734,15 @@ std::ostream & colvarmodule::write_traj(std::ostream &os) void colvarmodule::log(std::string const &message, int min_log_level) { if (cvm::log_level() < min_log_level) return; + + std::string const trailing_newline = (message.size() > 0) ? + (message[message.size()-1] == '\n' ? "" : "\n") : ""; // allow logging when the module is not fully initialized size_t const d = (cvm::main() != NULL) ? depth() : 0; if (d > 0) { - proxy->log((std::string(2*d, ' '))+message); + proxy->log((std::string(2*d, ' ')) + message + trailing_newline); } else { - proxy->log(message); + proxy->log(message + trailing_newline); } } @@ -1854,18 +1811,26 @@ void colvarmodule::clear_error() int colvarmodule::error(std::string const &message, int code) { set_error_bits(code); - proxy->error(message); + + std::string const trailing_newline = (message.size() > 0) ? + (message[message.size()-1] == '\n' ? "" : "\n") : ""; + size_t const d = depth(); + if (d > 0) { + proxy->error((std::string(2*d, ' ')) + message + trailing_newline); + } else { + proxy->error(message + trailing_newline); + } + return get_error(); } int cvm::read_index_file(char const *filename) { - std::ifstream is(filename, std::ios::binary); - if (!is.good()) { - return cvm::error("Error: in opening index file \""+ - std::string(filename)+"\".\n", - COLVARS_FILE_ERROR); + std::istream &is = proxy->input_stream(filename, "index file"); + + if (!is) { + return COLVARS_FILE_ERROR; } else { index_file_names.push_back(std::string(filename)); } @@ -1947,7 +1912,7 @@ int cvm::read_index_file(char const *filename) cvm::to_str((index_groups[i])->size())+" atoms)\n"); } - return COLVARS_OK; + return proxy->close_input_stream(filename); } @@ -2016,9 +1981,10 @@ int cvm::load_coords(char const *file_name, int cvm::load_coords_xyz(char const *filename, std::vector *pos, - cvm::atom_group *atoms) + cvm::atom_group *atoms, + bool keep_open) { - std::ifstream xyz_is(filename); + std::istream &xyz_is = proxy->input_stream(filename, "XYZ file"); unsigned int natoms; char symbol[256]; std::string line; @@ -2028,7 +1994,8 @@ int cvm::load_coords_xyz(char const *filename, std::string(filename)+"\".\n"); if ( ! (xyz_is >> natoms) ) { - return cvm::error(error_msg, COLVARS_INPUT_ERROR); + // Return silent error when reaching the end of multi-frame files + return keep_open ? COLVARS_NO_SUCH_FRAME : cvm::error(error_msg, COLVARS_INPUT_ERROR); } ++xyz_reader_use_count; @@ -2049,6 +2016,12 @@ int cvm::load_coords_xyz(char const *filename, size_t xyz_natoms = 0; if (pos->size() != natoms) { // Use specified indices int next = 0; // indices are zero-based + if (!atoms) { + // In the other branch of this test, reading all positions from the file, + // a valid atom group pointer is not necessary + return cvm::error("Trying to read partial positions with invalid atom group pointer", + COLVARS_BUG_ERROR); + } std::vector::const_iterator index = atoms->sorted_ids().begin(); for ( ; pos_i != pos->end() ; pos_i++, index++) { @@ -2092,7 +2065,11 @@ int cvm::load_coords_xyz(char const *filename, cvm::to_str(pos->size())+".\n", COLVARS_INPUT_ERROR); } - return COLVARS_OK; + if (keep_open) { + return COLVARS_OK; + } else { + return proxy->close_input_stream(filename); + } } @@ -2100,18 +2077,6 @@ int cvm::load_coords_xyz(char const *filename, // Wrappers to proxy functions: these may go in the future -cvm::real cvm::boltzmann() -{ - return proxy->boltzmann(); -} - - -cvm::real cvm::temperature() -{ - return proxy->temperature(); -} - - cvm::real cvm::dt() { return proxy->dt(); diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index ae29e94505..236d432a95 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -40,15 +40,13 @@ You can browse the class hierarchy or the list of source files. #define COLVARS_BUG_ERROR (1<<3) // Inconsistent state indicating bug #define COLVARS_FILE_ERROR (1<<4) #define COLVARS_MEMORY_ERROR (1<<5) -#define COLVARS_NO_SUCH_FRAME (1<<6) // Cannot load the requested frame +#define COLVARS_NO_SUCH_FRAME (1<<6) // Cannot load the requested frame -#include -#include -#include #include #include #include #include +#include class colvarparse; class colvar; @@ -441,9 +439,9 @@ public: // from the proxy that may change during program execution) // No additional parsing is done within these functions - /// (Re)initialize internal data (currently used by LAMMPS) + /// (Re)initialize any internal data affected by changes in the engine /// Also calls setup() member functions of colvars and biases - int setup(); + int update_engine_parameters(); /// (Re)initialize and (re)read the input state file calling read_restart() int setup_input(); @@ -634,12 +632,6 @@ public: // proxy functions - /// \brief Boltmann constant - static real boltzmann(); - - /// \brief Temperature of the simulation (K) - static real temperature(); - /// \brief Time step of MD integrator (fs) static real dt(); @@ -751,7 +743,8 @@ public: /// Load coordinates into an atom group from an XYZ file (assumes Angstroms) int load_coords_xyz(char const *filename, std::vector *pos, - atom_group *atoms); + atom_group *atoms, + bool keep_open = false); /// Frequency for collective variables trajectory output static size_t cv_traj_freq; @@ -766,21 +759,12 @@ public: protected: - /// Configuration file - std::ifstream config_s; - /// Configuration file parser object colvarparse *parse; /// Name of the trajectory file std::string cv_traj_name; - /// Collective variables output trajectory file - std::ostream *cv_traj_os; - - /// Appending to the existing trajectory file? - bool cv_traj_append; - /// Write labels at the next iteration bool cv_traj_write_labels; diff --git a/lib/colvars/colvarmodule_refs.h b/lib/colvars/colvarmodule_refs.h index 0b8791ce34..c3fccf297c 100644 --- a/lib/colvars/colvarmodule_refs.h +++ b/lib/colvars/colvarmodule_refs.h @@ -63,6 +63,22 @@ " url = {https://doi.org/10.1021/ct500874p}\n" "}\n"; + paper_count_[std::string("Ebrahimi2022")] = 0; + paper_url_[std::string("Ebrahimi2022")] = "https://doi.org/10.1021/acs.jctc.1c01235"; + paper_bibtex_[std::string("Ebrahimi2022")] = + "\n" + "@article {Ebrahimi2022,\n" + " author = {Ebrahimi, Mina and H\\'enin, J\\'er\\^ome},\n" + " title = {Symmetry-Adapted Restraints for Binding Free Energy Calculations},\n" + " journal = {Journal of Chemical Theory and Computation},\n" + " volume = {18},\n" + " number = {4},\n" + " pages = {2494-2502},\n" + " year = {2022},\n" + " doi = {10.1021/acs.jctc.1c01235},\n" + " url = {https://doi.org/10.1021/acs.jctc.1c01235}\n" + "}\n"; + paper_count_[std::string("Fiorin2013")] = 0; paper_url_[std::string("Fiorin2013")] = "https://doi.org/10.1080/00268976.2013.813594"; paper_bibtex_[std::string("Fiorin2013")] = @@ -246,20 +262,19 @@ " url = {https://doi.org/10.1063/5.0014475}\n" "}\n"; - paper_count_[std::string("Plimpton1995")] = 0; - paper_url_[std::string("Plimpton1995")] = "https://doi.org/10.1006/jcph.1995.1039"; - paper_bibtex_[std::string("Plimpton1995")] = + paper_count_[std::string("Thompson2022")] = 0; + paper_url_[std::string("Thompson2022")] = "https://doi.org/10.1016/j.cpc.2021.108171"; + paper_bibtex_[std::string("Thompson2022")] = "\n" - "@article{Plimpton1995,\n" - " title = {Fast parallel algorithms for short-range molecular dynamics},\n" - " author = {Plimpton, Steve},\n" - " journal = {J. Comp. Phys.},\n" - " year = {1995},\n" - " volume = {117},\n" - " number = {1},\n" - " pages = {1--19},\n" - " doi = {10.1006/jcph.1995.1039},\n" - " url = {https://doi.org/10.1006/jcph.1995.1039}\n" + "@article{Thompson2022,\n" + " title = {{LAMMPS} - a flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales},\n" + " author = {Thompson, Aidan P. and Aktulga, H. Metin and Berger, Richard and Bolintineanu, Dan S. and Brown, W. Michael and Crozier, Paul S. and {in't Veld}, Pieter J. and Kohlmeyer, Axel and Moore, Stan G. and Nguyen, Trung Dac and Shan, Ray and Stevens, Mark J. and Tranchida, Julien and Trott, Christian and Plimpton, Steven J.},\n" + " journal = {Comp. Phys. Comm.},\n" + " volume = {271},\n" + " pages = {108171},\n" + " year = {2022},\n" + " doi = {10.1016/j.cpc.2021.108171},\n" + " url = {https://doi.org/10.1016/j.cpc.2021.108171}\n" "}\n"; paper_count_[std::string("Shen2015")] = 0; @@ -329,6 +344,9 @@ feature_count_[std::string("Multiple-walker ABF implementation")] = 0; feature_paper_map_[std::string("Multiple-walker ABF implementation")] = "Comer2014c"; + feature_count_[std::string("Symmetry-adapted RMSD")] = 0; + feature_paper_map_[std::string("Symmetry-adapted RMSD")] = "Ebrahimi2022"; + feature_count_[std::string("Colvars module")] = 0; feature_paper_map_[std::string("Colvars module")] = "Fiorin2013"; @@ -504,7 +522,7 @@ feature_paper_map_[std::string("Scalable center-of-mass computation (NAMD)")] = "Phillips2020"; feature_count_[std::string("LAMMPS engine")] = 0; - feature_paper_map_[std::string("LAMMPS engine")] = "Plimpton1995"; + feature_paper_map_[std::string("LAMMPS engine")] = "Thompson2022"; feature_count_[std::string("distancePairs colvar component")] = 0; feature_paper_map_[std::string("distancePairs colvar component")] = "Shen2015"; diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 3d4c9c439b..b09ea6667c 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -7,23 +7,9 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. -// Using access() to check if a file exists (until we can assume C++14/17) -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#if defined(_WIN32) -#include -#endif - -#include - -#include -#include -#include - -#if defined(_OPENMP) -#include -#endif +#include +#include +#include #include "colvarmodule.h" #include "colvarproxy.h" @@ -33,205 +19,6 @@ -colvarproxy_system::colvarproxy_system() -{ - angstrom_value = 0.0; - kcal_mol_value = 0.0; - boundaries_type = boundaries_unsupported; - total_force_requested = false; - indirect_lambda_biasing_force = 0.0; - cached_alch_lambda_changed = false; - cached_alch_lambda = -1.0; - reset_pbc_lattice(); -} - - -colvarproxy_system::~colvarproxy_system() {} - - -int colvarproxy_system::set_unit_system(std::string const & /* units */, - bool /* check_only */) -{ - return COLVARS_NOT_IMPLEMENTED; -} - - -cvm::real colvarproxy_system::backend_angstrom_value() -{ - return 1.0; -} - - -cvm::real colvarproxy_system::boltzmann() -{ - return 0.001987191; -} - - -cvm::real colvarproxy_system::temperature() -{ - // TODO define, document and implement a user method to set the value of this - return 300.0; -} - - -cvm::real colvarproxy_system::dt() -{ - // TODO define, document and implement a user method to set the value of this - return 1.0; -} - - -cvm::real colvarproxy_system::rand_gaussian() -{ - // TODO define, document and implement a user method to set the value of this - return 0.0; -} - - -void colvarproxy_system::add_energy(cvm::real /* energy */) {} - - -void colvarproxy_system::request_total_force(bool yesno) -{ - if (yesno == true) - cvm::error("Error: total forces are currently not implemented.\n", - COLVARS_NOT_IMPLEMENTED); -} - - -bool colvarproxy_system::total_forces_enabled() const -{ - return false; -} - - -bool colvarproxy_system::total_forces_same_step() const -{ - return false; -} - - -inline int round_to_integer(cvm::real x) -{ - return int(cvm::floor(x+0.5)); -} - - -void colvarproxy_system::update_pbc_lattice() -{ - // Periodicity is assumed in all directions - - if (boundaries_type == boundaries_unsupported || - boundaries_type == boundaries_non_periodic) { - cvm::error("Error: setting PBC lattice with unsupported boundaries.\n", - COLVARS_BUG_ERROR); - return; - } - - { - cvm::rvector const v = cvm::rvector::outer(unit_cell_y, unit_cell_z); - reciprocal_cell_x = v/(v*unit_cell_x); - } - { - cvm::rvector const v = cvm::rvector::outer(unit_cell_z, unit_cell_x); - reciprocal_cell_y = v/(v*unit_cell_y); - } - { - cvm::rvector const v = cvm::rvector::outer(unit_cell_x, unit_cell_y); - reciprocal_cell_z = v/(v*unit_cell_z); - } -} - - -void colvarproxy_system::reset_pbc_lattice() -{ - unit_cell_x.reset(); - unit_cell_y.reset(); - unit_cell_z.reset(); - reciprocal_cell_x.reset(); - reciprocal_cell_y.reset(); - reciprocal_cell_z.reset(); -} - - -cvm::rvector colvarproxy_system::position_distance(cvm::atom_pos const &pos1, - cvm::atom_pos const &pos2) - const -{ - if (boundaries_type == boundaries_unsupported) { - cvm::error("Error: unsupported boundary conditions.\n", COLVARS_INPUT_ERROR); - } - - cvm::rvector diff = (pos2 - pos1); - - if (boundaries_type == boundaries_non_periodic) return diff; - - cvm::real const x_shift = round_to_integer(reciprocal_cell_x*diff); - cvm::real const y_shift = round_to_integer(reciprocal_cell_y*diff); - cvm::real const z_shift = round_to_integer(reciprocal_cell_z*diff); - - diff.x -= x_shift*unit_cell_x.x + y_shift*unit_cell_y.x + - z_shift*unit_cell_z.x; - diff.y -= x_shift*unit_cell_x.y + y_shift*unit_cell_y.y + - z_shift*unit_cell_z.y; - diff.z -= x_shift*unit_cell_x.z + y_shift*unit_cell_y.z + - z_shift*unit_cell_z.z; - - return diff; -} - - -int colvarproxy_system::get_molid(int &) -{ - cvm::error("Error: only VMD allows the use of multiple \"molecules\", " - "i.e. multiple molecular systems.", COLVARS_NOT_IMPLEMENTED); - return -1; -} - - -int colvarproxy_system::get_alch_lambda(cvm::real * /* lambda */) -{ - return cvm::error("Error in get_alch_lambda: alchemical lambda dynamics is not supported by this build.", - COLVARS_NOT_IMPLEMENTED); -} - - -void colvarproxy_system::set_alch_lambda(cvm::real lambda) -{ - cached_alch_lambda = lambda; - cached_alch_lambda_changed = true; -} - - -int colvarproxy_system::send_alch_lambda() -{ - return cvm::error("Error in set_alch_lambda: alchemical lambda dynamics is not supported by this build.", - COLVARS_NOT_IMPLEMENTED); -} - - -int colvarproxy_system::get_dE_dlambda(cvm::real * /* force */) -{ - return cvm::error("Error in get_dE_dlambda: alchemical lambda dynamics is not supported by this build.", - COLVARS_NOT_IMPLEMENTED); -} - - -int colvarproxy_system::apply_force_dE_dlambda(cvm::real* /* force */) -{ - return cvm::error("Error in apply_force_dE_dlambda: function is not implemented by this build.", - COLVARS_NOT_IMPLEMENTED); -} - - -int colvarproxy_system::get_d2E_dlambda2(cvm::real*) -{ - return cvm::error("Error in get_d2E_dlambda2: function is not implemented by this build.", - COLVARS_NOT_IMPLEMENTED); -} - - colvarproxy_atoms::colvarproxy_atoms() { atoms_rms_applied_force_ = atoms_max_applied_force_ = 0.0; @@ -249,7 +36,7 @@ colvarproxy_atoms::~colvarproxy_atoms() int colvarproxy_atoms::reset() { atoms_ids.clear(); - atoms_ncopies.clear(); + atoms_refcount.clear(); atoms_masses.clear(); atoms_charges.clear(); atoms_positions.clear(); @@ -262,7 +49,7 @@ int colvarproxy_atoms::reset() int colvarproxy_atoms::add_atom_slot(int atom_id) { atoms_ids.push_back(atom_id); - atoms_ncopies.push_back(1); + atoms_refcount.push_back(1); atoms_masses.push_back(1.0); atoms_charges.push_back(0.0); atoms_positions.push_back(cvm::rvector(0.0, 0.0, 0.0)); @@ -309,12 +96,22 @@ void colvarproxy_atoms::clear_atom(int index) cvm::error("Error: trying to disable an atom that was not previously requested.\n", COLVARS_INPUT_ERROR); } - if (atoms_ncopies[index] > 0) { - atoms_ncopies[index] -= 1; + if (atoms_refcount[index] > 0) { + atoms_refcount[index] -= 1; } } +size_t colvarproxy_atoms::get_num_active_atoms() const +{ + size_t result = 0; + for (size_t i = 0; i < atoms_refcount.size(); i++) { + if (atoms_refcount[i] > 0) result++; + } + return result; +} + + int colvarproxy_atoms::load_atoms(char const * /* filename */, cvm::atom_group & /* atoms */, std::string const & /* pdb_field */, @@ -382,7 +179,7 @@ colvarproxy_atom_groups::~colvarproxy_atom_groups() int colvarproxy_atom_groups::reset() { atom_groups_ids.clear(); - atom_groups_ncopies.clear(); + atom_groups_refcount.clear(); atom_groups_masses.clear(); atom_groups_charges.clear(); atom_groups_coms.clear(); @@ -395,7 +192,7 @@ int colvarproxy_atom_groups::reset() int colvarproxy_atom_groups::add_atom_group_slot(int atom_group_id) { atom_groups_ids.push_back(atom_group_id); - atom_groups_ncopies.push_back(1); + atom_groups_refcount.push_back(1); atom_groups_masses.push_back(1.0); atom_groups_charges.push_back(0.0); atom_groups_coms.push_back(cvm::rvector(0.0, 0.0, 0.0)); @@ -427,12 +224,22 @@ void colvarproxy_atom_groups::clear_atom_group(int index) "that was not previously requested.\n", COLVARS_INPUT_ERROR); } - if (atom_groups_ncopies[index] > 0) { - atom_groups_ncopies[index] -= 1; + if (atom_groups_refcount[index] > 0) { + atom_groups_refcount[index] -= 1; } } +size_t colvarproxy_atom_groups::get_num_active_atom_groups() const +{ + size_t result = 0; + for (size_t i = 0; i < atom_groups_refcount.size(); i++) { + if (atom_groups_refcount[i] > 0) result++; + } + return result; +} + + void colvarproxy_atom_groups::compute_rms_atom_groups_applied_force() { atom_groups_rms_applied_force_ = @@ -454,8 +261,8 @@ colvarproxy_smp::colvarproxy_smp() omp_lock_state = NULL; #if defined(_OPENMP) if (omp_get_thread_num() == 0) { - omp_lock_state = reinterpret_cast(new omp_lock_t); - omp_init_lock(reinterpret_cast(omp_lock_state)); + omp_lock_state = new omp_lock_t; + omp_init_lock(omp_lock_state); } #endif } @@ -466,7 +273,7 @@ colvarproxy_smp::~colvarproxy_smp() #if defined(_OPENMP) if (omp_get_thread_num() == 0) { if (omp_lock_state) { - delete reinterpret_cast(omp_lock_state); + delete omp_lock_state; } } #endif @@ -567,7 +374,7 @@ int colvarproxy_smp::smp_thread_id() #if defined(_OPENMP) return omp_get_thread_num(); #else - return COLVARS_NOT_IMPLEMENTED; + return -1; #endif } @@ -577,7 +384,7 @@ int colvarproxy_smp::smp_num_threads() #if defined(_OPENMP) return omp_get_max_threads(); #else - return COLVARS_NOT_IMPLEMENTED; + return -1; #endif } @@ -585,7 +392,7 @@ int colvarproxy_smp::smp_num_threads() int colvarproxy_smp::smp_lock() { #if defined(_OPENMP) - omp_set_lock(reinterpret_cast(omp_lock_state)); + omp_set_lock(omp_lock_state); #endif return COLVARS_OK; } @@ -594,8 +401,7 @@ int colvarproxy_smp::smp_lock() int colvarproxy_smp::smp_trylock() { #if defined(_OPENMP) - return omp_test_lock(reinterpret_cast(omp_lock_state)) ? - COLVARS_OK : COLVARS_ERROR; + return omp_test_lock(omp_lock_state) ? COLVARS_OK : COLVARS_ERROR; #else return COLVARS_OK; #endif @@ -605,7 +411,7 @@ int colvarproxy_smp::smp_trylock() int colvarproxy_smp::smp_unlock() { #if defined(_OPENMP) - omp_unset_lock(reinterpret_cast(omp_lock_state)); + omp_unset_lock(omp_lock_state); #endif return COLVARS_OK; } @@ -651,151 +457,35 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name -colvarproxy_io::colvarproxy_io() -{ - input_buffer_ = NULL; - restart_frequency_engine = 0; -} - - -colvarproxy_io::~colvarproxy_io() {} - - -int colvarproxy_io::get_frame(long int&) -{ - return COLVARS_NOT_IMPLEMENTED; -} - - -int colvarproxy_io::set_frame(long int) -{ - return COLVARS_NOT_IMPLEMENTED; -} - - -int colvarproxy_io::backup_file(char const *filename) -{ - // Simplified version of NAMD_file_exists() - int exit_code; - do { -#if defined(_WIN32) && !defined(__CYGWIN__) - // We could use _access_s here, but it is probably too new - exit_code = _access(filename, 00); -#else - exit_code = access(filename, F_OK); -#endif - } while ((exit_code != 0) && (errno == EINTR)); - if (exit_code != 0) { - if (errno == ENOENT) { - // File does not exist - return COLVARS_OK; - } else { - return cvm::error("Unknown error while checking if file \""+ - std::string(filename)+"\" exists.\n", COLVARS_ERROR); - } - } - - // The file exists, then rename it - if (std::string(filename).rfind(std::string(".colvars.state")) != - std::string::npos) { - return rename_file(filename, (std::string(filename)+".old").c_str()); - } else { - return rename_file(filename, (std::string(filename)+".BAK").c_str()); - } -} - - -int colvarproxy_io::remove_file(char const *filename) -{ - int error_code = COLVARS_OK; -#if defined(_WIN32) && !defined(__CYGWIN__) - // Because the file may be open by other processes, rename it to filename.old - std::string const renamed_file(std::string(filename)+".old"); - // It may still be there from an interrupted run, so remove it to be safe - std::remove(renamed_file.c_str()); - int rename_exit_code = 0; - while ((rename_exit_code = std::rename(filename, - renamed_file.c_str())) != 0) { - if (errno == EINTR) continue; - error_code |= COLVARS_FILE_ERROR; - break; - } - // Ask to remove filename.old, but ignore any errors raised - std::remove(renamed_file.c_str()); -#else - if (std::remove(filename)) { - if (errno != ENOENT) { - error_code |= COLVARS_FILE_ERROR; - } - } -#endif - if (error_code != COLVARS_OK) { - return cvm::error("Error: in removing file \""+std::string(filename)+ - "\".\n.", - error_code); - } - return COLVARS_OK; -} - - -int colvarproxy_io::rename_file(char const *filename, char const *newfilename) -{ - int error_code = COLVARS_OK; -#if defined(_WIN32) && !defined(__CYGWIN__) - // On straight Windows, must remove the destination before renaming it - error_code |= remove_file(newfilename); -#endif - int rename_exit_code = 0; - while ((rename_exit_code = std::rename(filename, newfilename)) != 0) { - if (errno == EINTR) continue; - // Call log() instead of error to allow the next try - cvm::log("Error: in renaming file \""+std::string(filename)+"\" to \""+ - std::string(newfilename)+"\".\n."); - error_code |= COLVARS_FILE_ERROR; - if (errno == EXDEV) continue; - break; - } - return rename_exit_code ? error_code : COLVARS_OK; -} - - - colvarproxy::colvarproxy() { colvars = NULL; + // By default, simulation engines allow to immediately request atoms + engine_ready_ = true; b_simulation_running = true; b_simulation_continuing = false; b_delete_requested = false; version_int = -1; features_hash = 0; + config_queue_ = reinterpret_cast(new std::list >); } colvarproxy::~colvarproxy() { - close_files(); + close_output_streams(); if (colvars != NULL) { delete colvars; colvars = NULL; } + delete reinterpret_cast > *>(config_queue_); } -int colvarproxy::close_files() +bool colvarproxy::io_available() { - if (smp_enabled() == COLVARS_OK && smp_thread_id() > 0) { - // Nothing to do on non-master threads - return COLVARS_OK; - } - std::list::iterator osni = output_stream_names.begin(); - std::list::iterator osi = output_files.begin(); - for ( ; osi != output_files.end(); osi++, osni++) { - ((std::ofstream *) (*osi))->close(); - delete *osi; - } - output_files.clear(); - output_stream_names.clear(); - return COLVARS_OK; + return (smp_enabled() == COLVARS_OK && smp_thread_id() == 0) || + (smp_enabled() != COLVARS_OK); } @@ -816,12 +506,41 @@ int colvarproxy::request_deletion() } +void colvarproxy::add_config(std::string const &cmd, std::string const &conf) +{ + reinterpret_cast > *>(config_queue_)->push_back(std::make_pair(cmd, conf)); +} + + int colvarproxy::setup() { return COLVARS_OK; } +int colvarproxy::parse_module_config() +{ + int error_code = COLVARS_OK; + // Read any configuration queued up for Colvars + std::list > *config_queue = reinterpret_cast > *>(config_queue_); + while (config_queue->size() > 0) { + std::pair const &p = config_queue->front(); + if (p.first == "config") { + error_code |= colvars->read_config_string(p.second); + } else if (p.first == "configfile") { + error_code |= colvars->read_config_file(p.second.c_str()); + } else { + error_code |= cvm::error(std::string("Error: invalid keyword \"") + + p.first + + std::string("\" in colvarproxy::setup()\n"), + COLVARS_BUG_ERROR); + } + config_queue->pop_front(); + } + return error_code; +} + + int colvarproxy::update_input() { return COLVARS_OK; @@ -874,7 +593,7 @@ void colvarproxy::print_input_atomic_data() cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ "atoms_ids = "+cvm::to_str(atoms_ids)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ - "atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n"); + "atoms_refcount = "+cvm::to_str(atoms_refcount)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ "atoms_masses = "+cvm::to_str(atoms_masses)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ @@ -893,7 +612,7 @@ void colvarproxy::print_input_atomic_data() cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ "atom_groups_ids = "+cvm::to_str(atom_groups_ids)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ - "atom_groups_ncopies = "+cvm::to_str(atom_groups_ncopies)+"\n"); + "atom_groups_refcount = "+cvm::to_str(atom_groups_refcount)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ "atom_groups_masses = "+cvm::to_str(atom_groups_masses)+"\n"); cvm::log("Step "+cvm::to_str(cvm::step_absolute())+", "+ @@ -988,103 +707,3 @@ int colvarproxy::get_version_from_string(char const *version_string) } -void colvarproxy::smp_stream_error() -{ - cvm::error("Error: trying to access an output stream from a " - "multi-threaded region (bug). For a quick workaround, use " - "\"smp off\" in the Colvars config.\n", COLVARS_BUG_ERROR); -} - - -std::ostream * colvarproxy::output_stream(std::string const &output_name, - std::ios_base::openmode mode) -{ - if (cvm::debug()) { - cvm::log("Using colvarproxy::output_stream()\n"); - } - - std::ostream *os = get_output_stream(output_name); - if (os != NULL) return os; - - if (!(mode & (std::ios_base::app | std::ios_base::ate))) { - backup_file(output_name); - } - std::ofstream *osf = new std::ofstream(output_name.c_str(), mode); - if (!osf->is_open()) { - cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n", - COLVARS_FILE_ERROR); - return NULL; - } - output_stream_names.push_back(output_name); - output_files.push_back(osf); - return osf; -} - - -std::ostream *colvarproxy::get_output_stream(std::string const &output_name) -{ - if (smp_enabled() == COLVARS_OK) { - if (smp_thread_id() > 0) smp_stream_error(); - } - std::list::iterator osi = output_files.begin(); - std::list::iterator osni = output_stream_names.begin(); - for ( ; osi != output_files.end(); osi++, osni++) { - if (*osni == output_name) { - return *osi; - } - } - return NULL; -} - - - -int colvarproxy::flush_output_stream(std::ostream *os) -{ - if (smp_enabled() == COLVARS_OK) { - if (smp_thread_id() > 0) smp_stream_error(); - } - std::list::iterator osi = output_files.begin(); - std::list::iterator osni = output_stream_names.begin(); - for ( ; osi != output_files.end(); osi++, osni++) { - if (*osi == os) { - ((std::ofstream *) (*osi))->flush(); - return COLVARS_OK; - } - } - return cvm::error("Error: trying to flush an output file/channel " - "that wasn't open.\n", COLVARS_BUG_ERROR); -} - - -int colvarproxy::flush_output_streams() -{ - if (smp_enabled() == COLVARS_OK && smp_thread_id() > 0) - return COLVARS_OK; - - std::list::iterator osi = output_files.begin(); - for ( ; osi != output_files.end(); osi++) { - ((std::ofstream *) (*osi))->flush(); - } - return COLVARS_OK; -} - - -int colvarproxy::close_output_stream(std::string const &output_name) -{ - if (smp_enabled() == COLVARS_OK) { - if (smp_thread_id() > 0) smp_stream_error(); - } - std::list::iterator osi = output_files.begin(); - std::list::iterator osni = output_stream_names.begin(); - for ( ; osi != output_files.end(); osi++, osni++) { - if (*osni == output_name) { - ((std::ofstream *) (*osi))->close(); - delete *osi; - output_files.erase(osi); - output_stream_names.erase(osni); - return COLVARS_OK; - } - } - return cvm::error("Error: trying to close an output file/channel " - "that wasn't open.\n", COLVARS_BUG_ERROR); -} diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index 3ed3768aef..5733b8b66d 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -10,12 +10,11 @@ #ifndef COLVARPROXY_H #define COLVARPROXY_H -#include -#include - #include "colvarmodule.h" #include "colvartypes.h" #include "colvarvalue.h" +#include "colvarproxy_io.h" +#include "colvarproxy_system.h" #include "colvarproxy_tcl.h" #include "colvarproxy_volmaps.h" @@ -38,165 +37,6 @@ class colvarscript; -/// Methods for accessing the simulation system (PBCs, integrator, etc) -class colvarproxy_system { - -public: - - /// Constructor - colvarproxy_system(); - - /// Destructor - virtual ~colvarproxy_system(); - - /// \brief Name of the unit system used internally by Colvars (by default, that of the back-end). - /// Supported depending on the back-end: real (A, kcal/mol), metal (A, eV), electron (Bohr, Hartree), gromacs (nm, kJ/mol) - /// Note: calls to back-end PBC functions assume back-end length unit - /// We use different unit from back-end in VMD bc using PBC functions from colvarproxy base class - /// Colvars internal units are user specified, because the module exchanges info in unknown - /// composite dimensions with user input, while it only exchanges quantities of known - /// dimension with the back-end (length and forces) - std::string units; - - /// \brief Request to set the units used internally by Colvars - virtual int set_unit_system(std::string const &units, bool check_only); - - /// \brief Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates - /// * defaults to 0. in the base class; derived proxy classes must set it - /// * in VMD proxy, can only be changed when no variables are defined - /// as user-defined values in composite units must be compatible with that system - cvm::real angstrom_value; - - /// \brief Value of 1 Angstrom in the backend's unit for atomic coordinates - virtual cvm::real backend_angstrom_value(); - - /// \brief Value of 1 kcal/mol in the internal Colvars unit for energy - cvm::real kcal_mol_value; - - /// \brief Convert a length from Angstrom to internal - inline cvm::real angstrom_to_internal(cvm::real l) const - { - return l * angstrom_value; - } - - /// \brief Convert a length from internal to Angstrom - inline cvm::real internal_to_angstrom(cvm::real l) const - { - return l / angstrom_value; - } - - // /// \brief Convert a length from back-end unit to internal - // inline cvm::real back_end_to_internal_unit(cvm::real l) { - // if (angstrom_value == 0.) { - // return l / backend_angstrom_value(); - // } - // return l * angstrom_value / backend_angstrom_value(); - // } - - /// \brief Boltzmann constant in internal Colvars units - virtual cvm::real boltzmann(); - - /// \brief Target temperature of the simulation (K units) - virtual cvm::real temperature(); - - /// \brief Time step of the simulation (fs) - virtual cvm::real dt(); - - /// \brief Pseudo-random number with Gaussian distribution - virtual cvm::real rand_gaussian(void); - - /// Pass restraint energy value for current timestep to MD engine - virtual void add_energy(cvm::real energy); - - /// \brief Get the PBC-aware distance vector between two positions - virtual cvm::rvector position_distance(cvm::atom_pos const &pos1, - cvm::atom_pos const &pos2) const; - - /// Recompute PBC reciprocal lattice (assumes XYZ periodicity) - void update_pbc_lattice(); - - /// Set the lattice vectors to zero - void reset_pbc_lattice(); - - /// \brief Tell the proxy whether total forces are needed (they may not - /// always be available) - virtual void request_total_force(bool yesno); - - /// Are total forces being used? - virtual bool total_forces_enabled() const; - - /// Are total forces from the current step available? - virtual bool total_forces_same_step() const; - - /// Get the molecule ID when called in VMD; raise error otherwise - /// \param molid Set this argument equal to the current VMD molid - virtual int get_molid(int &molid); - - /// Get value of alchemical lambda parameter from back-end (if available) - virtual int get_alch_lambda(cvm::real* lambda); - - /// Set value of alchemical lambda parameter to be sent to back-end at end of timestep - void set_alch_lambda(cvm::real lambda); - - /// Send cached value of alchemical lambda parameter to back-end (if available) - virtual int send_alch_lambda(); - - /// Get energy derivative with respect to lambda (if available) - virtual int get_dE_dlambda(cvm::real* dE_dlambda); - - /// Apply a scalar force on dE_dlambda (back-end distributes it onto atoms) - virtual int apply_force_dE_dlambda(cvm::real* force); - - /// Get energy second derivative with respect to lambda (if available) - virtual int get_d2E_dlambda2(cvm::real* d2E_dlambda2); - - /// Force to be applied onto alch. lambda, propagated from biasing forces on dE_dlambda - cvm::real indirect_lambda_biasing_force; - - /// Get weight factor from accelMD - virtual cvm::real get_accelMD_factor() const { - cvm::error("Error: accessing the reweighting factor of accelerated MD " - "is not yet implemented in the MD engine.\n", - COLVARS_NOT_IMPLEMENTED); - return 1.0; - } - virtual bool accelMD_enabled() const { - return false; - } - -protected: - /// Next value of lambda to be sent to back-end - cvm::real cached_alch_lambda; - - /// Whether lambda has been set and needs to be updated in backend - bool cached_alch_lambda_changed; - - /// Whether the total forces have been requested - bool total_force_requested; - - /// \brief Type of boundary conditions - /// - /// Orthogonal and triclinic cells are made available to objects. - /// For any other conditions (mixed periodicity, triclinic cells in LAMMPS) - /// minimum-image distances are computed by the host engine regardless. - enum Boundaries_type { - boundaries_non_periodic, - boundaries_pbc_ortho, - boundaries_pbc_triclinic, - boundaries_unsupported - }; - - /// Type of boundary conditions - Boundaries_type boundaries_type; - - /// Bravais lattice vectors - cvm::rvector unit_cell_x, unit_cell_y, unit_cell_z; - - /// Reciprocal lattice vectors - cvm::rvector reciprocal_cell_x, reciprocal_cell_y, reciprocal_cell_z; -}; - - /// \brief Container of atomic data for processing by Colvars class colvarproxy_atoms { @@ -229,7 +69,7 @@ public: std::string const &segment_id); /// \brief Used by the atom class destructor: rather than deleting the array slot - /// (costly) set the corresponding atoms_ncopies to zero + /// (costly) set the corresponding atoms_refcount to zero virtual void clear_atom(int index); /// \brief Select atom IDs from a file (usually PDB) \param filename name of @@ -260,37 +100,51 @@ public: /// Clear atomic data int reset(); - /// Get the numeric ID of the given atom (for the program) + /// Get the numeric ID of the given atom + /// \param index Internal index in the Colvars arrays inline int get_atom_id(int index) const { return atoms_ids[index]; } /// Get the mass of the given atom + /// \param index Internal index in the Colvars arrays inline cvm::real get_atom_mass(int index) const { return atoms_masses[index]; } + /// Increase the reference count of the given atom + /// \param index Internal index in the Colvars arrays + inline void increase_refcount(int index) + { + atoms_refcount[index] += 1; + } + /// Get the charge of the given atom + /// \param index Internal index in the Colvars arrays inline cvm::real get_atom_charge(int index) const { return atoms_charges[index]; } /// Read the current position of the given atom + /// \param index Internal index in the Colvars arrays inline cvm::rvector get_atom_position(int index) const { return atoms_positions[index]; } /// Read the current total force of the given atom + /// \param index Internal index in the Colvars arrays inline cvm::rvector get_atom_total_force(int index) const { return atoms_total_forces[index]; } /// Request that this force is applied to the given atom + /// \param index Internal index in the Colvars arrays + /// \param new_force Force to add inline void apply_atom_force(int index, cvm::rvector const &new_force) { atoms_new_colvar_forces[index] += new_force; @@ -310,6 +164,9 @@ public: return &atoms_ids; } + /// Return number of atoms with positive reference count + size_t get_num_active_atoms() const; + inline std::vector const *get_atom_masses() const { return &atoms_masses; @@ -406,7 +263,7 @@ protected: /// within the host program std::vector atoms_ids; /// \brief Keep track of how many times each atom is used by a separate colvar object - std::vector atoms_ncopies; + std::vector atoms_refcount; /// \brief Masses of the atoms (allow redefinition during a run, as done e.g. in LAMMPS) std::vector atoms_masses; /// \brief Charges of the atoms (allow redefinition during a run, as done e.g. in LAMMPS) @@ -510,6 +367,9 @@ public: return &atom_groups_ids; } + /// Return number of atom groups with positive reference count + size_t get_num_active_atom_groups() const; + inline std::vector *modify_atom_group_masses() { // TODO updated_masses @@ -561,7 +421,7 @@ protected: /// within the host program std::vector atom_groups_ids; /// \brief Keep track of how many times each group is used by a separate cvc - std::vector atom_groups_ncopies; + std::vector atom_groups_refcount; /// \brief Total masses of the atom groups std::vector atom_groups_masses; /// \brief Total charges of the atom groups (allow redefinition during a run, as done e.g. in LAMMPS) @@ -584,6 +444,12 @@ protected: }; +#if defined(_OPENMP) +#include +#else +struct omp_lock_t; +#endif + /// \brief Methods for SMP parallelization class colvarproxy_smp { @@ -629,7 +495,7 @@ public: protected: /// Lock state for OpenMP - void *omp_lock_state; + omp_lock_t *omp_lock_state; }; @@ -698,108 +564,6 @@ public: }; -/// Methods for data input/output -class colvarproxy_io { - -public: - - /// Constructor - colvarproxy_io(); - - /// Destructor - virtual ~colvarproxy_io(); - - /// \brief Save the current frame number in the argument given - // Returns error code - virtual int get_frame(long int &); - - /// \brief Set the current frame number (as well as colvarmodule::it) - // Returns error code - virtual int set_frame(long int); - - /// \brief Rename the given file, before overwriting it - virtual int backup_file(char const *filename); - - /// \brief Rename the given file, before overwriting it - inline int backup_file(std::string const &filename) - { - return backup_file(filename.c_str()); - } - - /// Remove the given file (on Windows only, rename to filename.old) - virtual int remove_file(char const *filename); - - /// Remove the given file (on Windows only, rename to filename.old) - inline int remove_file(std::string const &filename) - { - return remove_file(filename.c_str()); - } - - /// Rename the given file - virtual int rename_file(char const *filename, char const *newfilename); - - /// Rename the given file - inline int rename_file(std::string const &filename, - std::string const &newfilename) - { - return rename_file(filename.c_str(), newfilename.c_str()); - } - - /// Prefix of the input state file to be read next - inline std::string & input_prefix() - { - return input_prefix_str; - } - - /// Default prefix to be used for all output files (final configuration) - inline std::string & output_prefix() - { - return output_prefix_str; - } - - /// Prefix of the restart (checkpoint) file to be written next - inline std::string & restart_output_prefix() - { - return restart_output_prefix_str; - } - - /// Default restart frequency (as set by the simulation engine) - inline int default_restart_frequency() const - { - return restart_frequency_engine; - } - - /// Buffer from which the input state information may be read - inline char const * & input_buffer() - { - return input_buffer_; - } - -protected: - - /// Prefix of the input state file to be read next - std::string input_prefix_str; - - /// Default prefix to be used for all output files (final configuration) - std::string output_prefix_str; - - /// Prefix of the restart (checkpoint) file to be written next - std::string restart_output_prefix_str; - - /// How often the simulation engine will write its own restart - int restart_frequency_engine; - - /// \brief Currently opened output files: by default, these are ofstream objects. - /// Allows redefinition to implement different output mechanisms - std::list output_files; - /// \brief Identifiers for output_stream objects: by default, these are the names of the files - std::list output_stream_names; - - /// Buffer from which the input state information may be read - char const *input_buffer_; -}; - - /// \brief Interface between the collective variables module and /// the simulation or analysis program (NAMD, VMD, LAMMPS...). @@ -827,6 +591,8 @@ public: /// Destructor virtual ~colvarproxy(); + virtual bool io_available() /* override */; + /// Request deallocation of the module (currently only implemented by VMD) virtual int request_deletion(); @@ -839,21 +605,30 @@ public: /// \brief Reset proxy state, e.g. requested atoms virtual int reset(); - /// Close any open files to prevent data loss - int close_files(); + /// (Re)initialize the module + virtual int parse_module_config(); - /// (Re)initialize required member data after construction + /// (Re)initialize required member data (called after the module) virtual int setup(); - /// \brief Update data required by the colvars module (e.g. cache atom positions) + /// Whether the engine allows to fully initialize Colvars immediately + inline bool engine_ready() const + { + return engine_ready_; + } + + /// Enqueue new configuration text, to be parsed as soon as possible + void add_config(std::string const &cmd, std::string const &conf); + + /// Update data required by Colvars module (e.g. read atom positions) /// /// TODO Break up colvarproxy_namd and colvarproxy_lammps function into these virtual int update_input(); - /// \brief Update data based from the results of a module update (e.g. send forces) + /// Update data based on the results of a Colvars call (e.g. send forces) virtual int update_output(); - /// Carry out operations needed before next step is run + /// Carry out operations needed before next simulation step is run int end_of_step(); /// Print a message to the main log @@ -903,26 +678,11 @@ public: return version_int; } - /// \brief Returns a reference to the given output channel; - /// if this is not open already, then open it - virtual std::ostream *output_stream(std::string const &output_name, - std::ios_base::openmode mode = - std::ios_base::out); - - /// Returns a reference to output_name if it exists, NULL otherwise - virtual std::ostream *get_output_stream(std::string const &output_name); - - /// \brief Flushes the given output channel - virtual int flush_output_stream(std::ostream *os); - - /// \brief Flushes all output channels - virtual int flush_output_streams(); - - /// \brief Closes the given output channel - virtual int close_output_stream(std::string const &output_name); - protected: + /// Whether the engine allows to fully initialize Colvars immediately + bool engine_ready_; + /// Collected error messages std::string error_output; @@ -943,8 +703,10 @@ protected: /// Track which features have been acknowledged during the last run size_t features_hash; - /// Raise when the output stream functions are used on threads other than 0 - void smp_stream_error(); +private: + + /// Queue of config strings or files to be fed to the module + void *config_queue_; }; diff --git a/lib/colvars/colvarproxy_io.cpp b/lib/colvars/colvarproxy_io.cpp new file mode 100644 index 0000000000..225ca40bef --- /dev/null +++ b/lib/colvars/colvarproxy_io.cpp @@ -0,0 +1,310 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + +// Using access() to check if a file exists (until we can assume C++14/17) +#if !defined(_WIN32) || defined(__CYGWIN__) +#include +#endif +#if defined(_WIN32) +#include +#endif + +#include +#include + +#include +#include +#include +#include + +#include "colvarmodule.h" +#include "colvarproxy_io.h" + + +colvarproxy_io::colvarproxy_io() +{ + input_buffer_ = NULL; + restart_frequency_engine = 0; + input_stream_error_ = new std::istringstream(); + input_stream_error_->setstate(std::ios::badbit); + output_stream_error_ = new std::ostringstream(); + output_stream_error_->setstate(std::ios::badbit); +} + + +colvarproxy_io::~colvarproxy_io() +{ + delete input_stream_error_; + close_input_streams(); + delete output_stream_error_; + close_output_streams(); +} + + +bool colvarproxy_io::io_available() +{ + return false; +} + + +int colvarproxy_io::get_frame(long int&) +{ + return COLVARS_NOT_IMPLEMENTED; +} + + +int colvarproxy_io::set_frame(long int) +{ + return COLVARS_NOT_IMPLEMENTED; +} + + +int colvarproxy_io::backup_file(char const *filename) +{ + // Simplified version of NAMD_file_exists() + int exit_code; + do { +#if defined(_WIN32) && !defined(__CYGWIN__) + // We could use _access_s here, but it is probably too new + exit_code = _access(filename, 00); +#else + exit_code = access(filename, F_OK); +#endif + } while ((exit_code != 0) && (errno == EINTR)); + if (exit_code != 0) { + if (errno == ENOENT) { + // File does not exist + return COLVARS_OK; + } else { + return cvm::error("Unknown error while checking if file \""+ + std::string(filename)+"\" exists.\n", COLVARS_ERROR); + } + } + + // The file exists, then rename it + if (std::string(filename).rfind(std::string(".colvars.state")) != + std::string::npos) { + return rename_file(filename, (std::string(filename)+".old").c_str()); + } else { + return rename_file(filename, (std::string(filename)+".BAK").c_str()); + } +} + + +int colvarproxy_io::remove_file(char const *filename) +{ + int error_code = COLVARS_OK; +#if defined(_WIN32) && !defined(__CYGWIN__) + // Because the file may be open by other processes, rename it to filename.old + std::string const renamed_file(std::string(filename)+".old"); + // It may still be there from an interrupted run, so remove it to be safe + std::remove(renamed_file.c_str()); + int rename_exit_code = 0; + while ((rename_exit_code = std::rename(filename, + renamed_file.c_str())) != 0) { + if (errno == EINTR) continue; + error_code |= COLVARS_FILE_ERROR; + break; + } + // Ask to remove filename.old, but ignore any errors raised + std::remove(renamed_file.c_str()); +#else + if (std::remove(filename)) { + if (errno != ENOENT) { + error_code |= COLVARS_FILE_ERROR; + } + } +#endif + if (error_code != COLVARS_OK) { + return cvm::error("Error: in removing file \""+std::string(filename)+ + "\".\n.", + error_code); + } + return COLVARS_OK; +} + + +int colvarproxy_io::rename_file(char const *filename, char const *newfilename) +{ + int error_code = COLVARS_OK; +#if defined(_WIN32) && !defined(__CYGWIN__) + // On straight Windows, must remove the destination before renaming it + error_code |= remove_file(newfilename); +#endif + int rename_exit_code = 0; + while ((rename_exit_code = std::rename(filename, newfilename)) != 0) { + if (errno == EINTR) continue; + // Call log() instead of error to allow the next try + cvm::log("Error: in renaming file \""+std::string(filename)+"\" to \""+ + std::string(newfilename)+"\".\n."); + error_code |= COLVARS_FILE_ERROR; + if (errno == EXDEV) continue; + break; + } + return rename_exit_code ? error_code : COLVARS_OK; +} + + +std::istream &colvarproxy_io::input_stream(std::string const &input_name, + std::string const description, + bool error_on_fail) +{ + if (!io_available()) { + cvm::error("Error: trying to access an input file/channel " + "from the wrong thread.\n", COLVARS_BUG_ERROR); + return *input_stream_error_; + } + + if (colvarproxy_io::input_stream_exists(input_name)) { + return *(input_streams_[input_name]); + } + + // Using binary to work around differences in line termination conventions + // See https://github.com/Colvars/colvars/commit/8236879f7de4 + input_streams_[input_name] = new std::ifstream(input_name.c_str(), + std::ios::binary); + + if (input_streams_[input_name]->fail() && error_on_fail) { + cvm::error("Error: cannot open "+description+" \""+input_name+"\".\n", + COLVARS_FILE_ERROR); + } + + return *(input_streams_[input_name]); +} + + +bool colvarproxy_io::input_stream_exists(std::string const &input_name) +{ + return (input_streams_.count(input_name) > 0); +} + + +int colvarproxy_io::close_input_stream(std::string const &input_name) +{ + if (colvarproxy_io::input_stream_exists(input_name)) { + delete input_streams_[input_name]; + input_streams_.erase(input_name); + return COLVARS_OK; + } + return cvm::error("Error: input file/channel \""+input_name+ + "\" does not exist.\n", COLVARS_FILE_ERROR); +} + + +int colvarproxy_io::close_input_streams() +{ + for (std::map::iterator ii = input_streams_.begin(); + ii != input_streams_.end(); + ii++) { + delete ii->second; + } + input_streams_.clear(); + return COLVARS_OK; +} + + +std::ostream & colvarproxy_io::output_stream(std::string const &output_name, + std::string const description) +{ + if (cvm::debug()) { + cvm::log("Using colvarproxy_io::output_stream()\n"); + } + + if (!io_available()) { + cvm::error("Error: trying to access an output file/channel " + "from the wrong thread.\n", COLVARS_BUG_ERROR); + return *output_stream_error_; + } + + if (colvarproxy_io::output_stream_exists(output_name)) { + return *(output_streams_[output_name]); + } + + backup_file(output_name.c_str()); + + output_streams_[output_name] = new std::ofstream(output_name.c_str()); + if (!*(output_streams_[output_name])) { + cvm::error("Error: cannot write to "+description+" \""+output_name+"\".\n", + COLVARS_FILE_ERROR); + } + + return *(output_streams_[output_name]); +} + + +bool colvarproxy_io::output_stream_exists(std::string const &output_name) +{ + return (output_streams_.count(output_name) > 0); +} + + +int colvarproxy_io::flush_output_stream(std::string const &output_name) +{ + if (!io_available()) { + // No-op + return COLVARS_OK; + } + + if (colvarproxy_io::output_stream_exists(output_name)) { + (dynamic_cast(output_streams_[output_name]))->flush(); + return COLVARS_OK; + } + + return COLVARS_OK; +} + + +int colvarproxy_io::flush_output_streams() +{ + if (!io_available()) { + return COLVARS_OK; + } + + for (std::map::iterator osi = output_streams_.begin(); + osi != output_streams_.end(); + osi++) { + (dynamic_cast(osi->second))->flush(); + } + + return COLVARS_OK; +} + + +int colvarproxy_io::close_output_stream(std::string const &output_name) +{ + if (!io_available()) { + return cvm::error("Error: trying to access an output file/channel " + "from the wrong thread.\n", COLVARS_BUG_ERROR); + } + + if (colvarproxy_io::output_stream_exists(output_name)) { + (dynamic_cast(output_streams_[output_name]))->close(); + delete output_streams_[output_name]; + output_streams_.erase(output_name); + } + + return COLVARS_OK; +} + + +int colvarproxy_io::close_output_streams() +{ + if (! io_available()) { + return COLVARS_OK; + } + + for (std::map::iterator osi = output_streams_.begin(); + osi != output_streams_.end(); + osi++) { + (dynamic_cast(osi->second))->close(); + } + output_streams_.clear(); + + return COLVARS_OK; +} diff --git a/lib/colvars/colvarproxy_io.h b/lib/colvars/colvarproxy_io.h new file mode 100644 index 0000000000..ee217362d4 --- /dev/null +++ b/lib/colvars/colvarproxy_io.h @@ -0,0 +1,167 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + +#ifndef COLVARPROXY_IO_H +#define COLVARPROXY_IO_H + +#include +#include +#include + + +/// Methods for data input/output +class colvarproxy_io { + +public: + + /// Constructor + colvarproxy_io(); + + /// Destructor + virtual ~colvarproxy_io(); + + /// Ensure that we're on the main thread (derived class will do actual check) + virtual bool io_available(); + + /// \brief Save the current frame number in the argument given + // Returns error code + virtual int get_frame(long int &); + + /// \brief Set the current frame number (as well as colvarmodule::it) + // Returns error code + virtual int set_frame(long int); + + /// \brief Rename the given file, before overwriting it + virtual int backup_file(char const *filename); + + /// \brief Rename the given file, before overwriting it + inline int backup_file(std::string const &filename) + { + return backup_file(filename.c_str()); + } + + /// Remove the given file (on Windows only, rename to filename.old) + virtual int remove_file(char const *filename); + + /// Remove the given file (on Windows only, rename to filename.old) + inline int remove_file(std::string const &filename) + { + return remove_file(filename.c_str()); + } + + /// Rename the given file + virtual int rename_file(char const *filename, char const *newfilename); + + /// Rename the given file + inline int rename_file(std::string const &filename, + std::string const &newfilename) + { + return rename_file(filename.c_str(), newfilename.c_str()); + } + + /// Prefix of the input state file to be read next + inline std::string & input_prefix() + { + return input_prefix_str; + } + + /// Default prefix to be used for all output files (final configuration) + inline std::string & output_prefix() + { + return output_prefix_str; + } + + /// Prefix of the restart (checkpoint) file to be written next + inline std::string & restart_output_prefix() + { + return restart_output_prefix_str; + } + + /// Default restart frequency (as set by the simulation engine) + inline int default_restart_frequency() const + { + return restart_frequency_engine; + } + + /// Buffer from which the input state information may be read + inline char const * & input_buffer() + { + return input_buffer_; + } + + /// Returns a reference to given input stream, creating it if needed + /// \param input_name File name (later only a handle) + /// \param description Purpose of the file + /// \param error_on_fail Raise error when failing to open (allow testing) + virtual std::istream &input_stream(std::string const &input_name, + std::string const description = "file/channel", + bool error_on_fail = true); + + /// Check if the file/channel is open (without opening it if not) + virtual bool input_stream_exists(std::string const &input_name); + + /// Closes the given input stream + virtual int close_input_stream(std::string const &input_name); + + /// Closes all input streams + virtual int close_input_streams(); + + /// Returns a reference to the named output file/channel (open it if needed) + /// \param output_name File name or identifier + /// \param description Purpose of the file + virtual std::ostream &output_stream(std::string const &output_name, + std::string const description = "file/channel"); + + /// Check if the file/channel is open (without opening it if not) + virtual bool output_stream_exists(std::string const &output_name); + + /// Flushes the given output file/channel + virtual int flush_output_stream(std::string const &output_name); + + /// Flushes all output files/channels + virtual int flush_output_streams(); + + /// Closes the given output file/channel + virtual int close_output_stream(std::string const &output_name); + + /// Close all open files/channels to prevent data loss + virtual int close_output_streams(); + +protected: + + /// Prefix of the input state file to be read next + std::string input_prefix_str; + + /// Default prefix to be used for all output files (final configuration) + std::string output_prefix_str; + + /// Prefix of the restart (checkpoint) file to be written next + std::string restart_output_prefix_str; + + /// How often the simulation engine will write its own restart + int restart_frequency_engine; + + /// Container of input files/channels indexed by path name + std::map input_streams_; + + /// Object whose reference is returned when read errors occur + std::istream *input_stream_error_; + + /// Currently open output files/channels + std::map output_streams_; + + /// Object whose reference is returned when write errors occur + std::ostream *output_stream_error_; + + /// Buffer from which the input state information may be read + char const *input_buffer_; +}; + + +#endif diff --git a/lib/colvars/colvarproxy_system.cpp b/lib/colvars/colvarproxy_system.cpp new file mode 100644 index 0000000000..0a2769dcc9 --- /dev/null +++ b/lib/colvars/colvarproxy_system.cpp @@ -0,0 +1,203 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + + +#include "colvarmodule.h" +#include "colvartypes.h" +#include "colvarproxy_system.h" + + + +colvarproxy_system::colvarproxy_system() +{ + angstrom_value_ = 0.0; + kcal_mol_value_ = 0.0; + target_temperature_ = 0.0; + boltzmann_ = 0.001987191; // Default: kcal/mol/K + boundaries_type = boundaries_unsupported; + total_force_requested = false; + indirect_lambda_biasing_force = 0.0; + cached_alch_lambda_changed = false; + cached_alch_lambda = -1.0; + reset_pbc_lattice(); +} + + +colvarproxy_system::~colvarproxy_system() {} + + +int colvarproxy_system::set_unit_system(std::string const & /* units */, + bool /* check_only */) +{ + return COLVARS_NOT_IMPLEMENTED; +} + + +int colvarproxy_system::set_target_temperature(cvm::real T) +{ + target_temperature_ = T; + return COLVARS_OK; +} + + +cvm::real colvarproxy_system::dt() +{ + // TODO define, document and implement a user method to set the value of this + return 1.0; +} + + +cvm::real colvarproxy_system::rand_gaussian() +{ + // TODO define, document and implement a user method to set the value of this + return 0.0; +} + + +void colvarproxy_system::add_energy(cvm::real /* energy */) {} + + +void colvarproxy_system::request_total_force(bool yesno) +{ + if (yesno == true) + cvm::error("Error: total forces are currently not implemented.\n", + COLVARS_NOT_IMPLEMENTED); +} + + +bool colvarproxy_system::total_forces_enabled() const +{ + return false; +} + + +bool colvarproxy_system::total_forces_same_step() const +{ + return false; +} + + +inline int round_to_integer(cvm::real x) +{ + return int(cvm::floor(x+0.5)); +} + + +void colvarproxy_system::update_pbc_lattice() +{ + // Periodicity is assumed in all directions + + if (boundaries_type == boundaries_unsupported || + boundaries_type == boundaries_non_periodic) { + cvm::error("Error: setting PBC lattice with unsupported boundaries.\n", + COLVARS_BUG_ERROR); + return; + } + + { + cvm::rvector const v = cvm::rvector::outer(unit_cell_y, unit_cell_z); + reciprocal_cell_x = v/(v*unit_cell_x); + } + { + cvm::rvector const v = cvm::rvector::outer(unit_cell_z, unit_cell_x); + reciprocal_cell_y = v/(v*unit_cell_y); + } + { + cvm::rvector const v = cvm::rvector::outer(unit_cell_x, unit_cell_y); + reciprocal_cell_z = v/(v*unit_cell_z); + } +} + + +void colvarproxy_system::reset_pbc_lattice() +{ + unit_cell_x.reset(); + unit_cell_y.reset(); + unit_cell_z.reset(); + reciprocal_cell_x.reset(); + reciprocal_cell_y.reset(); + reciprocal_cell_z.reset(); +} + + +cvm::rvector colvarproxy_system::position_distance(cvm::atom_pos const &pos1, + cvm::atom_pos const &pos2) + const +{ + if (boundaries_type == boundaries_unsupported) { + cvm::error("Error: unsupported boundary conditions.\n", COLVARS_INPUT_ERROR); + } + + cvm::rvector diff = (pos2 - pos1); + + if (boundaries_type == boundaries_non_periodic) return diff; + + cvm::real const x_shift = round_to_integer(reciprocal_cell_x*diff); + cvm::real const y_shift = round_to_integer(reciprocal_cell_y*diff); + cvm::real const z_shift = round_to_integer(reciprocal_cell_z*diff); + + diff.x -= x_shift*unit_cell_x.x + y_shift*unit_cell_y.x + + z_shift*unit_cell_z.x; + diff.y -= x_shift*unit_cell_x.y + y_shift*unit_cell_y.y + + z_shift*unit_cell_z.y; + diff.z -= x_shift*unit_cell_x.z + y_shift*unit_cell_y.z + + z_shift*unit_cell_z.z; + + return diff; +} + + +int colvarproxy_system::get_molid(int &) +{ + cvm::error("Error: only VMD allows the use of multiple \"molecules\", " + "i.e. multiple molecular systems.", COLVARS_NOT_IMPLEMENTED); + return -1; +} + + +int colvarproxy_system::get_alch_lambda(cvm::real * /* lambda */) +{ + return cvm::error("Error in get_alch_lambda: alchemical lambda dynamics is not supported by this build.", + COLVARS_NOT_IMPLEMENTED); +} + + +void colvarproxy_system::set_alch_lambda(cvm::real lambda) +{ + cached_alch_lambda = lambda; + cached_alch_lambda_changed = true; +} + + +int colvarproxy_system::send_alch_lambda() +{ + return cvm::error("Error in set_alch_lambda: alchemical lambda dynamics is not supported by this build.", + COLVARS_NOT_IMPLEMENTED); +} + + +int colvarproxy_system::get_dE_dlambda(cvm::real * /* force */) +{ + return cvm::error("Error in get_dE_dlambda: alchemical lambda dynamics is not supported by this build.", + COLVARS_NOT_IMPLEMENTED); +} + + +int colvarproxy_system::apply_force_dE_dlambda(cvm::real* /* force */) +{ + return cvm::error("Error in apply_force_dE_dlambda: function is not implemented by this build.", + COLVARS_NOT_IMPLEMENTED); +} + + +int colvarproxy_system::get_d2E_dlambda2(cvm::real*) +{ + return cvm::error("Error in get_d2E_dlambda2: function is not implemented by this build.", + COLVARS_NOT_IMPLEMENTED); +} diff --git a/lib/colvars/colvarproxy_system.h b/lib/colvars/colvarproxy_system.h new file mode 100644 index 0000000000..be3cd346c2 --- /dev/null +++ b/lib/colvars/colvarproxy_system.h @@ -0,0 +1,177 @@ +// -*- c++ -*- + +// This file is part of the Collective Variables module (Colvars). +// The original version of Colvars and its updates are located at: +// https://github.com/Colvars/colvars +// Please update all Colvars source files before making any changes. +// If you wish to distribute your changes, please submit them to the +// Colvars repository at GitHub. + +#ifndef COLVARPROXY_SYSTEM_H +#define COLVARPROXY_SYSTEM_H + + +/// Methods for accessing the simulation system (PBCs, integrator, etc) +class colvarproxy_system { + +public: + + /// Constructor + colvarproxy_system(); + + /// Destructor + virtual ~colvarproxy_system(); + + /// \brief Name of the unit system used internally by Colvars (by default, that of the back-end). + /// Supported depending on the back-end: real (A, kcal/mol), metal (A, eV), electron (Bohr, Hartree), gromacs (nm, kJ/mol) + /// Note: calls to back-end PBC functions assume back-end length unit + /// We use different unit from back-end in VMD bc using PBC functions from colvarproxy base class + /// Colvars internal units are user specified, because the module exchanges info in unknown + /// composite dimensions with user input, while it only exchanges quantities of known + /// dimension with the back-end (length and forces) + std::string units; + + /// \brief Request to set the units used internally by Colvars + virtual int set_unit_system(std::string const &units, bool check_only); + + /// \brief Convert a length from Angstrom to internal + inline cvm::real angstrom_to_internal(cvm::real l) const + { + return l * angstrom_value_; + } + + /// \brief Convert a length from internal to Angstrom + inline cvm::real internal_to_angstrom(cvm::real l) const + { + return l / angstrom_value_; + } + + /// Boltzmann constant, with unit the same as energy / K + inline cvm::real boltzmann() const + { + return boltzmann_; + } + + /// Current target temperature of the simulation (K units) + inline cvm::real target_temperature() const + { + return target_temperature_; + } + + /// Set the current target temperature of the simulation (K units) + virtual int set_target_temperature(cvm::real T); + + /// \brief Time step of the simulation (fs) + virtual cvm::real dt(); + + /// \brief Pseudo-random number with Gaussian distribution + virtual cvm::real rand_gaussian(void); + + /// Pass restraint energy value for current timestep to MD engine + virtual void add_energy(cvm::real energy); + + /// \brief Get the PBC-aware distance vector between two positions + virtual cvm::rvector position_distance(cvm::atom_pos const &pos1, + cvm::atom_pos const &pos2) const; + + /// Recompute PBC reciprocal lattice (assumes XYZ periodicity) + void update_pbc_lattice(); + + /// Set the lattice vectors to zero + void reset_pbc_lattice(); + + /// \brief Tell the proxy whether total forces are needed (they may not + /// always be available) + virtual void request_total_force(bool yesno); + + /// Are total forces being used? + virtual bool total_forces_enabled() const; + + /// Are total forces from the current step available? + virtual bool total_forces_same_step() const; + + /// Get the molecule ID when called in VMD; raise error otherwise + /// \param molid Set this argument equal to the current VMD molid + virtual int get_molid(int &molid); + + /// Get value of alchemical lambda parameter from back-end (if available) + virtual int get_alch_lambda(cvm::real* lambda); + + /// Set value of alchemical lambda parameter to be sent to back-end at end of timestep + void set_alch_lambda(cvm::real lambda); + + /// Send cached value of alchemical lambda parameter to back-end (if available) + virtual int send_alch_lambda(); + + /// Get energy derivative with respect to lambda (if available) + virtual int get_dE_dlambda(cvm::real* dE_dlambda); + + /// Apply a scalar force on dE_dlambda (back-end distributes it onto atoms) + virtual int apply_force_dE_dlambda(cvm::real* force); + + /// Get energy second derivative with respect to lambda (if available) + virtual int get_d2E_dlambda2(cvm::real* d2E_dlambda2); + + /// Force to be applied onto alch. lambda, propagated from biasing forces on dE_dlambda + cvm::real indirect_lambda_biasing_force; + + /// Get weight factor from accelMD + virtual cvm::real get_accelMD_factor() const { + cvm::error("Error: accessing the reweighting factor of accelerated MD " + "is not yet implemented in the MD engine.\n", + COLVARS_NOT_IMPLEMENTED); + return 1.0; + } + virtual bool accelMD_enabled() const { + return false; + } + +protected: + + /// Next value of lambda to be sent to back-end + cvm::real cached_alch_lambda; + + /// Whether lambda has been set and needs to be updated in backend + bool cached_alch_lambda_changed; + + /// Boltzmann constant in internal Colvars units + cvm::real boltzmann_; + + /// Most up to date target temperature for the system (in K) + cvm::real target_temperature_; + + /// \brief Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates + /// * defaults to 0 in the base class; derived proxy classes must set it + /// * in VMD proxy, can only be changed when no variables are defined + /// as user-defined values in composite units must be compatible with that system + cvm::real angstrom_value_; + + /// \brief Value of 1 kcal/mol in the internal Colvars unit for energy + cvm::real kcal_mol_value_; + + /// Whether the total forces have been requested + bool total_force_requested; + + /// \brief Type of boundary conditions + /// + /// Orthogonal and triclinic cells are made available to objects. + /// For any other conditions (mixed periodicity, triclinic cells in LAMMPS) + /// minimum-image distances are computed by the host engine regardless. + enum Boundaries_type { + boundaries_non_periodic, + boundaries_pbc_ortho, + boundaries_pbc_triclinic, + boundaries_unsupported + }; + + /// Type of boundary conditions + Boundaries_type boundaries_type; + + /// Bravais lattice vectors + cvm::rvector unit_cell_x, unit_cell_y, unit_cell_z; + + /// Reciprocal lattice vectors + cvm::rvector reciprocal_cell_x, reciprocal_cell_y, reciprocal_cell_z; +}; + +#endif diff --git a/lib/colvars/colvarproxy_tcl.cpp b/lib/colvars/colvarproxy_tcl.cpp index 700492f0e7..5bf97a0d98 100644 --- a/lib/colvars/colvarproxy_tcl.cpp +++ b/lib/colvars/colvarproxy_tcl.cpp @@ -8,6 +8,7 @@ // Colvars repository at GitHub. #include +#include #include "colvarmodule.h" #include "colvarproxy.h" diff --git a/lib/colvars/colvarproxy_volmaps.cpp b/lib/colvars/colvarproxy_volmaps.cpp index d0ae8b51ff..6c1f11e32e 100644 --- a/lib/colvars/colvarproxy_volmaps.cpp +++ b/lib/colvars/colvarproxy_volmaps.cpp @@ -33,7 +33,7 @@ int colvarproxy_volmaps::reset() clear_volmap(i); } volmaps_ids.clear(); - volmaps_ncopies.clear(); + volmaps_refcount.clear(); volmaps_values.clear(); volmaps_new_colvar_forces.clear(); return COLVARS_OK; @@ -43,7 +43,7 @@ int colvarproxy_volmaps::reset() int colvarproxy_volmaps::add_volmap_slot(int volmap_id) { volmaps_ids.push_back(volmap_id); - volmaps_ncopies.push_back(1); + volmaps_refcount.push_back(1); volmaps_values.push_back(0.0); volmaps_new_colvar_forces.push_back(0.0); return (volmaps_ids.size() - 1); @@ -95,8 +95,8 @@ void colvarproxy_volmaps::clear_volmap(int index) "previously requested.\n", COLVARS_INPUT_ERROR); } - if (volmaps_ncopies[index] > 0) { - volmaps_ncopies[index] -= 1; + if (volmaps_refcount[index] > 0) { + volmaps_refcount[index] -= 1; } } diff --git a/lib/colvars/colvarproxy_volmaps.h b/lib/colvars/colvarproxy_volmaps.h index 6e88ee83f9..f8c9ba8539 100644 --- a/lib/colvars/colvarproxy_volmaps.h +++ b/lib/colvars/colvarproxy_volmaps.h @@ -108,7 +108,7 @@ protected: /// \brief Keep track of how many times each vol map is used by a /// separate colvar object - std::vector volmaps_ncopies; + std::vector volmaps_refcount; /// \brief Current values of the vol maps std::vector volmaps_values; diff --git a/lib/colvars/colvars_version.h b/lib/colvars/colvars_version.h index d2a48f8af7..d500c0e5ec 100644 --- a/lib/colvars/colvars_version.h +++ b/lib/colvars/colvars_version.h @@ -1,3 +1,3 @@ #ifndef COLVARS_VERSION -#define COLVARS_VERSION "2022-05-24" +#define COLVARS_VERSION "2023-05-01" #endif diff --git a/lib/colvars/colvarscript_commands.h b/lib/colvars/colvarscript_commands.h index 7f208e5da6..6dd63d82d2 100644 --- a/lib/colvars/colvarscript_commands.h +++ b/lib/colvars/colvarscript_commands.h @@ -134,11 +134,19 @@ CVSCRIPT(cv_config, char const *conf_str = script->obj_to_str(script->get_module_cmd_arg(0, objc, objv)); std::string const conf(conf_str); - if (cvm::main()->read_config_string(conf) == COLVARS_OK) { - return COLVARS_OK; + script->proxy()->add_config("config", conf); + if (script->proxy()->engine_ready()) { + // Engine allows immediate initialization + if ((script->proxy()->parse_module_config() | + script->proxy()->setup()) == COLVARS_OK) { + return COLVARS_OK; + } else { + script->add_error_msg("Error parsing configuration string"); + return COLVARSCRIPT_ERROR; + } } - script->add_error_msg("Error parsing configuration string"); - return COLVARSCRIPT_ERROR; + // Engine not ready, config will be read during proxy->setup() + return COLVARS_OK; ) CVSCRIPT(cv_configfile, @@ -146,13 +154,20 @@ CVSCRIPT(cv_configfile, 1, 1, "conf_file : string - Path to configuration file", char const *conf_file_name = - script->obj_to_str(script->get_module_cmd_arg(0, objc, objv)); - if (script->module()->read_config_file(conf_file_name) == COLVARS_OK) { - return COLVARS_OK; - } else { - script->add_error_msg("Error parsing configuration file"); - return COLVARSCRIPT_ERROR; + script->obj_to_str(script->get_module_cmd_arg(0, objc, objv)); + script->proxy()->add_config("configfile", std::string(conf_file_name)); + if (script->proxy()->engine_ready()) { + // Engine allows immediate initialization + if ((script->proxy()->parse_module_config() | + script->proxy()->setup()) == COLVARS_OK) { + return COLVARS_OK; + } else { + script->add_error_msg("Error parsing configuration file"); + return COLVARSCRIPT_ERROR; + } } + // Engine not ready, config will be read during proxy->setup() + return COLVARS_OK; ) CVSCRIPT(cv_delete, @@ -309,6 +324,51 @@ CVSCRIPT(cv_getenergy, return COLVARS_OK; ) +CVSCRIPT(cv_getnumactiveatomgroups, + "Get the number of atom groups that currently have positive ref counts\n" + "count : integer - Total number of atom groups", + 0, 0, + "", + script->set_result_int(static_cast(script->proxy()->get_num_active_atom_groups())); + return COLVARS_OK; + ) + +CVSCRIPT(cv_getnumactiveatoms, + "Get the number of atoms that currently have positive ref counts\n" + "count : integer - Total number of atoms", + 0, 0, + "", + script->set_result_int(static_cast(script->proxy()->get_num_active_atoms())); + return COLVARS_OK; + ) + +CVSCRIPT(cv_getnumatoms, + "Get the number of requested atoms, including those not in use now\n" + "count : integer - Total number of atoms", + 0, 0, + "", + script->set_result_int(static_cast(script->proxy()->get_atom_ids()->size())); + return COLVARS_OK; + ) + +CVSCRIPT(cv_getstepabsolute, + "Get the current step number of the simulation (including restarts)\n" + "step : int - Absolute step number", + 0, 0, + "", + script->set_result_int(cvm::step_absolute()); + return COLVARS_OK; + ) + +CVSCRIPT(cv_getsteprelative, + "Get the current step number from the start of this job\n" + "step : int - Relative step number", + 0, 0, + "", + script->set_result_int(cvm::step_relative()); + return COLVARS_OK; + ) + CVSCRIPT(cv_help, "Get the help string of the Colvars scripting interface\n" "help : string - Help string", @@ -481,6 +541,7 @@ CVSCRIPT(cv_reset, "Delete all internal configuration", 0, 0, "", + cvm::log("Resetting the Collective Variables module."); return script->module()->reset(); ) @@ -516,6 +577,20 @@ CVSCRIPT(cv_savetostring, return script->module()->write_restart_string(script->modify_str_result()); ) +CVSCRIPT(cv_targettemperature, + "Get/set target temperature, overriding what the MD engine provides\n" + "T : float - Current target temperature in K", + 0, 1, + "T : float - New target temperature in K", + char const *Targ = + script->obj_to_str(script->get_module_cmd_arg(0, objc, objv)); + if (Targ == NULL) { + return script->set_result_real(script->proxy()->target_temperature()); + } else { + return script->proxy()->set_target_temperature(strtod(Targ, NULL)); + } + ) + CVSCRIPT(cv_units, "Get or set the current Colvars unit system\n" "units : string - The current unit system", diff --git a/lib/colvars/colvartypes.cpp b/lib/colvars/colvartypes.cpp index 47117bf2ff..04e007cbc0 100644 --- a/lib/colvars/colvartypes.cpp +++ b/lib/colvars/colvartypes.cpp @@ -125,46 +125,16 @@ std::ostream & operator << (std::ostream &os, colvarmodule::quaternion const &q) std::istream & operator >> (std::istream &is, colvarmodule::quaternion &q) { std::streampos const start_pos = is.tellg(); - - std::string euler(""); - - if ( (is >> euler) && (colvarparse::to_lower_cppstr(euler) == - std::string("euler")) ) { - - // parse the Euler angles - - char sep; - cvm::real phi, theta, psi; - if ( !(is >> sep) || !(sep == '(') || - !(is >> phi) || !(is >> sep) || !(sep == ',') || - !(is >> theta) || !(is >> sep) || !(sep == ',') || - !(is >> psi) || !(is >> sep) || !(sep == ')') ) { - is.clear(); - is.seekg(start_pos, std::ios::beg); - is.setstate(std::ios::failbit); - return is; - } - - q = colvarmodule::quaternion(phi, theta, psi); - - } else { - - // parse the quaternion components - + char sep; + if ( !(is >> sep) || !(sep == '(') || + !(is >> q.q0) || !(is >> sep) || !(sep == ',') || + !(is >> q.q1) || !(is >> sep) || !(sep == ',') || + !(is >> q.q2) || !(is >> sep) || !(sep == ',') || + !(is >> q.q3) || !(is >> sep) || !(sep == ')') ) { + is.clear(); is.seekg(start_pos, std::ios::beg); - char sep; - if ( !(is >> sep) || !(sep == '(') || - !(is >> q.q0) || !(is >> sep) || !(sep == ',') || - !(is >> q.q1) || !(is >> sep) || !(sep == ',') || - !(is >> q.q2) || !(is >> sep) || !(sep == ',') || - !(is >> q.q3) || !(is >> sep) || !(sep == ')') ) { - is.clear(); - is.seekg(start_pos, std::ios::beg); - is.setstate(std::ios::failbit); - return is; - } + is.setstate(std::ios::failbit); } - return is; } @@ -318,15 +288,15 @@ void colvarmodule::rotation::build_correlation_matrix( // build the correlation matrix size_t i; for (i = 0; i < pos1.size(); i++) { - C.xx() += pos1[i].x * pos2[i].x; - C.xy() += pos1[i].x * pos2[i].y; - C.xz() += pos1[i].x * pos2[i].z; - C.yx() += pos1[i].y * pos2[i].x; - C.yy() += pos1[i].y * pos2[i].y; - C.yz() += pos1[i].y * pos2[i].z; - C.zx() += pos1[i].z * pos2[i].x; - C.zy() += pos1[i].z * pos2[i].y; - C.zz() += pos1[i].z * pos2[i].z; + C.xx += pos1[i].x * pos2[i].x; + C.xy += pos1[i].x * pos2[i].y; + C.xz += pos1[i].x * pos2[i].z; + C.yx += pos1[i].y * pos2[i].x; + C.yy += pos1[i].y * pos2[i].y; + C.yz += pos1[i].y * pos2[i].z; + C.zx += pos1[i].z * pos2[i].x; + C.zy += pos1[i].z * pos2[i].y; + C.zz += pos1[i].z * pos2[i].z; } } @@ -335,22 +305,22 @@ void colvarmodule::rotation::compute_overlap_matrix() { // build the "overlap" matrix, whose eigenvectors are stationary // points of the RMSD in the space of rotations - S[0][0] = C.xx() + C.yy() + C.zz(); - S[1][0] = C.yz() - C.zy(); + S[0][0] = C.xx + C.yy + C.zz; + S[1][0] = C.yz - C.zy; S[0][1] = S[1][0]; - S[2][0] = - C.xz() + C.zx() ; + S[2][0] = - C.xz + C.zx ; S[0][2] = S[2][0]; - S[3][0] = C.xy() - C.yx(); + S[3][0] = C.xy - C.yx; S[0][3] = S[3][0]; - S[1][1] = C.xx() - C.yy() - C.zz(); - S[2][1] = C.xy() + C.yx(); + S[1][1] = C.xx - C.yy - C.zz; + S[2][1] = C.xy + C.yx; S[1][2] = S[2][1]; - S[3][1] = C.xz() + C.zx(); + S[3][1] = C.xz + C.zx; S[1][3] = S[3][1]; - S[2][2] = - C.xx() + C.yy() - C.zz(); - S[3][2] = C.yz() + C.zy(); + S[2][2] = - C.xx + C.yy - C.zz; + S[3][2] = C.yz + C.zy; S[2][3] = S[3][2]; - S[3][3] = - C.xx() - C.yy() + C.zz(); + S[3][3] = - C.xx - C.yy + C.zz; } @@ -402,7 +372,6 @@ void colvarmodule::rotation::calc_optimal_rotation( std::vector const &pos1, std::vector const &pos2) { - C.resize(3, 3); C.reset(); build_correlation_matrix(pos1, pos2); diff --git a/lib/colvars/colvartypes.h b/lib/colvars/colvartypes.h index 354c216838..13b6a5bdb3 100644 --- a/lib/colvars/colvartypes.h +++ b/lib/colvars/colvartypes.h @@ -868,107 +868,69 @@ public: /// \brief 2-dimensional array of real numbers with three components /// along each dimension (works with colvarmodule::rvector) -class colvarmodule::rmatrix - : public colvarmodule::matrix2d { -private: +class colvarmodule::rmatrix { public: - /// Return the xx element - inline cvm::real & xx() { return (*this)[0][0]; } - /// Return the xy element - inline cvm::real & xy() { return (*this)[0][1]; } - /// Return the xz element - inline cvm::real & xz() { return (*this)[0][2]; } - /// Return the yx element - inline cvm::real & yx() { return (*this)[1][0]; } - /// Return the yy element - inline cvm::real & yy() { return (*this)[1][1]; } - /// Return the yz element - inline cvm::real & yz() { return (*this)[1][2]; } - /// Return the zx element - inline cvm::real & zx() { return (*this)[2][0]; } - /// Return the zy element - inline cvm::real & zy() { return (*this)[2][1]; } - /// Return the zz element - inline cvm::real & zz() { return (*this)[2][2]; } - - /// Return the xx element - inline cvm::real xx() const { return (*this)[0][0]; } - /// Return the xy element - inline cvm::real xy() const { return (*this)[0][1]; } - /// Return the xz element - inline cvm::real xz() const { return (*this)[0][2]; } - /// Return the yx element - inline cvm::real yx() const { return (*this)[1][0]; } - /// Return the yy element - inline cvm::real yy() const { return (*this)[1][1]; } - /// Return the yz element - inline cvm::real yz() const { return (*this)[1][2]; } - /// Return the zx element - inline cvm::real zx() const { return (*this)[2][0]; } - /// Return the zy element - inline cvm::real zy() const { return (*this)[2][1]; } - /// Return the zz element - inline cvm::real zz() const { return (*this)[2][2]; } + cvm::real xx, xy, xz, yx, yy, yz, zx, zy, zz; /// Default constructor inline rmatrix() - : cvm::matrix2d(3, 3) - {} + { + reset(); + } /// Constructor component by component inline rmatrix(cvm::real xxi, cvm::real xyi, cvm::real xzi, cvm::real yxi, cvm::real yyi, cvm::real yzi, cvm::real zxi, cvm::real zyi, cvm::real zzi) - : cvm::matrix2d(3, 3) { - this->xx() = xxi; - this->xy() = xyi; - this->xz() = xzi; - this->yx() = yxi; - this->yy() = yyi; - this->yz() = yzi; - this->zx() = zxi; - this->zy() = zyi; - this->zz() = zzi; + xx = xxi; + xy = xyi; + xz = xzi; + yx = yxi; + yy = yyi; + yz = yzi; + zx = zxi; + zy = zyi; + zz = zzi; } /// Destructor inline ~rmatrix() {} + inline void reset() + { + xx = xy = xz = yx = yy = yz = zx = zy = zz = 0.0; + } + /// Return the determinant inline cvm::real determinant() const { return - ( xx() * (yy()*zz() - zy()*yz())) - - (yx() * (xy()*zz() - zy()*xz())) - + (zx() * (xy()*yz() - yy()*xz())); + ( xx * (yy*zz - zy*yz)) + - (yx * (xy*zz - zy*xz)) + + (zx * (xy*yz - yy*xz)); } inline cvm::rmatrix transpose() const { - return cvm::rmatrix(this->xx(), this->yx(), this->zx(), - this->xy(), this->yy(), this->zy(), - this->xz(), this->yz(), this->zz()); + return cvm::rmatrix(xx, yx, zx, + xy, yy, zy, + xz, yz, zz); } - friend cvm::rvector operator * (cvm::rmatrix const &m, cvm::rvector const &r); - + inline friend cvm::rvector operator * (cvm::rmatrix const &m, + cvm::rvector const &r) + { + return cvm::rvector(m.xx*r.x + m.xy*r.y + m.xz*r.z, + m.yx*r.x + m.yy*r.y + m.yz*r.z, + m.zx*r.x + m.zy*r.y + m.zz*r.z); + } }; -inline cvm::rvector operator * (cvm::rmatrix const &m, - cvm::rvector const &r) -{ - return cvm::rvector(m.xx()*r.x + m.xy()*r.y + m.xz()*r.z, - m.yx()*r.x + m.yy()*r.y + m.yz()*r.z, - m.zx()*r.x + m.zy()*r.y + m.zz()*r.z); -} - - - /// \brief 1-dimensional vector of real numbers with four components and /// a quaternion algebra @@ -1151,11 +1113,6 @@ public: q0-=h.q0; q1-=h.q1; q2-=h.q2; q3-=h.q3; } - /// Promote a 3-vector to a quaternion - static inline cvm::quaternion promote(cvm::rvector const &v) - { - return cvm::quaternion(0.0, v.x, v.y, v.z); - } /// Return the vector component inline cvm::rvector get_vector() const { @@ -1207,7 +1164,8 @@ public: /// reference frame) inline cvm::rvector rotate(cvm::rvector const &v) const { - return ((*this) * promote(v) * ((*this).conjugate())).get_vector(); + return ( (*this) * cvm::quaternion(0.0, v.x, v.y, v.z) * + this->conjugate() ).get_vector(); } /// \brief Rotate Q2 through this quaternion (put it in the rotated @@ -1223,18 +1181,18 @@ public: { cvm::rmatrix R; - R.xx() = q0*q0 + q1*q1 - q2*q2 - q3*q3; - R.yy() = q0*q0 - q1*q1 + q2*q2 - q3*q3; - R.zz() = q0*q0 - q1*q1 - q2*q2 + q3*q3; + R.xx = q0*q0 + q1*q1 - q2*q2 - q3*q3; + R.yy = q0*q0 - q1*q1 + q2*q2 - q3*q3; + R.zz = q0*q0 - q1*q1 - q2*q2 + q3*q3; - R.xy() = 2.0 * (q1*q2 - q0*q3); - R.xz() = 2.0 * (q0*q2 + q1*q3); + R.xy = 2.0 * (q1*q2 - q0*q3); + R.xz = 2.0 * (q0*q2 + q1*q3); - R.yx() = 2.0 * (q0*q3 + q1*q2); - R.yz() = 2.0 * (q2*q3 - q0*q1); + R.yx = 2.0 * (q0*q3 + q1*q2); + R.yz = 2.0 * (q2*q3 - q0*q1); - R.zx() = 2.0 * (q1*q3 - q0*q2); - R.zy() = 2.0 * (q0*q1 + q2*q3); + R.zx = 2.0 * (q1*q3 - q0*q2); + R.zy = 2.0 * (q0*q1 + q2*q3); return R; } diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index 1911be8431..fc8e2cfe7a 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -260,10 +260,10 @@ double AnswerT::energy_virial(double *eatom, double **vatom, ecoul+=ecv; if (_ef_atom) { if (_ilist==nullptr) { - for (int i=0; i<_ev_stride; i++) - eatom[i]+=engv[i]; - for (int i=_ev_stride; i ./kim-prefix.txt 2. Download and unpack the kim-api $ wget http://s3.openkim.org/kim-api/kim-api-X.Y.Z.txz -$ tar zxvf kim-api-X.Y.Z.txz +$ tar xvf kim-api-X.Y.Z.txz # configure the kim-api $ cd kim-api-X.Y.Z @@ -50,7 +50,7 @@ $ rm -rf kim-api-X.Y.Z.txz 5. To add items do the following (replace the kim item name with your desired value) -$ source ${PWD}/kim-api-X.Y.Z/bin/kim-api-activate +$ source ${PWD}/installed-kim-api-X.Y.Z/bin/kim-api-activate $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_324507536345_002 @@ -59,7 +59,7 @@ $ kim-api-collections-management install system EAM_ErcolessiAdams_1994_Al__MO_3 When these steps are complete you can build LAMMPS with the KIM package installed: -$ cd lammpos/src +$ cd lammps/src $ make yes-kim $ make g++ (or whatever target you wish) diff --git a/lib/kokkos/CHANGELOG.md b/lib/kokkos/CHANGELOG.md index bdbc75604b..34df76a0fd 100644 --- a/lib/kokkos/CHANGELOG.md +++ b/lib/kokkos/CHANGELOG.md @@ -1,4 +1,25 @@ -# Change Log +# CHANGELOG + +## [3.7.02](https://github.com/kokkos/kokkos/tree/3.7.02) (2023-05-17) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.01...3.7.02) + +### Backends and Archs Enhancements: +#### CUDA +- Add Hopper support and update nvcc_wrapper to work with CUDA-12 [\#5693](https://github.com/kokkos/kokkos/pull/5693) +### General Enhancements: +- sprintf -> snprintf [\#5787](https://github.com/kokkos/kokkos/pull/5787) +### Build System: +- Add error message when not using `hipcc` and when `CMAKE_CXX_STANDARD` is not set [\#5945](https://github.com/kokkos/kokkos/pull/5945) +### Bug Fixes: +- Fix Scratch allocation alignment issues [\#5692](https://github.com/kokkos/kokkos/pull/5692) +- Fix Intel Classic Compiler ICE [\#5710](https://github.com/kokkos/kokkos/pull/5710) +- Don't install std algorithm headers multiple times [\#5711](https://github.com/kokkos/kokkos/pull/5711) +- Fix static init order issue in InitalizationSettings [\#5721](https://github.com/kokkos/kokkos/pull/5721) +- Fix src/dst Properties in deep_copy(DynamicView,View) [\#5732](https://github.com/kokkos/kokkos/pull/5732) +- Fix build on Fedora Rawhide [\#5782](https://github.com/kokkos/kokkos/pull/5782) +- Finalize HIP lock arrays [\#5694](https://github.com/kokkos/kokkos/pull/5694) +- Fix CUDA lock arrays for current Desul [\#5812](https://github.com/kokkos/kokkos/pull/5812) +- Set the correct device/context in InterOp tests [\#5701](https://github.com/kokkos/kokkos/pull/5701) ## [3.7.01](https://github.com/kokkos/kokkos/tree/3.7.01) (2022-12-01) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.00...3.7.01) diff --git a/lib/kokkos/CMakeLists.txt b/lib/kokkos/CMakeLists.txt index 7b78f29d73..404aad8065 100644 --- a/lib/kokkos/CMakeLists.txt +++ b/lib/kokkos/CMakeLists.txt @@ -129,7 +129,7 @@ ENDIF() set(Kokkos_VERSION_MAJOR 3) set(Kokkos_VERSION_MINOR 7) -set(Kokkos_VERSION_PATCH 01) +set(Kokkos_VERSION_PATCH 02) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index b873fd1e06..adcee303ba 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -12,7 +12,7 @@ endif KOKKOS_VERSION_MAJOR = 3 KOKKOS_VERSION_MINOR = 7 -KOKKOS_VERSION_PATCH = 01 +KOKKOS_VERSION_PATCH = 02 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial @@ -1376,6 +1376,7 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") + tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") diff --git a/lib/kokkos/algorithms/src/CMakeLists.txt b/lib/kokkos/algorithms/src/CMakeLists.txt index 597626b111..606d83d18b 100644 --- a/lib/kokkos/algorithms/src/CMakeLists.txt +++ b/lib/kokkos/algorithms/src/CMakeLists.txt @@ -25,7 +25,7 @@ INSTALL ( # These will get ignored for standalone CMake and a true interface library made KOKKOS_ADD_INTERFACE_LIBRARY( kokkosalgorithms - HEADERS ${ALGO_HEADERS} + NOINSTALLHEADERS ${ALGO_HEADERS} SOURCES ${ALGO_SOURCES} ) KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms diff --git a/lib/kokkos/cmake/kokkos_arch.cmake b/lib/kokkos/cmake/kokkos_arch.cmake index f20a91e42f..3aff6857a3 100644 --- a/lib/kokkos/cmake/kokkos_arch.cmake +++ b/lib/kokkos/cmake/kokkos_arch.cmake @@ -214,6 +214,9 @@ GLOBAL_SET(KOKKOS_AMDGPU_OPTIONS) IF(KOKKOS_ENABLE_HIP) SET(AMDGPU_ARCH_FLAG "--offload-arch") IF(NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) + IF(KOKKOS_CXX_STANDARD STREQUAL 14 AND NOT CMAKE_CXX_STANDARD) + message(FATAL_ERROR "Set CMAKE_CXX_STANDARD to 14") + ENDIF() GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS -x hip) IF(DEFINED ENV{ROCM_PATH}) GLOBAL_APPEND(KOKKOS_AMDGPU_OPTIONS --rocm-path=$ENV{ROCM_PATH}) diff --git a/lib/kokkos/cmake/kokkos_tribits.cmake b/lib/kokkos/cmake/kokkos_tribits.cmake index 34e45ecf72..9a55d2a5e9 100644 --- a/lib/kokkos/cmake/kokkos_tribits.cmake +++ b/lib/kokkos/cmake/kokkos_tribits.cmake @@ -534,13 +534,6 @@ FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME) IF (KOKKOS_HAS_TRILINOS) TRIBITS_ADD_LIBRARY(${NAME} ${ARGN}) ELSE() - CMAKE_PARSE_ARGUMENTS(PARSE - "" - "" - "HEADERS;SOURCES" - ${ARGN} - ) - ADD_LIBRARY(${NAME} INTERFACE) KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME}) ENDIF() diff --git a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp index a2b68064de..8450c06077 100644 --- a/lib/kokkos/containers/src/Kokkos_DynamicView.hpp +++ b/lib/kokkos/containers/src/Kokkos_DynamicView.hpp @@ -915,8 +915,8 @@ inline void deep_copy(const View& dst, template inline void deep_copy(const Kokkos::Experimental::DynamicView& dst, const View& src) { - using dst_type = Kokkos::Experimental::DynamicView; - using src_type = View; + using dst_type = Kokkos::Experimental::DynamicView; + using src_type = View; using dst_execution_space = typename ViewTraits::execution_space; using src_memory_space = typename ViewTraits::memory_space; diff --git a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp index 5345f8ea24..303e3643c9 100644 --- a/lib/kokkos/containers/unit_tests/TestDynamicView.hpp +++ b/lib/kokkos/containers/unit_tests/TestDynamicView.hpp @@ -240,6 +240,83 @@ struct TestDynamicView { ASSERT_EQ(new_result_sum, (value_type)(da_resize * (da_resize - 1) / 2)); #endif } // end scope + + // Test: Reproducer to demonstrate compile-time error of deep_copy + // of DynamicView to/from on-host View. + // Case 4: + { + using device_view_type = Kokkos::View; + using host_view_type = typename Kokkos::View::HostMirror; + + view_type device_dynamic_view("on-device DynamicView", 1024, + arg_total_size); + device_view_type device_view("on-device View", arg_total_size); + host_view_type host_view("on-host View", arg_total_size); + + unsigned da_size = arg_total_size / 8; + device_dynamic_view.resize_serial(da_size); + + // Use parallel_for to populate device_dynamic_view and verify values +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(i); }); + + value_type result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + result_sum); + + ASSERT_EQ(result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Use an on-device View as intermediate to deep_copy the + // device_dynamic_view to host, zero out the device_dynamic_view, + // deep_copy from host back to the device_dynamic_view and verify + Kokkos::deep_copy(device_view, device_dynamic_view); + Kokkos::deep_copy(host_view, device_view); + Kokkos::deep_copy(device_view, host_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(0); }); +#endif + Kokkos::deep_copy(device_dynamic_view, device_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + value_type new_result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + new_result_sum); + + ASSERT_EQ(new_result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Try to deep_copy device_dynamic_view directly to/from host. + // host-to-device currently fails to compile because DP and SP are + // swapped in the deep_copy implementation. + // Once that's fixed, both deep_copy's will fail at runtime because the + // destination execution space cannot access the source memory space. + try { + Kokkos::deep_copy(host_view, device_dynamic_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-device DynamicView to on-host View failed:\n" + << msg << std::endl; + } + try { + Kokkos::deep_copy(device_dynamic_view, host_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-host View to on-device DynamicView failed:\n" + << msg << std::endl; + } + } } }; diff --git a/lib/kokkos/core/perf_test/test_atomic.cpp b/lib/kokkos/core/perf_test/test_atomic.cpp index 54824e5b39..094c40bfa7 100644 --- a/lib/kokkos/core/perf_test/test_atomic.cpp +++ b/lib/kokkos/core/perf_test/test_atomic.cpp @@ -73,7 +73,7 @@ void textcolor(int attr, int fg, int bg) { char command[40]; /* Command is the control command to the terminal */ - sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); + snprintf(command, 40, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); printf("%s", command); } void textcolor_standard() { textcolor(RESET, BLACK, WHITE); } diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp index ba43e362bb..a91d0eb313 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp @@ -710,7 +710,7 @@ struct CudaParallelLaunchImpl< " occupancy requests are currently broken.")); } - KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + ensure_cuda_lock_arrays_on_device(); // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance); diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp index 84d4307cfd..3796534816 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp @@ -79,8 +79,7 @@ CudaLockArrays g_host_cuda_lock_arrays = {nullptr, 0}; void initialize_host_cuda_lock_arrays() { #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS desul::Impl::init_lock_arrays(); - - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + desul::ensure_cuda_lock_arrays_on_device(); #endif if (g_host_cuda_lock_arrays.atomic != nullptr) return; KOKKOS_IMPL_CUDA_SAFE_CALL( @@ -89,7 +88,7 @@ void initialize_host_cuda_lock_arrays() { Impl::cuda_device_synchronize( "Kokkos::Impl::initialize_host_cuda_lock_arrays: Pre Init Lock Arrays"); g_host_cuda_lock_arrays.n = Cuda::concurrency(); - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); init_lock_array_kernel_atomic<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); Impl::cuda_device_synchronize( @@ -106,7 +105,7 @@ void finalize_host_cuda_lock_arrays() { g_host_cuda_lock_arrays.atomic = nullptr; g_host_cuda_lock_arrays.n = 0; #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp index bdb7723985..84bfc953fd 100644 --- a/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp +++ b/lib/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp @@ -67,7 +67,7 @@ struct CudaLockArrays { /// \brief This global variable in Host space is the central definition /// of these arrays. -extern Kokkos::Impl::CudaLockArrays g_host_cuda_lock_arrays; +extern CudaLockArrays g_host_cuda_lock_arrays; /// \brief After this call, the g_host_cuda_lock_arrays variable has /// valid, initialized arrays. @@ -105,12 +105,12 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE __constant__ extern #endif - Kokkos::Impl::CudaLockArrays g_device_cuda_lock_arrays; + CudaLockArrays g_device_cuda_lock_arrays; #define CUDA_SPACE_ATOMIC_MASK 0x1FFFF @@ -123,9 +123,7 @@ __device__ inline bool lock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - return ( - 0 == - atomicCAS(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0, 1)); + return (0 == atomicCAS(&g_device_cuda_lock_arrays.atomic[offset], 0, 1)); } /// \brief Release lock for the address @@ -138,7 +136,7 @@ __device__ inline void unlock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - atomicExch(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0); + atomicExch(&g_device_cuda_lock_arrays.atomic[offset], 0); } } // namespace Impl @@ -151,45 +149,49 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace -} // namespace Impl -} // namespace Kokkos -/* Dan Ibanez: it is critical that this code be a macro, so that it will - capture the right address for Kokkos::Impl::g_device_cuda_lock_arrays! - putting this in an inline function will NOT do the right thing! */ -#define KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::Kokkos::Impl::lock_array_copied == 0) { \ - KOKKOS_IMPL_CUDA_SAFE_CALL( \ - cudaMemcpyToSymbol(Kokkos::Impl::g_device_cuda_lock_arrays, \ - &Kokkos::Impl::g_host_cuda_lock_arrays, \ - sizeof(Kokkos::Impl::CudaLockArrays))); \ - } \ - lock_array_copied = 1; \ +#ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemcpyToSymbol(g_device_cuda_lock_arrays, + &g_host_cuda_lock_arrays, + sizeof(CudaLockArrays))); } + lock_array_copied = 1; +} #ifndef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); +} #endif #else #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else // Still Need COPY_CUDA_LOCK_ARRAYS for team scratch etc. -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); + desul::ensure_cuda_lock_arrays_on_device(); +} #endif #endif /* defined( KOKKOS_ENABLE_IMPL_DESUL_ATOMICS ) */ +} // namespace Impl +} // namespace Kokkos + #endif /* defined( KOKKOS_ENABLE_CUDA ) */ #endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP */ diff --git a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 3785cfe80b..bdba322fcc 100644 --- a/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/lib/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -428,6 +428,8 @@ void HIPInternal::finalize() { if (this == &singleton()) { (void)Kokkos::Impl::hip_global_unique_token_locks(true); + Kokkos::Impl::finalize_host_hip_lock_arrays(); + KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging)); KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable)); } diff --git a/lib/kokkos/core/src/Kokkos_Macros.hpp b/lib/kokkos/core/src/Kokkos_Macros.hpp index e42944d819..8d2aa4d188 100644 --- a/lib/kokkos/core/src/Kokkos_Macros.hpp +++ b/lib/kokkos/core/src/Kokkos_Macros.hpp @@ -228,11 +228,6 @@ #define KOKKOS_ENABLE_PRAGMA_SIMD 1 #endif -// FIXME Workaround for ICE with intel 17,18,19,20,21 in Trilinos -#if (KOKKOS_COMPILER_INTEL <= 2100) -#define KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS -#endif - // FIXME_SYCL #if !defined(KOKKOS_ENABLE_SYCL) #define KOKKOS_ENABLE_PRAGMA_IVDEP 1 @@ -653,7 +648,8 @@ static constexpr bool kokkos_omp_on_host() { return false; } #if (defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \ defined(KOKKOS_COMPILER_INTEL) || defined(KOKKOS_COMPILER_PGI)) && \ !defined(_WIN32) -#if (!defined(__linux__) || defined(__GLIBC_MINOR__)) +// disable stacktrace for musl-libc +#if !defined(__linux__) || defined(__GLIBC_MINOR__) #define KOKKOS_IMPL_ENABLE_STACKTRACE #endif #define KOKKOS_IMPL_ENABLE_CXXABI diff --git a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp index 3e37eb61dc..a1d77071f5 100644 --- a/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp +++ b/lib/kokkos/core/src/Kokkos_ScratchSpace.hpp @@ -73,9 +73,8 @@ class ScratchMemorySpace { "Instantiating ScratchMemorySpace on non-execution-space type."); public: - // Alignment of memory chunks returned by 'get' - // must be a power of two - enum { ALIGN = 8 }; + // Minimal overalignment used by view scratch allocations + constexpr static int ALIGN = 8; private: mutable char* m_iter_L0 = nullptr; @@ -87,7 +86,9 @@ class ScratchMemorySpace { mutable int m_offset = 0; mutable int m_default_level = 0; - enum { MASK = ALIGN - 1 }; // Alignment used by View::shmem_size +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + constexpr static int DEFAULT_ALIGNMENT_MASK = ALIGN - 1; +#endif public: //! Tag this class as a memory space @@ -101,39 +102,59 @@ class ScratchMemorySpace { static constexpr const char* name() { return "ScratchMemorySpace"; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + // This function is unused template - KOKKOS_INLINE_FUNCTION static IntType align(const IntType& size) { - return (size + MASK) & ~MASK; + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static constexpr IntType align( + const IntType& size) { + return (size + DEFAULT_ALIGNMENT_MASK) & ~DEFAULT_ALIGNMENT_MASK; } +#endif template KOKKOS_INLINE_FUNCTION void* get_shmem(const IntType& size, int level = -1) const { - return get_shmem_common(size, 1, level); + return get_shmem_common(size, 1, level); } template KOKKOS_INLINE_FUNCTION void* get_shmem_aligned(const IntType& size, const ptrdiff_t alignment, int level = -1) const { - return get_shmem_common(size, alignment, level); + return get_shmem_common(size, alignment, + level); } private: - template + template KOKKOS_INLINE_FUNCTION void* get_shmem_common(const IntType& size, const ptrdiff_t alignment, int level = -1) const { if (level == -1) level = m_default_level; - auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; - auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - char* previous = m_iter; - const ptrdiff_t missalign = size_t(m_iter) % alignment; - if (missalign) m_iter += alignment - missalign; + auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; + auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - void* tmp = m_iter + m_offset * (aligned ? size : align(size)); - if (m_end < (m_iter += (aligned ? size : align(size)) * m_multiplier)) { - m_iter = previous; // put it back like it was + if (alignment_requested) { + const ptrdiff_t missalign = size_t(m_iter) % alignment; + if (missalign) m_iter += alignment - missalign; + } + + // This is each thread's start pointer for its allocation + // Note: for team scratch m_offset is 0, since every + // thread will get back the same shared pointer + void* tmp = m_iter + m_offset * size; + ptrdiff_t increment = size * m_multiplier; + + // increment m_iter first and decrement it again if not + // enough memory was available. In the non-failing path + // this will save instructions. + m_iter += increment; + + if (m_end < m_iter) { + // Request did overflow: reset the base team ptr, and + // return nullptr + m_iter -= increment; + tmp = nullptr; #ifdef KOKKOS_ENABLE_DEBUG // mfh 23 Jun 2015: printf call consumes 25 registers // in a CUDA build, so only print in debug mode. The @@ -143,7 +164,6 @@ class ScratchMemorySpace { "%ld byte(s); remaining capacity is %ld byte(s)\n", long(size), long(m_end - m_iter)); #endif // KOKKOS_ENABLE_DEBUG - tmp = nullptr; } return tmp; } diff --git a/lib/kokkos/core/src/Kokkos_Serial.hpp b/lib/kokkos/core/src/Kokkos_Serial.hpp index ffdd1e9fc8..b0d1d693fc 100644 --- a/lib/kokkos/core/src/Kokkos_Serial.hpp +++ b/lib/kokkos/core/src/Kokkos_Serial.hpp @@ -203,19 +203,11 @@ class Serial { static const char* name(); Impl::SerialInternal* impl_internal_space_instance() const { -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - return m_space_instance; -#else return m_space_instance.get(); -#endif } private: -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - Impl::SerialInternal* m_space_instance; -#else Kokkos::Impl::HostSharedPtr m_space_instance; -#endif //-------------------------------------------------------------------------- }; diff --git a/lib/kokkos/core/src/Kokkos_View.hpp b/lib/kokkos/core/src/Kokkos_View.hpp index f8dcfc869e..795ef91e6a 100644 --- a/lib/kokkos/core/src/Kokkos_View.hpp +++ b/lib/kokkos/core/src/Kokkos_View.hpp @@ -67,6 +67,8 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include +#include + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -1692,19 +1694,27 @@ class View : public ViewTraits { arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)); } + private: + // Want to be able to align to minimum scratch alignment or sizeof or alignof + // elements + static constexpr size_t scratch_value_alignment = + ::Kokkos::max(::Kokkos::max(sizeof(typename traits::value_type), + alignof(typename traits::value_type)), + static_cast( + traits::execution_space::scratch_memory_space::ALIGN)); + + public: static KOKKOS_INLINE_FUNCTION size_t shmem_size(typename traits::array_layout const& arg_layout) { - return map_type::memory_span(arg_layout) + - sizeof(typename traits::value_type); + return map_type::memory_span(arg_layout) + scratch_value_alignment; } explicit KOKKOS_INLINE_FUNCTION View( const typename traits::execution_space::scratch_memory_space& arg_space, const typename traits::array_layout& arg_layout) - : View(Impl::ViewCtorProp( - reinterpret_cast(arg_space.get_shmem_aligned( - map_type::memory_span(arg_layout), - sizeof(typename traits::value_type)))), + : View(Impl::ViewCtorProp(reinterpret_cast( + arg_space.get_shmem_aligned(map_type::memory_span(arg_layout), + scratch_value_alignment))), arg_layout) {} explicit KOKKOS_INLINE_FUNCTION View( @@ -1722,7 +1732,7 @@ class View : public ViewTraits { map_type::memory_span(typename traits::array_layout( arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)), - sizeof(typename traits::value_type)))), + scratch_value_alignment))), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7), check_input_args::yes) { diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp index 9205e82560..25d220e45d 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial.cpp @@ -173,14 +173,8 @@ void SerialInternal::resize_thread_team_data(size_t pool_reduce_bytes, } // namespace Impl Serial::Serial() -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - : m_space_instance(&Impl::SerialInternal::singleton()) { -} -#else : m_space_instance(&Impl::SerialInternal::singleton(), - [](Impl::SerialInternal*) {}) { -} -#endif + [](Impl::SerialInternal*) {}) {} void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const { os << "Host Serial Execution Space:\n"; diff --git a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp index d726a86f76..c3e28c59f4 100644 --- a/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp +++ b/lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp @@ -63,11 +63,10 @@ class ParallelFor, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; void exec() const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor)(i); } } @@ -85,9 +84,7 @@ class ParallelFor, } inline ParallelFor(const FunctorType& arg_functor, const MDRangePolicy& arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {} + : m_functor(arg_functor), m_mdr_policy(arg_policy) {} }; template @@ -120,13 +117,12 @@ class ParallelReduce, ReducerType, const FunctorType m_functor; const MDRangePolicy m_mdr_policy; - const Policy m_policy; const ReducerType m_reducer; const pointer_type m_result_ptr; inline void exec(reference_type update) const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { + const typename Policy::member_type e = m_mdr_policy.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { iterate_type(m_mdr_policy, m_functor, update)(i); } } @@ -148,7 +144,8 @@ class ParallelReduce, ReducerType, const size_t team_shared_size = 0; // Never shrinks const size_t thread_local_size = 0; // Never shrinks - auto* internal_instance = m_policy.space().impl_internal_space_instance(); + auto* internal_instance = + m_mdr_policy.space().impl_internal_space_instance(); // Need to lock resize_thread_team_data std::lock_guard lock( internal_instance->m_thread_team_data_mutex); @@ -181,7 +178,6 @@ class ParallelReduce, ReducerType, void*> = nullptr) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(InvalidType()), m_result_ptr(arg_result_view.data()) { static_assert(Kokkos::is_view::value, @@ -197,7 +193,6 @@ class ParallelReduce, ReducerType, MDRangePolicy arg_policy, const ReducerType& reducer) : m_functor(arg_functor), m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), m_reducer(reducer), m_result_ptr(reducer.view().data()) { /*static_assert( std::is_same< typename ViewType::memory_space diff --git a/lib/kokkos/core/src/impl/Kokkos_Core.cpp b/lib/kokkos/core/src/impl/Kokkos_Core.cpp index a5bd003237..fc89e485fd 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Core.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Core.cpp @@ -1165,6 +1165,5 @@ void _kokkos_pgi_compiler_bug_workaround() {} #endif } // namespace Kokkos -Kokkos::Impl::InitializationSettingsHelper::storage_type const - Kokkos::Impl::InitializationSettingsHelper::unspecified = - "some string we don't expect user would ever provide"; +constexpr char + Kokkos::Impl::InitializationSettingsHelper::unspecified[]; diff --git a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp index ceb35f0247..00b2335fd7 100644 --- a/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp +++ b/lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp @@ -104,7 +104,9 @@ struct InitializationSettingsHelper { using value_type = std::string; using storage_type = std::string; - static storage_type const unspecified; + // prefer c-string to avoid static initialization order nightmare + static constexpr char unspecified[] = + "some string we don't expect user would ever provide"; }; } // namespace Impl diff --git a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp index 480b1a392b..796552cead 100644 --- a/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp +++ b/lib/kokkos/core/src/impl/Kokkos_Profiling.cpp @@ -655,9 +655,9 @@ void initialize(const std::string& profileLibrary) { char* envProfileLibrary = const_cast(profileLibrary.c_str()); - const auto envProfileCopy = - std::make_unique(strlen(envProfileLibrary) + 1); - sprintf(envProfileCopy.get(), "%s", envProfileLibrary); + const size_t envProfileLen = strlen(envProfileLibrary) + 1; + const auto envProfileCopy = std::make_unique(envProfileLen); + snprintf(envProfileCopy.get(), envProfileLen, "%s", envProfileLibrary); char* profileLibraryName = strtok(envProfileCopy.get(), ";"); diff --git a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp index d915b7e472..55a29f1128 100644 --- a/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp +++ b/lib/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp @@ -69,9 +69,10 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, nargs = (do_threads ? 1 : 0) + (do_numa ? 1 : 0) + (do_device ? 1 : 0) + (do_other ? 4 : 0) + (do_tune ? 1 : 0); - char** args_kokkos = new char*[nargs]; + char** args_kokkos = new char*[nargs]; + const int max_args_size = 45; for (int i = 0; i < nargs; i++) { - args_kokkos[i] = new char[45]; + args_kokkos[i] = new char[max_args_size]; delete_these.insert(args_kokkos[i]); } @@ -112,7 +113,7 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_threads = nthreads; - sprintf(args_kokkos[threads_idx], "--threads=%i", nthreads); + snprintf(args_kokkos[threads_idx], max_args_size, "--threads=%i", nthreads); } if (do_numa) { @@ -130,24 +131,27 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_numa = numa; - sprintf(args_kokkos[numa_idx], "--numa=%i", numa); + snprintf(args_kokkos[numa_idx], max_args_size, "--numa=%i", numa); } if (do_device) { init_args.device_id = 0; - sprintf(args_kokkos[device_idx], "--device-id=%i", 0); + snprintf(args_kokkos[device_idx], max_args_size, "--device-id=%i", 0); } if (do_other) { - sprintf(args_kokkos[0], "--dummyarg=1"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], "--dummy2arg"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], "dummy3arg"); - sprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], "dummy4arg=1"); + snprintf(args_kokkos[0], max_args_size, "--dummyarg=1"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], max_args_size, + "--dummy2arg"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], max_args_size, + "dummy3arg"); + snprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], max_args_size, + "dummy4arg=1"); } if (do_tune) { init_args.tune_internals = true; - sprintf(args_kokkos[tune_idx], "--kokkos-tune-internals"); + snprintf(args_kokkos[tune_idx], max_args_size, "--kokkos-tune-internals"); } return args_kokkos; diff --git a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp index f66b35dc9f..18f3c9a777 100644 --- a/lib/kokkos/core/unit_test/TestSharedAlloc.hpp +++ b/lib/kokkos/core/unit_test/TestSharedAlloc.hpp @@ -91,7 +91,7 @@ void test_shared_alloc() { // Since always executed on host space, leave [=] Kokkos::parallel_for(range, [=](int i) { char name[64]; - sprintf(name, "test_%.2d", i); + snprintf(name, 64, "test_%.2d", i); r[i] = RecordMemS::allocate(s, name, size * (i + 1)); h[i] = Header::get_header(r[i]->data()); @@ -135,7 +135,7 @@ void test_shared_alloc() { Kokkos::parallel_for(range, [=](size_t i) { char name[64]; - sprintf(name, "test_%.2d", int(i)); + snprintf(name, 64, "test_%.2d", int(i)); RecordFull* rec = RecordFull::allocate(s, name, size * (i + 1)); diff --git a/lib/kokkos/core/unit_test/TestTeam.hpp b/lib/kokkos/core/unit_test/TestTeam.hpp index 3f05b2ef66..58db4360e5 100644 --- a/lib/kokkos/core/unit_test/TestTeam.hpp +++ b/lib/kokkos/core/unit_test/TestTeam.hpp @@ -1551,14 +1551,16 @@ struct TestScratchAlignment { double x, y, z; }; TestScratchAlignment() { - test(true); - test(false); + test_view(true); + test_view(false); + test_minimal(); + test_raw(); } using ScratchView = Kokkos::View; using ScratchViewInt = Kokkos::View; - void test(bool allocate_small) { + void test_view(bool allocate_small) { int shmem_size = ScratchView::shmem_size(11); #ifdef KOKKOS_ENABLE_OPENMPTARGET int team_size = @@ -1580,12 +1582,68 @@ struct TestScratchAlignment { }); Kokkos::fence(); } + + void test_minimal() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + size_t scratch_size = sizeof(int); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr = (int *)team.team_shmem().get_shmem(scratch_size); + if (scratch_ptr == nullptr) flag() = 1; + }); + Kokkos::fence(); + int minimal_scratch_allocation_failed = 0; + Kokkos::deep_copy(minimal_scratch_allocation_failed, flag); + ASSERT_TRUE(minimal_scratch_allocation_failed == 0); + } + + void test_raw() { + using member_type = typename Kokkos::TeamPolicy::member_type; + Kokkos::TeamPolicy policy(1, 1); + Kokkos::View flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(1024)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr1 = (int *)team.team_shmem().get_shmem(24); + int *scratch_ptr2 = (int *)team.team_shmem().get_shmem(32); + int *scratch_ptr3 = (int *)team.team_shmem().get_shmem(12); + + if ((int(scratch_ptr2 - scratch_ptr1) != 6) || + (int(scratch_ptr3 - scratch_ptr2) != 8)) + flag() = 1; + + if (((scratch_ptr3 - static_cast(nullptr)) + 3) % 2 == 1) + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(24, 4); + else { + scratch_ptr1 = (int *)team.team_shmem().get_shmem_aligned(12, 4); + } + scratch_ptr2 = (int *)team.team_shmem().get_shmem_aligned(32, 8); + scratch_ptr3 = (int *)team.team_shmem().get_shmem_aligned(8, 4); + + if ((int(scratch_ptr2 - scratch_ptr1) != 7) && + (int(scratch_ptr2 - scratch_ptr1) != 4)) + flag() = 1; + if (int(scratch_ptr3 - scratch_ptr2) != 8) flag() = 1; + if ((int(size_t(scratch_ptr1) % 4) != 0) || + (int(size_t(scratch_ptr2) % 8) != 0) || + (int(size_t(scratch_ptr3) % 4) != 0)) + flag() = 1; + }); + Kokkos::fence(); + int raw_get_shmem_alignment_failed = 0; + Kokkos::deep_copy(raw_get_shmem_alignment_failed, flag); + ASSERT_TRUE(raw_get_shmem_alignment_failed == 0); + } }; } // namespace namespace { - template struct TestTeamPolicyHandleByValue { using scalar = double; diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp index 31fd63f084..c4381b29e7 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // Cuda. TEST(cuda, raw_cuda_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp index f11f657e00..69aef6f8d8 100644 --- a/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp @@ -48,9 +48,11 @@ namespace Test { // Test Interoperability with Cuda Streams TEST(cuda, raw_cuda_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + cudaStream_t stream; cudaStreamCreate(&stream); - Kokkos::initialize(); int* p; cudaMalloc(&p, sizeof(int) * 100); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp index af20e753d4..ce76076f9b 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp @@ -59,9 +59,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // HIP. TEST(hip, raw_hip_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp index 95d102d4d1..6c7fdd7044 100644 --- a/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp @@ -50,9 +50,11 @@ namespace Test { // The difference with the CUDA tests are: raw HIP vs raw CUDA and no launch // bound in HIP due to an error when computing the block size. TEST(hip, raw_hip_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + hipStream_t stream; KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream)); - Kokkos::initialize(); int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp index e45d990745..1189aba26f 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp @@ -52,8 +52,8 @@ namespace Test { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // SYCL. TEST(sycl, raw_sycl_interop) { + // Make sure all queues use the same context Kokkos::initialize(); - Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp index 114d2a4aa2..7b9a664304 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp @@ -51,6 +51,7 @@ namespace Test { // Test whether external allocations can be accessed by the default queue. TEST(sycl, raw_sycl_interop_context_1) { + // Make sure all queues use the same context Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp index 8ffada1dab..be093d8edc 100644 --- a/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp +++ b/lib/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp @@ -48,9 +48,13 @@ namespace Test { // Test Interoperability with SYCL Streams TEST(sycl, raw_sycl_queues) { - sycl::default_selector device_selector; - sycl::queue queue(device_selector); + // Make sure all queues use the same context Kokkos::initialize(); + Kokkos::Experimental::SYCL default_space; + sycl::context default_context = default_space.sycl_queue().get_context(); + + sycl::default_selector device_selector; + sycl::queue queue(default_context, device_selector); int* p = sycl::malloc_device(100, queue); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp index 1815adb4a7..b55be52264 100644 --- a/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp +++ b/lib/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp @@ -76,7 +76,7 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef __CUDACC_RDC__ __constant__ extern @@ -138,33 +138,42 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace + +#ifdef __CUDACC_RDC__ +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_DEVICE, + &CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, + sizeof(int32_t*)); + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_NODE, + &CUDA_SPACE_ATOMIC_LOCKS_NODE_h, + sizeof(int32_t*)); + } + lock_array_copied = 1; +} + } // namespace Impl } // namespace desul -/* It is critical that this code be a macro, so that it will - capture the right address for desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE - putting this in an inline function will NOT do the right thing! */ -#define DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::desul::Impl::lock_array_copied == 0) { \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, \ - sizeof(int32_t*)); \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE_h, \ - sizeof(int32_t*)); \ - } \ - ::desul::Impl::lock_array_copied = 1; \ - } #endif /* defined( __CUDACC__ ) */ #endif /* defined( DESUL_HAVE_CUDA_ATOMICS ) */ +namespace desul { + #if defined(__CUDACC_RDC__) || (!defined(__CUDACC__)) -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +static inline void ensure_cuda_lock_arrays_on_device() { + Impl::copy_cuda_lock_arrays_to_device(); +} #endif -#endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP_ */ +} // namespace desul + +#endif /* #ifndef DESUL_ATOMICS_LOCK_ARRAY_CUDA_HPP_ */ diff --git a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp index cb8482c5da..19944b378e 100644 --- a/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp +++ b/lib/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp @@ -70,7 +70,7 @@ void init_lock_arrays_cuda() { "init_lock_arrays_cuda: cudaMalloc host locks"); auto error_sync1 = cudaDeviceSynchronize(); - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); check_error_and_throw_cuda(error_sync1, "init_lock_arrays_cuda: post mallocs"); init_lock_arrays_cuda_kernel<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); auto error_sync2 = cudaDeviceSynchronize(); @@ -85,7 +85,7 @@ void finalize_lock_arrays_cuda() { CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h = nullptr; CUDA_SPACE_ATOMIC_LOCKS_NODE_h = nullptr; #ifdef __CUDACC_RDC__ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/potentials/BNC.tersoff b/potentials/BNC.tersoff index 046566dd99..a072aa05b3 100644 --- a/potentials/BNC.tersoff +++ b/potentials/BNC.tersoff @@ -1,4 +1,4 @@ -# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) +# DATE: 2013-03-21 UNITS: metal CONTRIBUTOR: Cem Sevik CITATION: Kinaci, Haskins, Sevik and Cagin, Phys Rev B, 86, 115410 (2012) # Tersoff parameters for B, C, and BN-C hybrid based graphene like nano structures # multiple entries can be added to this file, LAMMPS reads the ones it needs @@ -7,11 +7,11 @@ # other quantities are unitless # Cem Sevik (csevik at anadolu.edu.tr) takes full blame for this -# file. It specifies B-N, B-C, and N-C interaction parameters -# generated and published by the reseacrh group of Prof. Tahir Cagin. +# file. It specifies B-N, B-C, and N-C interaction parameters +# generated and published by the research group of Prof. Tahir Cagin. # 1. Physical Review B 84, 085409 2011 -# Characterization of thermal transport in low-dimensional boron nitride nanostructures, +# Characterization of thermal transport in low-dimensional boron nitride nanostructures, # # 2. Physical Review B 86, 075403 2012 @@ -22,14 +22,14 @@ # Thermal conductivity of BN-C nanostructures # -# The file also specifies C-C, interaction parameters +# The file also specifies C-C, interaction parameters # generated and published by the research group of Dr. D. A. Broido # Physical Review B 81, 205441 2010 -# Optimized Tersoff and Brenner empirical potential parameters for +# Optimized Tersoff and Brenner empirical potential parameters for # lattice dynamics and phonon thermal transport in carbon nanotubes and graphene # Users in referring the full parameters can cite the full parameter paper (3) as: -# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) +# A. Kinaci, J. B. Haskins, C. Sevik, T. Cagin, Physical Review B 86, 115410 (2012) # Thermal conductivity of BN-C nanostructures # @@ -38,11 +38,11 @@ # m, gamma, lambda3, c, d, costheta0, n, beta, lambda2, B, R, D, lambda1, A N B B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +N B N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N B C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N B 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 -B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 +B N N 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 B N C 3.0 1.0 0.0 25000 4.3484 -0.89000 0.72751 1.25724e-7 2.199 340.00 1.95 0.05 3.568 1380.0 N N B 3.0 1.0 0.0 17.7959 5.9484 0.00000 0.6184432 0.019251 2.6272721 138.77866 2.0 0.1 2.8293093 128.86866 diff --git a/potentials/COH.DMC.aip.water.2dm b/potentials/COH.DMC.aip.water.2dm new file mode 100644 index 0000000000..f3619dd3f1 --- /dev/null +++ b/potentials/COH.DMC.aip.water.2dm @@ -0,0 +1,28 @@ +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions +# The parameters below are fitted against the DMC reference data that rescaled from PBE+MBD-NL. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +C C 3.205843 7.511126 1.235334 1.528338E-5 37.530428 15.499947 0.7954443 3.681440 25.714535E3 1.0 2.0 +H H 3.974540 6.53799 1.080633 0.6700556 0.8333833 15.022371 0.7490632 2.767223 1.6159581E3 1.0 1.2 +C H 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 2.0 +C Hw 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 2.0 +Ow C 4.03686677 15.09817069 1.00000323 1.03838111 0.16372013 9.00010553 1.12057182 2.96484087 21887.14173222 1.0 1.2 +Hw C 3.08246994 6.412090180 1.00000265 2.89390420 -1.85748759 9.00009101 1.04574423 2.21642099 4652.78021666 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 diff --git a/potentials/COH.aip.water.2dm b/potentials/COH.aip.water.2dm new file mode 100644 index 0000000000..5325399abe --- /dev/null +++ b/potentials/COH.aip.water.2dm @@ -0,0 +1,28 @@ +# DATE: 2022-12-02 UNITS: metal CONTRIBUTOR: Wengen Ouyang w.g.ouyang@gmail.com CITATION: Z. Feng, ..., and W. Ouyang, J. Phys. Chem. C 127, 8704 (2023). +# Anisotropic Interfacial Potential (AIP) parameters for water/graphene heterojunctions +# The parameters below are fitted against the PBE + MBD-NL DFT reference data from 2.5 A to 15 A. +# +# ----------------- Repulsion Potential ------------------++++++++++++++ Vdw Potential ++++++++++++++++************ +# beta(A) alpha delta(A) epsilon(meV) C(meV) d sR reff(A) C6(meV*A^6) S rcut +# For graphene and hydrocarbons +C C 3.205843 7.511126 1.235334 1.528338E-5 37.530428 15.499947 0.7954443 3.681440 25.714535E3 1.0 2.0 +H H 3.974540 6.53799 1.080633 0.6700556 0.8333833 15.022371 0.7490632 2.767223 1.6159581E3 1.0 1.2 +C H 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 +H C 2.642950 12.91410 1.020257 0.9750012 25.340996 15.222927 0.8115998 3.887324 5.6874617E3 1.0 1.5 + +# For water-graphene +C Ow 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 2.0 +C Hw 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 2.0 +Ow C 5.45369612 6.18172364 1.25025450 3.34909245 0.68780636 9.05706482 1.23249498 2.77577173 100226.55503127 1.0 1.2 +Hw C 2.55380862 9.68664390 1.96489198 41.77617053 -16.30012807 9.01568534 0.74415463 2.41545571 7409.12856378 1.0 1.2 + +# # The ILPs for other systems are set to zero +H Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +H Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw H 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 + +Ow Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Ow Hw 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 +Hw Ow 5.45369612 6.18172364 1.25025450 0.00000000 0.00000000 9.05706482 1.23249498 2.77577173 0.00000000 1.0 1.2 diff --git a/potentials/C_SNAP_2021.10.15.quadratic.snapcoeff b/potentials/C_SNAP_2021.10.15.quadratic.snapcoeff new file mode 100644 index 0000000000..4db83060f7 --- /dev/null +++ b/potentials/C_SNAP_2021.10.15.quadratic.snapcoeff @@ -0,0 +1,1602 @@ +#Carbon SNAP generated on 2021-10-15 08:21:38.396384 +#UNITS: metal CONTRIBUTOR: Ivan Oleynik CITATION: Jonathan T. Willman, Kien Nguyen-Cong, Ashley S. Williams, Anatoly B. Belonoshko, Stan G. Moore, Aidan P. Thompson, Mitchell A. Wood, and Ivan I. Oleynik, "Machine learning interatomic potential for simulations of carbon at extreme conditions" Phys. Rev. B 106, L180101 (2022) +1 1596 +C 0.5 1.0 + -2.7758927591660334 # B[0] + 0.00859216942217639126 # B[1, 0, 0, 0] + 0.16638458601459194 # B[2, 1, 0, 1] + 0.22261822339506554 # B[3, 1, 1, 2] + 0.257355166247009937 # B[4, 2, 0, 2] + 0.802105904460230779 # B[5, 2, 1, 3] + 0.227216469467176801 # B[6, 2, 2, 2] + 0.494646284119575508 # B[7, 2, 2, 4] + 0.276718638025069574 # B[8, 3, 0, 3] + 1.09101782892605392 # B[9, 3, 1, 4] + 0.775283725099378151 # B[10, 3, 2, 3] + -0.232869556477520168 # B[11, 3, 2, 5] + 0.188466708736270222 # B[12, 3, 3, 4] + -0.213463540195325957 # B[13, 3, 3, 6] + 0.285049005401720568 # B[14, 4, 0, 4] + -0.248039138369940321 # B[15, 4, 1, 5] + -0.017694405190132434 # B[16, 4, 2, 4] + -0.513770238875468355 # B[17, 4, 2, 6] + -0.603368424950793791 # B[18, 4, 3, 5] + -0.4245149972360448 # B[19, 4, 3, 7] + -0.149612637312833391 # B[20, 4, 4, 4] + -0.153415086019898006 # B[21, 4, 4, 6] + -0.14513624400298164 # B[22, 4, 4, 8] + -0.0460661393681677661 # B[23, 5, 0, 5] + -0.0512559726916635844 # B[24, 5, 1, 6] + -0.125285455697324882 # B[25, 5, 2, 5] + -0.297464016341802473 # B[26, 5, 2, 7] + -0.219930176940332595 # B[27, 5, 3, 6] + -0.195418601625407001 # B[28, 5, 3, 8] + -0.236454956825408069 # B[29, 5, 4, 5] + -0.247483318285177556 # B[30, 5, 4, 7] + 0.108404148378543994 # B[31, 5, 5, 6] + 0.102786344334006338 # B[32, 5, 5, 8] + -0.0174963987262215619 # B[33, 6, 0, 6] + -0.347663919737827065 # B[34, 6, 1, 7] + -0.308777238806140442 # B[35, 6, 2, 6] + -0.30366671620990171 # B[36, 6, 2, 8] + -0.190992135157848048 # B[37, 6, 3, 7] + -0.212717125362634818 # B[38, 6, 4, 6] + -0.127682310305149815 # B[39, 6, 4, 8] + 0.128955786755968027 # B[40, 6, 5, 7] + 0.108121871413745185 # B[41, 6, 6, 6] + 0.0951564970231452284 # B[42, 6, 6, 8] + -0.0443430969083889667 # B[43, 7, 0, 7] + 0.0394012265947801602 # B[44, 7, 1, 8] + 0.0238287662182333909 # B[45, 7, 2, 7] + -0.0703216614205220136 # B[46, 7, 3, 8] + -0.0229748587995626564 # B[47, 7, 4, 7] + 0.461615758896215367 # B[48, 7, 5, 8] + 0.032037855993324961 # B[49, 7, 6, 7] + 0.105399776101016598 # B[50, 7, 7, 8] + -0.0452778356788145764 # B[51, 8, 0, 8] + -0.0400452652333231421 # B[52, 8, 2, 8] + -0.152415456089667084 # B[53, 8, 4, 8] + 0.0303383368396002995 # B[54, 8, 6, 8] + 0.0660845112300222914 # B[55, 8, 8, 8] + 5.0022584003536763e-06 # B[55, [1, 0, 0, 0], [1, 0, 0, 0]] + 7.12434860521689133e-05 # B[56, [1, 0, 0, 0], [2, 1, 0, 1]] + 0.00410559459459784552 # B[57, [1, 0, 0, 0], [3, 1, 1, 2]] + -0.000152151102822628559 # B[58, [1, 0, 0, 0], [4, 2, 0, 2]] + -0.00104851962847402839 # B[59, [1, 0, 0, 0], [5, 2, 1, 3]] + 0.00174544590749468355 # B[60, [1, 0, 0, 0], [6, 2, 2, 2]] + -0.00039686396723943862 # B[61, [1, 0, 0, 0], [7, 2, 2, 4]] + 0.000344474173032960351 # B[62, [1, 0, 0, 0], [8, 3, 0, 3]] + 5.77832175303926235e-05 # B[63, [1, 0, 0, 0], [9, 3, 1, 4]] + 0.00124014860085090543 # B[64, [1, 0, 0, 0], [10, 3, 2, 3]] + 1.92520730655986946e-05 # B[65, [1, 0, 0, 0], [11, 3, 2, 5]] + -0.000659022869027497959 # B[66, [1, 0, 0, 0], [12, 3, 3, 4]] + -0.000296998157394604001 # B[67, [1, 0, 0, 0], [13, 3, 3, 6]] + 2.13348987737616014e-06 # B[68, [1, 0, 0, 0], [14, 4, 0, 4]] + -0.000377679899824956422 # B[69, [1, 0, 0, 0], [15, 4, 1, 5]] + 0.00045743496488695988 # B[70, [1, 0, 0, 0], [16, 4, 2, 4]] + -0.00047978616167941926 # B[71, [1, 0, 0, 0], [17, 4, 2, 6]] + -0.000346601408372410741 # B[72, [1, 0, 0, 0], [18, 4, 3, 5]] + -0.000216752459512900564 # B[73, [1, 0, 0, 0], [19, 4, 3, 7]] + -0.000153945954064437646 # B[74, [1, 0, 0, 0], [20, 4, 4, 4]] + 0.00029484781857681483 # B[75, [1, 0, 0, 0], [21, 4, 4, 6]] + 1.59236973873017051e-05 # B[76, [1, 0, 0, 0], [22, 4, 4, 8]] + -2.35544935613951623e-05 # B[77, [1, 0, 0, 0], [23, 5, 0, 5]] + 0.000492019807872501325 # B[78, [1, 0, 0, 0], [24, 5, 1, 6]] + 0.000376700986017126233 # B[79, [1, 0, 0, 0], [25, 5, 2, 5]] + -0.000185900021989794662 # B[80, [1, 0, 0, 0], [26, 5, 2, 7]] + 0.000219939447169378507 # B[81, [1, 0, 0, 0], [27, 5, 3, 6]] + -0.000192198129806066265 # B[82, [1, 0, 0, 0], [28, 5, 3, 8]] + 0.000175514531344928004 # B[83, [1, 0, 0, 0], [29, 5, 4, 5]] + 0.000261949015135925535 # B[84, [1, 0, 0, 0], [30, 5, 4, 7]] + 0.00021011408484750832 # B[85, [1, 0, 0, 0], [31, 5, 5, 6]] + -7.47807464450689352e-05 # B[86, [1, 0, 0, 0], [32, 5, 5, 8]] + -1.36809205491805752e-05 # B[87, [1, 0, 0, 0], [33, 6, 0, 6]] + 0.000493576806965066728 # B[88, [1, 0, 0, 0], [34, 6, 1, 7]] + 0.000216301405824667614 # B[89, [1, 0, 0, 0], [35, 6, 2, 6]] + -0.000364540437645548276 # B[90, [1, 0, 0, 0], [36, 6, 2, 8]] + -0.000251411532179113273 # B[91, [1, 0, 0, 0], [37, 6, 3, 7]] + 3.19331690196988927e-05 # B[92, [1, 0, 0, 0], [38, 6, 4, 6]] + -1.56092571080845843e-05 # B[93, [1, 0, 0, 0], [39, 6, 4, 8]] + 2.4859429830464963e-05 # B[94, [1, 0, 0, 0], [40, 6, 5, 7]] + -5.06306418207175257e-05 # B[95, [1, 0, 0, 0], [41, 6, 6, 6]] + -9.75742047871729079e-05 # B[96, [1, 0, 0, 0], [42, 6, 6, 8]] + -4.07774117821002591e-05 # B[97, [1, 0, 0, 0], [43, 7, 0, 7]] + 0.000169705539551909257 # B[98, [1, 0, 0, 0], [44, 7, 1, 8]] + 0.000261792097012429614 # B[99, [1, 0, 0, 0], [45, 7, 2, 7]] + 0.000235813389494382575 # B[100, [1, 0, 0, 0], [46, 7, 3, 8]] + 3.69194385055615637e-05 # B[101, [1, 0, 0, 0], [47, 7, 4, 7]] + 0.000101832840349036502 # B[102, [1, 0, 0, 0], [48, 7, 5, 8]] + 1.87768621704026417e-05 # B[103, [1, 0, 0, 0], [49, 7, 6, 7]] + 6.90123641682582889e-05 # B[104, [1, 0, 0, 0], [50, 7, 7, 8]] + 3.82281861928956967e-05 # B[105, [1, 0, 0, 0], [51, 8, 0, 8]] + 0.00044905358698343889 # B[106, [1, 0, 0, 0], [52, 8, 2, 8]] + 3.83170337754923374e-05 # B[107, [1, 0, 0, 0], [53, 8, 4, 8]] + -4.53472261485315942e-05 # B[108, [1, 0, 0, 0], [54, 8, 6, 8]] + -0.000105793544360549552 # B[109, [1, 0, 0, 0], [55, 8, 8, 8]] + -0.00542851209933992596 # B[110, [2, 1, 0, 1], [2, 1, 0, 1]] + -0.00800035055604917701 # B[111, [2, 1, 0, 1], [3, 1, 1, 2]] + 0.000279580761847972054 # B[112, [2, 1, 0, 1], [4, 2, 0, 2]] + -0.0132643544617690821 # B[113, [2, 1, 0, 1], [5, 2, 1, 3]] + -0.00300637860380324968 # B[114, [2, 1, 0, 1], [6, 2, 2, 2]] + 0.00343216933390476549 # B[115, [2, 1, 0, 1], [7, 2, 2, 4]] + 6.39026040622058672e-05 # B[116, [2, 1, 0, 1], [8, 3, 0, 3]] + -0.0124005148347727506 # B[117, [2, 1, 0, 1], [9, 3, 1, 4]] + -0.0036690465725984691 # B[118, [2, 1, 0, 1], [10, 3, 2, 3]] + -0.0066468850826254932 # B[119, [2, 1, 0, 1], [11, 3, 2, 5]] + -0.00518212543330048934 # B[120, [2, 1, 0, 1], [12, 3, 3, 4]] + -0.00269613907034030407 # B[121, [2, 1, 0, 1], [13, 3, 3, 6]] + -0.000330193583102013615 # B[122, [2, 1, 0, 1], [14, 4, 0, 4]] + -0.000429062486184235686 # B[123, [2, 1, 0, 1], [15, 4, 1, 5]] + -0.000991704717453613382 # B[124, [2, 1, 0, 1], [16, 4, 2, 4]] + 0.00152944521177345071 # B[125, [2, 1, 0, 1], [17, 4, 2, 6]] + -0.00660856033628089406 # B[126, [2, 1, 0, 1], [18, 4, 3, 5]] + 0.00146758746394204951 # B[127, [2, 1, 0, 1], [19, 4, 3, 7]] + -0.00161093753941019967 # B[128, [2, 1, 0, 1], [20, 4, 4, 4]] + -0.00101484284665418574 # B[129, [2, 1, 0, 1], [21, 4, 4, 6]] + 0.00150269420364470413 # B[130, [2, 1, 0, 1], [22, 4, 4, 8]] + -0.000251279508914979688 # B[131, [2, 1, 0, 1], [23, 5, 0, 5]] + 0.00427791921512100763 # B[132, [2, 1, 0, 1], [24, 5, 1, 6]] + -0.00312327633171666707 # B[133, [2, 1, 0, 1], [25, 5, 2, 5]] + 0.00145518956483171066 # B[134, [2, 1, 0, 1], [26, 5, 2, 7]] + -0.00296392629706135422 # B[135, [2, 1, 0, 1], [27, 5, 3, 6]] + 0.00106990236696331148 # B[136, [2, 1, 0, 1], [28, 5, 3, 8]] + 0.000140740776400729824 # B[137, [2, 1, 0, 1], [29, 5, 4, 5]] + -0.000704484148092703912 # B[138, [2, 1, 0, 1], [30, 5, 4, 7]] + 0.000555926138942124939 # B[139, [2, 1, 0, 1], [31, 5, 5, 6]] + 0.000749361142656781065 # B[140, [2, 1, 0, 1], [32, 5, 5, 8]] + -0.000275563231062828096 # B[141, [2, 1, 0, 1], [33, 6, 0, 6]] + 0.00404287546990938183 # B[142, [2, 1, 0, 1], [34, 6, 1, 7]] + -0.00329083016295819491 # B[143, [2, 1, 0, 1], [35, 6, 2, 6]] + 0.00374648670440783874 # B[144, [2, 1, 0, 1], [36, 6, 2, 8]] + -0.000931584323738718183 # B[145, [2, 1, 0, 1], [37, 6, 3, 7]] + 0.001545987588966576 # B[146, [2, 1, 0, 1], [38, 6, 4, 6]] + 0.000136630337825366203 # B[147, [2, 1, 0, 1], [39, 6, 4, 8]] + -0.000338191518470186761 # B[148, [2, 1, 0, 1], [40, 6, 5, 7]] + 0.000383732900037425575 # B[149, [2, 1, 0, 1], [41, 6, 6, 6]] + 0.000891911333988446714 # B[150, [2, 1, 0, 1], [42, 6, 6, 8]] + 0.000372325777048820861 # B[151, [2, 1, 0, 1], [43, 7, 0, 7]] + 0.00203975899324063559 # B[152, [2, 1, 0, 1], [44, 7, 1, 8]] + -0.00366168906366426058 # B[153, [2, 1, 0, 1], [45, 7, 2, 7]] + -0.00217927110231279971 # B[154, [2, 1, 0, 1], [46, 7, 3, 8]] + -0.000355180731966526532 # B[155, [2, 1, 0, 1], [47, 7, 4, 7]] + -0.00190295940654904624 # B[156, [2, 1, 0, 1], [48, 7, 5, 8]] + -0.00045640385432905474 # B[157, [2, 1, 0, 1], [49, 7, 6, 7]] + -0.00123273230096131864 # B[158, [2, 1, 0, 1], [50, 7, 7, 8]] + 2.61749541232737803e-06 # B[159, [2, 1, 0, 1], [51, 8, 0, 8]] + -0.00188736987570012403 # B[160, [2, 1, 0, 1], [52, 8, 2, 8]] + 0.000127235145614493401 # B[161, [2, 1, 0, 1], [53, 8, 4, 8]] + -0.000446185446234578786 # B[162, [2, 1, 0, 1], [54, 8, 6, 8]] + 3.06626149019382718e-05 # B[163, [2, 1, 0, 1], [55, 8, 8, 8]] + 0.00500803145405033512 # B[164, [3, 1, 1, 2], [3, 1, 1, 2]] + 0.0136537265129433767 # B[165, [3, 1, 1, 2], [4, 2, 0, 2]] + 0.00586793418015095231 # B[166, [3, 1, 1, 2], [5, 2, 1, 3]] + 0.0108897828563872673 # B[167, [3, 1, 1, 2], [6, 2, 2, 2]] + 0.000782326392446437181 # B[168, [3, 1, 1, 2], [7, 2, 2, 4]] + -0.00196905235294965193 # B[169, [3, 1, 1, 2], [8, 3, 0, 3]] + -0.00575620599927615263 # B[170, [3, 1, 1, 2], [9, 3, 1, 4]] + -0.0395084171352078836 # B[171, [3, 1, 1, 2], [10, 3, 2, 3]] + -0.0402914809330097226 # B[172, [3, 1, 1, 2], [11, 3, 2, 5]] + -0.031380925125560552 # B[173, [3, 1, 1, 2], [12, 3, 3, 4]] + 0.0074098991236085333 # B[174, [3, 1, 1, 2], [13, 3, 3, 6]] + -0.00144234945688183152 # B[175, [3, 1, 1, 2], [14, 4, 0, 4]] + -0.00715563010950572616 # B[176, [3, 1, 1, 2], [15, 4, 1, 5]] + -0.0068004389765142035 # B[177, [3, 1, 1, 2], [16, 4, 2, 4]] + -0.0397838555572563451 # B[178, [3, 1, 1, 2], [17, 4, 2, 6]] + 0.00335672059516798228 # B[179, [3, 1, 1, 2], [18, 4, 3, 5]] + 0.0148934683418572647 # B[180, [3, 1, 1, 2], [19, 4, 3, 7]] + -0.000967980016249102011 # B[181, [3, 1, 1, 2], [20, 4, 4, 4]] + 0.00772576295059950596 # B[182, [3, 1, 1, 2], [21, 4, 4, 6]] + -0.00450662666899595381 # B[183, [3, 1, 1, 2], [22, 4, 4, 8]] + -0.00395807515027411967 # B[184, [3, 1, 1, 2], [23, 5, 0, 5]] + 0.010414612350238486 # B[185, [3, 1, 1, 2], [24, 5, 1, 6]] + -0.00513372683983254804 # B[186, [3, 1, 1, 2], [25, 5, 2, 5]] + -0.0265398819124704963 # B[187, [3, 1, 1, 2], [26, 5, 2, 7]] + 0.00742434172938952544 # B[188, [3, 1, 1, 2], [27, 5, 3, 6]] + -0.00256386423704287481 # B[189, [3, 1, 1, 2], [28, 5, 3, 8]] + 0.00841179553194743718 # B[190, [3, 1, 1, 2], [29, 5, 4, 5]] + 0.00668617729586690451 # B[191, [3, 1, 1, 2], [30, 5, 4, 7]] + 0.000484464094046739568 # B[192, [3, 1, 1, 2], [31, 5, 5, 6]] + 0.00458460314168420216 # B[193, [3, 1, 1, 2], [32, 5, 5, 8]] + -0.00235318401641824212 # B[194, [3, 1, 1, 2], [33, 6, 0, 6]] + -0.000804392064641467762 # B[195, [3, 1, 1, 2], [34, 6, 1, 7]] + -0.000974349018272668323 # B[196, [3, 1, 1, 2], [35, 6, 2, 6]] + -0.0186467861443154748 # B[197, [3, 1, 1, 2], [36, 6, 2, 8]] + 0.0149394908128317495 # B[198, [3, 1, 1, 2], [37, 6, 3, 7]] + -0.001417773975968062 # B[199, [3, 1, 1, 2], [38, 6, 4, 6]] + 0.00708801668305296916 # B[200, [3, 1, 1, 2], [39, 6, 4, 8]] + 0.00422029817457212405 # B[201, [3, 1, 1, 2], [40, 6, 5, 7]] + 0.00110117813016081525 # B[202, [3, 1, 1, 2], [41, 6, 6, 6]] + -0.00187490884044745794 # B[203, [3, 1, 1, 2], [42, 6, 6, 8]] + -0.00530063898164105998 # B[204, [3, 1, 1, 2], [43, 7, 0, 7]] + 0.0156639815207892212 # B[205, [3, 1, 1, 2], [44, 7, 1, 8]] + 0.0118519420103458811 # B[206, [3, 1, 1, 2], [45, 7, 2, 7]] + 0.00375057568532275679 # B[207, [3, 1, 1, 2], [46, 7, 3, 8]] + 0.00757584350406629962 # B[208, [3, 1, 1, 2], [47, 7, 4, 7]] + 0.0106601777099339986 # B[209, [3, 1, 1, 2], [48, 7, 5, 8]] + -0.0041075690062942552 # B[210, [3, 1, 1, 2], [49, 7, 6, 7]] + 0.00248707997936048041 # B[211, [3, 1, 1, 2], [50, 7, 7, 8]] + -0.0025390217113529746 # B[212, [3, 1, 1, 2], [51, 8, 0, 8]] + 0.00498354453902482165 # B[213, [3, 1, 1, 2], [52, 8, 2, 8]] + 0.00383782774054214912 # B[214, [3, 1, 1, 2], [53, 8, 4, 8]] + 0.00318870204625110783 # B[215, [3, 1, 1, 2], [54, 8, 6, 8]] + -0.00078409267383599678 # B[216, [3, 1, 1, 2], [55, 8, 8, 8]] + 0.00411479420703600093 # B[217, [4, 2, 0, 2], [4, 2, 0, 2]] + -0.00352482696278418658 # B[218, [4, 2, 0, 2], [5, 2, 1, 3]] + 0.00293296373222708129 # B[219, [4, 2, 0, 2], [6, 2, 2, 2]] + -0.00169108240942662173 # B[220, [4, 2, 0, 2], [7, 2, 2, 4]] + -0.00166875839344953099 # B[221, [4, 2, 0, 2], [8, 3, 0, 3]] + -0.00303743189373234653 # B[222, [4, 2, 0, 2], [9, 3, 1, 4]] + -0.00360352002032471395 # B[223, [4, 2, 0, 2], [10, 3, 2, 3]] + -0.00844475258400314774 # B[224, [4, 2, 0, 2], [11, 3, 2, 5]] + -0.00267861760564082688 # B[225, [4, 2, 0, 2], [12, 3, 3, 4]] + 0.00249373694942188646 # B[226, [4, 2, 0, 2], [13, 3, 3, 6]] + 0.00129518789575956 # B[227, [4, 2, 0, 2], [14, 4, 0, 4]] + -0.000616706097657935626 # B[228, [4, 2, 0, 2], [15, 4, 1, 5]] + -0.00374793183827557257 # B[229, [4, 2, 0, 2], [16, 4, 2, 4]] + -0.00725453590077526286 # B[230, [4, 2, 0, 2], [17, 4, 2, 6]] + -0.00328165463874066426 # B[231, [4, 2, 0, 2], [18, 4, 3, 5]] + -0.00387910875571249565 # B[232, [4, 2, 0, 2], [19, 4, 3, 7]] + -0.000691443248665482221 # B[233, [4, 2, 0, 2], [20, 4, 4, 4]] + -0.00364575524119575139 # B[234, [4, 2, 0, 2], [21, 4, 4, 6]] + 0.000579213613942424974 # B[235, [4, 2, 0, 2], [22, 4, 4, 8]] + 0.000382530088889220486 # B[236, [4, 2, 0, 2], [23, 5, 0, 5]] + 0.000700082663528700608 # B[237, [4, 2, 0, 2], [24, 5, 1, 6]] + -0.00303645662419470708 # B[238, [4, 2, 0, 2], [25, 5, 2, 5]] + -0.00412449214914962191 # B[239, [4, 2, 0, 2], [26, 5, 2, 7]] + -0.000863747946010486305 # B[240, [4, 2, 0, 2], [27, 5, 3, 6]] + 0.000597171151136822748 # B[241, [4, 2, 0, 2], [28, 5, 3, 8]] + -0.00290482182317059953 # B[242, [4, 2, 0, 2], [29, 5, 4, 5]] + -0.00218615594313117554 # B[243, [4, 2, 0, 2], [30, 5, 4, 7]] + 0.00120270898159113111 # B[244, [4, 2, 0, 2], [31, 5, 5, 6]] + -0.000439562436330729364 # B[245, [4, 2, 0, 2], [32, 5, 5, 8]] + -0.000155002689849706443 # B[246, [4, 2, 0, 2], [33, 6, 0, 6]] + -0.00203784613220199399 # B[247, [4, 2, 0, 2], [34, 6, 1, 7]] + -0.00251933129878168221 # B[248, [4, 2, 0, 2], [35, 6, 2, 6]] + -0.00227857345941180406 # B[249, [4, 2, 0, 2], [36, 6, 2, 8]] + 0.00307391827986236085 # B[250, [4, 2, 0, 2], [37, 6, 3, 7]] + -0.000435707916552085118 # B[251, [4, 2, 0, 2], [38, 6, 4, 6]] + -0.00141960729594133419 # B[252, [4, 2, 0, 2], [39, 6, 4, 8]] + -0.000275734648504752638 # B[253, [4, 2, 0, 2], [40, 6, 5, 7]] + 0.000703286595409794617 # B[254, [4, 2, 0, 2], [41, 6, 6, 6]] + -5.55751922647368824e-05 # B[255, [4, 2, 0, 2], [42, 6, 6, 8]] + -0.000401816924228297345 # B[256, [4, 2, 0, 2], [43, 7, 0, 7]] + -0.000554714661495172429 # B[257, [4, 2, 0, 2], [44, 7, 1, 8]] + 0.00088244559527147267 # B[258, [4, 2, 0, 2], [45, 7, 2, 7]] + 0.000429487284537406104 # B[259, [4, 2, 0, 2], [46, 7, 3, 8]] + 0.000160720016534536374 # B[260, [4, 2, 0, 2], [47, 7, 4, 7]] + -0.000116046064898544729 # B[261, [4, 2, 0, 2], [48, 7, 5, 8]] + 0.00077812424584384446 # B[262, [4, 2, 0, 2], [49, 7, 6, 7]] + 0.0014223009786123353 # B[263, [4, 2, 0, 2], [50, 7, 7, 8]] + 5.45987148103492526e-05 # B[264, [4, 2, 0, 2], [51, 8, 0, 8]] + -0.00229888217343966316 # B[265, [4, 2, 0, 2], [52, 8, 2, 8]] + -0.00144376280980788169 # B[266, [4, 2, 0, 2], [53, 8, 4, 8]] + 0.000240138800657541986 # B[267, [4, 2, 0, 2], [54, 8, 6, 8]] + -4.09764373741731969e-05 # B[268, [4, 2, 0, 2], [55, 8, 8, 8]] + 0.0453826120189535706 # B[269, [5, 2, 1, 3], [5, 2, 1, 3]] + 0.00337080799390409615 # B[270, [5, 2, 1, 3], [6, 2, 2, 2]] + 0.0339316309546992961 # B[271, [5, 2, 1, 3], [7, 2, 2, 4]] + 0.00483677443671226039 # B[272, [5, 2, 1, 3], [8, 3, 0, 3]] + 0.00174954019608989774 # B[273, [5, 2, 1, 3], [9, 3, 1, 4]] + 0.00420306320210527603 # B[274, [5, 2, 1, 3], [10, 3, 2, 3]] + -0.0179939258962366969 # B[275, [5, 2, 1, 3], [11, 3, 2, 5]] + -0.01997198698308544 # B[276, [5, 2, 1, 3], [12, 3, 3, 4]] + -0.0136471344704570501 # B[277, [5, 2, 1, 3], [13, 3, 3, 6]] + -0.00203572867299816902 # B[278, [5, 2, 1, 3], [14, 4, 0, 4]] + 0.0113893698593142377 # B[279, [5, 2, 1, 3], [15, 4, 1, 5]] + -0.00283495847488346529 # B[280, [5, 2, 1, 3], [16, 4, 2, 4]] + -0.0209899506178404249 # B[281, [5, 2, 1, 3], [17, 4, 2, 6]] + 0.00307893999573658839 # B[282, [5, 2, 1, 3], [18, 4, 3, 5]] + 0.00625880909518397067 # B[283, [5, 2, 1, 3], [19, 4, 3, 7]] + 0.00109461945578659598 # B[284, [5, 2, 1, 3], [20, 4, 4, 4]] + 0.00213752786441095705 # B[285, [5, 2, 1, 3], [21, 4, 4, 6]] + -0.00379774849562602296 # B[286, [5, 2, 1, 3], [22, 4, 4, 8]] + -0.0013508169978871552 # B[287, [5, 2, 1, 3], [23, 5, 0, 5]] + 0.00921730935112183292 # B[288, [5, 2, 1, 3], [24, 5, 1, 6]] + -0.0029427132897584694 # B[289, [5, 2, 1, 3], [25, 5, 2, 5]] + 0.0013497580216050211 # B[290, [5, 2, 1, 3], [26, 5, 2, 7]] + -0.0130362734683665445 # B[291, [5, 2, 1, 3], [27, 5, 3, 6]] + 0.000858369129835153365 # B[292, [5, 2, 1, 3], [28, 5, 3, 8]] + 0.0129288669947052737 # B[293, [5, 2, 1, 3], [29, 5, 4, 5]] + -0.00373719468786774291 # B[294, [5, 2, 1, 3], [30, 5, 4, 7]] + -0.00885030928727506203 # B[295, [5, 2, 1, 3], [31, 5, 5, 6]] + 0.00285083482960970039 # B[296, [5, 2, 1, 3], [32, 5, 5, 8]] + 0.00351819863542377799 # B[297, [5, 2, 1, 3], [33, 6, 0, 6]] + -0.00783526064954031404 # B[298, [5, 2, 1, 3], [34, 6, 1, 7]] + -0.00257460837433342703 # B[299, [5, 2, 1, 3], [35, 6, 2, 6]] + -0.00421680657028429638 # B[300, [5, 2, 1, 3], [36, 6, 2, 8]] + -0.00918753516813325399 # B[301, [5, 2, 1, 3], [37, 6, 3, 7]] + -0.00316878171100497871 # B[302, [5, 2, 1, 3], [38, 6, 4, 6]] + 0.000939804682159322766 # B[303, [5, 2, 1, 3], [39, 6, 4, 8]] + -0.00618801787900946643 # B[304, [5, 2, 1, 3], [40, 6, 5, 7]] + -0.00623545765495540482 # B[305, [5, 2, 1, 3], [41, 6, 6, 6]] + 0.00519552954815065936 # B[306, [5, 2, 1, 3], [42, 6, 6, 8]] + 0.0042213652228506697 # B[307, [5, 2, 1, 3], [43, 7, 0, 7]] + 0.0113944611011103838 # B[308, [5, 2, 1, 3], [44, 7, 1, 8]] + -0.00104197865751114085 # B[309, [5, 2, 1, 3], [45, 7, 2, 7]] + -0.0087446191630695079 # B[310, [5, 2, 1, 3], [46, 7, 3, 8]] + -0.00196327596558909696 # B[311, [5, 2, 1, 3], [47, 7, 4, 7]] + -0.00447686867642808298 # B[312, [5, 2, 1, 3], [48, 7, 5, 8]] + -0.00474469665733750351 # B[313, [5, 2, 1, 3], [49, 7, 6, 7]] + -0.0059004868061462868 # B[314, [5, 2, 1, 3], [50, 7, 7, 8]] + 2.22874717926892923e-05 # B[315, [5, 2, 1, 3], [51, 8, 0, 8]] + -0.00154741089157206784 # B[316, [5, 2, 1, 3], [52, 8, 2, 8]] + 0.00417852330669051582 # B[317, [5, 2, 1, 3], [53, 8, 4, 8]] + 0.00134060860138395356 # B[318, [5, 2, 1, 3], [54, 8, 6, 8]] + -4.29219459423162489e-05 # B[319, [5, 2, 1, 3], [55, 8, 8, 8]] + 0.000319124100064731785 # B[320, [6, 2, 2, 2], [6, 2, 2, 2]] + -0.00839561599135440172 # B[321, [6, 2, 2, 2], [7, 2, 2, 4]] + -0.00326195850510992494 # B[322, [6, 2, 2, 2], [8, 3, 0, 3]] + 0.0194547426296311776 # B[323, [6, 2, 2, 2], [9, 3, 1, 4]] + -0.020516093722439413 # B[324, [6, 2, 2, 2], [10, 3, 2, 3]] + -0.00901624473884381043 # B[325, [6, 2, 2, 2], [11, 3, 2, 5]] + 0.0129026669830971837 # B[326, [6, 2, 2, 2], [12, 3, 3, 4]] + 0.00463182910296210636 # B[327, [6, 2, 2, 2], [13, 3, 3, 6]] + -0.00261498466108737743 # B[328, [6, 2, 2, 2], [14, 4, 0, 4]] + 0.0215819608660451426 # B[329, [6, 2, 2, 2], [15, 4, 1, 5]] + 0.000767688854520869957 # B[330, [6, 2, 2, 2], [16, 4, 2, 4]] + -0.00666111439578009716 # B[331, [6, 2, 2, 2], [17, 4, 2, 6]] + 0.0112705725443772303 # B[332, [6, 2, 2, 2], [18, 4, 3, 5]] + 0.00228839615631495127 # B[333, [6, 2, 2, 2], [19, 4, 3, 7]] + 0.00124148748415313414 # B[334, [6, 2, 2, 2], [20, 4, 4, 4]] + 0.00353391028977510834 # B[335, [6, 2, 2, 2], [21, 4, 4, 6]] + -0.00310464569903003834 # B[336, [6, 2, 2, 2], [22, 4, 4, 8]] + -0.001770681064288395 # B[337, [6, 2, 2, 2], [23, 5, 0, 5]] + 0.000554784469018851215 # B[338, [6, 2, 2, 2], [24, 5, 1, 6]] + -0.000102008183116791319 # B[339, [6, 2, 2, 2], [25, 5, 2, 5]] + -0.00128750706249572758 # B[340, [6, 2, 2, 2], [26, 5, 2, 7]] + 0.0046490656013451568 # B[341, [6, 2, 2, 2], [27, 5, 3, 6]] + 0.0034506831073765681 # B[342, [6, 2, 2, 2], [28, 5, 3, 8]] + 0.00501652811902741046 # B[343, [6, 2, 2, 2], [29, 5, 4, 5]] + -1.88389891915279224e-05 # B[344, [6, 2, 2, 2], [30, 5, 4, 7]] + -0.00246586719805504942 # B[345, [6, 2, 2, 2], [31, 5, 5, 6]] + -0.00339629261051872756 # B[346, [6, 2, 2, 2], [32, 5, 5, 8]] + -1.22729584505151552e-05 # B[347, [6, 2, 2, 2], [33, 6, 0, 6]] + -0.0055646406349652653 # B[348, [6, 2, 2, 2], [34, 6, 1, 7]] + 0.00216606634250279383 # B[349, [6, 2, 2, 2], [35, 6, 2, 6]] + -0.000140725603696151627 # B[350, [6, 2, 2, 2], [36, 6, 2, 8]] + -0.01190136261487338 # B[351, [6, 2, 2, 2], [37, 6, 3, 7]] + -0.000996588010308921109 # B[352, [6, 2, 2, 2], [38, 6, 4, 6]] + -0.0040124728576705895 # B[353, [6, 2, 2, 2], [39, 6, 4, 8]] + 0.000422679331586792552 # B[354, [6, 2, 2, 2], [40, 6, 5, 7]] + 0.000548939662545001959 # B[355, [6, 2, 2, 2], [41, 6, 6, 6]] + 0.00256895119228900404 # B[356, [6, 2, 2, 2], [42, 6, 6, 8]] + -0.000615139781019174688 # B[357, [6, 2, 2, 2], [43, 7, 0, 7]] + -0.00404941774617198578 # B[358, [6, 2, 2, 2], [44, 7, 1, 8]] + 0.00466754848324051064 # B[359, [6, 2, 2, 2], [45, 7, 2, 7]] + 0.00150461796185176488 # B[360, [6, 2, 2, 2], [46, 7, 3, 8]] + 0.0037489054114537468 # B[361, [6, 2, 2, 2], [47, 7, 4, 7]] + 0.00285804436398595782 # B[362, [6, 2, 2, 2], [48, 7, 5, 8]] + -0.00287521518361254919 # B[363, [6, 2, 2, 2], [49, 7, 6, 7]] + 0.000969520968104660755 # B[364, [6, 2, 2, 2], [50, 7, 7, 8]] + -0.000716125857042927043 # B[365, [6, 2, 2, 2], [51, 8, 0, 8]] + -0.00157385185114507437 # B[366, [6, 2, 2, 2], [52, 8, 2, 8]] + 0.002689243736875038 # B[367, [6, 2, 2, 2], [53, 8, 4, 8]] + -0.000661038690452418623 # B[368, [6, 2, 2, 2], [54, 8, 6, 8]] + 0.00157186481624649321 # B[369, [6, 2, 2, 2], [55, 8, 8, 8]] + -0.0134601349926017494 # B[370, [7, 2, 2, 4], [7, 2, 2, 4]] + -0.000918558149715113011 # B[371, [7, 2, 2, 4], [8, 3, 0, 3]] + -0.00377418701166061087 # B[372, [7, 2, 2, 4], [9, 3, 1, 4]] + 0.0148168734486278948 # B[373, [7, 2, 2, 4], [10, 3, 2, 3]] + -0.00535328606426562371 # B[374, [7, 2, 2, 4], [11, 3, 2, 5]] + 0.00804271469408427385 # B[375, [7, 2, 2, 4], [12, 3, 3, 4]] + 0.00136329663181449737 # B[376, [7, 2, 2, 4], [13, 3, 3, 6]] + 0.000218608555253111195 # B[377, [7, 2, 2, 4], [14, 4, 0, 4]] + 0.00767165886258287799 # B[378, [7, 2, 2, 4], [15, 4, 1, 5]] + -0.0022580429604385833 # B[379, [7, 2, 2, 4], [16, 4, 2, 4]] + -0.0050991924246220309 # B[380, [7, 2, 2, 4], [17, 4, 2, 6]] + -0.00308509180848093572 # B[381, [7, 2, 2, 4], [18, 4, 3, 5]] + -0.000900097231895549623 # B[382, [7, 2, 2, 4], [19, 4, 3, 7]] + -0.0063557020842957869 # B[383, [7, 2, 2, 4], [20, 4, 4, 4]] + -0.000409569358807882096 # B[384, [7, 2, 2, 4], [21, 4, 4, 6]] + 0.00254581400782049119 # B[385, [7, 2, 2, 4], [22, 4, 4, 8]] + 0.000657951401298526029 # B[386, [7, 2, 2, 4], [23, 5, 0, 5]] + -0.00940269729352927013 # B[387, [7, 2, 2, 4], [24, 5, 1, 6]] + 0.00333566383730494239 # B[388, [7, 2, 2, 4], [25, 5, 2, 5]] + 0.00896493308698088215 # B[389, [7, 2, 2, 4], [26, 5, 2, 7]] + 0.00132812590751918685 # B[390, [7, 2, 2, 4], [27, 5, 3, 6]] + -0.00127282140780485189 # B[391, [7, 2, 2, 4], [28, 5, 3, 8]] + -0.00435358176352772068 # B[392, [7, 2, 2, 4], [29, 5, 4, 5]] + -0.00226566527245459885 # B[393, [7, 2, 2, 4], [30, 5, 4, 7]] + 0.00326597657188156627 # B[394, [7, 2, 2, 4], [31, 5, 5, 6]] + -0.00247993076825692074 # B[395, [7, 2, 2, 4], [32, 5, 5, 8]] + -0.00138012806761597748 # B[396, [7, 2, 2, 4], [33, 6, 0, 6]] + -0.00296559266178312566 # B[397, [7, 2, 2, 4], [34, 6, 1, 7]] + -0.00345134318647404535 # B[398, [7, 2, 2, 4], [35, 6, 2, 6]] + 0.00604122282441024554 # B[399, [7, 2, 2, 4], [36, 6, 2, 8]] + -0.00602530276328681197 # B[400, [7, 2, 2, 4], [37, 6, 3, 7]] + 0.00113230868581531974 # B[401, [7, 2, 2, 4], [38, 6, 4, 6]] + 0.00132069580529702024 # B[402, [7, 2, 2, 4], [39, 6, 4, 8]] + -0.00355708848499901743 # B[403, [7, 2, 2, 4], [40, 6, 5, 7]] + 0.00103954578232134899 # B[404, [7, 2, 2, 4], [41, 6, 6, 6]] + 0.00138660655783935638 # B[405, [7, 2, 2, 4], [42, 6, 6, 8]] + 0.00122312383058832339 # B[406, [7, 2, 2, 4], [43, 7, 0, 7]] + 0.00122422070912251465 # B[407, [7, 2, 2, 4], [44, 7, 1, 8]] + -0.00497379521097694472 # B[408, [7, 2, 2, 4], [45, 7, 2, 7]] + -0.00811974704425355749 # B[409, [7, 2, 2, 4], [46, 7, 3, 8]] + 0.00114732010903773659 # B[410, [7, 2, 2, 4], [47, 7, 4, 7]] + -0.00569074628354063975 # B[411, [7, 2, 2, 4], [48, 7, 5, 8]] + 0.00235624642317577588 # B[412, [7, 2, 2, 4], [49, 7, 6, 7]] + 7.98437182146268919e-05 # B[413, [7, 2, 2, 4], [50, 7, 7, 8]] + 0.00113891921332402897 # B[414, [7, 2, 2, 4], [51, 8, 0, 8]] + -0.00492469555442132112 # B[415, [7, 2, 2, 4], [52, 8, 2, 8]] + 0.000792980352556455804 # B[416, [7, 2, 2, 4], [53, 8, 4, 8]] + 0.00153854887229367375 # B[417, [7, 2, 2, 4], [54, 8, 6, 8]] + -0.000881221748445243022 # B[418, [7, 2, 2, 4], [55, 8, 8, 8]] + -0.00136471788502227735 # B[419, [8, 3, 0, 3], [8, 3, 0, 3]] + 0.00246251727263488776 # B[420, [8, 3, 0, 3], [9, 3, 1, 4]] + 0.000996613519267240677 # B[421, [8, 3, 0, 3], [10, 3, 2, 3]] + -0.00207976146372090831 # B[422, [8, 3, 0, 3], [11, 3, 2, 5]] + -9.97509064182486305e-05 # B[423, [8, 3, 0, 3], [12, 3, 3, 4]] + 0.000656935135924852087 # B[424, [8, 3, 0, 3], [13, 3, 3, 6]] + -0.000492474229225159377 # B[425, [8, 3, 0, 3], [14, 4, 0, 4]] + 0.0032189163248994351 # B[426, [8, 3, 0, 3], [15, 4, 1, 5]] + -0.00115555104609991501 # B[427, [8, 3, 0, 3], [16, 4, 2, 4]] + -0.000101151026370576574 # B[428, [8, 3, 0, 3], [17, 4, 2, 6]] + 0.00020301152740384229 # B[429, [8, 3, 0, 3], [18, 4, 3, 5]] + -0.000285445107860462371 # B[430, [8, 3, 0, 3], [19, 4, 3, 7]] + 0.000462665925556146607 # B[431, [8, 3, 0, 3], [20, 4, 4, 4]] + -2.75652763320703015e-05 # B[432, [8, 3, 0, 3], [21, 4, 4, 6]] + -0.000358778647317398169 # B[433, [8, 3, 0, 3], [22, 4, 4, 8]] + -0.000397176131748222527 # B[434, [8, 3, 0, 3], [23, 5, 0, 5]] + -0.00026950177456114624 # B[435, [8, 3, 0, 3], [24, 5, 1, 6]] + 0.00119424632084062527 # B[436, [8, 3, 0, 3], [25, 5, 2, 5]] + 0.000922347152199163439 # B[437, [8, 3, 0, 3], [26, 5, 2, 7]] + -0.000340838509282952173 # B[438, [8, 3, 0, 3], [27, 5, 3, 6]] + 0.00128847730890532808 # B[439, [8, 3, 0, 3], [28, 5, 3, 8]] + -0.00044582191494569115 # B[440, [8, 3, 0, 3], [29, 5, 4, 5]] + -0.00114898350718379422 # B[441, [8, 3, 0, 3], [30, 5, 4, 7]] + -0.000530499767100067743 # B[442, [8, 3, 0, 3], [31, 5, 5, 6]] + 1.68864176486992895e-05 # B[443, [8, 3, 0, 3], [32, 5, 5, 8]] + -0.000312292146951373417 # B[444, [8, 3, 0, 3], [33, 6, 0, 6]] + -0.00186273440079770883 # B[445, [8, 3, 0, 3], [34, 6, 1, 7]] + -0.000475625961442131123 # B[446, [8, 3, 0, 3], [35, 6, 2, 6]] + 0.000505090975521763769 # B[447, [8, 3, 0, 3], [36, 6, 2, 8]] + 0.000128630083375533277 # B[448, [8, 3, 0, 3], [37, 6, 3, 7]] + -0.000431369283499544176 # B[449, [8, 3, 0, 3], [38, 6, 4, 6]] + 0.000461881443708941908 # B[450, [8, 3, 0, 3], [39, 6, 4, 8]] + 0.000867550860200114182 # B[451, [8, 3, 0, 3], [40, 6, 5, 7]] + 0.000179604539903628624 # B[452, [8, 3, 0, 3], [41, 6, 6, 6]] + -0.000405383988192370426 # B[453, [8, 3, 0, 3], [42, 6, 6, 8]] + -0.000305572243426546764 # B[454, [8, 3, 0, 3], [43, 7, 0, 7]] + -0.0010766931736053021 # B[455, [8, 3, 0, 3], [44, 7, 1, 8]] + 0.000701859051866787764 # B[456, [8, 3, 0, 3], [45, 7, 2, 7]] + -1.5413662061584954e-05 # B[457, [8, 3, 0, 3], [46, 7, 3, 8]] + 0.000428834666348756888 # B[458, [8, 3, 0, 3], [47, 7, 4, 7]] + 0.000468098667731533385 # B[459, [8, 3, 0, 3], [48, 7, 5, 8]] + 0.000158467988956009775 # B[460, [8, 3, 0, 3], [49, 7, 6, 7]] + 2.77948419442784408e-05 # B[461, [8, 3, 0, 3], [50, 7, 7, 8]] + -0.000282655955044820717 # B[462, [8, 3, 0, 3], [51, 8, 0, 8]] + 0.000100300940760145348 # B[463, [8, 3, 0, 3], [52, 8, 2, 8]] + 0.000314947671131902973 # B[464, [8, 3, 0, 3], [53, 8, 4, 8]] + 0.000144842823919437078 # B[465, [8, 3, 0, 3], [54, 8, 6, 8]] + 7.00050428864840146e-05 # B[466, [8, 3, 0, 3], [55, 8, 8, 8]] + 0.0118411448561217512 # B[467, [9, 3, 1, 4], [9, 3, 1, 4]] + 0.0158809314732707603 # B[468, [9, 3, 1, 4], [10, 3, 2, 3]] + -0.00690506493475962109 # B[469, [9, 3, 1, 4], [11, 3, 2, 5]] + 0.0085626937099196887 # B[470, [9, 3, 1, 4], [12, 3, 3, 4]] + -0.00387686964925252654 # B[471, [9, 3, 1, 4], [13, 3, 3, 6]] + 0.00015029200549142481 # B[472, [9, 3, 1, 4], [14, 4, 0, 4]] + -0.000142532963490632015 # B[473, [9, 3, 1, 4], [15, 4, 1, 5]] + 0.00921427022949583042 # B[474, [9, 3, 1, 4], [16, 4, 2, 4]] + -0.0112717231196791407 # B[475, [9, 3, 1, 4], [17, 4, 2, 6]] + -0.0122014182952103704 # B[476, [9, 3, 1, 4], [18, 4, 3, 5]] + -0.0111571557686284996 # B[477, [9, 3, 1, 4], [19, 4, 3, 7]] + -0.00276180055211498916 # B[478, [9, 3, 1, 4], [20, 4, 4, 4]] + -0.00444456405006457382 # B[479, [9, 3, 1, 4], [21, 4, 4, 6]] + -0.00248162623330630983 # B[480, [9, 3, 1, 4], [22, 4, 4, 8]] + 0.000238830840202226575 # B[481, [9, 3, 1, 4], [23, 5, 0, 5]] + 0.0106883008114137777 # B[482, [9, 3, 1, 4], [24, 5, 1, 6]] + -0.00176293319638371826 # B[483, [9, 3, 1, 4], [25, 5, 2, 5]] + -0.000706186990249144109 # B[484, [9, 3, 1, 4], [26, 5, 2, 7]] + -0.000957413082652629373 # B[485, [9, 3, 1, 4], [27, 5, 3, 6]] + -0.00485998335666546887 # B[486, [9, 3, 1, 4], [28, 5, 3, 8]] + -0.000739967956913101287 # B[487, [9, 3, 1, 4], [29, 5, 4, 5]] + -0.00656002591947351353 # B[488, [9, 3, 1, 4], [30, 5, 4, 7]] + -0.00191607250770065712 # B[489, [9, 3, 1, 4], [31, 5, 5, 6]] + -0.000375150046930213714 # B[490, [9, 3, 1, 4], [32, 5, 5, 8]] + 0.000379540253919751804 # B[491, [9, 3, 1, 4], [33, 6, 0, 6]] + 0.0103809997405371179 # B[492, [9, 3, 1, 4], [34, 6, 1, 7]] + -0.00167937900508645203 # B[493, [9, 3, 1, 4], [35, 6, 2, 6]] + -0.000942453027264282192 # B[494, [9, 3, 1, 4], [36, 6, 2, 8]] + -0.00358794660355351257 # B[495, [9, 3, 1, 4], [37, 6, 3, 7]] + 0.00367542903060237222 # B[496, [9, 3, 1, 4], [38, 6, 4, 6]] + -0.00605874518215254298 # B[497, [9, 3, 1, 4], [39, 6, 4, 8]] + -0.0053364107721741022 # B[498, [9, 3, 1, 4], [40, 6, 5, 7]] + -0.00220303686176452889 # B[499, [9, 3, 1, 4], [41, 6, 6, 6]] + 0.000240224733534942676 # B[500, [9, 3, 1, 4], [42, 6, 6, 8]] + 0.00118204722287629585 # B[501, [9, 3, 1, 4], [43, 7, 0, 7]] + 0.00391606544218769514 # B[502, [9, 3, 1, 4], [44, 7, 1, 8]] + -0.00190557542057654024 # B[503, [9, 3, 1, 4], [45, 7, 2, 7]] + -0.0010749256928406746 # B[504, [9, 3, 1, 4], [46, 7, 3, 8]] + 6.24186835188134462e-05 # B[505, [9, 3, 1, 4], [47, 7, 4, 7]] + -0.00250872188348977114 # B[506, [9, 3, 1, 4], [48, 7, 5, 8]] + -0.00164710314956706405 # B[507, [9, 3, 1, 4], [49, 7, 6, 7]] + -0.0029144992153610676 # B[508, [9, 3, 1, 4], [50, 7, 7, 8]] + 0.000712015267242259442 # B[509, [9, 3, 1, 4], [51, 8, 0, 8]] + -0.00179539873092394715 # B[510, [9, 3, 1, 4], [52, 8, 2, 8]] + 0.00203000698298521493 # B[511, [9, 3, 1, 4], [53, 8, 4, 8]] + -0.00103477100047664442 # B[512, [9, 3, 1, 4], [54, 8, 6, 8]] + -0.000727628763147338854 # B[513, [9, 3, 1, 4], [55, 8, 8, 8]] + 0.0163451466486591972 # B[514, [10, 3, 2, 3], [10, 3, 2, 3]] + -0.00145259448176927441 # B[515, [10, 3, 2, 3], [11, 3, 2, 5]] + -0.00808947571520425568 # B[516, [10, 3, 2, 3], [12, 3, 3, 4]] + -0.00693599935022420205 # B[517, [10, 3, 2, 3], [13, 3, 3, 6]] + -0.00419683318703741731 # B[518, [10, 3, 2, 3], [14, 4, 0, 4]] + 0.00927666204585274323 # B[519, [10, 3, 2, 3], [15, 4, 1, 5]] + -0.0138962541759877663 # B[520, [10, 3, 2, 3], [16, 4, 2, 4]] + 0.0115061801390417759 # B[521, [10, 3, 2, 3], [17, 4, 2, 6]] + 0.0118559077356181798 # B[522, [10, 3, 2, 3], [18, 4, 3, 5]] + 0.00193270595871023604 # B[523, [10, 3, 2, 3], [19, 4, 3, 7]] + 0.00156708209719190472 # B[524, [10, 3, 2, 3], [20, 4, 4, 4]] + 0.0030286948486105119 # B[525, [10, 3, 2, 3], [21, 4, 4, 6]] + -6.03736466163237034e-05 # B[526, [10, 3, 2, 3], [22, 4, 4, 8]] + -0.00147218391304548835 # B[527, [10, 3, 2, 3], [23, 5, 0, 5]] + 0.000931966019926808685 # B[528, [10, 3, 2, 3], [24, 5, 1, 6]] + 0.0153667638164197012 # B[529, [10, 3, 2, 3], [25, 5, 2, 5]] + -0.0023105273691670326 # B[530, [10, 3, 2, 3], [26, 5, 2, 7]] + 0.0018873267014898696 # B[531, [10, 3, 2, 3], [27, 5, 3, 6]] + -0.00221592978134090707 # B[532, [10, 3, 2, 3], [28, 5, 3, 8]] + 0.00175823978838723916 # B[533, [10, 3, 2, 3], [29, 5, 4, 5]] + 0.00134986143361107494 # B[534, [10, 3, 2, 3], [30, 5, 4, 7]] + -0.00280444330034939227 # B[535, [10, 3, 2, 3], [31, 5, 5, 6]] + -0.000446159575940244073 # B[536, [10, 3, 2, 3], [32, 5, 5, 8]] + 0.000126573802730074736 # B[537, [10, 3, 2, 3], [33, 6, 0, 6]] + 7.95217271451070795e-05 # B[538, [10, 3, 2, 3], [34, 6, 1, 7]] + -0.000615992203402992468 # B[539, [10, 3, 2, 3], [35, 6, 2, 6]] + -0.0106304231235931409 # B[540, [10, 3, 2, 3], [36, 6, 2, 8]] + -0.00513102234934090934 # B[541, [10, 3, 2, 3], [37, 6, 3, 7]] + 0.00086364506858761271 # B[542, [10, 3, 2, 3], [38, 6, 4, 6]] + -0.00427816275089007263 # B[543, [10, 3, 2, 3], [39, 6, 4, 8]] + -0.00709876751806875171 # B[544, [10, 3, 2, 3], [40, 6, 5, 7]] + -0.00107679083671011894 # B[545, [10, 3, 2, 3], [41, 6, 6, 6]] + -0.0014022801302571164 # B[546, [10, 3, 2, 3], [42, 6, 6, 8]] + 0.00032001340322446864 # B[547, [10, 3, 2, 3], [43, 7, 0, 7]] + 0.0099494513037338677 # B[548, [10, 3, 2, 3], [44, 7, 1, 8]] + 0.00657164457459321564 # B[549, [10, 3, 2, 3], [45, 7, 2, 7]] + -0.00193909086513409032 # B[550, [10, 3, 2, 3], [46, 7, 3, 8]] + -0.000661327911070458407 # B[551, [10, 3, 2, 3], [47, 7, 4, 7]] + -0.00236609840279333045 # B[552, [10, 3, 2, 3], [48, 7, 5, 8]] + 0.000323126961361372422 # B[553, [10, 3, 2, 3], [49, 7, 6, 7]] + 0.00156411007472663857 # B[554, [10, 3, 2, 3], [50, 7, 7, 8]] + -0.000413410696562647312 # B[555, [10, 3, 2, 3], [51, 8, 0, 8]] + 0.00151556635054790959 # B[556, [10, 3, 2, 3], [52, 8, 2, 8]] + 0.0032252808357782943 # B[557, [10, 3, 2, 3], [53, 8, 4, 8]] + 0.00431814581620697767 # B[558, [10, 3, 2, 3], [54, 8, 6, 8]] + 0.000198535493268348594 # B[559, [10, 3, 2, 3], [55, 8, 8, 8]] + 0.0156540432654675432 # B[560, [11, 3, 2, 5], [11, 3, 2, 5]] + 0.00979845476873780416 # B[561, [11, 3, 2, 5], [12, 3, 3, 4]] + 0.00873265456764509701 # B[562, [11, 3, 2, 5], [13, 3, 3, 6]] + -0.00355250352643814854 # B[563, [11, 3, 2, 5], [14, 4, 0, 4]] + 0.0197388975583387243 # B[564, [11, 3, 2, 5], [15, 4, 1, 5]] + 0.0158965586216084157 # B[565, [11, 3, 2, 5], [16, 4, 2, 4]] + 0.0126440348146513917 # B[566, [11, 3, 2, 5], [17, 4, 2, 6]] + 0.00588822462217037865 # B[567, [11, 3, 2, 5], [18, 4, 3, 5]] + 0.00465829809814364074 # B[568, [11, 3, 2, 5], [19, 4, 3, 7]] + 0.00460100330976275125 # B[569, [11, 3, 2, 5], [20, 4, 4, 4]] + 0.00507979510261629894 # B[570, [11, 3, 2, 5], [21, 4, 4, 6]] + -0.000978147842247499566 # B[571, [11, 3, 2, 5], [22, 4, 4, 8]] + 0.000175648698607325238 # B[572, [11, 3, 2, 5], [23, 5, 0, 5]] + 0.00701365729786882983 # B[573, [11, 3, 2, 5], [24, 5, 1, 6]] + 0.0124121871279893672 # B[574, [11, 3, 2, 5], [25, 5, 2, 5]] + 0.0133268604743271169 # B[575, [11, 3, 2, 5], [26, 5, 2, 7]] + -0.00306906262974302943 # B[576, [11, 3, 2, 5], [27, 5, 3, 6]] + 0.00411586711144847073 # B[577, [11, 3, 2, 5], [28, 5, 3, 8]] + -0.00483702208096517539 # B[578, [11, 3, 2, 5], [29, 5, 4, 5]] + 0.000232830853394127776 # B[579, [11, 3, 2, 5], [30, 5, 4, 7]] + -0.00500644765401524715 # B[580, [11, 3, 2, 5], [31, 5, 5, 6]] + -0.000732991087538808345 # B[581, [11, 3, 2, 5], [32, 5, 5, 8]] + 0.0028290195015726223 # B[582, [11, 3, 2, 5], [33, 6, 0, 6]] + 0.000660043236562475252 # B[583, [11, 3, 2, 5], [34, 6, 1, 7]] + 0.00858014820620479901 # B[584, [11, 3, 2, 5], [35, 6, 2, 6]] + 0.00979420830127970127 # B[585, [11, 3, 2, 5], [36, 6, 2, 8]] + -0.00276929529868128257 # B[586, [11, 3, 2, 5], [37, 6, 3, 7]] + -0.00462592209123751513 # B[587, [11, 3, 2, 5], [38, 6, 4, 6]] + 0.000957159367659247626 # B[588, [11, 3, 2, 5], [39, 6, 4, 8]] + -0.00289923459154850169 # B[589, [11, 3, 2, 5], [40, 6, 5, 7]] + -0.00605668820795574915 # B[590, [11, 3, 2, 5], [41, 6, 6, 6]] + -0.00571070540762017888 # B[591, [11, 3, 2, 5], [42, 6, 6, 8]] + 0.00247733408975375075 # B[592, [11, 3, 2, 5], [43, 7, 0, 7]] + 0.00452000165177812024 # B[593, [11, 3, 2, 5], [44, 7, 1, 8]] + 0.00267833963693382693 # B[594, [11, 3, 2, 5], [45, 7, 2, 7]] + -0.00558917145621175976 # B[595, [11, 3, 2, 5], [46, 7, 3, 8]] + -0.00228097422335522999 # B[596, [11, 3, 2, 5], [47, 7, 4, 7]] + -0.00366604043706369575 # B[597, [11, 3, 2, 5], [48, 7, 5, 8]] + -0.00340088281218112534 # B[598, [11, 3, 2, 5], [49, 7, 6, 7]] + -0.00355022426643257852 # B[599, [11, 3, 2, 5], [50, 7, 7, 8]] + 0.00124080314205340242 # B[600, [11, 3, 2, 5], [51, 8, 0, 8]] + 0.00287261267197001097 # B[601, [11, 3, 2, 5], [52, 8, 2, 8]] + 0.000744815191487350516 # B[602, [11, 3, 2, 5], [53, 8, 4, 8]] + -0.000112288931147085103 # B[603, [11, 3, 2, 5], [54, 8, 6, 8]] + -0.000128712309023326903 # B[604, [11, 3, 2, 5], [55, 8, 8, 8]] + -0.00238666366477884723 # B[605, [12, 3, 3, 4], [12, 3, 3, 4]] + 0.000248696286071804773 # B[606, [12, 3, 3, 4], [13, 3, 3, 6]] + -0.000479775127143412111 # B[607, [12, 3, 3, 4], [14, 4, 0, 4]] + 0.00175952173341571141 # B[608, [12, 3, 3, 4], [15, 4, 1, 5]] + 0.000197368498788095745 # B[609, [12, 3, 3, 4], [16, 4, 2, 4]] + 0.00726401135600521306 # B[610, [12, 3, 3, 4], [17, 4, 2, 6]] + -0.00118096336629036625 # B[611, [12, 3, 3, 4], [18, 4, 3, 5]] + 0.00702896514440041337 # B[612, [12, 3, 3, 4], [19, 4, 3, 7]] + -0.00236026619914155369 # B[613, [12, 3, 3, 4], [20, 4, 4, 4]] + -0.00341152672753146672 # B[614, [12, 3, 3, 4], [21, 4, 4, 6]] + 0.00348613231611557411 # B[615, [12, 3, 3, 4], [22, 4, 4, 8]] + 0.00244457707345889508 # B[616, [12, 3, 3, 4], [23, 5, 0, 5]] + -0.000822727235681003019 # B[617, [12, 3, 3, 4], [24, 5, 1, 6]] + -0.00248763810919495551 # B[618, [12, 3, 3, 4], [25, 5, 2, 5]] + 0.00796413115978647848 # B[619, [12, 3, 3, 4], [26, 5, 2, 7]] + -0.00179317048488774472 # B[620, [12, 3, 3, 4], [27, 5, 3, 6]] + 0.00454384820995466787 # B[621, [12, 3, 3, 4], [28, 5, 3, 8]] + -0.00425365149530766012 # B[622, [12, 3, 3, 4], [29, 5, 4, 5]] + -0.000569152560526600682 # B[623, [12, 3, 3, 4], [30, 5, 4, 7]] + -0.00506501220127485163 # B[624, [12, 3, 3, 4], [31, 5, 5, 6]] + -0.00142637122228714969 # B[625, [12, 3, 3, 4], [32, 5, 5, 8]] + 0.00190739239349446005 # B[626, [12, 3, 3, 4], [33, 6, 0, 6]] + 0.00215429853006474104 # B[627, [12, 3, 3, 4], [34, 6, 1, 7]] + 0.00512135793044871807 # B[628, [12, 3, 3, 4], [35, 6, 2, 6]] + 0.00479344551680733165 # B[629, [12, 3, 3, 4], [36, 6, 2, 8]] + -0.000813733007282164966 # B[630, [12, 3, 3, 4], [37, 6, 3, 7]] + -0.00162747725274282884 # B[631, [12, 3, 3, 4], [38, 6, 4, 6]] + -0.00440004969635155417 # B[632, [12, 3, 3, 4], [39, 6, 4, 8]] + -0.00939941153506137356 # B[633, [12, 3, 3, 4], [40, 6, 5, 7]] + -0.00314893787689287524 # B[634, [12, 3, 3, 4], [41, 6, 6, 6]] + -0.00125776748984993136 # B[635, [12, 3, 3, 4], [42, 6, 6, 8]] + 0.00129112127843685615 # B[636, [12, 3, 3, 4], [43, 7, 0, 7]] + 0.00564724346615860621 # B[637, [12, 3, 3, 4], [44, 7, 1, 8]] + -0.0018460571659526942 # B[638, [12, 3, 3, 4], [45, 7, 2, 7]] + -0.000300525523225368685 # B[639, [12, 3, 3, 4], [46, 7, 3, 8]] + -0.00277157581435865698 # B[640, [12, 3, 3, 4], [47, 7, 4, 7]] + -0.00975210406554173105 # B[641, [12, 3, 3, 4], [48, 7, 5, 8]] + -0.00233845213984289896 # B[642, [12, 3, 3, 4], [49, 7, 6, 7]] + -0.00138723239922117561 # B[643, [12, 3, 3, 4], [50, 7, 7, 8]] + 0.000864866797073243071 # B[644, [12, 3, 3, 4], [51, 8, 0, 8]] + -0.000747563068773752452 # B[645, [12, 3, 3, 4], [52, 8, 2, 8]] + 0.000965474694725087373 # B[646, [12, 3, 3, 4], [53, 8, 4, 8]] + -0.00140612646390263218 # B[647, [12, 3, 3, 4], [54, 8, 6, 8]] + -0.00149643617894318522 # B[648, [12, 3, 3, 4], [55, 8, 8, 8]] + 0.00149153681612450295 # B[649, [13, 3, 3, 6], [13, 3, 3, 6]] + -0.000954556711257832646 # B[650, [13, 3, 3, 6], [14, 4, 0, 4]] + 0.00120983585813713799 # B[651, [13, 3, 3, 6], [15, 4, 1, 5]] + 0.00300317867570911888 # B[652, [13, 3, 3, 6], [16, 4, 2, 4]] + 0.00236443796053106663 # B[653, [13, 3, 3, 6], [17, 4, 2, 6]] + 0.00415524139600132597 # B[654, [13, 3, 3, 6], [18, 4, 3, 5]] + -0.000123573851697839077 # B[655, [13, 3, 3, 6], [19, 4, 3, 7]] + 0.000470359195248265527 # B[656, [13, 3, 3, 6], [20, 4, 4, 4]] + 0.000635927641249957321 # B[657, [13, 3, 3, 6], [21, 4, 4, 6]] + 0.000747673754939660613 # B[658, [13, 3, 3, 6], [22, 4, 4, 8]] + 0.00074188846631736971 # B[659, [13, 3, 3, 6], [23, 5, 0, 5]] + 0.00463957097737913854 # B[660, [13, 3, 3, 6], [24, 5, 1, 6]] + -0.00271105182543343939 # B[661, [13, 3, 3, 6], [25, 5, 2, 5]] + 6.90411348413036419e-06 # B[662, [13, 3, 3, 6], [26, 5, 2, 7]] + 0.000911354980270381865 # B[663, [13, 3, 3, 6], [27, 5, 3, 6]] + -0.0028545746938972022 # B[664, [13, 3, 3, 6], [28, 5, 3, 8]] + -1.76062828863947363e-05 # B[665, [13, 3, 3, 6], [29, 5, 4, 5]] + -1.51206672011107435e-05 # B[666, [13, 3, 3, 6], [30, 5, 4, 7]] + -0.000798318879555708766 # B[667, [13, 3, 3, 6], [31, 5, 5, 6]] + -0.0015978026047660434 # B[668, [13, 3, 3, 6], [32, 5, 5, 8]] + 0.00034244751324807865 # B[669, [13, 3, 3, 6], [33, 6, 0, 6]] + 0.00338996797689858353 # B[670, [13, 3, 3, 6], [34, 6, 1, 7]] + 0.000289281476490772793 # B[671, [13, 3, 3, 6], [35, 6, 2, 6]] + -0.000559772151149058594 # B[672, [13, 3, 3, 6], [36, 6, 2, 8]] + -0.000650724286175463629 # B[673, [13, 3, 3, 6], [37, 6, 3, 7]] + 0.00148244897292096334 # B[674, [13, 3, 3, 6], [38, 6, 4, 6]] + 0.000183404639618602733 # B[675, [13, 3, 3, 6], [39, 6, 4, 8]] + -0.00185779692530890772 # B[676, [13, 3, 3, 6], [40, 6, 5, 7]] + -0.000708322215432564961 # B[677, [13, 3, 3, 6], [41, 6, 6, 6]] + -0.000491831969715535167 # B[678, [13, 3, 3, 6], [42, 6, 6, 8]] + 0.000833818016036214082 # B[679, [13, 3, 3, 6], [43, 7, 0, 7]] + -0.00256922900730601443 # B[680, [13, 3, 3, 6], [44, 7, 1, 8]] + -0.00112433206588518839 # B[681, [13, 3, 3, 6], [45, 7, 2, 7]] + 6.43716101358243753e-05 # B[682, [13, 3, 3, 6], [46, 7, 3, 8]] + -0.00126304972485289518 # B[683, [13, 3, 3, 6], [47, 7, 4, 7]] + -0.00210937996313975001 # B[684, [13, 3, 3, 6], [48, 7, 5, 8]] + -0.00126022676030809744 # B[685, [13, 3, 3, 6], [49, 7, 6, 7]] + -0.000555039709846411045 # B[686, [13, 3, 3, 6], [50, 7, 7, 8]] + 0.000790824100586496465 # B[687, [13, 3, 3, 6], [51, 8, 0, 8]] + -0.000844206812343649936 # B[688, [13, 3, 3, 6], [52, 8, 2, 8]] + 0.000195900027714517901 # B[689, [13, 3, 3, 6], [53, 8, 4, 8]] + -0.000823274415849936658 # B[690, [13, 3, 3, 6], [54, 8, 6, 8]] + -0.000330474595809105917 # B[691, [13, 3, 3, 6], [55, 8, 8, 8]] + -3.04835503155357485e-05 # B[692, [14, 4, 0, 4], [14, 4, 0, 4]] + -0.000825475145007361147 # B[693, [14, 4, 0, 4], [15, 4, 1, 5]] + -0.00244887111925138484 # B[694, [14, 4, 0, 4], [16, 4, 2, 4]] + -0.00122050568127611732 # B[695, [14, 4, 0, 4], [17, 4, 2, 6]] + -0.00226655265247485693 # B[696, [14, 4, 0, 4], [18, 4, 3, 5]] + -0.000767631950688907327 # B[697, [14, 4, 0, 4], [19, 4, 3, 7]] + -0.000547575812124723171 # B[698, [14, 4, 0, 4], [20, 4, 4, 4]] + -0.00121783548699544442 # B[699, [14, 4, 0, 4], [21, 4, 4, 6]] + 6.68947985199286332e-05 # B[700, [14, 4, 0, 4], [22, 4, 4, 8]] + -9.6030771921717939e-05 # B[701, [14, 4, 0, 4], [23, 5, 0, 5]] + -0.000544408900336967871 # B[702, [14, 4, 0, 4], [24, 5, 1, 6]] + -0.00139019051437529293 # B[703, [14, 4, 0, 4], [25, 5, 2, 5]] + -0.000281919324988699413 # B[704, [14, 4, 0, 4], [26, 5, 2, 7]] + -0.00125721115437776171 # B[705, [14, 4, 0, 4], [27, 5, 3, 6]] + -0.000282797770993010317 # B[706, [14, 4, 0, 4], [28, 5, 3, 8]] + -0.00139320549871079641 # B[707, [14, 4, 0, 4], [29, 5, 4, 5]] + -0.000628813518841068401 # B[708, [14, 4, 0, 4], [30, 5, 4, 7]] + -0.000607292163329276047 # B[709, [14, 4, 0, 4], [31, 5, 5, 6]] + 0.000242807689929189566 # B[710, [14, 4, 0, 4], [32, 5, 5, 8]] + -0.000100536983796830487 # B[711, [14, 4, 0, 4], [33, 6, 0, 6]] + 0.00111838401982674706 # B[712, [14, 4, 0, 4], [34, 6, 1, 7]] + -0.0012014113032742873 # B[713, [14, 4, 0, 4], [35, 6, 2, 6]] + -1.32311363260466386e-05 # B[714, [14, 4, 0, 4], [36, 6, 2, 8]] + 0.000753146180409180327 # B[715, [14, 4, 0, 4], [37, 6, 3, 7]] + -0.000270332227596856156 # B[716, [14, 4, 0, 4], [38, 6, 4, 6]] + -0.000293750660311472775 # B[717, [14, 4, 0, 4], [39, 6, 4, 8]] + 6.52480591955099942e-05 # B[718, [14, 4, 0, 4], [40, 6, 5, 7]] + -4.70588815947581285e-05 # B[719, [14, 4, 0, 4], [41, 6, 6, 6]] + 0.000244731448919628669 # B[720, [14, 4, 0, 4], [42, 6, 6, 8]] + -9.3149326930830334e-05 # B[721, [14, 4, 0, 4], [43, 7, 0, 7]] + 0.000731947904616598796 # B[722, [14, 4, 0, 4], [44, 7, 1, 8]] + -0.00107463735030771668 # B[723, [14, 4, 0, 4], [45, 7, 2, 7]] + 0.000139861959076940934 # B[724, [14, 4, 0, 4], [46, 7, 3, 8]] + 0.000101877532936889281 # B[725, [14, 4, 0, 4], [47, 7, 4, 7]] + -0.000196888502333611437 # B[726, [14, 4, 0, 4], [48, 7, 5, 8]] + 6.12030178565765859e-05 # B[727, [14, 4, 0, 4], [49, 7, 6, 7]] + -0.000223986590912481076 # B[728, [14, 4, 0, 4], [50, 7, 7, 8]] + -6.56819431667232667e-05 # B[729, [14, 4, 0, 4], [51, 8, 0, 8]] + -0.000970632773483491584 # B[730, [14, 4, 0, 4], [52, 8, 2, 8]] + -0.000182189294658170395 # B[731, [14, 4, 0, 4], [53, 8, 4, 8]] + -3.45215935849477185e-05 # B[732, [14, 4, 0, 4], [54, 8, 6, 8]] + 6.19739521221795986e-05 # B[733, [14, 4, 0, 4], [55, 8, 8, 8]] + 0.000242753902013392972 # B[734, [15, 4, 1, 5], [15, 4, 1, 5]] + 0.00729727211034517358 # B[735, [15, 4, 1, 5], [16, 4, 2, 4]] + -0.0024545495000649507 # B[736, [15, 4, 1, 5], [17, 4, 2, 6]] + -0.00265559618939786597 # B[737, [15, 4, 1, 5], [18, 4, 3, 5]] + 0.00473045463551583639 # B[738, [15, 4, 1, 5], [19, 4, 3, 7]] + -0.000140785797905494323 # B[739, [15, 4, 1, 5], [20, 4, 4, 4]] + 0.00179841698526277474 # B[740, [15, 4, 1, 5], [21, 4, 4, 6]] + 0.00129773534161339073 # B[741, [15, 4, 1, 5], [22, 4, 4, 8]] + 0.00172905697138841467 # B[742, [15, 4, 1, 5], [23, 5, 0, 5]] + -0.00408304027381215483 # B[743, [15, 4, 1, 5], [24, 5, 1, 6]] + -0.00205043992851699228 # B[744, [15, 4, 1, 5], [25, 5, 2, 5]] + 0.000756591579123801249 # B[745, [15, 4, 1, 5], [26, 5, 2, 7]] + -0.00421238291006168549 # B[746, [15, 4, 1, 5], [27, 5, 3, 6]] + -0.00196911327032830725 # B[747, [15, 4, 1, 5], [28, 5, 3, 8]] + 0.000729488918071528446 # B[748, [15, 4, 1, 5], [29, 5, 4, 5]] + -0.00177843604064341788 # B[749, [15, 4, 1, 5], [30, 5, 4, 7]] + -0.00130376966915328159 # B[750, [15, 4, 1, 5], [31, 5, 5, 6]] + -0.00198695656227435707 # B[751, [15, 4, 1, 5], [32, 5, 5, 8]] + 0.000608914142072050635 # B[752, [15, 4, 1, 5], [33, 6, 0, 6]] + -0.00109469344681823767 # B[753, [15, 4, 1, 5], [34, 6, 1, 7]] + -0.00451953523789613495 # B[754, [15, 4, 1, 5], [35, 6, 2, 6]] + 0.00279449892877900279 # B[755, [15, 4, 1, 5], [36, 6, 2, 8]] + -0.00435984465194903283 # B[756, [15, 4, 1, 5], [37, 6, 3, 7]] + 0.00275969130186590542 # B[757, [15, 4, 1, 5], [38, 6, 4, 6]] + 0.00154021904971430755 # B[758, [15, 4, 1, 5], [39, 6, 4, 8]] + -0.00146163413862035289 # B[759, [15, 4, 1, 5], [40, 6, 5, 7]] + -0.000333421796264918996 # B[760, [15, 4, 1, 5], [41, 6, 6, 6]] + -0.00139958818201657261 # B[761, [15, 4, 1, 5], [42, 6, 6, 8]] + 0.000750502250600797172 # B[762, [15, 4, 1, 5], [43, 7, 0, 7]] + 0.00476052216726493421 # B[763, [15, 4, 1, 5], [44, 7, 1, 8]] + -0.00155321215408361565 # B[764, [15, 4, 1, 5], [45, 7, 2, 7]] + -0.00351167160511536933 # B[765, [15, 4, 1, 5], [46, 7, 3, 8]] + 0.00268907735535169144 # B[766, [15, 4, 1, 5], [47, 7, 4, 7]] + -0.00296394481906553462 # B[767, [15, 4, 1, 5], [48, 7, 5, 8]] + -0.00115945739998543369 # B[768, [15, 4, 1, 5], [49, 7, 6, 7]] + -0.0011498694923236445 # B[769, [15, 4, 1, 5], [50, 7, 7, 8]] + 0.000691127444573572114 # B[770, [15, 4, 1, 5], [51, 8, 0, 8]] + 0.00149148321917135169 # B[771, [15, 4, 1, 5], [52, 8, 2, 8]] + 0.00226549729687968923 # B[772, [15, 4, 1, 5], [53, 8, 4, 8]] + -0.00127955154911817224 # B[773, [15, 4, 1, 5], [54, 8, 6, 8]] + -0.0006680598304007173 # B[774, [15, 4, 1, 5], [55, 8, 8, 8]] + 0.00773393138113156846 # B[775, [16, 4, 2, 4], [16, 4, 2, 4]] + 0.00481567776445743917 # B[776, [16, 4, 2, 4], [17, 4, 2, 6]] + 0.00646602315581837339 # B[777, [16, 4, 2, 4], [18, 4, 3, 5]] + 0.00401373256364237051 # B[778, [16, 4, 2, 4], [19, 4, 3, 7]] + -0.000224833927917125753 # B[779, [16, 4, 2, 4], [20, 4, 4, 4]] + 0.0030532060451974926 # B[780, [16, 4, 2, 4], [21, 4, 4, 6]] + -0.000126777823410560014 # B[781, [16, 4, 2, 4], [22, 4, 4, 8]] + 0.00109512376860463863 # B[782, [16, 4, 2, 4], [23, 5, 0, 5]] + 0.0014906978453806609 # B[783, [16, 4, 2, 4], [24, 5, 1, 6]] + 0.00278609484035531206 # B[784, [16, 4, 2, 4], [25, 5, 2, 5]] + 0.00720611209490516682 # B[785, [16, 4, 2, 4], [26, 5, 2, 7]] + 0.00230880055683394415 # B[786, [16, 4, 2, 4], [27, 5, 3, 6]] + 0.00492114792718315389 # B[787, [16, 4, 2, 4], [28, 5, 3, 8]] + 0.00102265649585190407 # B[788, [16, 4, 2, 4], [29, 5, 4, 5]] + -0.000348239317084679881 # B[789, [16, 4, 2, 4], [30, 5, 4, 7]] + -0.00394431438420023671 # B[790, [16, 4, 2, 4], [31, 5, 5, 6]] + -0.00362914461095884553 # B[791, [16, 4, 2, 4], [32, 5, 5, 8]] + 0.000172019923347470349 # B[792, [16, 4, 2, 4], [33, 6, 0, 6]] + -0.000316455135754767445 # B[793, [16, 4, 2, 4], [34, 6, 1, 7]] + 0.00107098215861984453 # B[794, [16, 4, 2, 4], [35, 6, 2, 6]] + -0.000907131668137324478 # B[795, [16, 4, 2, 4], [36, 6, 2, 8]] + -0.000367695081353409058 # B[796, [16, 4, 2, 4], [37, 6, 3, 7]] + 0.00181370580350630889 # B[797, [16, 4, 2, 4], [38, 6, 4, 6]] + 0.000820930060826967692 # B[798, [16, 4, 2, 4], [39, 6, 4, 8]] + -0.00466238776474962348 # B[799, [16, 4, 2, 4], [40, 6, 5, 7]] + -0.0024305728850557008 # B[800, [16, 4, 2, 4], [41, 6, 6, 6]] + -0.00165013696151081928 # B[801, [16, 4, 2, 4], [42, 6, 6, 8]] + 0.000760058338755045804 # B[802, [16, 4, 2, 4], [43, 7, 0, 7]] + -0.00203289214112462729 # B[803, [16, 4, 2, 4], [44, 7, 1, 8]] + -0.00103057221789182719 # B[804, [16, 4, 2, 4], [45, 7, 2, 7]] + 0.00188720556649034019 # B[805, [16, 4, 2, 4], [46, 7, 3, 8]] + -0.000348979964538542048 # B[806, [16, 4, 2, 4], [47, 7, 4, 7]] + -0.00595514004121479486 # B[807, [16, 4, 2, 4], [48, 7, 5, 8]] + -0.00122307692783891336 # B[808, [16, 4, 2, 4], [49, 7, 6, 7]] + -0.00161626528708522232 # B[809, [16, 4, 2, 4], [50, 7, 7, 8]] + 0.000683658453003721522 # B[810, [16, 4, 2, 4], [51, 8, 0, 8]] + 0.000169503544911074264 # B[811, [16, 4, 2, 4], [52, 8, 2, 8]] + 0.00163132840171071117 # B[812, [16, 4, 2, 4], [53, 8, 4, 8]] + -0.000633742642666999118 # B[813, [16, 4, 2, 4], [54, 8, 6, 8]] + -0.000861029784191980584 # B[814, [16, 4, 2, 4], [55, 8, 8, 8]] + 0.0101724317893582689 # B[815, [17, 4, 2, 6], [17, 4, 2, 6]] + 0.00963074903115390332 # B[816, [17, 4, 2, 6], [18, 4, 3, 5]] + 0.00792776812488414986 # B[817, [17, 4, 2, 6], [19, 4, 3, 7]] + 0.00129789596639547263 # B[818, [17, 4, 2, 6], [20, 4, 4, 4]] + 0.0025280260724625768 # B[819, [17, 4, 2, 6], [21, 4, 4, 6]] + -0.00130604081814601758 # B[820, [17, 4, 2, 6], [22, 4, 4, 8]] + 0.00061656245411057832 # B[821, [17, 4, 2, 6], [23, 5, 0, 5]] + 0.00256026791937838134 # B[822, [17, 4, 2, 6], [24, 5, 1, 6]] + 0.00833728674660196879 # B[823, [17, 4, 2, 6], [25, 5, 2, 5]] + 0.00819332084025456604 # B[824, [17, 4, 2, 6], [26, 5, 2, 7]] + 0.00199258058679730159 # B[825, [17, 4, 2, 6], [27, 5, 3, 6]] + -0.00235687406293394464 # B[826, [17, 4, 2, 6], [28, 5, 3, 8]] + 0.00172306590551023903 # B[827, [17, 4, 2, 6], [29, 5, 4, 5]] + 0.00273320921325834404 # B[828, [17, 4, 2, 6], [30, 5, 4, 7]] + 0.00124490813870011289 # B[829, [17, 4, 2, 6], [31, 5, 5, 6]] + -0.00239829497882970916 # B[830, [17, 4, 2, 6], [32, 5, 5, 8]] + 0.000403489881901454572 # B[831, [17, 4, 2, 6], [33, 6, 0, 6]] + 0.0115977289566935714 # B[832, [17, 4, 2, 6], [34, 6, 1, 7]] + 0.00631330244272786285 # B[833, [17, 4, 2, 6], [35, 6, 2, 6]] + 0.00745951676374975552 # B[834, [17, 4, 2, 6], [36, 6, 2, 8]] + 0.00129555462014044158 # B[835, [17, 4, 2, 6], [37, 6, 3, 7]] + 0.0031708889242759988 # B[836, [17, 4, 2, 6], [38, 6, 4, 6]] + 0.00314059501950873093 # B[837, [17, 4, 2, 6], [39, 6, 4, 8]] + -0.00157311519106628078 # B[838, [17, 4, 2, 6], [40, 6, 5, 7]] + -0.000535633835711041804 # B[839, [17, 4, 2, 6], [41, 6, 6, 6]] + -0.00106218347026977491 # B[840, [17, 4, 2, 6], [42, 6, 6, 8]] + 0.00171130648037900839 # B[841, [17, 4, 2, 6], [43, 7, 0, 7]] + 0.00318381348777509654 # B[842, [17, 4, 2, 6], [44, 7, 1, 8]] + 0.00121186975917000981 # B[843, [17, 4, 2, 6], [45, 7, 2, 7]] + -0.00505226933268299559 # B[844, [17, 4, 2, 6], [46, 7, 3, 8]] + 0.000505489038324865442 # B[845, [17, 4, 2, 6], [47, 7, 4, 7]] + -0.00260650572816220009 # B[846, [17, 4, 2, 6], [48, 7, 5, 8]] + -0.00458388666826989831 # B[847, [17, 4, 2, 6], [49, 7, 6, 7]] + -0.0030323259618317824 # B[848, [17, 4, 2, 6], [50, 7, 7, 8]] + 0.000919810997489799165 # B[849, [17, 4, 2, 6], [51, 8, 0, 8]] + 0.00153843620323466154 # B[850, [17, 4, 2, 6], [52, 8, 2, 8]] + 0.00177452104337356975 # B[851, [17, 4, 2, 6], [53, 8, 4, 8]] + -0.00133363365246129796 # B[852, [17, 4, 2, 6], [54, 8, 6, 8]] + 0.000497168699576265929 # B[853, [17, 4, 2, 6], [55, 8, 8, 8]] + 0.00916493227652732945 # B[854, [18, 4, 3, 5], [18, 4, 3, 5]] + 0.00662893191875722591 # B[855, [18, 4, 3, 5], [19, 4, 3, 7]] + 0.00102473567933248147 # B[856, [18, 4, 3, 5], [20, 4, 4, 4]] + 0.000661293664462594619 # B[857, [18, 4, 3, 5], [21, 4, 4, 6]] + 0.00302383517430961438 # B[858, [18, 4, 3, 5], [22, 4, 4, 8]] + 0.00182134236384280147 # B[859, [18, 4, 3, 5], [23, 5, 0, 5]] + 0.00481003527044247467 # B[860, [18, 4, 3, 5], [24, 5, 1, 6]] + 0.00472221587821478311 # B[861, [18, 4, 3, 5], [25, 5, 2, 5]] + 0.00204855894682247092 # B[862, [18, 4, 3, 5], [26, 5, 2, 7]] + 0.00108437129165206425 # B[863, [18, 4, 3, 5], [27, 5, 3, 6]] + 0.000188071259560827417 # B[864, [18, 4, 3, 5], [28, 5, 3, 8]] + 0.000402244806083140727 # B[865, [18, 4, 3, 5], [29, 5, 4, 5]] + 0.00350511561101824257 # B[866, [18, 4, 3, 5], [30, 5, 4, 7]] + -0.00196731170271619883 # B[867, [18, 4, 3, 5], [31, 5, 5, 6]] + -0.000854471064769226317 # B[868, [18, 4, 3, 5], [32, 5, 5, 8]] + 0.00163753590726098495 # B[869, [18, 4, 3, 5], [33, 6, 0, 6]] + 0.00678767470498069323 # B[870, [18, 4, 3, 5], [34, 6, 1, 7]] + 0.00671898362129526739 # B[871, [18, 4, 3, 5], [35, 6, 2, 6]] + 0.00504150139406711259 # B[872, [18, 4, 3, 5], [36, 6, 2, 8]] + -0.00150058947564556469 # B[873, [18, 4, 3, 5], [37, 6, 3, 7]] + 0.00126561580055304518 # B[874, [18, 4, 3, 5], [38, 6, 4, 6]] + -0.000556565865268397481 # B[875, [18, 4, 3, 5], [39, 6, 4, 8]] + -0.00527488386402661519 # B[876, [18, 4, 3, 5], [40, 6, 5, 7]] + -0.00214157468754809163 # B[877, [18, 4, 3, 5], [41, 6, 6, 6]] + -0.0020431148178264337 # B[878, [18, 4, 3, 5], [42, 6, 6, 8]] + 0.00142704628054338232 # B[879, [18, 4, 3, 5], [43, 7, 0, 7]] + 0.00368882624306161085 # B[880, [18, 4, 3, 5], [44, 7, 1, 8]] + -0.000742447358153045661 # B[881, [18, 4, 3, 5], [45, 7, 2, 7]] + -0.00158678830901623838 # B[882, [18, 4, 3, 5], [46, 7, 3, 8]] + -0.00107876302160130055 # B[883, [18, 4, 3, 5], [47, 7, 4, 7]] + -0.00701537311445033646 # B[884, [18, 4, 3, 5], [48, 7, 5, 8]] + -0.00184801443295596127 # B[885, [18, 4, 3, 5], [49, 7, 6, 7]] + -0.00127678697871524667 # B[886, [18, 4, 3, 5], [50, 7, 7, 8]] + 0.00105641109188138113 # B[887, [18, 4, 3, 5], [51, 8, 0, 8]] + 0.000718098622203026428 # B[888, [18, 4, 3, 5], [52, 8, 2, 8]] + 0.00219486004289275692 # B[889, [18, 4, 3, 5], [53, 8, 4, 8]] + -0.00158748993130468905 # B[890, [18, 4, 3, 5], [54, 8, 6, 8]] + -0.00105128398142791644 # B[891, [18, 4, 3, 5], [55, 8, 8, 8]] + -0.00705876763301777586 # B[892, [19, 4, 3, 7], [19, 4, 3, 7]] + 0.00377186011578763136 # B[893, [19, 4, 3, 7], [20, 4, 4, 4]] + 0.00351225097737749986 # B[894, [19, 4, 3, 7], [21, 4, 4, 6]] + -0.00323798036048509805 # B[895, [19, 4, 3, 7], [22, 4, 4, 8]] + 0.00126225430824061444 # B[896, [19, 4, 3, 7], [23, 5, 0, 5]] + -0.00132900767543010258 # B[897, [19, 4, 3, 7], [24, 5, 1, 6]] + 0.000212743875668733318 # B[898, [19, 4, 3, 7], [25, 5, 2, 5]] + -8.93559293989563963e-05 # B[899, [19, 4, 3, 7], [26, 5, 2, 7]] + 0.00401415269432878544 # B[900, [19, 4, 3, 7], [27, 5, 3, 6]] + -0.00422923196125859352 # B[901, [19, 4, 3, 7], [28, 5, 3, 8]] + 0.00252733635050122335 # B[902, [19, 4, 3, 7], [29, 5, 4, 5]] + -0.00020969110581340808 # B[903, [19, 4, 3, 7], [30, 5, 4, 7]] + -0.000969147769818896193 # B[904, [19, 4, 3, 7], [31, 5, 5, 6]] + -0.00249817386761041864 # B[905, [19, 4, 3, 7], [32, 5, 5, 8]] + 7.71120512828363247e-05 # B[906, [19, 4, 3, 7], [33, 6, 0, 6]] + 0.00560302176075209817 # B[907, [19, 4, 3, 7], [34, 6, 1, 7]] + 0.00342833731167378752 # B[908, [19, 4, 3, 7], [35, 6, 2, 6]] + 0.00116548365936076578 # B[909, [19, 4, 3, 7], [36, 6, 2, 8]] + 0.00499590856190199745 # B[910, [19, 4, 3, 7], [37, 6, 3, 7]] + 0.00391644837067879614 # B[911, [19, 4, 3, 7], [38, 6, 4, 6]] + 0.00116606811408420229 # B[912, [19, 4, 3, 7], [39, 6, 4, 8]] + -0.000563820914290556058 # B[913, [19, 4, 3, 7], [40, 6, 5, 7]] + -0.000251464925992161276 # B[914, [19, 4, 3, 7], [41, 6, 6, 6]] + -0.000718753250305587815 # B[915, [19, 4, 3, 7], [42, 6, 6, 8]] + 0.000453024387943248494 # B[916, [19, 4, 3, 7], [43, 7, 0, 7]] + -0.00146422451962339994 # B[917, [19, 4, 3, 7], [44, 7, 1, 8]] + 0.00271974781140060795 # B[918, [19, 4, 3, 7], [45, 7, 2, 7]] + 0.00151707017829591159 # B[919, [19, 4, 3, 7], [46, 7, 3, 8]] + 0.00202377896423465691 # B[920, [19, 4, 3, 7], [47, 7, 4, 7]] + -0.00131185948123999779 # B[921, [19, 4, 3, 7], [48, 7, 5, 8]] + 0.000239464941185672797 # B[922, [19, 4, 3, 7], [49, 7, 6, 7]] + -0.000667571478871501964 # B[923, [19, 4, 3, 7], [50, 7, 7, 8]] + 0.000666789360176615192 # B[924, [19, 4, 3, 7], [51, 8, 0, 8]] + 0.00179543252151156355 # B[925, [19, 4, 3, 7], [52, 8, 2, 8]] + 0.000954396542852647967 # B[926, [19, 4, 3, 7], [53, 8, 4, 8]] + 0.000593331439814590023 # B[927, [19, 4, 3, 7], [54, 8, 6, 8]] + -0.000292670120459602445 # B[928, [19, 4, 3, 7], [55, 8, 8, 8]] + -0.000303353861178074294 # B[929, [20, 4, 4, 4], [20, 4, 4, 4]] + -6.41585335468541906e-05 # B[930, [20, 4, 4, 4], [21, 4, 4, 6]] + 0.00145464895340288725 # B[931, [20, 4, 4, 4], [22, 4, 4, 8]] + 0.000557677559397141802 # B[932, [20, 4, 4, 4], [23, 5, 0, 5]] + 0.00214733001664968188 # B[933, [20, 4, 4, 4], [24, 5, 1, 6]] + 0.000196804226194771757 # B[934, [20, 4, 4, 4], [25, 5, 2, 5]] + 0.00169621771662652795 # B[935, [20, 4, 4, 4], [26, 5, 2, 7]] + -0.00126951106424718924 # B[936, [20, 4, 4, 4], [27, 5, 3, 6]] + 0.00156201190059711802 # B[937, [20, 4, 4, 4], [28, 5, 3, 8]] + -0.000188505112089858498 # B[938, [20, 4, 4, 4], [29, 5, 4, 5]] + 0.00101485096974841295 # B[939, [20, 4, 4, 4], [30, 5, 4, 7]] + -0.000254023094278113288 # B[940, [20, 4, 4, 4], [31, 5, 5, 6]] + -0.000332430225508446864 # B[941, [20, 4, 4, 4], [32, 5, 5, 8]] + 0.000393172799404761797 # B[942, [20, 4, 4, 4], [33, 6, 0, 6]] + -0.000945851456653874594 # B[943, [20, 4, 4, 4], [34, 6, 1, 7]] + 0.000937118523093692299 # B[944, [20, 4, 4, 4], [35, 6, 2, 6]] + 0.00108463610451345858 # B[945, [20, 4, 4, 4], [36, 6, 2, 8]] + -0.00167878968186336089 # B[946, [20, 4, 4, 4], [37, 6, 3, 7]] + 0.000109649976457827647 # B[947, [20, 4, 4, 4], [38, 6, 4, 6]] + 0.000205908523746248934 # B[948, [20, 4, 4, 4], [39, 6, 4, 8]] + -0.000952641271225448949 # B[949, [20, 4, 4, 4], [40, 6, 5, 7]] + -0.000386842165161269298 # B[950, [20, 4, 4, 4], [41, 6, 6, 6]] + -0.000662992329463731739 # B[951, [20, 4, 4, 4], [42, 6, 6, 8]] + 0.000368522676488847178 # B[952, [20, 4, 4, 4], [43, 7, 0, 7]] + -0.000181924614212486402 # B[953, [20, 4, 4, 4], [44, 7, 1, 8]] + -0.00119374010493299761 # B[954, [20, 4, 4, 4], [45, 7, 2, 7]] + -0.000775398926021152179 # B[955, [20, 4, 4, 4], [46, 7, 3, 8]] + -0.000670782103704289923 # B[956, [20, 4, 4, 4], [47, 7, 4, 7]] + -0.00192682764111087456 # B[957, [20, 4, 4, 4], [48, 7, 5, 8]] + -0.000648663865567958298 # B[958, [20, 4, 4, 4], [49, 7, 6, 7]] + -0.000387954189232417312 # B[959, [20, 4, 4, 4], [50, 7, 7, 8]] + 0.000302370648048068055 # B[960, [20, 4, 4, 4], [51, 8, 0, 8]] + -0.00085980088667597307 # B[961, [20, 4, 4, 4], [52, 8, 2, 8]] + 0.000568399123124077588 # B[962, [20, 4, 4, 4], [53, 8, 4, 8]] + -0.000482151590861096269 # B[963, [20, 4, 4, 4], [54, 8, 6, 8]] + -0.000405828455879983507 # B[964, [20, 4, 4, 4], [55, 8, 8, 8]] + 0.00165997230068267755 # B[965, [21, 4, 4, 6], [21, 4, 4, 6]] + 0.000963896255597472551 # B[966, [21, 4, 4, 6], [22, 4, 4, 8]] + 0.0002094521100325826 # B[967, [21, 4, 4, 6], [23, 5, 0, 5]] + 0.000534879644705995444 # B[968, [21, 4, 4, 6], [24, 5, 1, 6]] + 0.00292236533791157905 # B[969, [21, 4, 4, 6], [25, 5, 2, 5]] + 0.00151524368635043427 # B[970, [21, 4, 4, 6], [26, 5, 2, 7]] + -0.00101689007388491501 # B[971, [21, 4, 4, 6], [27, 5, 3, 6]] + 0.000738459806183821427 # B[972, [21, 4, 4, 6], [28, 5, 3, 8]] + 0.00148643764242684627 # B[973, [21, 4, 4, 6], [29, 5, 4, 5]] + 0.0011556877894129472 # B[974, [21, 4, 4, 6], [30, 5, 4, 7]] + -0.000208381440186615127 # B[975, [21, 4, 4, 6], [31, 5, 5, 6]] + -0.00143743030752817389 # B[976, [21, 4, 4, 6], [32, 5, 5, 8]] + -0.00016600302639456152 # B[977, [21, 4, 4, 6], [33, 6, 0, 6]] + 0.00172160125073629253 # B[978, [21, 4, 4, 6], [34, 6, 1, 7]] + 0.00344812165058533751 # B[979, [21, 4, 4, 6], [35, 6, 2, 6]] + 0.000544104512334869089 # B[980, [21, 4, 4, 6], [36, 6, 2, 8]] + -0.00182558144376257503 # B[981, [21, 4, 4, 6], [37, 6, 3, 7]] + 0.00101065848983370246 # B[982, [21, 4, 4, 6], [38, 6, 4, 6]] + 0.00103400096073465869 # B[983, [21, 4, 4, 6], [39, 6, 4, 8]] + -0.000235944095127582111 # B[984, [21, 4, 4, 6], [40, 6, 5, 7]] + 0.000154580830205655606 # B[985, [21, 4, 4, 6], [41, 6, 6, 6]] + -0.000488680460493023505 # B[986, [21, 4, 4, 6], [42, 6, 6, 8]] + 3.83739714257189113e-05 # B[987, [21, 4, 4, 6], [43, 7, 0, 7]] + -0.000275037336268196993 # B[988, [21, 4, 4, 6], [44, 7, 1, 8]] + 0.0017878021157122859 # B[989, [21, 4, 4, 6], [45, 7, 2, 7]] + -0.00110857713686632331 # B[990, [21, 4, 4, 6], [46, 7, 3, 8]] + -0.000126074852562767237 # B[991, [21, 4, 4, 6], [47, 7, 4, 7]] + -0.00125862858469075189 # B[992, [21, 4, 4, 6], [48, 7, 5, 8]] + -0.000277638160776805254 # B[993, [21, 4, 4, 6], [49, 7, 6, 7]] + 0.000163335859971639602 # B[994, [21, 4, 4, 6], [50, 7, 7, 8]] + 0.000151747507838979889 # B[995, [21, 4, 4, 6], [51, 8, 0, 8]] + 0.00156180455186682998 # B[996, [21, 4, 4, 6], [52, 8, 2, 8]] + 0.00112614353705531994 # B[997, [21, 4, 4, 6], [53, 8, 4, 8]] + -0.000376140365477903652 # B[998, [21, 4, 4, 6], [54, 8, 6, 8]] + -0.000378786757414536351 # B[999, [21, 4, 4, 6], [55, 8, 8, 8]] + -0.00186381195965971969 # B[1000, [22, 4, 4, 8], [22, 4, 4, 8]] + 0.000334060235611270684 # B[1001, [22, 4, 4, 8], [23, 5, 0, 5]] + -0.000182139490643212255 # B[1002, [22, 4, 4, 8], [24, 5, 1, 6]] + -0.000866414678376911532 # B[1003, [22, 4, 4, 8], [25, 5, 2, 5]] + -0.000713836573909394211 # B[1004, [22, 4, 4, 8], [26, 5, 2, 7]] + 0.00340359387460056721 # B[1005, [22, 4, 4, 8], [27, 5, 3, 6]] + -0.0025631762232975969 # B[1006, [22, 4, 4, 8], [28, 5, 3, 8]] + 0.00154837338005092001 # B[1007, [22, 4, 4, 8], [29, 5, 4, 5]] + -0.000713785025005329171 # B[1008, [22, 4, 4, 8], [30, 5, 4, 7]] + -6.17852167664190155e-06 # B[1009, [22, 4, 4, 8], [31, 5, 5, 6]] + -0.000925788250245492385 # B[1010, [22, 4, 4, 8], [32, 5, 5, 8]] + -0.000220618203180443506 # B[1011, [22, 4, 4, 8], [33, 6, 0, 6]] + 0.00158760304062654546 # B[1012, [22, 4, 4, 8], [34, 6, 1, 7]] + -0.00201296543384867077 # B[1013, [22, 4, 4, 8], [35, 6, 2, 6]] + -0.000153111573438037551 # B[1014, [22, 4, 4, 8], [36, 6, 2, 8]] + 0.001936342943994784 # B[1015, [22, 4, 4, 8], [37, 6, 3, 7]] + 0.0014724303902098404 # B[1016, [22, 4, 4, 8], [38, 6, 4, 6]] + 0.000412977919829218137 # B[1017, [22, 4, 4, 8], [39, 6, 4, 8]] + 0.000243129124011996767 # B[1018, [22, 4, 4, 8], [40, 6, 5, 7]] + 0.000433542078585167322 # B[1019, [22, 4, 4, 8], [41, 6, 6, 6]] + 5.87712210821707964e-05 # B[1020, [22, 4, 4, 8], [42, 6, 6, 8]] + -2.13873587015245281e-05 # B[1021, [22, 4, 4, 8], [43, 7, 0, 7]] + -0.00121671500578664389 # B[1022, [22, 4, 4, 8], [44, 7, 1, 8]] + 0.00185443425860575776 # B[1023, [22, 4, 4, 8], [45, 7, 2, 7]] + 0.00153976874095648406 # B[1024, [22, 4, 4, 8], [46, 7, 3, 8]] + 0.00100585852984078766 # B[1025, [22, 4, 4, 8], [47, 7, 4, 7]] + 0.000146502145157426621 # B[1026, [22, 4, 4, 8], [48, 7, 5, 8]] + 0.00026572798098887726 # B[1027, [22, 4, 4, 8], [49, 7, 6, 7]] + 0.000239744529446223043 # B[1028, [22, 4, 4, 8], [50, 7, 7, 8]] + 3.13331575558552233e-05 # B[1029, [22, 4, 4, 8], [51, 8, 0, 8]] + 0.0005761629631739415 # B[1030, [22, 4, 4, 8], [52, 8, 2, 8]] + 0.00020451472183747807 # B[1031, [22, 4, 4, 8], [53, 8, 4, 8]] + 0.000761501707699011737 # B[1032, [22, 4, 4, 8], [54, 8, 6, 8]] + 4.7608269104475881e-05 # B[1033, [22, 4, 4, 8], [55, 8, 8, 8]] + 0.00010288893231941848 # B[1034, [23, 5, 0, 5], [23, 5, 0, 5]] + -0.000598160679614365143 # B[1035, [23, 5, 0, 5], [24, 5, 1, 6]] + -0.000125600887517359969 # B[1036, [23, 5, 0, 5], [25, 5, 2, 5]] + -0.000541602347577959872 # B[1037, [23, 5, 0, 5], [26, 5, 2, 7]] + 0.000138742295315047448 # B[1038, [23, 5, 0, 5], [27, 5, 3, 6]] + 0.000320496112291311641 # B[1039, [23, 5, 0, 5], [28, 5, 3, 8]] + 9.77076363189860464e-05 # B[1040, [23, 5, 0, 5], [29, 5, 4, 5]] + -0.00018519393057754574 # B[1041, [23, 5, 0, 5], [30, 5, 4, 7]] + -0.000314308790209320843 # B[1042, [23, 5, 0, 5], [31, 5, 5, 6]] + -2.03507196530547385e-05 # B[1043, [23, 5, 0, 5], [32, 5, 5, 8]] + -8.76692912155085935e-08 # B[1044, [23, 5, 0, 5], [33, 6, 0, 6]] + -0.000208914241663854874 # B[1045, [23, 5, 0, 5], [34, 6, 1, 7]] + 0.000289191305925793653 # B[1046, [23, 5, 0, 5], [35, 6, 2, 6]] + 0.000292827060287376498 # B[1047, [23, 5, 0, 5], [36, 6, 2, 8]] + -0.000195999965143696386 # B[1048, [23, 5, 0, 5], [37, 6, 3, 7]] + 0.000122837407081860615 # B[1049, [23, 5, 0, 5], [38, 6, 4, 6]] + 0.000238061673948679331 # B[1050, [23, 5, 0, 5], [39, 6, 4, 8]] + 6.23458911314621333e-06 # B[1051, [23, 5, 0, 5], [40, 6, 5, 7]] + 0.000153645644536796327 # B[1052, [23, 5, 0, 5], [41, 6, 6, 6]] + 0.000208144485879115104 # B[1053, [23, 5, 0, 5], [42, 6, 6, 8]] + 0.000107382317423423967 # B[1054, [23, 5, 0, 5], [43, 7, 0, 7]] + -3.16437877474207152e-05 # B[1055, [23, 5, 0, 5], [44, 7, 1, 8]] + 5.2567890411161361e-05 # B[1056, [23, 5, 0, 5], [45, 7, 2, 7]] + -0.000407365287815795313 # B[1057, [23, 5, 0, 5], [46, 7, 3, 8]] + -0.000277007442936893014 # B[1058, [23, 5, 0, 5], [47, 7, 4, 7]] + -0.000163960409271388802 # B[1059, [23, 5, 0, 5], [48, 7, 5, 8]] + -0.00018222236229294142 # B[1060, [23, 5, 0, 5], [49, 7, 6, 7]] + -8.93725149996096868e-05 # B[1061, [23, 5, 0, 5], [50, 7, 7, 8]] + -4.59835267753172516e-05 # B[1062, [23, 5, 0, 5], [51, 8, 0, 8]] + -3.00980967951527262e-05 # B[1063, [23, 5, 0, 5], [52, 8, 2, 8]] + -0.00011786089545340328 # B[1064, [23, 5, 0, 5], [53, 8, 4, 8]] + 6.24840877215676604e-05 # B[1065, [23, 5, 0, 5], [54, 8, 6, 8]] + 0.000151333518371397913 # B[1066, [23, 5, 0, 5], [55, 8, 8, 8]] + -0.00373509601310103353 # B[1067, [24, 5, 1, 6], [24, 5, 1, 6]] + 0.00250350668234289742 # B[1068, [24, 5, 1, 6], [25, 5, 2, 5]] + -0.00141763987470412255 # B[1069, [24, 5, 1, 6], [26, 5, 2, 7]] + -0.000458490741576836162 # B[1070, [24, 5, 1, 6], [27, 5, 3, 6]] + 0.000169432811229417585 # B[1071, [24, 5, 1, 6], [28, 5, 3, 8]] + -0.000531768848310092699 # B[1072, [24, 5, 1, 6], [29, 5, 4, 5]] + 0.0019269207337581605 # B[1073, [24, 5, 1, 6], [30, 5, 4, 7]] + 0.000623468915929115824 # B[1074, [24, 5, 1, 6], [31, 5, 5, 6]] + 0.000262459747020924762 # B[1075, [24, 5, 1, 6], [32, 5, 5, 8]] + 0.000319464830252011445 # B[1076, [24, 5, 1, 6], [33, 6, 0, 6]] + 0.00250974732963905444 # B[1077, [24, 5, 1, 6], [34, 6, 1, 7]] + 0.00423653007687384807 # B[1078, [24, 5, 1, 6], [35, 6, 2, 6]] + 0.00144771358428595707 # B[1079, [24, 5, 1, 6], [36, 6, 2, 8]] + 0.00255496505633429419 # B[1080, [24, 5, 1, 6], [37, 6, 3, 7]] + -0.000923899857380450218 # B[1081, [24, 5, 1, 6], [38, 6, 4, 6]] + -0.000308666389289608337 # B[1082, [24, 5, 1, 6], [39, 6, 4, 8]] + 0.00222537659577300671 # B[1083, [24, 5, 1, 6], [40, 6, 5, 7]] + -0.00107541311587263343 # B[1084, [24, 5, 1, 6], [41, 6, 6, 6]] + -0.00278767944085371068 # B[1085, [24, 5, 1, 6], [42, 6, 6, 8]] + -0.000867530969177243705 # B[1086, [24, 5, 1, 6], [43, 7, 0, 7]] + 0.00357297895621819196 # B[1087, [24, 5, 1, 6], [44, 7, 1, 8]] + 0.00383976572090019216 # B[1088, [24, 5, 1, 6], [45, 7, 2, 7]] + -0.000580234942856992786 # B[1089, [24, 5, 1, 6], [46, 7, 3, 8]] + 0.00102888910081111798 # B[1090, [24, 5, 1, 6], [47, 7, 4, 7]] + 0.00132107614311613355 # B[1091, [24, 5, 1, 6], [48, 7, 5, 8]] + 0.00101848252621374036 # B[1092, [24, 5, 1, 6], [49, 7, 6, 7]] + 0.00160018234143227862 # B[1093, [24, 5, 1, 6], [50, 7, 7, 8]] + -5.52824024903572631e-05 # B[1094, [24, 5, 1, 6], [51, 8, 0, 8]] + 4.59186780197786033e-05 # B[1095, [24, 5, 1, 6], [52, 8, 2, 8]] + -0.000153436254581188554 # B[1096, [24, 5, 1, 6], [53, 8, 4, 8]] + -0.000546750998621967597 # B[1097, [24, 5, 1, 6], [54, 8, 6, 8]] + 0.000595956738118895348 # B[1098, [24, 5, 1, 6], [55, 8, 8, 8]] + 0.0083807047595118693 # B[1099, [25, 5, 2, 5], [25, 5, 2, 5]] + -0.000170544318645505719 # B[1100, [25, 5, 2, 5], [26, 5, 2, 7]] + 0.00235544441902155004 # B[1101, [25, 5, 2, 5], [27, 5, 3, 6]] + -0.00340197827063909962 # B[1102, [25, 5, 2, 5], [28, 5, 3, 8]] + 0.00311335525578198104 # B[1103, [25, 5, 2, 5], [29, 5, 4, 5]] + 0.00185214714164834123 # B[1104, [25, 5, 2, 5], [30, 5, 4, 7]] + -0.00328905913600528992 # B[1105, [25, 5, 2, 5], [31, 5, 5, 6]] + -0.00141866010082636025 # B[1106, [25, 5, 2, 5], [32, 5, 5, 8]] + 0.000176317033907393006 # B[1107, [25, 5, 2, 5], [33, 6, 0, 6]] + 0.00648328973805229608 # B[1108, [25, 5, 2, 5], [34, 6, 1, 7]] + 4.8980528358618259e-05 # B[1109, [25, 5, 2, 5], [35, 6, 2, 6]] + -0.00616971046300731144 # B[1110, [25, 5, 2, 5], [36, 6, 2, 8]] + -0.00135942372726050205 # B[1111, [25, 5, 2, 5], [37, 6, 3, 7]] + 0.000572735024796908881 # B[1112, [25, 5, 2, 5], [38, 6, 4, 6]] + -0.00229752149848994405 # B[1113, [25, 5, 2, 5], [39, 6, 4, 8]] + 0.0003485310815041524 # B[1114, [25, 5, 2, 5], [40, 6, 5, 7]] + -0.0011437361439647427 # B[1115, [25, 5, 2, 5], [41, 6, 6, 6]] + -0.000604819873822432311 # B[1116, [25, 5, 2, 5], [42, 6, 6, 8]] + 9.06237770597643696e-05 # B[1117, [25, 5, 2, 5], [43, 7, 0, 7]] + -0.000382141545017884894 # B[1118, [25, 5, 2, 5], [44, 7, 1, 8]] + -0.000842464094047663554 # B[1119, [25, 5, 2, 5], [45, 7, 2, 7]] + 0.000461973830441065811 # B[1120, [25, 5, 2, 5], [46, 7, 3, 8]] + 2.86192620363814355e-06 # B[1121, [25, 5, 2, 5], [47, 7, 4, 7]] + -0.0023436531447123838 # B[1122, [25, 5, 2, 5], [48, 7, 5, 8]] + 0.00134025173860287308 # B[1123, [25, 5, 2, 5], [49, 7, 6, 7]] + -0.000520013981518205846 # B[1124, [25, 5, 2, 5], [50, 7, 7, 8]] + 0.000515782740310496285 # B[1125, [25, 5, 2, 5], [51, 8, 0, 8]] + 0.00421651313615256564 # B[1126, [25, 5, 2, 5], [52, 8, 2, 8]] + 0.000755327719218409519 # B[1127, [25, 5, 2, 5], [53, 8, 4, 8]] + 0.000182937308412391315 # B[1128, [25, 5, 2, 5], [54, 8, 6, 8]] + 8.10383680097163071e-05 # B[1129, [25, 5, 2, 5], [55, 8, 8, 8]] + 0.000177735296666065024 # B[1130, [26, 5, 2, 7], [26, 5, 2, 7]] + -0.000642334677407747565 # B[1131, [26, 5, 2, 7], [27, 5, 3, 6]] + 0.000205172894139061396 # B[1132, [26, 5, 2, 7], [28, 5, 3, 8]] + -0.000537004220752698019 # B[1133, [26, 5, 2, 7], [29, 5, 4, 5]] + 5.14115941491347442e-05 # B[1134, [26, 5, 2, 7], [30, 5, 4, 7]] + 0.000417673445165051005 # B[1135, [26, 5, 2, 7], [31, 5, 5, 6]] + 0.00158446769775330391 # B[1136, [26, 5, 2, 7], [32, 5, 5, 8]] + 0.00121383407410429606 # B[1137, [26, 5, 2, 7], [33, 6, 0, 6]] + -0.00111992976945914785 # B[1138, [26, 5, 2, 7], [34, 6, 1, 7]] + 0.00398972286341117699 # B[1139, [26, 5, 2, 7], [35, 6, 2, 6]] + 0.00454565411209783762 # B[1140, [26, 5, 2, 7], [36, 6, 2, 8]] + -0.00300928796618537761 # B[1141, [26, 5, 2, 7], [37, 6, 3, 7]] + -0.00280024702462813163 # B[1142, [26, 5, 2, 7], [38, 6, 4, 6]] + 0.00182097597359056305 # B[1143, [26, 5, 2, 7], [39, 6, 4, 8]] + 0.00247143387165752772 # B[1144, [26, 5, 2, 7], [40, 6, 5, 7]] + -0.00143698477566456435 # B[1145, [26, 5, 2, 7], [41, 6, 6, 6]] + -0.00105878554545993375 # B[1146, [26, 5, 2, 7], [42, 6, 6, 8]] + 0.000650619036842032747 # B[1147, [26, 5, 2, 7], [43, 7, 0, 7]] + 8.72947879012740853e-05 # B[1148, [26, 5, 2, 7], [44, 7, 1, 8]] + -0.0002084941102769855 # B[1149, [26, 5, 2, 7], [45, 7, 2, 7]] + -0.000924608969529588931 # B[1150, [26, 5, 2, 7], [46, 7, 3, 8]] + -0.000320719808114693777 # B[1151, [26, 5, 2, 7], [47, 7, 4, 7]] + 0.00241998856780361801 # B[1152, [26, 5, 2, 7], [48, 7, 5, 8]] + -0.00171923440812344827 # B[1153, [26, 5, 2, 7], [49, 7, 6, 7]] + -0.000301390241580377569 # B[1154, [26, 5, 2, 7], [50, 7, 7, 8]] + -6.37461557401481499e-05 # B[1155, [26, 5, 2, 7], [51, 8, 0, 8]] + 0.00161644303684405446 # B[1156, [26, 5, 2, 7], [52, 8, 2, 8]] + 0.00104379414920739667 # B[1157, [26, 5, 2, 7], [53, 8, 4, 8]] + -0.00119795702190159808 # B[1158, [26, 5, 2, 7], [54, 8, 6, 8]] + 0.000604059138156293803 # B[1159, [26, 5, 2, 7], [55, 8, 8, 8]] + 0.000513459633959805622 # B[1160, [27, 5, 3, 6], [27, 5, 3, 6]] + -0.000172334638360790993 # B[1161, [27, 5, 3, 6], [28, 5, 3, 8]] + 1.60719061511648345e-05 # B[1162, [27, 5, 3, 6], [29, 5, 4, 5]] + 0.00440279299288983371 # B[1163, [27, 5, 3, 6], [30, 5, 4, 7]] + 0.000549761981236742206 # B[1164, [27, 5, 3, 6], [31, 5, 5, 6]] + 0.000424619689378998542 # B[1165, [27, 5, 3, 6], [32, 5, 5, 8]] + 0.000247367934895610653 # B[1166, [27, 5, 3, 6], [33, 6, 0, 6]] + 0.00400569055534595944 # B[1167, [27, 5, 3, 6], [34, 6, 1, 7]] + 0.00274378194299987679 # B[1168, [27, 5, 3, 6], [35, 6, 2, 6]] + 0.00368141326251353665 # B[1169, [27, 5, 3, 6], [36, 6, 2, 8]] + 0.00160469169395054817 # B[1170, [27, 5, 3, 6], [37, 6, 3, 7]] + 0.000105807739550402985 # B[1171, [27, 5, 3, 6], [38, 6, 4, 6]] + -0.000682801438033796976 # B[1172, [27, 5, 3, 6], [39, 6, 4, 8]] + -0.00121964915110857504 # B[1173, [27, 5, 3, 6], [40, 6, 5, 7]] + -0.000817665263990522556 # B[1174, [27, 5, 3, 6], [41, 6, 6, 6]] + 0.000534593784435832137 # B[1175, [27, 5, 3, 6], [42, 6, 6, 8]] + 0.000116542343021167755 # B[1176, [27, 5, 3, 6], [43, 7, 0, 7]] + 0.00351267154418699948 # B[1177, [27, 5, 3, 6], [44, 7, 1, 8]] + -0.00189934642995405814 # B[1178, [27, 5, 3, 6], [45, 7, 2, 7]] + 0.000751906974843792597 # B[1179, [27, 5, 3, 6], [46, 7, 3, 8]] + -0.000446808189773967301 # B[1180, [27, 5, 3, 6], [47, 7, 4, 7]] + -0.00324699511848197502 # B[1181, [27, 5, 3, 6], [48, 7, 5, 8]] + 2.53540837371335481e-05 # B[1182, [27, 5, 3, 6], [49, 7, 6, 7]] + 7.5273388360289073e-07 # B[1183, [27, 5, 3, 6], [50, 7, 7, 8]] + 0.00023346363571073725 # B[1184, [27, 5, 3, 6], [51, 8, 0, 8]] + 0.000490008984593369619 # B[1185, [27, 5, 3, 6], [52, 8, 2, 8]] + 0.000205260233742234413 # B[1186, [27, 5, 3, 6], [53, 8, 4, 8]] + -7.84984665939646165e-05 # B[1187, [27, 5, 3, 6], [54, 8, 6, 8]] + -0.000299454037036409743 # B[1188, [27, 5, 3, 6], [55, 8, 8, 8]] + -0.00411961786705090406 # B[1189, [28, 5, 3, 8], [28, 5, 3, 8]] + 0.00256764268592788759 # B[1190, [28, 5, 3, 8], [29, 5, 4, 5]] + -0.000267820435572239945 # B[1191, [28, 5, 3, 8], [30, 5, 4, 7]] + 0.000545048575291992229 # B[1192, [28, 5, 3, 8], [31, 5, 5, 6]] + -0.000141236037433873154 # B[1193, [28, 5, 3, 8], [32, 5, 5, 8]] + -8.17647193563642016e-05 # B[1194, [28, 5, 3, 8], [33, 6, 0, 6]] + 0.00184594470809960887 # B[1195, [28, 5, 3, 8], [34, 6, 1, 7]] + 0.000715653691449843685 # B[1196, [28, 5, 3, 8], [35, 6, 2, 6]] + -0.000371782729873919304 # B[1197, [28, 5, 3, 8], [36, 6, 2, 8]] + 0.00184451560473704312 # B[1198, [28, 5, 3, 8], [37, 6, 3, 7]] + 0.00298992898894900189 # B[1199, [28, 5, 3, 8], [38, 6, 4, 6]] + 0.00087474408278464047 # B[1200, [28, 5, 3, 8], [39, 6, 4, 8]] + 0.00115889056554823421 # B[1201, [28, 5, 3, 8], [40, 6, 5, 7]] + -0.000209440071593354482 # B[1202, [28, 5, 3, 8], [41, 6, 6, 6]] + 0.000707847416081031772 # B[1203, [28, 5, 3, 8], [42, 6, 6, 8]] + 0.00025922895119332573 # B[1204, [28, 5, 3, 8], [43, 7, 0, 7]] + -0.00210744601505012327 # B[1205, [28, 5, 3, 8], [44, 7, 1, 8]] + -0.00187401632149015486 # B[1206, [28, 5, 3, 8], [45, 7, 2, 7]] + 0.000616682247583759391 # B[1207, [28, 5, 3, 8], [46, 7, 3, 8]] + 0.00142526179781785924 # B[1208, [28, 5, 3, 8], [47, 7, 4, 7]] + -9.1619163886703936e-06 # B[1209, [28, 5, 3, 8], [48, 7, 5, 8]] + -0.000300978843055903222 # B[1210, [28, 5, 3, 8], [49, 7, 6, 7]] + -0.000124034381208077554 # B[1211, [28, 5, 3, 8], [50, 7, 7, 8]] + 0.000249158311162858692 # B[1212, [28, 5, 3, 8], [51, 8, 0, 8]] + -0.000970252220622513538 # B[1213, [28, 5, 3, 8], [52, 8, 2, 8]] + 0.000840312328335843066 # B[1214, [28, 5, 3, 8], [53, 8, 4, 8]] + 0.000145361901756495965 # B[1215, [28, 5, 3, 8], [54, 8, 6, 8]] + 0.00013163551986085896 # B[1216, [28, 5, 3, 8], [55, 8, 8, 8]] + 0.00265810885844912576 # B[1217, [29, 5, 4, 5], [29, 5, 4, 5]] + 0.00191793603428468823 # B[1218, [29, 5, 4, 5], [30, 5, 4, 7]] + 0.000446118694394436605 # B[1219, [29, 5, 4, 5], [31, 5, 5, 6]] + -9.59445098255573559e-05 # B[1220, [29, 5, 4, 5], [32, 5, 5, 8]] + 0.000369255428727587043 # B[1221, [29, 5, 4, 5], [33, 6, 0, 6]] + -0.000553149628059141762 # B[1222, [29, 5, 4, 5], [34, 6, 1, 7]] + 0.00315275275750991242 # B[1223, [29, 5, 4, 5], [35, 6, 2, 6]] + 0.00138540352181828336 # B[1224, [29, 5, 4, 5], [36, 6, 2, 8]] + 0.000776256233303879162 # B[1225, [29, 5, 4, 5], [37, 6, 3, 7]] + 0.000594477884906325672 # B[1226, [29, 5, 4, 5], [38, 6, 4, 6]] + 0.000757712543509288586 # B[1227, [29, 5, 4, 5], [39, 6, 4, 8]] + -0.000917903532807641184 # B[1228, [29, 5, 4, 5], [40, 6, 5, 7]] + -0.000915313398456763742 # B[1229, [29, 5, 4, 5], [41, 6, 6, 6]] + -0.00116732293566375843 # B[1230, [29, 5, 4, 5], [42, 6, 6, 8]] + 0.000172432189541951719 # B[1231, [29, 5, 4, 5], [43, 7, 0, 7]] + 0.000845370011774060912 # B[1232, [29, 5, 4, 5], [44, 7, 1, 8]] + 0.00178029205661471915 # B[1233, [29, 5, 4, 5], [45, 7, 2, 7]] + 0.00129739636685697463 # B[1234, [29, 5, 4, 5], [46, 7, 3, 8]] + 0.000282865369400489564 # B[1235, [29, 5, 4, 5], [47, 7, 4, 7]] + -0.00178988233479955398 # B[1236, [29, 5, 4, 5], [48, 7, 5, 8]] + 0.00023603474784275949 # B[1237, [29, 5, 4, 5], [49, 7, 6, 7]] + -0.000461436431325358207 # B[1238, [29, 5, 4, 5], [50, 7, 7, 8]] + 0.000234131705926524103 # B[1239, [29, 5, 4, 5], [51, 8, 0, 8]] + 0.00216254821351878363 # B[1240, [29, 5, 4, 5], [52, 8, 2, 8]] + 0.000831658742681578439 # B[1241, [29, 5, 4, 5], [53, 8, 4, 8]] + -0.00046318901257626742 # B[1242, [29, 5, 4, 5], [54, 8, 6, 8]] + -0.000607580535321294163 # B[1243, [29, 5, 4, 5], [55, 8, 8, 8]] + 0.00158347719827001653 # B[1244, [30, 5, 4, 7], [30, 5, 4, 7]] + 0.00120733638068271261 # B[1245, [30, 5, 4, 7], [31, 5, 5, 6]] + -0.000191610125195333311 # B[1246, [30, 5, 4, 7], [32, 5, 5, 8]] + -0.000363280761575070915 # B[1247, [30, 5, 4, 7], [33, 6, 0, 6]] + 0.0015080393447339897 # B[1248, [30, 5, 4, 7], [34, 6, 1, 7]] + 0.00144737958774105498 # B[1249, [30, 5, 4, 7], [35, 6, 2, 6]] + -0.000191256340607337365 # B[1250, [30, 5, 4, 7], [36, 6, 2, 8]] + 0.00324542123326504103 # B[1251, [30, 5, 4, 7], [37, 6, 3, 7]] + 0.00135369467391198949 # B[1252, [30, 5, 4, 7], [38, 6, 4, 6]] + 0.00077393986417062131 # B[1253, [30, 5, 4, 7], [39, 6, 4, 8]] + 0.00187057819081324836 # B[1254, [30, 5, 4, 7], [40, 6, 5, 7]] + 4.06728949024891956e-05 # B[1255, [30, 5, 4, 7], [41, 6, 6, 6]] + -0.000100060243024913467 # B[1256, [30, 5, 4, 7], [42, 6, 6, 8]] + -0.000170624797097965186 # B[1257, [30, 5, 4, 7], [43, 7, 0, 7]] + -0.00157200294852092963 # B[1258, [30, 5, 4, 7], [44, 7, 1, 8]] + -5.099465391029262e-05 # B[1259, [30, 5, 4, 7], [45, 7, 2, 7]] + 0.00166973065524506255 # B[1260, [30, 5, 4, 7], [46, 7, 3, 8]] + 0.000976468235486894175 # B[1261, [30, 5, 4, 7], [47, 7, 4, 7]] + -0.000570830124590235299 # B[1262, [30, 5, 4, 7], [48, 7, 5, 8]] + 0.000667250794893839427 # B[1263, [30, 5, 4, 7], [49, 7, 6, 7]] + -0.000273376565753529832 # B[1264, [30, 5, 4, 7], [50, 7, 7, 8]] + 0.000206233716860107844 # B[1265, [30, 5, 4, 7], [51, 8, 0, 8]] + 0.00260342927157033218 # B[1266, [30, 5, 4, 7], [52, 8, 2, 8]] + 0.000943954042545826558 # B[1267, [30, 5, 4, 7], [53, 8, 4, 8]] + -0.00022781927635321525 # B[1268, [30, 5, 4, 7], [54, 8, 6, 8]] + -0.000448456045604168733 # B[1269, [30, 5, 4, 7], [55, 8, 8, 8]] + 0.00102985782764508475 # B[1270, [31, 5, 5, 6], [31, 5, 5, 6]] + -8.89908688742153606e-05 # B[1271, [31, 5, 5, 6], [32, 5, 5, 8]] + -0.000162481274467801695 # B[1272, [31, 5, 5, 6], [33, 6, 0, 6]] + 0.00263772603538907271 # B[1273, [31, 5, 5, 6], [34, 6, 1, 7]] + -0.00223528099165903275 # B[1274, [31, 5, 5, 6], [35, 6, 2, 6]] + 0.000441657599119526373 # B[1275, [31, 5, 5, 6], [36, 6, 2, 8]] + 0.00165514785004864176 # B[1276, [31, 5, 5, 6], [37, 6, 3, 7]] + 0.000898928585103351413 # B[1277, [31, 5, 5, 6], [38, 6, 4, 6]] + -0.00026071204606309753 # B[1278, [31, 5, 5, 6], [39, 6, 4, 8]] + -0.000251612913047311385 # B[1279, [31, 5, 5, 6], [40, 6, 5, 7]] + -0.00022773870089292346 # B[1280, [31, 5, 5, 6], [41, 6, 6, 6]] + -0.000449951686975022525 # B[1281, [31, 5, 5, 6], [42, 6, 6, 8]] + -0.000252400784021909741 # B[1282, [31, 5, 5, 6], [43, 7, 0, 7]] + 0.000574433272355396977 # B[1283, [31, 5, 5, 6], [44, 7, 1, 8]] + -0.0014040949400035245 # B[1284, [31, 5, 5, 6], [45, 7, 2, 7]] + 0.00124516802775002586 # B[1285, [31, 5, 5, 6], [46, 7, 3, 8]] + 0.000875572292146320832 # B[1286, [31, 5, 5, 6], [47, 7, 4, 7]] + -0.000509730931921630048 # B[1287, [31, 5, 5, 6], [48, 7, 5, 8]] + 0.000422266146488117777 # B[1288, [31, 5, 5, 6], [49, 7, 6, 7]] + -0.000239146684560266956 # B[1289, [31, 5, 5, 6], [50, 7, 7, 8]] + 9.95899703990707486e-05 # B[1290, [31, 5, 5, 6], [51, 8, 0, 8]] + -0.0020784147827535588 # B[1291, [31, 5, 5, 6], [52, 8, 2, 8]] + 0.000735684723224858811 # B[1292, [31, 5, 5, 6], [53, 8, 4, 8]] + -0.000248804810033285279 # B[1293, [31, 5, 5, 6], [54, 8, 6, 8]] + -0.000598263607047986451 # B[1294, [31, 5, 5, 6], [55, 8, 8, 8]] + 0.000131065920905359436 # B[1295, [32, 5, 5, 8], [32, 5, 5, 8]] + 0.000100196796943449913 # B[1296, [32, 5, 5, 8], [33, 6, 0, 6]] + -0.00173991171955805834 # B[1297, [32, 5, 5, 8], [34, 6, 1, 7]] + -0.000490539010579770906 # B[1298, [32, 5, 5, 8], [35, 6, 2, 6]] + 0.000676191083650941674 # B[1299, [32, 5, 5, 8], [36, 6, 2, 8]] + 0.000446932761165407325 # B[1300, [32, 5, 5, 8], [37, 6, 3, 7]] + -0.000153107558622965576 # B[1301, [32, 5, 5, 8], [38, 6, 4, 6]] + 1.67752859932734574e-05 # B[1302, [32, 5, 5, 8], [39, 6, 4, 8]] + 0.000215146896189506113 # B[1303, [32, 5, 5, 8], [40, 6, 5, 7]] + -0.000188466441880926362 # B[1304, [32, 5, 5, 8], [41, 6, 6, 6]] + -4.80917708388720055e-06 # B[1305, [32, 5, 5, 8], [42, 6, 6, 8]] + -5.04429979448911547e-05 # B[1306, [32, 5, 5, 8], [43, 7, 0, 7]] + -0.000494944862407609067 # B[1307, [32, 5, 5, 8], [44, 7, 1, 8]] + -0.000424473825928651724 # B[1308, [32, 5, 5, 8], [45, 7, 2, 7]] + 0.000417544384337296959 # B[1309, [32, 5, 5, 8], [46, 7, 3, 8]] + 0.000431586591455488614 # B[1310, [32, 5, 5, 8], [47, 7, 4, 7]] + 0.000187341827588022357 # B[1311, [32, 5, 5, 8], [48, 7, 5, 8]] + -6.87669988055673864e-05 # B[1312, [32, 5, 5, 8], [49, 7, 6, 7]] + 0.000147867669408649482 # B[1313, [32, 5, 5, 8], [50, 7, 7, 8]] + -7.32201679551347517e-06 # B[1314, [32, 5, 5, 8], [51, 8, 0, 8]] + -0.000392519615947300787 # B[1315, [32, 5, 5, 8], [52, 8, 2, 8]] + 8.78465325612771269e-05 # B[1316, [32, 5, 5, 8], [53, 8, 4, 8]] + -6.3960070015590606e-05 # B[1317, [32, 5, 5, 8], [54, 8, 6, 8]] + -7.97839909379757101e-06 # B[1318, [32, 5, 5, 8], [55, 8, 8, 8]] + 3.95695067041609838e-05 # B[1319, [33, 6, 0, 6], [33, 6, 0, 6]] + -0.000611658005184461534 # B[1320, [33, 6, 0, 6], [34, 6, 1, 7]] + -0.000277914808470863806 # B[1321, [33, 6, 0, 6], [35, 6, 2, 6]] + 0.000987938388973043716 # B[1322, [33, 6, 0, 6], [36, 6, 2, 8]] + 0.000198558948919527745 # B[1323, [33, 6, 0, 6], [37, 6, 3, 7]] + 9.76274805398642809e-05 # B[1324, [33, 6, 0, 6], [38, 6, 4, 6]] + 9.92197766131464043e-05 # B[1325, [33, 6, 0, 6], [39, 6, 4, 8]] + -4.16996931875308896e-05 # B[1326, [33, 6, 0, 6], [40, 6, 5, 7]] + -5.3495059095630057e-05 # B[1327, [33, 6, 0, 6], [41, 6, 6, 6]] + 1.0720822351671655e-05 # B[1328, [33, 6, 0, 6], [42, 6, 6, 8]] + 0.000114464898537391946 # B[1329, [33, 6, 0, 6], [43, 7, 0, 7]] + -0.00033593422820483651 # B[1330, [33, 6, 0, 6], [44, 7, 1, 8]] + -0.00061665800523461739 # B[1331, [33, 6, 0, 6], [45, 7, 2, 7]] + -0.000258302532232180387 # B[1332, [33, 6, 0, 6], [46, 7, 3, 8]] + 3.78181072490033077e-05 # B[1333, [33, 6, 0, 6], [47, 7, 4, 7]] + -0.000326273283142861775 # B[1334, [33, 6, 0, 6], [48, 7, 5, 8]] + 1.74277156155672186e-05 # B[1335, [33, 6, 0, 6], [49, 7, 6, 7]] + -0.000206600107910874173 # B[1336, [33, 6, 0, 6], [50, 7, 7, 8]] + 2.12855018918572947e-05 # B[1337, [33, 6, 0, 6], [51, 8, 0, 8]] + -0.000696835386532819456 # B[1338, [33, 6, 0, 6], [52, 8, 2, 8]] + 8.06841007746916805e-05 # B[1339, [33, 6, 0, 6], [53, 8, 4, 8]] + 1.96129469472779844e-05 # B[1340, [33, 6, 0, 6], [54, 8, 6, 8]] + 7.35114191380559223e-05 # B[1341, [33, 6, 0, 6], [55, 8, 8, 8]] + 0.00360109138862139185 # B[1342, [34, 6, 1, 7], [34, 6, 1, 7]] + 0.00304872474261531218 # B[1343, [34, 6, 1, 7], [35, 6, 2, 6]] + -0.00546316824530662139 # B[1344, [34, 6, 1, 7], [36, 6, 2, 8]] + 0.000721988419001898946 # B[1345, [34, 6, 1, 7], [37, 6, 3, 7]] + -0.00254968694435141717 # B[1346, [34, 6, 1, 7], [38, 6, 4, 6]] + -0.00102187793811427596 # B[1347, [34, 6, 1, 7], [39, 6, 4, 8]] + 0.000977866285507509106 # B[1348, [34, 6, 1, 7], [40, 6, 5, 7]] + 0.00129156024637028417 # B[1349, [34, 6, 1, 7], [41, 6, 6, 6]] + 8.43980229575398005e-05 # B[1350, [34, 6, 1, 7], [42, 6, 6, 8]] + -0.000854491821273548058 # B[1351, [34, 6, 1, 7], [43, 7, 0, 7]] + -0.00229655360277009144 # B[1352, [34, 6, 1, 7], [44, 7, 1, 8]] + 0.00392740594657482126 # B[1353, [34, 6, 1, 7], [45, 7, 2, 7]] + 0.00282086313880587115 # B[1354, [34, 6, 1, 7], [46, 7, 3, 8]] + -0.00269367822401865922 # B[1355, [34, 6, 1, 7], [47, 7, 4, 7]] + 0.00120544917432826269 # B[1356, [34, 6, 1, 7], [48, 7, 5, 8]] + 0.00137213082032611872 # B[1357, [34, 6, 1, 7], [49, 7, 6, 7]] + 0.00278774897747785522 # B[1358, [34, 6, 1, 7], [50, 7, 7, 8]] + -1.00075929411755707e-05 # B[1359, [34, 6, 1, 7], [51, 8, 0, 8]] + 0.00331402709384703321 # B[1360, [34, 6, 1, 7], [52, 8, 2, 8]] + -0.00220016465090739841 # B[1361, [34, 6, 1, 7], [53, 8, 4, 8]] + 0.000794479619849004434 # B[1362, [34, 6, 1, 7], [54, 8, 6, 8]] + 0.000207117210070053084 # B[1363, [34, 6, 1, 7], [55, 8, 8, 8]] + 0.000547206364960122621 # B[1364, [35, 6, 2, 6], [35, 6, 2, 6]] + 0.00243529980905243717 # B[1365, [35, 6, 2, 6], [36, 6, 2, 8]] + 0.000346076245330416421 # B[1366, [35, 6, 2, 6], [37, 6, 3, 7]] + 0.00220550296989585788 # B[1367, [35, 6, 2, 6], [38, 6, 4, 6]] + 0.00101934408216735467 # B[1368, [35, 6, 2, 6], [39, 6, 4, 8]] + 6.76995447894471192e-05 # B[1369, [35, 6, 2, 6], [40, 6, 5, 7]] + -4.61734905116591154e-05 # B[1370, [35, 6, 2, 6], [41, 6, 6, 6]] + 0.000809543629624515093 # B[1371, [35, 6, 2, 6], [42, 6, 6, 8]] + 0.000219078295465409238 # B[1372, [35, 6, 2, 6], [43, 7, 0, 7]] + -0.00316872925249137884 # B[1373, [35, 6, 2, 6], [44, 7, 1, 8]] + 0.000676713636760976206 # B[1374, [35, 6, 2, 6], [45, 7, 2, 7]] + -0.00100477918211841141 # B[1375, [35, 6, 2, 6], [46, 7, 3, 8]] + 0.000400524978896980161 # B[1376, [35, 6, 2, 6], [47, 7, 4, 7]] + -0.00197634098305848622 # B[1377, [35, 6, 2, 6], [48, 7, 5, 8]] + 0.000367979983554051621 # B[1378, [35, 6, 2, 6], [49, 7, 6, 7]] + -0.00126672502130457942 # B[1379, [35, 6, 2, 6], [50, 7, 7, 8]] + 0.000161373464169148675 # B[1380, [35, 6, 2, 6], [51, 8, 0, 8]] + 0.00258770627559228462 # B[1381, [35, 6, 2, 6], [52, 8, 2, 8]] + 0.000816135012742828661 # B[1382, [35, 6, 2, 6], [53, 8, 4, 8]] + -3.28991122771973843e-05 # B[1383, [35, 6, 2, 6], [54, 8, 6, 8]] + -4.18127338362338707e-05 # B[1384, [35, 6, 2, 6], [55, 8, 8, 8]] + 0.00658745572292138409 # B[1385, [36, 6, 2, 8], [36, 6, 2, 8]] + -0.00238764687643479301 # B[1386, [36, 6, 2, 8], [37, 6, 3, 7]] + -0.000831950910425274803 # B[1387, [36, 6, 2, 8], [38, 6, 4, 6]] + 0.00351737364404769177 # B[1388, [36, 6, 2, 8], [39, 6, 4, 8]] + -0.00276293358095670936 # B[1389, [36, 6, 2, 8], [40, 6, 5, 7]] + -0.00115031008308692437 # B[1390, [36, 6, 2, 8], [41, 6, 6, 6]] + -0.000921624256609663434 # B[1391, [36, 6, 2, 8], [42, 6, 6, 8]] + 0.000810924380859275734 # B[1392, [36, 6, 2, 8], [43, 7, 0, 7]] + -0.00488922361819911239 # B[1393, [36, 6, 2, 8], [44, 7, 1, 8]] + 0.00170426259508682162 # B[1394, [36, 6, 2, 8], [45, 7, 2, 7]] + -0.000698037236981145087 # B[1395, [36, 6, 2, 8], [46, 7, 3, 8]] + -0.00159293071425275958 # B[1396, [36, 6, 2, 8], [47, 7, 4, 7]] + 0.00145526568566858513 # B[1397, [36, 6, 2, 8], [48, 7, 5, 8]] + -0.0034526631911915729 # B[1398, [36, 6, 2, 8], [49, 7, 6, 7]] + 0.00136118079841816148 # B[1399, [36, 6, 2, 8], [50, 7, 7, 8]] + -0.000519558666561149851 # B[1400, [36, 6, 2, 8], [51, 8, 0, 8]] + -0.00125430728243427136 # B[1401, [36, 6, 2, 8], [52, 8, 2, 8]] + 0.000225746730173992209 # B[1402, [36, 6, 2, 8], [53, 8, 4, 8]] + 0.000144081610870761424 # B[1403, [36, 6, 2, 8], [54, 8, 6, 8]] + 0.000848192939185923693 # B[1404, [36, 6, 2, 8], [55, 8, 8, 8]] + 0.00209760366601450393 # B[1405, [37, 6, 3, 7], [37, 6, 3, 7]] + -0.00114098142783233825 # B[1406, [37, 6, 3, 7], [38, 6, 4, 6]] + -0.00012482798433224862 # B[1407, [37, 6, 3, 7], [39, 6, 4, 8]] + 0.000414303981445450498 # B[1408, [37, 6, 3, 7], [40, 6, 5, 7]] + -2.06949976952613968e-05 # B[1409, [37, 6, 3, 7], [41, 6, 6, 6]] + 0.000986658381613915447 # B[1410, [37, 6, 3, 7], [42, 6, 6, 8]] + 0.000196361012595618056 # B[1411, [37, 6, 3, 7], [43, 7, 0, 7]] + 0.000421620511108736218 # B[1412, [37, 6, 3, 7], [44, 7, 1, 8]] + -0.00121366957406692996 # B[1413, [37, 6, 3, 7], [45, 7, 2, 7]] + 0.000319772245183778947 # B[1414, [37, 6, 3, 7], [46, 7, 3, 8]] + -0.00189440310525268441 # B[1415, [37, 6, 3, 7], [47, 7, 4, 7]] + -0.000420808921505540223 # B[1416, [37, 6, 3, 7], [48, 7, 5, 8]] + -0.000833056882638676111 # B[1417, [37, 6, 3, 7], [49, 7, 6, 7]] + -0.000210394181928773294 # B[1418, [37, 6, 3, 7], [50, 7, 7, 8]] + 4.67415997983874898e-05 # B[1419, [37, 6, 3, 7], [51, 8, 0, 8]] + -0.000629437221263145228 # B[1420, [37, 6, 3, 7], [52, 8, 2, 8]] + -0.000561739301858470846 # B[1421, [37, 6, 3, 7], [53, 8, 4, 8]] + -0.000244403089656959616 # B[1422, [37, 6, 3, 7], [54, 8, 6, 8]] + 0.000170058213410727299 # B[1423, [37, 6, 3, 7], [55, 8, 8, 8]] + 0.000190580820336867102 # B[1424, [38, 6, 4, 6], [38, 6, 4, 6]] + -5.17086422710446442e-05 # B[1425, [38, 6, 4, 6], [39, 6, 4, 8]] + -0.000870479233908965505 # B[1426, [38, 6, 4, 6], [40, 6, 5, 7]] + 8.56431173592298034e-05 # B[1427, [38, 6, 4, 6], [41, 6, 6, 6]] + -0.000219028113680014638 # B[1428, [38, 6, 4, 6], [42, 6, 6, 8]] + 6.99094597341239771e-05 # B[1429, [38, 6, 4, 6], [43, 7, 0, 7]] + -0.00217214753267054063 # B[1430, [38, 6, 4, 6], [44, 7, 1, 8]] + 0.00103452950595812193 # B[1431, [38, 6, 4, 6], [45, 7, 2, 7]] + 0.000131158053198399821 # B[1432, [38, 6, 4, 6], [46, 7, 3, 8]] + -0.000991288929959081421 # B[1433, [38, 6, 4, 6], [47, 7, 4, 7]] + -0.000321058899826150157 # B[1434, [38, 6, 4, 6], [48, 7, 5, 8]] + -0.000126379357764709599 # B[1435, [38, 6, 4, 6], [49, 7, 6, 7]] + 0.000513859397020456632 # B[1436, [38, 6, 4, 6], [50, 7, 7, 8]] + -2.72482190626921472e-05 # B[1437, [38, 6, 4, 6], [51, 8, 0, 8]] + 0.000742781076179950886 # B[1438, [38, 6, 4, 6], [52, 8, 2, 8]] + -9.17701606060090935e-05 # B[1439, [38, 6, 4, 6], [53, 8, 4, 8]] + 1.49768390447675703e-05 # B[1440, [38, 6, 4, 6], [54, 8, 6, 8]] + -5.94521118466549703e-05 # B[1441, [38, 6, 4, 6], [55, 8, 8, 8]] + 0.00161400415689978271 # B[1442, [39, 6, 4, 8], [39, 6, 4, 8]] + -0.000149892220376375129 # B[1443, [39, 6, 4, 8], [40, 6, 5, 7]] + -0.000242832088631229209 # B[1444, [39, 6, 4, 8], [41, 6, 6, 6]] + -4.23223006292567511e-05 # B[1445, [39, 6, 4, 8], [42, 6, 6, 8]] + 0.000145544599928226076 # B[1446, [39, 6, 4, 8], [43, 7, 0, 7]] + -0.000846976149028450323 # B[1447, [39, 6, 4, 8], [44, 7, 1, 8]] + 0.000313402576083809947 # B[1448, [39, 6, 4, 8], [45, 7, 2, 7]] + -0.00105304559168569421 # B[1449, [39, 6, 4, 8], [46, 7, 3, 8]] + -0.000563622717067245593 # B[1450, [39, 6, 4, 8], [47, 7, 4, 7]] + -0.000176248327800098206 # B[1451, [39, 6, 4, 8], [48, 7, 5, 8]] + -0.000523005481859822874 # B[1452, [39, 6, 4, 8], [49, 7, 6, 7]] + 0.000327425878709725754 # B[1453, [39, 6, 4, 8], [50, 7, 7, 8]] + -0.000214075091648432969 # B[1454, [39, 6, 4, 8], [51, 8, 0, 8]] + 0.000892962890338189208 # B[1455, [39, 6, 4, 8], [52, 8, 2, 8]] + 0.000483016760753301674 # B[1456, [39, 6, 4, 8], [53, 8, 4, 8]] + 0.000385986009520520711 # B[1457, [39, 6, 4, 8], [54, 8, 6, 8]] + 0.000210387221014841225 # B[1458, [39, 6, 4, 8], [55, 8, 8, 8]] + 0.000423894835630976054 # B[1459, [40, 6, 5, 7], [40, 6, 5, 7]] + 2.52152593651043533e-05 # B[1460, [40, 6, 5, 7], [41, 6, 6, 6]] + 0.0001406783760301792 # B[1461, [40, 6, 5, 7], [42, 6, 6, 8]] + -0.000402862939603353815 # B[1462, [40, 6, 5, 7], [43, 7, 0, 7]] + -0.000764679971924708997 # B[1463, [40, 6, 5, 7], [44, 7, 1, 8]] + 0.000690122720081854865 # B[1464, [40, 6, 5, 7], [45, 7, 2, 7]] + 0.00135911524951161378 # B[1465, [40, 6, 5, 7], [46, 7, 3, 8]] + 5.52075818169902449e-06 # B[1466, [40, 6, 5, 7], [47, 7, 4, 7]] + -0.000149902773226399076 # B[1467, [40, 6, 5, 7], [48, 7, 5, 8]] + 0.000389894625400750289 # B[1468, [40, 6, 5, 7], [49, 7, 6, 7]] + 0.000257807843360047251 # B[1469, [40, 6, 5, 7], [50, 7, 7, 8]] + -3.67912373811542237e-05 # B[1470, [40, 6, 5, 7], [51, 8, 0, 8]] + -0.000174743024771516643 # B[1471, [40, 6, 5, 7], [52, 8, 2, 8]] + 0.000276798622678277838 # B[1472, [40, 6, 5, 7], [53, 8, 4, 8]] + 0.000152459620483783032 # B[1473, [40, 6, 5, 7], [54, 8, 6, 8]] + -0.000616599602238733502 # B[1474, [40, 6, 5, 7], [55, 8, 8, 8]] + -5.12324624723156652e-05 # B[1475, [41, 6, 6, 6], [41, 6, 6, 6]] + -4.23334509430418893e-05 # B[1476, [41, 6, 6, 6], [42, 6, 6, 8]] + -0.000111212733055157664 # B[1477, [41, 6, 6, 6], [43, 7, 0, 7]] + 0.000882360189618891337 # B[1478, [41, 6, 6, 6], [44, 7, 1, 8]] + -0.000581964842687935843 # B[1479, [41, 6, 6, 6], [45, 7, 2, 7]] + 0.000211138997961872465 # B[1480, [41, 6, 6, 6], [46, 7, 3, 8]] + 7.79906436828414068e-05 # B[1481, [41, 6, 6, 6], [47, 7, 4, 7]] + -0.000201461425275273331 # B[1482, [41, 6, 6, 6], [48, 7, 5, 8]] + 6.87828589884392771e-05 # B[1483, [41, 6, 6, 6], [49, 7, 6, 7]] + 0.000150653067204437052 # B[1484, [41, 6, 6, 6], [50, 7, 7, 8]] + 3.87532549918634395e-05 # B[1485, [41, 6, 6, 6], [51, 8, 0, 8]] + 0.000361299779465781672 # B[1486, [41, 6, 6, 6], [52, 8, 2, 8]] + -0.000217385549744270783 # B[1487, [41, 6, 6, 6], [53, 8, 4, 8]] + 6.09508622621875856e-05 # B[1488, [41, 6, 6, 6], [54, 8, 6, 8]] + -0.000174447165900721429 # B[1489, [41, 6, 6, 6], [55, 8, 8, 8]] + 4.08451735536830007e-05 # B[1490, [42, 6, 6, 8], [42, 6, 6, 8]] + -0.000100109250872669128 # B[1491, [42, 6, 6, 8], [43, 7, 0, 7]] + 0.000543796967600337564 # B[1492, [42, 6, 6, 8], [44, 7, 1, 8]] + 0.000744432946735457124 # B[1493, [42, 6, 6, 8], [45, 7, 2, 7]] + 0.0010803210667922683 # B[1494, [42, 6, 6, 8], [46, 7, 3, 8]] + 0.000151445105968722347 # B[1495, [42, 6, 6, 8], [47, 7, 4, 7]] + -0.000100848877598445907 # B[1496, [42, 6, 6, 8], [48, 7, 5, 8]] + -0.000109088350721993355 # B[1497, [42, 6, 6, 8], [49, 7, 6, 7]] + -0.000287924009882135207 # B[1498, [42, 6, 6, 8], [50, 7, 7, 8]] + 1.48405987461727729e-05 # B[1499, [42, 6, 6, 8], [51, 8, 0, 8]] + 0.00133229142431166023 # B[1500, [42, 6, 6, 8], [52, 8, 2, 8]] + -0.00019157481902659472 # B[1501, [42, 6, 6, 8], [53, 8, 4, 8]] + -0.000214414469154704246 # B[1502, [42, 6, 6, 8], [54, 8, 6, 8]] + -0.000145460173238021184 # B[1503, [42, 6, 6, 8], [55, 8, 8, 8]] + 0.000122164068846408735 # B[1504, [43, 7, 0, 7], [43, 7, 0, 7]] + -0.000271198052548764657 # B[1505, [43, 7, 0, 7], [44, 7, 1, 8]] + -7.53020792218089818e-05 # B[1506, [43, 7, 0, 7], [45, 7, 2, 7]] + -0.000522043739406908344 # B[1507, [43, 7, 0, 7], [46, 7, 3, 8]] + -4.818852612961666e-05 # B[1508, [43, 7, 0, 7], [47, 7, 4, 7]] + -0.000220542438614808323 # B[1509, [43, 7, 0, 7], [48, 7, 5, 8]] + -0.000160998835878327362 # B[1510, [43, 7, 0, 7], [49, 7, 6, 7]] + -2.41628428966911279e-05 # B[1511, [43, 7, 0, 7], [50, 7, 7, 8]] + -1.41474469189661889e-05 # B[1512, [43, 7, 0, 7], [51, 8, 0, 8]] + -0.000160534811881916234 # B[1513, [43, 7, 0, 7], [52, 8, 2, 8]] + -1.73735621299461046e-05 # B[1514, [43, 7, 0, 7], [53, 8, 4, 8]] + 4.73251016045242445e-05 # B[1515, [43, 7, 0, 7], [54, 8, 6, 8]] + 0.000182463508348683356 # B[1516, [43, 7, 0, 7], [55, 8, 8, 8]] + -0.000629134879565343137 # B[1517, [44, 7, 1, 8], [44, 7, 1, 8]] + -0.00207361578267727673 # B[1518, [44, 7, 1, 8], [45, 7, 2, 7]] + 0.0031686999001355326 # B[1519, [44, 7, 1, 8], [46, 7, 3, 8]] + -0.000405403647932546952 # B[1520, [44, 7, 1, 8], [47, 7, 4, 7]] + -0.000111251617971438489 # B[1521, [44, 7, 1, 8], [48, 7, 5, 8]] + 0.0014482690523848242 # B[1522, [44, 7, 1, 8], [49, 7, 6, 7]] + 0.000818892450912583197 # B[1523, [44, 7, 1, 8], [50, 7, 7, 8]] + 0.000100422502558870572 # B[1524, [44, 7, 1, 8], [51, 8, 0, 8]] + -0.000412863674396233161 # B[1525, [44, 7, 1, 8], [52, 8, 2, 8]] + -0.000905494278120194153 # B[1526, [44, 7, 1, 8], [53, 8, 4, 8]] + 0.00126932173443552359 # B[1527, [44, 7, 1, 8], [54, 8, 6, 8]] + -0.000374814469421512735 # B[1528, [44, 7, 1, 8], [55, 8, 8, 8]] + -0.00330341133748704441 # B[1529, [45, 7, 2, 7], [45, 7, 2, 7]] + 0.00131616674488897398 # B[1530, [45, 7, 2, 7], [46, 7, 3, 8]] + -0.000483635326292886428 # B[1531, [45, 7, 2, 7], [47, 7, 4, 7]] + -0.00177550615332965067 # B[1532, [45, 7, 2, 7], [48, 7, 5, 8]] + 0.00226091969304176299 # B[1533, [45, 7, 2, 7], [49, 7, 6, 7]] + -0.00142635978155006456 # B[1534, [45, 7, 2, 7], [50, 7, 7, 8]] + 0.000289476939908078768 # B[1535, [45, 7, 2, 7], [51, 8, 0, 8]] + 0.000582488578419503846 # B[1536, [45, 7, 2, 7], [52, 8, 2, 8]] + -0.000228795123723987606 # B[1537, [45, 7, 2, 7], [53, 8, 4, 8]] + 0.000478658611037000373 # B[1538, [45, 7, 2, 7], [54, 8, 6, 8]] + -0.00101956994563059782 # B[1539, [45, 7, 2, 7], [55, 8, 8, 8]] + 0.00268648192223141895 # B[1540, [46, 7, 3, 8], [46, 7, 3, 8]] + 0.000515570689344949529 # B[1541, [46, 7, 3, 8], [47, 7, 4, 7]] + 0.000903689215066725768 # B[1542, [46, 7, 3, 8], [48, 7, 5, 8]] + 0.00180650309403464215 # B[1543, [46, 7, 3, 8], [49, 7, 6, 7]] + -7.48574841450792838e-05 # B[1544, [46, 7, 3, 8], [50, 7, 7, 8]] + -2.90930360741237237e-05 # B[1545, [46, 7, 3, 8], [51, 8, 0, 8]] + 0.00139057844941538594 # B[1546, [46, 7, 3, 8], [52, 8, 2, 8]] + -0.000263907165716330272 # B[1547, [46, 7, 3, 8], [53, 8, 4, 8]] + -5.74521512815137289e-05 # B[1548, [46, 7, 3, 8], [54, 8, 6, 8]] + -0.00030234445629373323 # B[1549, [46, 7, 3, 8], [55, 8, 8, 8]] + -0.000842080339294604824 # B[1550, [47, 7, 4, 7], [47, 7, 4, 7]] + -1.8677234631915389e-05 # B[1551, [47, 7, 4, 7], [48, 7, 5, 8]] + 0.000150434033167294937 # B[1552, [47, 7, 4, 7], [49, 7, 6, 7]] + 0.000201922161197246736 # B[1553, [47, 7, 4, 7], [50, 7, 7, 8]] + 5.63689077359152968e-05 # B[1554, [47, 7, 4, 7], [51, 8, 0, 8]] + 0.000490229079971716761 # B[1555, [47, 7, 4, 7], [52, 8, 2, 8]] + -0.00019335269881828529 # B[1556, [47, 7, 4, 7], [53, 8, 4, 8]] + -0.000118664083374402096 # B[1557, [47, 7, 4, 7], [54, 8, 6, 8]] + -0.000397263359111398734 # B[1558, [47, 7, 4, 7], [55, 8, 8, 8]] + -0.000724261739409587726 # B[1559, [48, 7, 5, 8], [48, 7, 5, 8]] + 0.000186853474209224685 # B[1560, [48, 7, 5, 8], [49, 7, 6, 7]] + -0.000533321040010020266 # B[1561, [48, 7, 5, 8], [50, 7, 7, 8]] + 9.95102706208284005e-08 # B[1562, [48, 7, 5, 8], [51, 8, 0, 8]] + -0.00093755398196557671 # B[1563, [48, 7, 5, 8], [52, 8, 2, 8]] + 0.000483236780374178207 # B[1564, [48, 7, 5, 8], [53, 8, 4, 8]] + -5.03524206302112531e-05 # B[1565, [48, 7, 5, 8], [54, 8, 6, 8]] + -0.000586245052440398373 # B[1566, [48, 7, 5, 8], [55, 8, 8, 8]] + -0.000207118017941997773 # B[1567, [49, 7, 6, 7], [49, 7, 6, 7]] + -9.40116364012005823e-05 # B[1568, [49, 7, 6, 7], [50, 7, 7, 8]] + 0.000124266884770383307 # B[1569, [49, 7, 6, 7], [51, 8, 0, 8]] + 0.00118479186165786239 # B[1570, [49, 7, 6, 7], [52, 8, 2, 8]] + -0.000129238345120056067 # B[1571, [49, 7, 6, 7], [53, 8, 4, 8]] + -0.000383875224777865259 # B[1572, [49, 7, 6, 7], [54, 8, 6, 8]] + -0.000457194559055141767 # B[1573, [49, 7, 6, 7], [55, 8, 8, 8]] + -0.000450510261664234871 # B[1574, [50, 7, 7, 8], [50, 7, 7, 8]] + 7.52704593073999506e-05 # B[1575, [50, 7, 7, 8], [51, 8, 0, 8]] + -0.00128732840082427732 # B[1576, [50, 7, 7, 8], [52, 8, 2, 8]] + 0.000293225651298797269 # B[1577, [50, 7, 7, 8], [53, 8, 4, 8]] + -0.000306521733645761033 # B[1578, [50, 7, 7, 8], [54, 8, 6, 8]] + -0.000370268243746852549 # B[1579, [50, 7, 7, 8], [55, 8, 8, 8]] + -4.00747887657759705e-06 # B[1580, [51, 8, 0, 8], [51, 8, 0, 8]] + -0.000179079356204300821 # B[1581, [51, 8, 0, 8], [52, 8, 2, 8]] + -6.37205046857824975e-06 # B[1582, [51, 8, 0, 8], [53, 8, 4, 8]] + 5.20087282658288075e-05 # B[1583, [51, 8, 0, 8], [54, 8, 6, 8]] + 6.68015373273544988e-05 # B[1584, [51, 8, 0, 8], [55, 8, 8, 8]] + 0.00160592146390294661 # B[1585, [52, 8, 2, 8], [52, 8, 2, 8]] + 0.000454049229948232103 # B[1586, [52, 8, 2, 8], [53, 8, 4, 8]] + 0.00110675066334388339 # B[1587, [52, 8, 2, 8], [54, 8, 6, 8]] + -0.000191060465051852771 # B[1588, [52, 8, 2, 8], [55, 8, 8, 8]] + -0.000131765455753670314 # B[1589, [53, 8, 4, 8], [53, 8, 4, 8]] + -7.05704764431217685e-05 # B[1590, [53, 8, 4, 8], [54, 8, 6, 8]] + -1.82263105369812051e-05 # B[1591, [53, 8, 4, 8], [55, 8, 8, 8]] + -0.00032731873727259329 # B[1592, [54, 8, 6, 8], [54, 8, 6, 8]] + -0.000198178389384386089 # B[1593, [54, 8, 6, 8], [55, 8, 8, 8]] + -0.000136309758672861769 # B[1594, [55, 8, 8, 8], [55, 8, 8, 8]] + +# End of potential diff --git a/potentials/C_SNAP_2021.10.15.quadratic.snapparam b/potentials/C_SNAP_2021.10.15.quadratic.snapparam new file mode 100644 index 0000000000..26dddf627d --- /dev/null +++ b/potentials/C_SNAP_2021.10.15.quadratic.snapparam @@ -0,0 +1,10 @@ + + # required + rcutfac 2.7 + twojmax 8 + + # optional + rfac0 0.99363 + rmin0 0.0 + bzeroflag 0 + quadraticflag 1 diff --git a/python/lammps/constants.py b/python/lammps/constants.py index 8fd6a9eaf5..1d0d8adb78 100644 --- a/python/lammps/constants.py +++ b/python/lammps/constants.py @@ -13,7 +13,13 @@ # various symbolic constants to be used # in certain calls to select data formats + +# these must be kept in sync with the enums in src/library.h, src/lmptype.h, +# tools/swig/lammps.i, examples/COUPLE/plugin/liblammpsplugin.h, +# and the constants in fortran/lammps.f90 + LAMMPS_AUTODETECT = None +LAMMPS_NONE = -1 LAMMPS_INT = 0 LAMMPS_INT_2D = 1 LAMMPS_DOUBLE = 2 @@ -22,8 +28,6 @@ LAMMPS_INT64 = 4 LAMMPS_INT64_2D = 5 LAMMPS_STRING = 6 -# these must be kept in sync with the enums in src/library.h, tools/swig/lammps.i, -# examples/COUPLE/plugin/liblammpsplugin.h, and the constants in fortran/lammps.f90 LMP_STYLE_GLOBAL = 0 LMP_STYLE_ATOM = 1 LMP_STYLE_LOCAL = 2 diff --git a/python/lammps/core.py b/python/lammps/core.py index 80961186f3..84a80e77a3 100644 --- a/python/lammps/core.py +++ b/python/lammps/core.py @@ -272,6 +272,9 @@ class lammps(object): self.lib.lammps_get_thermo.argtypes = [c_void_p, c_char_p] self.lib.lammps_get_thermo.restype = c_double + self.lib.lammps_last_thermo.argtypes = [c_void_p, c_char_p, c_int] + self.lib.lammps_last_thermo.restype = c_void_p + self.lib.lammps_encode_image_flags.restype = self.c_imageint self.lib.lammps_config_has_package.argtypes = [c_char_p] @@ -503,9 +506,9 @@ class lammps(object): def error(self, error_type, error_text): """Forward error to the LAMMPS Error class. - This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. + .. versionadded:: 3Nov2022 - .. versionadded:: TBD + This is a wrapper around the :cpp:func:`lammps_error` function of the C-library interface. :param error_type: :type error_type: int @@ -742,6 +745,64 @@ class lammps(object): with ExceptionCheck(self): return self.lib.lammps_get_thermo(self.lmp,name) + # ------------------------------------------------------------------------- + @property + def last_thermo_step(self): + """ Get the last timestep where thermodynamic data was computed + + :return: the timestep or a negative number if there has not been any thermo output yet + :rtype: int + """ + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("step".encode()), 0) + return cast(ptr, POINTER(self.c_bigint)).contents.value + + def last_thermo(self): + """Get a dictionary of the last thermodynamic output + + This is a wrapper around the :cpp:func:`lammps_last_thermo` + function of the C-library interface. It collects the cached thermo + data from the last timestep into a dictionary. The return value + is None, if there has not been any thermo output yet. + + :return: a dictionary containing the last computed thermo output values + :rtype: dict or None + """ + + rv = dict() + mystep = self.last_thermo_step + if mystep < 0: + return None + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("num".encode()), 0) + nfield = cast(ptr, POINTER(c_int)).contents.value + + for i in range(nfield): + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("keyword".encode()), i) + kw = cast(ptr, c_char_p).value.decode() + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("type".encode()), i) + typ = cast(ptr, POINTER(c_int)).contents.value + + with ExceptionCheck(self): + ptr = self.lib.lammps_last_thermo(self.lmp, c_char_p("data".encode()), i) + + if typ == LAMMPS_DOUBLE: + val = cast(ptr, POINTER(c_double)).contents.value + elif typ == LAMMPS_INT: + val = cast(ptr, POINTER(c_int)).contents.value + elif typ == LAMMPS_INT64: + val = cast(ptr, POINTER(c_int64)).contents.value + else: + # we should not get here + raise TypeError("Unknown LAMMPS data type " + str(typ)) + rv[kw] = val + + return rv + # ------------------------------------------------------------------------- def extract_setting(self, name): @@ -1289,6 +1350,8 @@ class lammps(object): def gather_bonds(self): """Retrieve global list of bonds + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_gather_bonds` function of the C-library interface. @@ -1296,8 +1359,6 @@ class lammps(object): flat list of ctypes integer values with the bond type, bond atom1, bond atom2 for each bond. - .. versionadded:: 28Jul2021 - :return: a tuple with the number of bonds and a list of c_int or c_long :rtype: (int, 3*nbonds*c_tagint) """ @@ -1312,6 +1373,8 @@ class lammps(object): def gather_angles(self): """Retrieve global list of angles + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_angles` function of the C-library interface. @@ -1319,8 +1382,6 @@ class lammps(object): flat list of ctypes integer values with the angle type, angle atom1, angle atom2, angle atom3 for each angle. - .. versionadded:: TBD - :return: a tuple with the number of angles and a list of c_int or c_long :rtype: (int, 4*nangles*c_tagint) """ @@ -1335,6 +1396,8 @@ class lammps(object): def gather_dihedrals(self): """Retrieve global list of dihedrals + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_dihedrals` function of the C-library interface. @@ -1342,8 +1405,6 @@ class lammps(object): flat list of ctypes integer values with the dihedral type, dihedral atom1, dihedral atom2, dihedral atom3, dihedral atom4 for each dihedral. - .. versionadded:: TBD - :return: a tuple with the number of dihedrals and a list of c_int or c_long :rtype: (int, 5*ndihedrals*c_tagint) """ @@ -1358,6 +1419,8 @@ class lammps(object): def gather_impropers(self): """Retrieve global list of impropers + .. versionadded:: 8Feb2023 + This is a wrapper around the :cpp:func:`lammps_gather_impropers` function of the C-library interface. @@ -1365,8 +1428,6 @@ class lammps(object): flat list of ctypes integer values with the improper type, improper atom1, improper atom2, improper atom3, improper atom4 for each improper. - .. versionadded:: TBD - :return: a tuple with the number of impropers and a list of c_int or c_long :rtype: (int, 5*nimpropers*c_tagint) """ @@ -1605,13 +1666,13 @@ class lammps(object): def is_running(self): """ Report whether being called from a function during a run or a minimization + .. versionadded:: 9Oct2020 + Various LAMMPS commands must not be called during an ongoing run or minimization. This property allows to check for that. This is a wrapper around the :cpp:func:`lammps_is_running` function of the library interface. - .. versionadded:: 9Oct2020 - :return: True when called during a run otherwise false :rtype: bool """ @@ -1622,12 +1683,13 @@ class lammps(object): def force_timeout(self): """ Trigger an immediate timeout, i.e. a "soft stop" of a run. + .. versionadded:: 9Oct2020 + This function allows to cleanly stop an ongoing run or minimization at the next loop iteration. This is a wrapper around the :cpp:func:`lammps_force_timeout` function of the library interface. - .. versionadded:: 9Oct2020 """ self.lib.lammps_force_timeout(self.lmp) @@ -1710,11 +1772,11 @@ class lammps(object): def has_package(self, name): """ Report if the named package has been enabled in the LAMMPS shared library. + .. versionadded:: 3Nov2022 + This is a wrapper around the :cpp:func:`lammps_config_has_package` function of the library interface. - .. versionadded:: TBD - :param name: name of the package :type name: string @@ -1854,11 +1916,11 @@ class lammps(object): def has_id(self, category, name): """Returns whether a given ID name is available in a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the function :cpp:func:`lammps_has_id` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string :param name: name of the ID @@ -1874,11 +1936,11 @@ class lammps(object): def available_ids(self, category): """Returns a list of IDs available for a given category + .. versionadded:: 9Oct2020 + This is a wrapper around the functions :cpp:func:`lammps_id_count()` and :cpp:func:`lammps_id_name()` of the library interface. - .. versionadded:: 9Oct2020 - :param category: name of category :type category: string @@ -1901,11 +1963,11 @@ class lammps(object): def available_plugins(self, category): """Returns a list of plugins available for a given category + .. versionadded:: 10Mar2021 + This is a wrapper around the functions :cpp:func:`lammps_plugin_count()` and :cpp:func:`lammps_plugin_name()` of the library interface. - .. versionadded:: 10Mar2021 - :return: list of style/name pairs of loaded plugins :rtype: list """ @@ -1970,11 +2032,11 @@ class lammps(object): def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_get_force` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -1989,11 +2051,11 @@ class lammps(object): def fix_external_set_energy_global(self, fix_id, eng): """Set the global energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: potential energy value to be added by fix external @@ -2008,11 +2070,11 @@ class lammps(object): def fix_external_set_virial_global(self, fix_id, virial): """Set the global virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_global` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eng: list of 6 floating point numbers with the virial to be added by fix external @@ -2028,11 +2090,11 @@ class lammps(object): def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_energy_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: list of potential energy values for local atoms to be added by fix external @@ -2051,11 +2113,11 @@ class lammps(object): def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_virial_peratom` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param vatom: list of natoms lists with 6 floating point numbers to be added by fix external @@ -2083,11 +2145,11 @@ class lammps(object): def fix_external_set_vector_length(self, fix_id, length): """Set the vector length for a global vector stored with fix external for analysis + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector_length` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param length: length of the global vector @@ -2101,11 +2163,11 @@ class lammps(object): def fix_external_set_vector(self, fix_id, idx, val): """Store a global vector value for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This is a wrapper around the :cpp:func:`lammps_fix_external_set_vector` function of the C-library interface. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param idx: 1-based index of the value in the global vector diff --git a/python/lammps/numpy_wrapper.py b/python/lammps/numpy_wrapper.py index 8286fb9a5c..f3ea0fdf8e 100644 --- a/python/lammps/numpy_wrapper.py +++ b/python/lammps/numpy_wrapper.py @@ -262,12 +262,12 @@ class numpy_wrapper: def gather_bonds(self): """Retrieve global list of bonds as NumPy array + .. versionadded:: 28Jul2021 + This is a wrapper around :py:meth:`lammps.gather_bonds() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: 28Jul2021 - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nbonds,3) """ @@ -280,12 +280,12 @@ class numpy_wrapper: def gather_angles(self): """ Retrieve global list of angles as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_angles() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nangles,4) """ @@ -298,12 +298,12 @@ class numpy_wrapper: def gather_dihedrals(self): """ Retrieve global list of dihedrals as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_dihedrals() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(ndihedrals,5) """ @@ -316,12 +316,12 @@ class numpy_wrapper: def gather_impropers(self): """ Retrieve global list of impropers as NumPy array + .. versionadded:: 8Feb2023 + This is a wrapper around :py:meth:`lammps.gather_impropers() ` It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` list. - .. versionadded:: TBD - :return: the requested data as a 2d-integer numpy array :rtype: numpy.array(nimpropers,5) """ @@ -334,13 +334,13 @@ class numpy_wrapper: def fix_external_get_force(self, fix_id): """Get access to the array with per-atom forces of a fix external instance with a given fix ID. + .. versionchanged:: 28Jul2021 + This function is a wrapper around the :py:meth:`lammps.fix_external_get_force() ` method. It behaves the same as the original method, but returns a NumPy array instead of a ``ctypes`` pointer. - .. versionchanged:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :return: requested data @@ -356,13 +356,13 @@ class numpy_wrapper: def fix_external_set_energy_peratom(self, fix_id, eatom): """Set the per-atom energy contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_energy_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy @@ -383,13 +383,13 @@ class numpy_wrapper: def fix_external_set_virial_peratom(self, fix_id, vatom): """Set the per-atom virial contribution for a fix external instance with the given ID. + .. versionadded:: 28Jul2021 + This function is an alternative to :py:meth:`lammps.fix_external_set_virial_peratom() ` method. It behaves the same as the original method, but accepts a NumPy array instead of a list as argument. - .. versionadded:: 28Jul2021 - :param fix_id: Fix-ID of a fix external instance :type: string :param eatom: per-atom potential energy diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index d0ff7ab1aa..c693b7d565 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -13,7 +13,7 @@ ################################################################################ # Alternative Python Wrapper -# Written by Richard Berger +# Written by Richard Berger ################################################################################ # for python2/3 compatibility @@ -28,6 +28,7 @@ import tempfile from collections import namedtuple from .core import lammps +from .constants import * # lgtm [py/polluting-import] # ------------------------------------------------------------------------- @@ -65,22 +66,43 @@ class OutputCapture(object): # ------------------------------------------------------------------------- class Variable(object): - def __init__(self, pylammps_instance, name, style, definition): + def __init__(self, pylammps_instance, name): self._pylmp = pylammps_instance self.name = name - self.style = style - self.definition = definition.split() + + @property + def style(self): + vartype = self._pylmp.lmp.lib.lammps_extract_variable_datatype(self._pylmp.lmp.lmp, self.name.encode()) + if vartype == LMP_VAR_EQUAL: + return "equal" + elif vartype == LMP_VAR_ATOM: + return "atom" + elif vartype == LMP_VAR_VECTOR: + return "vector" + elif vartype == LMP_VAR_STRING: + return "string" + return None @property def value(self): - if self.style == 'atom': - return list(self._pylmp.lmp.extract_variable(self.name, "all", 1)) + return self._pylmp.lmp.extract_variable(self.name) + + @value.setter + def value(self, newvalue): + style = self.style + if style == "equal" or style == "string": + self._pylmp.variable("{} {} {}".format(self.name, style, newvalue)) else: - value = self._pylmp.lmp_print('"${%s}"' % self.name).strip() - try: - return float(value) - except ValueError: - return value + raise Exception("Setter not implemented for {} style variables.".format(style)) + + def __str__(self): + value = self.value + if isinstance(value, str): + value = "\"{}\"".format(value) + return "Variable(name=\"{}\", value={})".format(self.name, value) + + def __repr__(self): + return self.__str__() # ------------------------------------------------------------------------- @@ -377,55 +399,6 @@ class variable_set: def __repr__(self): return self.__str__() -# ------------------------------------------------------------------------- - -def get_thermo_data(output): - """ traverse output of runs and extract thermo data columns """ - if isinstance(output, str): - lines = output.splitlines() - else: - lines = output - - runs = [] - columns = [] - in_run = False - current_run = {} - - for line in lines: - if line.startswith("Per MPI rank memory allocation"): - in_run = True - elif in_run and len(columns) == 0: - # first line after memory usage are column names - columns = line.split() - - current_run = {} - - for col in columns: - current_run[col] = [] - - elif line.startswith("Loop time of "): - in_run = False - columns = [] - thermo_data = variable_set('ThermoData', current_run) - r = {'thermo' : thermo_data } - runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) - elif in_run and len(columns) > 0: - items = line.split() - # Convert thermo output and store it. - # It must have the same number of columns and - # all of them must be convertible to floats. - # Otherwise we ignore the line - if len(items) == len(columns): - try: - values = [float(x) for x in items] - for i, col in enumerate(columns): - current_run[col].append(values[i]) - except ValueError: - # cannot convert. must be a non-thermo output. ignore. - pass - - return runs - # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- @@ -483,6 +456,9 @@ class PyLammps(object): self._enable_cmd_history = False self.runs = [] + if not self.lmp.has_package("PYTHON"): + print("WARNING: run thermo data not captured since PYTHON LAMMPS package is not enabled") + def __enter__(self): return self @@ -573,16 +549,49 @@ class PyLammps(object): if self.enable_cmd_history: self._cmd_history.append(cmd) + def _append_run_thermo(self, thermo): + for k, v in thermo.items(): + if k in self._current_run: + self._current_run[k].append(v) + else: + self._current_run[k] = [v] + def run(self, *args, **kwargs): """ Execute LAMMPS run command with given arguments - All thermo output during the run is captured and saved as new entry in + Thermo data of the run is recorded and saved as new entry in :py:attr:`PyLammps.runs`. The latest run can be retrieved by :py:attr:`PyLammps.last_run`. + + Note, for recording of all thermo steps during a run, the PYTHON package + needs to be enabled in LAMMPS. Otherwise, it will only capture the final + timestep. """ + self._current_run = {} + self._last_thermo_step = -1 + def end_of_step_callback(lmp): + if self.lmp.last_thermo_step == self._last_thermo_step: return + thermo = self.lmp.last_thermo() + self._append_run_thermo(thermo) + self._last_thermo_step = thermo['Step'] + + import __main__ + __main__._PyLammps_end_of_step_callback = end_of_step_callback + capture_thermo = self.lmp.has_package("PYTHON") + + if capture_thermo: + self.fix("__pylammps_internal_run_callback", "all", "python/invoke", "1", "end_of_step", "_PyLammps_end_of_step_callback") + output = self.__getattr__('run')(*args, **kwargs) - self.runs += get_thermo_data(output) + + if capture_thermo: + self.unfix("__pylammps_internal_run_callback") + self._append_run_thermo(self.lmp.last_thermo()) + + thermo_data = variable_set('ThermoData', self._current_run) + r = {'thermo' : thermo_data } + self.runs.append(namedtuple('Run', list(r.keys()))(*list(r.values()))) return output @property @@ -677,9 +686,7 @@ class PyLammps(object): :getter: Returns a list of atom groups that are currently active in this LAMMPS instance :type: list """ - output = self.lmp_info("groups") - output = output[output.index("Group information:")+1:] - return self._parse_groups(output) + return self.lmp.available_ids("group") @property def variables(self): @@ -689,11 +696,9 @@ class PyLammps(object): :getter: Returns a dictionary of all variables that are defined in this LAMMPS instance :type: dict """ - output = self.lmp_info("variables") - output = output[output.index("Variable information:")+1:] variables = {} - for v in self._parse_element_list(output): - variables[v['name']] = Variable(self, v['name'], v['style'], v['def']) + for name in self.lmp.available_ids("variable"): + variables[name] = Variable(self, name) return variables def eval(self, expr): @@ -720,66 +725,53 @@ class PyLammps(object): def _parse_info_system(self, output): system = {} + system['dimensions'] = self.lmp.extract_setting("dimension") + system['xlo'] = self.lmp.extract_global("boxxlo") + system['ylo'] = self.lmp.extract_global("boxylo") + system['zlo'] = self.lmp.extract_global("boxzlo") + system['xhi'] = self.lmp.extract_global("boxxhi") + system['yhi'] = self.lmp.extract_global("boxyhi") + system['zhi'] = self.lmp.extract_global("boxzhi") + xprd = system["xhi"] - system["xlo"] + yprd = system["yhi"] - system["ylo"] + zprd = system["zhi"] - system["zlo"] + if self.lmp.extract_setting("triclinic") == 1: + system['triclinic_box'] = (xprd, yprd, zprd) + else: + system['orthogonal_box'] = (xprd, yprd, zprd) + system['nangles'] = self.lmp.extract_global("nbonds") + system['nangletypes'] = self.lmp.extract_setting("nbondtypes") + system['angle_style'] = self.lmp.extract_global("angle_style") + system['nbonds'] = self.lmp.extract_global("nbonds") + system['nbondtypes'] = self.lmp.extract_setting("nbondtypes") + system['bond_style'] = self.lmp.extract_global("bond_style") + system['ndihedrals'] = self.lmp.extract_global("ndihedrals") + system['ndihedraltypes'] = self.lmp.extract_setting("ndihedraltypes") + system['dihedral_style'] = self.lmp.extract_global("dihedral_style") + system['nimpropers'] = self.lmp.extract_global("nimpropers") + system['nimpropertypes'] = self.lmp.extract_setting("nimpropertypes") + system['improper_style'] = self.lmp.extract_global("improper_style") + system['kspace_style'] = self.lmp.extract_global("kspace_style") + system['natoms'] = self.lmp.extract_global("natoms") + system['ntypes'] = self.lmp.extract_global("ntypes") + system['pair_style'] = self.lmp.extract_global("pair_style") + system['atom_style'] = self.lmp.extract_global("atom_style") + system['units'] = self.lmp.extract_global("units") for line in output: - if line.startswith("Units"): - system['units'] = self._get_pair(line)[1] - elif line.startswith("Atom style"): - system['atom_style'] = self._get_pair(line)[1] - elif line.startswith("Atom map"): + if line.startswith("Atom map"): system['atom_map'] = self._get_pair(line)[1] - elif line.startswith("Atoms"): - parts = self._split_values(line) - system['natoms'] = int(self._get_pair(parts[0])[1]) - system['ntypes'] = int(self._get_pair(parts[1])[1]) - system['style'] = self._get_pair(parts[2])[1] - elif line.startswith("Kspace style"): - system['kspace_style'] = self._get_pair(line)[1] - elif line.startswith("Dimensions"): - system['dimensions'] = int(self._get_pair(line)[1]) - elif line.startswith("Orthogonal box"): - system['orthogonal_box'] = [float(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Boundaries"): system['boundaries'] = self._get_pair(line)[1] - elif line.startswith("xlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("ylo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) - elif line.startswith("zlo"): - keys, values = [self._split_values(x) for x in self._get_pair(line)] - for key, value in zip(keys, values): - system[key] = float(value) elif line.startswith("Molecule type"): system['molecule_type'] = self._get_pair(line)[1] - elif line.startswith("Bonds"): - parts = self._split_values(line) - system['nbonds'] = int(self._get_pair(parts[0])[1]) - system['nbondtypes'] = int(self._get_pair(parts[1])[1]) - system['bond_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Angles"): - parts = self._split_values(line) - system['nangles'] = int(self._get_pair(parts[0])[1]) - system['nangletypes'] = int(self._get_pair(parts[1])[1]) - system['angle_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Dihedrals"): - parts = self._split_values(line) - system['ndihedrals'] = int(self._get_pair(parts[0])[1]) - system['ndihedraltypes'] = int(self._get_pair(parts[1])[1]) - system['dihedral_style'] = self._get_pair(parts[2])[1] - elif line.startswith("Impropers"): - parts = self._split_values(line) - system['nimpropers'] = int(self._get_pair(parts[0])[1]) - system['nimpropertypes'] = int(self._get_pair(parts[1])[1]) - system['improper_style'] = self._get_pair(parts[2])[1] return system def _parse_info_communication(self, output): comm = {} + comm['nprocs'] = self.lmp.extract_setting("world_size") + comm['nthreads'] = self.lmp.extract_setting("nthreads") for line in output: if line.startswith("MPI library"): @@ -792,10 +784,6 @@ class PyLammps(object): comm['proc_grid'] = [int(x) for x in self._get_pair(line)[1].split('x')] elif line.startswith("Communicate velocities for ghost atoms"): comm['ghost_velocity'] = (self._get_pair(line)[1] == "yes") - elif line.startswith("Nprocs"): - parts = self._split_values(line) - comm['nprocs'] = int(self._get_pair(parts[0])[1]) - comm['nthreads'] = int(self._get_pair(parts[1])[1]) return comm def _parse_element_list(self, output): @@ -810,16 +798,6 @@ class PyLammps(object): elements.append(element) return elements - def _parse_groups(self, output): - groups = [] - group_pattern = re.compile(r"(?P.+) \((?P.+)\)") - - for line in output: - m = group_pattern.match(line.split(':')[1].strip()) - group = {'name': m.group('name'), 'type': m.group('type')} - groups.append(group) - return groups - def lmp_print(self, s): """ needed for Python2 compatibility, since print is a reserved keyword """ return self.__getattr__("print")(s) diff --git a/src/.gitignore b/src/.gitignore index 204eec5e0b..2cb2fd315b 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1058,6 +1058,10 @@ /pair_adp.h /pair_agni.cpp /pair_agni.h +/pair_aip_water_2dm.cpp +/pair_aip_water_2dm.h +/pair_aip_water_2dm_opt.cpp +/pair_aip_water_2dm_opt.h /pair_airebo.cpp /pair_airebo.h /pair_airebo_morse.cpp @@ -1549,6 +1553,10 @@ /fix_langevin_drude.h /fix_mol_swap.cpp /fix_mol_swap.h +/fix_pimd.cpp +/fix_pimd.h +/fix_pimd_langevin.cpp +/fix_pimd_langevin.h /fix_alchemy.cpp /fix_alchemy.h /fix_pimd_nvt.cpp diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index 4d0517e527..6f0622cbf6 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -44,7 +44,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI}; //#define _POLYGON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-2 // dimensionless threshold (dot products, end point checks, contact checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 212830eb81..546ef1f0d4 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -42,7 +42,7 @@ enum {FAR=0,XLO,XHI,YLO,YHI,ZLO,ZHI}; //#define _POLYHEDRON_DEBUG #define DELTA 10000 -#define EPSILON 1e-2 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks) #define BIG 1.0e20 #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 0e83b63f99..24f38a6a0a 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_CONTACTS 4 // maximum number of contacts for 2D models #define EFF_CONTACTS 2 // effective contacts for 2D models @@ -624,7 +624,8 @@ void PairBodyRoundedPolygon::sphere_against_sphere(int i, int j, fy = dely*fpair/rij; fz = delz*fpair/rij; - if (R <= EPSILON) { // in contact + double rmin = MIN(rradi, rradj); + if (R <= EPSILON*rmin) { // in contact // relative translational velocity @@ -1019,6 +1020,7 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, double xi1[3],xi2[3],u[3],v[3],uij[3]; double udotv, magv, magucostheta; double delx,dely,delz; + double rmin = MIN(rounded_radius, x0_rounded_radius); ifirst = dfirst[ibody]; iefirst = edfirst[ibody]; @@ -1105,17 +1107,17 @@ int PairBodyRoundedPolygon::compute_distance_to_vertex(int ibody, // x0 and xmi are on the different sides // t is the ratio to detect if x0 is closer to the vertices xi or xj - if (fabs(xi2[0] - xi1[0]) > EPSILON) + if (fabs(xi2[0] - xi1[0]) > EPSILON*rmin) t = (hi[0] - xi1[0]) / (xi2[0] - xi1[0]); - else if (fabs(xi2[1] - xi1[1]) > EPSILON) + else if (fabs(xi2[1] - xi1[1]) > EPSILON*rmin) t = (hi[1] - xi1[1]) / (xi2[1] - xi1[1]); - else if (fabs(xi2[2] - xi1[2]) > EPSILON) + else if (fabs(xi2[2] - xi1[2]) > EPSILON*rmin) t = (hi[2] - xi1[2]) / (xi2[2] - xi1[2]); double contact_dist = rounded_radius + x0_rounded_radius; if (t >= 0 && t <= 1) { mode = EDGE; - if (d < contact_dist + EPSILON) + if (d < contact_dist + EPSILON*rmin) contact = 1; } else { // t < 0 || t > 1: closer to either vertices of the edge @@ -1293,8 +1295,14 @@ double PairBodyRoundedPolygon::contact_separation(const Contact& c1, double x3 = c2.xv[0]; double y3 = c2.xv[1]; + int ibody = c1.ibody; + int jbody = c1.ibody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + double delta_a = 0.0; - if (fabs(x2 - x1) > EPSILON) { + if (fabs(x2 - x1) > EPSILON*rmin) { double A = (y2 - y1) / (x2 - x1); delta_a = fabs(y1 - A * x1 - y3 + A * x3) / sqrt(1 + A * A); } else { diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 2c23199e33..d9a79abad0 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; using namespace MathConst; #define DELTA 10000 -#define EPSILON 1e-3 +#define EPSILON 1e-3 // dimensionless threshold (dot products, end point checks, contact checks) #define MAX_FACE_SIZE 4 // maximum number of vertices per face (same as BodyRoundedPolyhedron) #define MAX_CONTACTS 32 // for 3D models (including duplicated counts) @@ -1186,7 +1186,13 @@ int PairBodyRoundedPolyhedron::interaction_edge_to_edge(int ibody, // singularity case, ignore interactions - if (r < EPSILON) return interact; + double rmin = MIN(rounded_radius_i, rounded_radius_j); + if (r < EPSILON*rmin) { + #ifdef _POLYHEDRON_DEBUG + printf("ignore interaction: r = %0.16f\n", r); + #endif + return interact; + } // include the vertices for interactions @@ -1898,10 +1904,12 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, { int i,n,ifirst,iffirst,npi1,npi2; - double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv; + double xi1[3],xi2[3],u[3],v[3],costheta,anglesum1,anglesum2,magu,magv,rradi; ifirst = dfirst[ibody]; iffirst = facfirst[ibody]; + rradi = rounded_radius[ibody]; + double rradsq = rradi*rradi; anglesum1 = anglesum2 = 0;; for (i = 0; i < MAX_FACE_SIZE; i++) { npi1 = static_cast(face[iffirst+face_index][i]); @@ -1929,7 +1937,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, // the point is at either vertices - if (magu * magv < EPSILON) inside1 = 1; + if (magu * magv < EPSILON*rradsq) inside1 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum1 += acos(costheta); @@ -1940,7 +1948,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); magv = MathExtra::len3(v); - if (magu * magv < EPSILON) inside2 = 1; + if (magu * magv < EPSILON*rradsq) inside2 = 1; else { costheta = MathExtra::dot3(u,v)/(magu*magv); anglesum2 += acos(costheta); @@ -2338,7 +2346,12 @@ void PairBodyRoundedPolyhedron::find_unique_contacts(Contact* contact_list, for (int j = i + 1; j < n; j++) { if (contact_list[i].unique == 0) continue; double d = contact_separation(contact_list[i], contact_list[j]); - if (d < EPSILON) contact_list[j].unique = 0; + int ibody = contact_list[i].ibody; + int jbody = contact_list[i].jbody; + double rradi = rounded_radius[ibody]; + double rradj = rounded_radius[jbody]; + double rmin = MIN(rradi, rradj); + if (d < EPSILON*rmin) contact_list[j].unique = 0; } } } diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index a68aea3e68..da189ccaf5 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -187,10 +187,12 @@ void BondBPM::settings(int narg, char **arg) iarg++; } } else if (strcmp(arg[iarg], "overlay/pair") == 0) { - overlay_flag = 1; + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for overlay/pair"); + overlay_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg++; - } else if (strcmp(arg[iarg], "break/no") == 0) { - break_flag = 0; + } else if (strcmp(arg[iarg], "break") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for break"); + break_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg++; } else { leftover_iarg.push_back(iarg); diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index ac29c0e376..ffb0d9521d 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -50,6 +50,7 @@ BondBPMRotational::BondBPMRotational(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 7; svector = new double[7]; @@ -203,6 +204,13 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, double Ts[3], Tb[3], Tt[3], Tbp[3], Ttp[3], Tsp[3], T_rot[3], Ttmp[3]; double **quat = atom->quat; + double r0_mag_inv = 1.0 / r0_mag; + double Kr_type = Kr[type]; + double Ks_type = Ks[type]; + if (normalize_flag) { + Kr_type *= r0_mag_inv; + Ks_type *= r0_mag_inv; + } q1[0] = quat[i1][0]; q1[1] = quat[i1][1]; @@ -217,26 +225,26 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, // Calculate normal forces, rb = bond vector in particle 1's frame MathExtra::qconjugate(q2, q2inv); MathExtra::quatrotvec(q2inv, r, rb); - Fr = Kr[type] * (r_mag - r0_mag); + Fr = Kr_type * (r_mag - r0_mag); MathExtra::scale3(Fr * r_mag_inv, rb, F_rot); // Calculate forces due to tangential displacements (no rotation) r0_dot_rb = MathExtra::dot3(r0, rb); - c = r0_dot_rb * r_mag_inv / r0_mag; + c = r0_dot_rb * r_mag_inv * r0_mag_inv; gamma = acos_limit(c); MathExtra::cross3(rb, r0, rb_x_r0); MathExtra::cross3(rb, rb_x_r0, s); MathExtra::norm3(s); - MathExtra::scale3(Ks[type] * r_mag * gamma, s, Fs); + MathExtra::scale3(Ks_type * r_mag * gamma, s, Fs); // Calculate torque due to tangential displacements MathExtra::cross3(r0, rb, t); MathExtra::norm3(t); - MathExtra::scale3(0.5 * r_mag * Ks[type] * r_mag * gamma, t, Ts); + MathExtra::scale3(0.5 * r_mag * Ks_type * r_mag * gamma, t, Ts); // Relative rotation force/torque // Use representation of X'Y'Z' rotations from Wang, Mora 2009 @@ -316,12 +324,12 @@ double BondBPMRotational::elastic_forces(int i1, int i2, int type, double r_mag, Ttp[1] = 0.0; Ttp[2] = Kt[type] * psi; - Fsp[0] = -0.5 * Ks[type] * r_mag * theta * cos_phi; - Fsp[1] = -0.5 * Ks[type] * r_mag * theta * sin_phi; + Fsp[0] = -0.5 * Ks_type * r_mag * theta * cos_phi; + Fsp[1] = -0.5 * Ks_type * r_mag * theta * sin_phi; Fsp[2] = 0.0; - Tsp[0] = 0.25 * Ks[type] * r_mag * r_mag * theta * sin_phi; - Tsp[1] = -0.25 * Ks[type] * r_mag * r_mag * theta * cos_phi; + Tsp[0] = 0.25 * Ks_type * r_mag * r_mag * theta * sin_phi; + Tsp[1] = -0.25 * Ks_type * r_mag * r_mag * theta * cos_phi; Tsp[2] = 0.0; // Rotate forces/torques back to 1st particle's frame @@ -667,6 +675,10 @@ void BondBPMRotational::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } @@ -793,7 +805,7 @@ double BondBPMRotational::single(int type, double rsq, int i, int j, double &ffo double breaking = elastic_forces(i, j, type, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2, torque1on2, torque2on1); damping_forces(i, j, type, rhat, r, force1on2, torque1on2, torque2on1); - fforce = MathExtra::dot3(force1on2, r); + fforce = MathExtra::dot3(force1on2, rhat); fforce *= -1; double smooth = 1.0; diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h index 0fb38e7343..9fdc418d2d 100644 --- a/src/BPM/bond_bpm_rotational.h +++ b/src/BPM/bond_bpm_rotational.h @@ -41,7 +41,7 @@ class BondBPMRotational : public BondBPM { protected: double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist; double *Fcr, *Fcs, *Tct, *Tcb; - int smooth_flag; + int smooth_flag, normalize_flag; double elastic_forces(int, int, int, double, double, double, double *, double *, double *, double *, double *, double *); diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index ed4e71daf1..37b79f93fb 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -37,6 +37,7 @@ BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : { partial_flag = 1; smooth_flag = 1; + normalize_flag = 0; single_extra = 1; svector = new double[1]; @@ -190,7 +191,10 @@ void BondBPMSpring::compute(int eflag, int vflag) } rinv = 1.0 / r; - fbond = k[type] * (r0 - r); + if (normalize_flag) + fbond = -k[type] * e; + else + fbond = k[type] * (r0 - r); delvx = v[i1][0] - v[i2][0]; delvy = v[i1][1] - v[i2][1]; @@ -302,6 +306,10 @@ void BondBPMSpring::settings(int narg, char **arg) if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for smooth"); smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); i += 1; + } else if (strcmp(arg[iarg], "normalize") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command, missing option for normalize"); + normalize_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; } else { error->all(FLERR, "Illegal bond bpm command, invalid argument {}", arg[iarg]); } @@ -376,7 +384,11 @@ double BondBPMSpring::single(int type, double rsq, int i, int j, double &fforce) double r = sqrt(rsq); double rinv = 1.0 / r; - fforce = k[type] * (r0 - r); + + if (normalize_flag) + fforce = k[type] * (r0 - r) / r0; + else + fforce = k[type] * (r0 - r); double **x = atom->x; double **v = atom->v; diff --git a/src/BPM/bond_bpm_spring.h b/src/BPM/bond_bpm_spring.h index 409469bef3..93f4b49a26 100644 --- a/src/BPM/bond_bpm_spring.h +++ b/src/BPM/bond_bpm_spring.h @@ -40,7 +40,7 @@ class BondBPMSpring : public BondBPM { protected: double *k, *ecrit, *gamma; - int smooth_flag; + int smooth_flag, normalize_flag; void allocate(); void store_data(); diff --git a/src/COLVARS/colvarproxy_lammps.cpp b/src/COLVARS/colvarproxy_lammps.cpp index eb03c14de7..06a2a23ec0 100644 --- a/src/COLVARS/colvarproxy_lammps.cpp +++ b/src/COLVARS/colvarproxy_lammps.cpp @@ -43,9 +43,10 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp, first_timestep=true; previous_step=-1; - t_target=temp; do_exit=false; + engine_ready_ = false; + // set input restart name and strip the extension, if present input_prefix_str = std::string(inp_name ? inp_name : ""); if (input_prefix_str.rfind(".colvars.state") != std::string::npos) @@ -87,7 +88,7 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp, } -void colvarproxy_lammps::init(const char *conf_file) +void colvarproxy_lammps::init() { version_int = get_version_from_string(COLVARPROXY_VERSION); @@ -102,18 +103,13 @@ void colvarproxy_lammps::init(const char *conf_file) my_angstrom = _lmp->force->angstrom; // Front-end unit is the same as back-end - angstrom_value = my_angstrom; + angstrom_value_ = my_angstrom; // my_kcal_mol = _lmp->force->qe2f / 23.060549; // force->qe2f is 1eV expressed in LAMMPS' energy unit (1 if unit is eV, 23 if kcal/mol) - my_boltzmann = _lmp->force->boltz; + boltzmann_ = _lmp->force->boltz; my_timestep = _lmp->update->dt * _lmp->force->femtosecond; - // TODO move one or more of these to setup() if needed - colvars->read_config_file(conf_file); - colvars->setup_input(); - colvars->setup_output(); - if (_lmp->update->ntimestep != 0) { cvm::log("Setting initial step number from LAMMPS: "+ cvm::to_str(_lmp->update->ntimestep)+"\n"); @@ -123,7 +119,7 @@ void colvarproxy_lammps::init(const char *conf_file) if (cvm::debug()) { cvm::log("atoms_ids = "+cvm::to_str(atoms_ids)+"\n"); - cvm::log("atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n"); + cvm::log("atoms_refcount = "+cvm::to_str(atoms_refcount)+"\n"); cvm::log("atoms_positions = "+cvm::to_str(atoms_positions)+"\n"); cvm::log(cvm::line_marker); cvm::log("Info: done initializing the colvars proxy object.\n"); @@ -154,8 +150,12 @@ colvarproxy_lammps::~colvarproxy_lammps() // re-initialize data where needed int colvarproxy_lammps::setup() { + int error_code = colvarproxy::setup(); my_timestep = _lmp->update->dt * _lmp->force->femtosecond; - return colvars->setup(); + error_code |= colvars->update_engine_parameters(); + error_code |= colvars->setup_input(); + error_code |= colvars->setup_output(); + return error_code; } // trigger colvars computation @@ -222,17 +222,19 @@ double colvarproxy_lammps::compute() if (cvm::debug()) { cvm::log("atoms_ids = "+cvm::to_str(atoms_ids)+"\n"); - cvm::log("atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n"); + cvm::log("atoms_refcount = "+cvm::to_str(atoms_refcount)+"\n"); cvm::log("atoms_positions = "+cvm::to_str(atoms_positions)+"\n"); cvm::log("atoms_new_colvar_forces = "+cvm::to_str(atoms_new_colvar_forces)+"\n"); } - // call the collective variable module - colvars->calc(); + // Call the collective variable module + if (colvars->calc() != COLVARS_OK) { + cvm::error("Error in the collective variables module.\n", COLVARS_ERROR); + } if (cvm::debug()) { cvm::log("atoms_ids = "+cvm::to_str(atoms_ids)+"\n"); - cvm::log("atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n"); + cvm::log("atoms_refcount = "+cvm::to_str(atoms_refcount)+"\n"); cvm::log("atoms_positions = "+cvm::to_str(atoms_positions)+"\n"); cvm::log("atoms_new_colvar_forces = "+cvm::to_str(atoms_new_colvar_forces)+"\n"); } @@ -384,7 +386,7 @@ int colvarproxy_lammps::init_atom(int atom_number) for (size_t i = 0; i < atoms_ids.size(); i++) { if (atoms_ids[i] == aid) { // this atom id was already recorded - atoms_ncopies[i] += 1; + atoms_refcount[i] += 1; return i; } } diff --git a/src/COLVARS/colvarproxy_lammps.h b/src/COLVARS/colvarproxy_lammps.h index 338f64fa86..0fc9f1ba12 100644 --- a/src/COLVARS/colvarproxy_lammps.h +++ b/src/COLVARS/colvarproxy_lammps.h @@ -33,7 +33,7 @@ class colvarproxy_lammps : public colvarproxy { LAMMPS_NS::RanPark *_random; // state of LAMMPS properties - double t_target, my_timestep, my_boltzmann, my_angstrom; + double my_timestep, my_angstrom; double bias_energy; int previous_step; @@ -50,7 +50,7 @@ class colvarproxy_lammps : public colvarproxy { colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp, const char *, const char *, const int, const double, MPI_Comm); ~colvarproxy_lammps() override; - void init(const char *); + void init(); int setup() override; // disable default and copy constructor @@ -60,7 +60,7 @@ class colvarproxy_lammps : public colvarproxy { // methods for lammps to move data or trigger actions in the proxy public: - void set_temperature(double t) { t_target = t; }; + bool total_forces_enabled() const override { return total_force_requested; }; bool total_forces_same_step() const override { return true; }; bool want_exit() const { return do_exit; }; @@ -86,10 +86,6 @@ class colvarproxy_lammps : public colvarproxy { // Request to set the units used internally by Colvars int set_unit_system(std::string const &units_in, bool check_only) override; - inline cvm::real backend_angstrom_value() override { return my_angstrom; }; - - inline cvm::real boltzmann() override { return my_boltzmann; }; - inline cvm::real temperature() override { return t_target; }; inline cvm::real dt() override { return my_timestep; @@ -101,8 +97,7 @@ class colvarproxy_lammps : public colvarproxy { void log(std::string const &message) override; void error(std::string const &message) override; - cvm::rvector position_distance(cvm::atom_pos const &pos1, - cvm::atom_pos const &pos2) const override; + cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const override; cvm::real rand_gaussian(void) override { return _random->gaussian(); }; diff --git a/src/COLVARS/colvarproxy_lammps_version.h b/src/COLVARS/colvarproxy_lammps_version.h index b0f8965fb0..4228740554 100644 --- a/src/COLVARS/colvarproxy_lammps_version.h +++ b/src/COLVARS/colvarproxy_lammps_version.h @@ -1,3 +1,3 @@ #ifndef COLVARPROXY_VERSION -#define COLVARPROXY_VERSION "2022-05-09" +#define COLVARPROXY_VERSION "2023-04-12" #endif diff --git a/src/COLVARS/fix_colvars.cpp b/src/COLVARS/fix_colvars.cpp index 0fd7bc9857..baf0209c61 100644 --- a/src/COLVARS/fix_colvars.cpp +++ b/src/COLVARS/fix_colvars.cpp @@ -443,7 +443,9 @@ void FixColvars::one_time_init() } proxy = new colvarproxy_lammps(lmp,inp_name,out_name,rng_seed,t_target,root2root); - proxy->init(conf_file); + proxy->init(); + proxy->add_config("configfile", conf_file); + proxy->parse_module_config(); num_coords = (proxy->modify_atom_positions()->size()); } @@ -677,16 +679,16 @@ void FixColvars::post_force(int /*vflag*/) error->one(FLERR,"Run aborted on request from colvars module.\n"); if (!tstat_fix) { - proxy->set_temperature(0.0); + proxy->set_target_temperature(0.0); } else { int tmp; // get thermostat target temperature from corresponding fix, // if the fix supports extraction. double *tt = (double *) tstat_fix->extract("t_target", tmp); if (tt) - proxy->set_temperature(*tt); + proxy->set_target_temperature(*tt); else - proxy->set_temperature(0.0); + proxy->set_target_temperature(0.0); } } diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index 010e5bcb7d..426248b31e 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -90,8 +90,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : ztype[i] = j; } } - if (ztype[i] == XRDmaxType + 1) - error->all(FLERR,"Compute XRD: Invalid ASF atom type"); + if (ztype[i] == XRDmaxType + 1) error->all(FLERR,"Compute XRD: Invalid ASF atom type {}", arg[iarg]); iarg++; } diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index 2687a11658..f7afddc64f 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -476,16 +476,14 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) utils::sfgets(FLERR,line,MAXLINE,fp,file,error); nwords = utils::count_words(utils::trim_comment(line)); - if (nwords != nspecies+2) { - printf("nwords=%d nspecies=%d\n",nwords,nspecies); - error->all(FLERR,"Illegal fix eos/table/rx command"); - } - nwords = 0; + if (nwords != nspecies+2) + error->all(FLERR,"Illegal fix eos/table/rx command: nwords={} nspecies={}", nwords, nspecies); + word = strtok(line," \t\n\r\f"); word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); - for (int icolumn=0;icolumn FixElectrodeConp::ele_ele_interaction(const std::vector &q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); assert(algo == Algo::CG || algo == Algo::MATRIX_CG); if (algo == Algo::CG) { set_charges(q_local); @@ -873,7 +873,7 @@ std::vector FixElectrodeConp::ele_ele_interaction(const std::vector q_local) { - assert((int)q_local.size() == nlocalele); + assert((int) q_local.size() == nlocalele); double *q = atom->q; for (int i = 0; i < nlocalele; i++) q[atom->map(taglist_local[i])] = q_local[i]; comm->forward_comm(this); @@ -942,7 +942,7 @@ std::vector FixElectrodeConp::scale_vector(double alpha, std::vector FixElectrodeConp::add_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); for (int i = 0; i < nlocalele; i++) a[i] += b[i]; return a; } @@ -951,7 +951,7 @@ std::vector FixElectrodeConp::add_nlocalele(std::vector a, std:: double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector b) { - assert(((int)a.size() == nlocalele) && ((int)b.size() == nlocalele)); + assert(((int) a.size() == nlocalele) && ((int) b.size() == nlocalele)); double out = 0.; for (int i = 0; i < nlocalele; i++) out += a[i] * b[i]; MPI_Allreduce(MPI_IN_PLACE, &out, 1, MPI_DOUBLE, MPI_SUM, world); @@ -962,7 +962,7 @@ double FixElectrodeConp::dot_nlocalele(std::vector a, std::vector FixElectrodeConp::times_elastance(std::vector x) { - assert((int)x.size() == ngroup); + assert((int) x.size() == ngroup); auto out = std::vector(nlocalele, 0.); for (int i = 0; i < nlocalele; i++) { double *_noalias row = elastance[list_iele[i]]; @@ -1209,8 +1209,8 @@ FixElectrodeConp::~FixElectrodeConp() } catch (std::exception &) { } } - if (!modify->get_fix_by_id(id)) // avoid segfault if derived fixes' ctor throws err - atom->delete_callback(id, Atom::GROW); // atomvec track local electrode atoms + + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); delete[] recvcounts; delete[] displs; @@ -1412,7 +1412,7 @@ void FixElectrodeConp::gather_list_iele() } } nlocalele = static_cast(taglist_local.size()); // just for safety - assert((int)iele_to_group_local.size() == nlocalele); + assert((int) iele_to_group_local.size() == nlocalele); if (matrix_algo) { MPI_Allgather(&nlocalele, 1, MPI_INT, recvcounts, 1, MPI_INT, world); diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index bd7b19cced..0380acbb82 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -14,12 +14,15 @@ #include "compute_stress_cartesian.h" #include "atom.h" +#include "bond.h" #include "citeme.h" #include "comm.h" #include "domain.h" #include "error.h" +#include "fix.h" #include "force.h" #include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" @@ -57,17 +60,14 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg pcxx(nullptr), pcyy(nullptr), pczz(nullptr), tdens(nullptr), tpkxx(nullptr), tpkyy(nullptr), tpkzz(nullptr), tpcxx(nullptr), tpcyy(nullptr), tpczz(nullptr), list(nullptr) { - if (lmp->citeme) lmp->citeme->add(cite_compute_stress_cartesian); - // narg == 5 for one-dimensional and narg == 7 for two-dimensional - if (narg == 5) - dims = 1; - else if (narg == 7) - dims = 2; - else - error->all(FLERR, "Illegal compute stress/cartesian command. Illegal number of arguments."); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/cartesian", error); + // no triclinic boxes + if (domain->triclinic) error->all(FLERR, "Compute stress/cartesian requires an orthogonal box"); + + // Direction of first dimension if (strcmp(arg[3], "x") == 0) dir1 = 0; else if (strcmp(arg[3], "y") == 0) @@ -75,28 +75,34 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg else if (strcmp(arg[3], "z") == 0) dir1 = 2; else - error->all(FLERR, "Illegal compute stress/cartesian command."); + error->all(FLERR, "Illegal compute stress/cartesian direction: {}", arg[3]); - dir2 = 0; bin_width1 = utils::numeric(FLERR, arg[4], false, lmp); - bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; nbins1 = (int) ((domain->boxhi[dir1] - domain->boxlo[dir1]) / bin_width1); - nbins2 = 1; // adjust bin width if not a perfect match double tmp_binwidth = (domain->boxhi[dir1] - domain->boxlo[dir1]) / nbins1; if ((fabs(tmp_binwidth - bin_width1) > SMALL) && (comm->me == 0)) - utils::logmesg(lmp, "Adjusting second bin width for compute {} from {:.6f} to {:.6f}\n", style, + utils::logmesg(lmp, "Adjusting first bin width for compute {} from {:.6f} to {:.6f}\n", style, bin_width1, tmp_binwidth); bin_width1 = tmp_binwidth; + invV = bin_width1; if (bin_width1 <= 0.0) - error->all(FLERR, "Illegal compute stress/cartesian command. Bin width must be > 0"); + error->all(FLERR, "Illegal compute stress/cartesian command. First bin width must be > 0"); else if (bin_width1 > domain->boxhi[dir1] - domain->boxlo[dir1]) - error->all(FLERR, "Illegal compute stress/cartesian command. Bin width larger than box."); + error->all(FLERR, "Illegal compute stress/cartesian command. First bin width > box."); - invV = bin_width1; - if (dims == 2) { + // Direction of second dimension + if (strcmp(arg[5], "NULL") == 0) { + dims = 1; + dir2 = 0; + bin_width2 = domain->boxhi[dir2] - domain->boxlo[dir2]; + nbins2 = 1; + } else { + dims = 2; + + // Direction of first dimension if (strcmp(arg[5], "x") == 0) dir2 = 0; else if (strcmp(arg[5], "y") == 0) @@ -104,7 +110,7 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg else if (strcmp(arg[5], "z") == 0) dir2 = 2; else - error->all(FLERR, "Illegal compute stress/cartesian command."); + error->all(FLERR, "Illegal compute stress/cartesian direction {}", arg[5]); bin_width2 = utils::numeric(FLERR, arg[6], false, lmp); nbins2 = (int) ((domain->boxhi[dir2] - domain->boxlo[dir2]) / bin_width2); @@ -119,9 +125,49 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg invV *= bin_width2; if (bin_width2 <= 0.0) - error->all(FLERR, "Illegal compute stress/cartesian command. Bin width must be > 0"); + error->all(FLERR, "Illegal compute stress/cartesian command. Second bin width must be > 0"); else if (bin_width2 > domain->boxhi[dir2] - domain->boxlo[dir2]) - error->all(FLERR, "Illegal compute stress/cartesian command. Bin width larger than box"); + error->all(FLERR, "Illegal compute stress/cartesian command. Second bin width > box"); + } + + // check for overflow + if (((bigint) nbins1 * nbins2) > MAXSMALLINT) + error->all(FLERR, "Too many bins in compute stress/cartesian"); + + // check for variable box dimension + int box_incompatible = 0; + for (auto ifix : modify->get_fix_list()) { + if (((dir1 == 0) && (ifix->box_change & Fix::BOX_CHANGE_X)) || + ((dir1 == 1) && (ifix->box_change & Fix::BOX_CHANGE_Y)) || + ((dir1 == 2) && (ifix->box_change & Fix::BOX_CHANGE_Z))) + box_incompatible = 1; + if (dims == 2) { + if (((dir2 == 0) && (ifix->box_change & Fix::BOX_CHANGE_X)) || + ((dir2 == 1) && (ifix->box_change & Fix::BOX_CHANGE_Y)) || + ((dir2 == 2) && (ifix->box_change & Fix::BOX_CHANGE_Z))) + box_incompatible = 1; + } + } + if (box_incompatible) + error->all(FLERR, "Must not use compute stress/cartesian on variable box dimension"); + + // process optional args + if (narg > 7) { + compute_ke = false; + compute_pair = false; + compute_bond = false; + int iarg = 7; + while (iarg < narg) { + if (strcmp(arg[iarg], "ke") == 0) + compute_ke = true; + else if (strcmp(arg[iarg], "pair") == 0) + compute_pair = true; + else if (strcmp(arg[iarg], "bond") == 0) + compute_bond = true; + else + error->all(FLERR, "Unknown compute stress/cartesian keyword: {}", arg[iarg]); + iarg++; + } } for (int i = 0; i < 3; i++) @@ -204,13 +250,6 @@ void ComputeStressCartesian::init_list(int /* id */, NeighList *ptr) void ComputeStressCartesian::compute_array() { - int i, j, ii, jj, inum, jnum, itype, jtype; - int bin, bin1, bin2; - tagint itag, jtag; - double xtmp, ytmp, ztmp, delx, dely, delz; - double rsq, fpair, factor_coul, factor_lj; - int *ilist, *jlist, *numneigh, **firstneigh; - double **x = atom->x; double **v = atom->v; double *mass = atom->mass; @@ -221,17 +260,18 @@ void ComputeStressCartesian::compute_array() double *special_coul = force->special_coul; double *special_lj = force->special_lj; int newton_pair = force->newton_pair; + double *boxlo = domain->boxlo; // invoke half neighbor list (will copy or build if necessary) neighbor->build_one(list); - inum = list->inum; - ilist = list->ilist; - numneigh = list->numneigh; - firstneigh = list->firstneigh; + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; // Zero arrays - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] = 0; tpkxx[bin] = 0; tpkyy[bin] = 0; @@ -242,84 +282,129 @@ void ComputeStressCartesian::compute_array() } // calculate number density and kinetic contribution to pressure - for (i = 0; i < nlocal; i++) { - bin1 = (int) (x[i][dir1] / bin_width1) % nbins1; - bin2 = 0; - if (dims == 2) bin2 = (int) (x[i][dir2] / bin_width2) % nbins2; + if (compute_ke) { + for (int i = 0; i < nlocal; i++) { + int bin1 = (int) ((x[i][dir1] - boxlo[dir1]) / bin_width1) % nbins1; + int bin2 = 0; + if (dims == 2) bin2 = (int) ((x[i][dir2] - boxlo[dir2]) / bin_width2) % nbins2; - j = bin1 + bin2 * nbins1; - tdens[j] += 1; - tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; - tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; - tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + // Apply periodic boundary conditions and avoid out of range access + if (domain->periodicity[dir1] == 1) { + if (bin1 < 0) + bin1 = (bin1 + nbins1) % nbins1; + else if (bin1 >= nbins1) + bin1 = (bin1 - nbins1) % nbins1; + } else if (bin1 < 0) + bin1 = 0; + else if (bin1 >= nbins1) + bin1 = nbins1 - 1; + + if (domain->periodicity[dir2] == 1) { + if (bin2 < 0) + bin2 = (bin2 + nbins2) % nbins2; + else if (bin2 >= nbins2) + bin2 = (bin2 - nbins2) % nbins2; + } else if (bin2 < 0) + bin2 = 0; + else if (bin2 >= nbins2) + bin2 = nbins2 - 1; + + int j = bin1 + bin2 * nbins1; + tdens[j] += 1; + tpkxx[j] += mass[type[i]] * v[i][0] * v[i][0]; + tpkyy[j] += mass[type[i]] * v[i][1] * v[i][1]; + tpkzz[j] += mass[type[i]] * v[i][2] * v[i][2]; + } } // loop over neighbors of my atoms - // skip if I or J are not in group - // for newton = 0 and J = ghost atom, - // need to ensure I,J pair is only output by one proc - // use same itag,jtag logic as in Neighbor::neigh_half_nsq() - // for flag = 0, just count pair interactions within force cutoff - // for flag = 1, calculate requested output fields + if (compute_pair && force->pair) { + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; - Pair *pair = force->pair; - double **cutsq = force->pair->cutsq; + // skip if I or J are not in group + if (!(mask[i] & groupbit)) continue; - double xi1, xi2; + double xi1 = x[i][dir1] - boxlo[dir1]; + double xi2 = x[i][dir2] - boxlo[dir2]; - for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; - if (!(mask[i] & groupbit)) continue; + for (int jj = 0; jj < numneigh[i]; jj++) { + int j = firstneigh[i][jj]; + double factor_lj = special_lj[sbmask(j)]; + double factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + if (!(mask[j] & groupbit)) continue; - xtmp = x[i][0]; - ytmp = x[i][1]; - ztmp = x[i][2]; - xi1 = x[i][dir1]; - xi2 = x[i][dir2]; - itag = tag[i]; - itype = type[i]; - jlist = firstneigh[i]; - jnum = numneigh[i]; - - for (jj = 0; jj < jnum; jj++) { - j = jlist[jj]; - factor_lj = special_lj[sbmask(j)]; - factor_coul = special_coul[sbmask(j)]; - j &= NEIGHMASK; - if (!(mask[j] & groupbit)) continue; - - // itag = jtag is possible for long cutoffs that include images of self - // do calculation only on appropriate processor - if (newton_pair == 0 && j >= nlocal) { - jtag = tag[j]; - if (itag > jtag) { - if ((itag + jtag) % 2 == 0) continue; - } else if (itag < jtag) { - if ((itag + jtag) % 2 == 1) continue; - } else { - if (x[j][2] < ztmp) continue; - if (x[j][2] == ztmp) { - if (x[j][1] < ytmp) continue; - if (x[j][1] == ytmp && x[j][0] < xtmp) continue; + // for newton = 0 and J = ghost atom, need to ensure I,J pair is only output by one proc + // use same tag[i],tag[j] logic as in Neighbor::neigh_half_nsq() + if (newton_pair == 0 && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] + tag[j]) % 2 == 1) continue; + } else { + // tag[i] = tag[j] is possible for long cutoffs that include images of self + if (x[j][2] < x[i][2]) continue; + if (x[j][2] == x[i][2]) { + if (x[j][1] < x[i][1]) continue; + if (x[j][1] == x[i][1] && x[j][0] < x[i][0]) continue; + } } } + + double delx = x[j][0] - x[i][0]; + double dely = x[j][1] - x[i][1]; + double delz = x[j][2] - x[i][2]; + double rsq = delx * delx + dely * dely + delz * delz; + + // Check if inside cut-off + int itype = type[i]; + int jtype = type[j]; + if (rsq >= force->pair->cutsq[itype][jtype]) continue; + + double fpair; + force->pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); + compute_pressure(fpair, xi1, xi2, delx, dely, delz); } - delx = x[j][0] - xtmp; - dely = x[j][1] - ytmp; - delz = x[j][2] - ztmp; + } + } - rsq = delx * delx + dely * dely + delz * delz; - jtype = type[j]; + // Loop over all bonds + if (compute_bond && force->bond) { + for (int i_bond = 0; i_bond < neighbor->nbondlist; i_bond++) { + // i == atom1, j == atom2 + int i = neighbor->bondlist[i_bond][0]; + int j = neighbor->bondlist[i_bond][1]; + int btype = neighbor->bondlist[i_bond][2]; - // Check if inside cut-off - if (rsq >= cutsq[itype][jtype]) continue; - pair->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fpair); - compute_pressure(fpair, xi1, xi2, delx, dely, delz); + // Skip if one of both atoms is not in group + if (!(mask[i] & groupbit)) continue; + if (!(mask[j] & groupbit)) continue; + + // if newton_bond is off and atom2 is a ghost atom, only compute this on one processor + if (!force->newton_bond && j >= nlocal) { + if (tag[i] > tag[j]) { + if ((tag[i] + tag[j]) % 2 == 0) continue; + } else if (tag[i] < tag[j]) { + if ((tag[i] < tag[j]) % 2 == 1) continue; + } + } + + double dx = x[j][0] - x[i][0]; + double dy = x[j][1] - x[i][1]; + double dz = x[j][2] - x[i][2]; + double rsq = dx * dx + dy * dy + dz * dz; + double xi = x[i][dir1] - boxlo[dir1]; + double yi = x[i][dir2] - boxlo[dir2]; + + double fbond; + force->bond->single(btype, rsq, i, j, fbond); + compute_pressure(fbond, xi, yi, dx, dy, dz); } } // normalize pressure - for (bin = 0; bin < nbins1 * nbins2; bin++) { + for (int bin = 0; bin < nbins1 * nbins2; bin++) { tdens[bin] *= invV; tpkxx[bin] *= invV; tpkyy[bin] *= invV; @@ -339,9 +424,9 @@ void ComputeStressCartesian::compute_array() MPI_Allreduce(tpczz, pczz, nbins1 * nbins2, MPI_DOUBLE, MPI_SUM, world); // populate array to output. - for (bin = 0; bin < nbins1 * nbins2; bin++) { - array[bin][0] = (bin % nbins1 + 0.5) * bin_width1; - if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2; + for (int bin = 0; bin < nbins1 * nbins2; bin++) { + array[bin][0] = (bin % nbins1 + 0.5) * bin_width1 + boxlo[dir1]; + if (dims == 2) array[bin][1] = ((int) (bin / nbins1) + 0.5) * bin_width2 + boxlo[dir2]; array[bin][0 + dims] = dens[bin]; array[bin][1 + dims] = pkxx[bin]; array[bin][2 + dims] = pkyy[bin]; @@ -355,25 +440,26 @@ void ComputeStressCartesian::compute_array() void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi, double delx, double dely, double delz) { - int bin1, bin2, next_bin1, next_bin2; double la = 0.0, lb = 0.0, l_sum = 0.0; double rij[3] = {delx, dely, delz}; - double l1 = 0.0, l2, rij1, rij2; - rij1 = rij[dir1]; - rij2 = rij[dir2]; + double rij1 = rij[dir1]; + double rij2 = rij[dir2]; - next_bin1 = (int) floor(xi / bin_width1); - next_bin2 = (int) floor(yi / bin_width2); + int next_bin1 = (int) floor(xi / bin_width1); + int next_bin2 = (int) floor(yi / bin_width2); // Integrating along line while (lb < 1.0) { - bin1 = next_bin1; - bin2 = next_bin2; + int bin1 = next_bin1; + int bin2 = next_bin2; + double l1; if (rij1 > 0) l1 = ((bin1 + 1) * bin_width1 - xi) / rij1; else l1 = (bin1 * bin_width1 - xi) / rij1; + + double l2; if (rij2 > 0) l2 = ((bin2 + 1) * bin_width2 - yi) / rij2; else diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.h b/src/EXTRA-COMPUTE/compute_stress_cartesian.h index 0954d9ca71..40f2e9d4af 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.h +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.h @@ -36,6 +36,9 @@ class ComputeStressCartesian : public Compute { private: int nbins1, nbins2, dir1, dir2, dims; double bin_width1, bin_width2, invV; + bool compute_ke = true; + bool compute_pair = true; + bool compute_bond = true; // Number density, kinetic and configurational contribution to the pressure. double *dens, *pkxx, *pkyy, *pkzz, *pcxx, *pcyy, *pczz; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 60f2d76e06..98e3bf7043 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,15 +13,21 @@ /*------------------------------------------------------------------------ Contributing Authors : Romain Vermorel (LFCR), Laurent Joly (ULyon) + Support for bonds and angles added by : Evangelos Voyiatzis (NovaMechanics) --------------------------------------------------------------------------*/ #include "compute_stress_mop.h" +#include "angle.h" #include "atom.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" #include "domain.h" #include "error.h" #include "force.h" #include "memory.h" +#include "molecule.h" #include "neigh_list.h" #include "neighbor.h" #include "pair.h" @@ -33,40 +38,52 @@ using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{TOTAL,CONF,KIN}; - -#define BIG 1000000000 +enum { X, Y, Z }; +enum { TOTAL, CONF, KIN, PAIR, BOND, ANGLE }; +// clang-format off /* ---------------------------------------------------------------------- */ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 6) error->all(FLERR,"Illegal compute stress/mop command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "compute stress/mop", error); - MPI_Comm_rank(world,&me); + bondflag = 0; + angleflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3],"x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3],"y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3],"z") == 0) { dir = Z; } else error->all(FLERR,"Illegal compute stress/mop command"); // Position of the plane - if (strcmp(arg[4],"lower")==0) { + if (strcmp(arg[4],"lower") == 0) { pos = domain->boxlo[dir]; - } else if (strcmp(arg[4],"upper")==0) { + } else if (strcmp(arg[4],"upper") == 0) { pos = domain->boxhi[dir]; - } else if (strcmp(arg[4],"center")==0) { + } else if (strcmp(arg[4],"center") == 0) { pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); } else pos = utils::numeric(FLERR,arg[4],false,lmp); + // plane inside the box + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) { + error->warning(FLERR, "The specified initial plane lies outside of the simulation box"); + double dx[3] = {0.0, 0.0, 0.0}; + dx[dir] = pos - 0.5*(domain->boxhi[dir] + domain->boxlo[dir]); + domain->minimum_image(dx[0], dx[1], dx[2]); + pos = 0.5*(domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; + + if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) + error->all(FLERR, "Plane for compute stress/mop is out of bounds"); + } + if (pos < (domain->boxlo[dir]+domain->prd_half[dir])) { pos1 = pos + domain->prd[dir]; } else { @@ -96,34 +113,53 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : which[nvalues] = TOTAL; nvalues++; } + } else if (strcmp(arg[iarg],"pair") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg],"bond") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = BOND; + nvalues++; + } + } else if (strcmp(arg[iarg],"angle") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = ANGLE; + nvalues++; + } } else error->all(FLERR, "Illegal compute stress/mop command"); //break; iarg++; } - // Error check + // Error checks // 3D only - if (domain->dimension < 3) - error->all(FLERR, "Compute stress/mop incompatible with simulation dimension"); + if (domain->dimension != 3) + error->all(FLERR, "Compute stress/mop requires a 3d system"); // orthogonal simulation box if (domain->triclinic != 0) - error->all(FLERR, "Compute stress/mop incompatible with triclinic simulation box"); - // plane inside the box - if (pos >domain->boxhi[dir] || pos boxlo[dir]) - error->all(FLERR, "Plane for compute stress/mop is out of bounds"); - + error->all(FLERR, "Compute stress/mop is incompatible with triclinic simulation box"); // Initialize some variables values_local = values_global = vector = nullptr; + bond_local = nullptr; + bond_global = nullptr; + angle_local = nullptr; + angle_global = nullptr; // this fix produces a global vector memory->create(vector,nvalues,"stress/mop:vector"); - memory->create(values_local,nvalues,"stress/mop/spatial:values_local"); - memory->create(values_global,nvalues,"stress/mop/spatial:values_global"); + memory->create(values_local,nvalues,"stress/mop:values_local"); + memory->create(values_global,nvalues,"stress/mop:values_global"); + memory->create(bond_local,nvalues,"stress/mop:bond_local"); + memory->create(bond_global,nvalues,"stress/mop:bond_global"); + memory->create(angle_local,nvalues,"stress/mop:angle_local"); + memory->create(angle_global,nvalues,"stress/mop:angle_global"); size_vector = nvalues; vector_flag = 1; @@ -135,11 +171,14 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : ComputeStressMop::~ComputeStressMop() { - - delete [] which; + delete[] which; memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); + memory->destroy(angle_local); + memory->destroy(angle_global); memory->destroy(vector); } @@ -169,31 +208,39 @@ void ComputeStressMop::init() // Compute stress/mop requires fixed simulation box if (domain->box_change_size || domain->box_change_shape || domain->deform_flag) - error->all(FLERR, "Compute stress/mop requires a fixed simulation box"); + error->all(FLERR, "Compute stress/mop requires a fixed size simulation box"); // This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) + if (!force->pair) error->all(FLERR,"No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); - // Warnings + // Errors - if (me==0) { + if (comm->me == 0) { - //Compute stress/mop only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // issue an error for unimplemented intramolecular potentials or Kspace. - if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for bond potentials"); - if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for angle potentials"); - if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=nullptr) + if (force->bond) bondflag = 1; + if (force->angle) { + if (force->angle->born_matrix_enable == 0) { + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for angle potentials"); + } else { + angleflag = 1; + } + } + if (force->dihedral) { + if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for dihedral potentials"); + } + if (force->improper) { + if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR,"compute stress/mop does not account for improper potentials"); + } + if (force->kspace) error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } @@ -221,14 +268,31 @@ void ComputeStressMop::compute_vector() compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(values_local,values_global,nvalues, - MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(values_local,values_global,nvalues,MPI_DOUBLE,MPI_SUM,world); - int m; - for (m=0; mpos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; - } - else if (((xi[dir]pos)) || ((xi[dir]pos1))) { - + } else if (((xi[dir] < pos) && (xj[dir] > pos)) || ((xi[dir] < pos1) && (xj[dir] > pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] -= fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] -= fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] -= fpair*(xi[2]-xj[2])/area*nktv2p; } - } else { - - if (((xi[dir]>pos) && (xj[dir]pos1) && (xj[dir] pos) && (xj[dir] < pos)) || ((xi[dir] > pos1) && (xj[dir] < pos1))) { pair->single(i,j,itype,jtype,rsq,factor_coul,factor_lj,fpair); - values_local[m] += fpair*(xi[0]-xj[0])/area*nktv2p; values_local[m+1] += fpair*(xi[1]-xj[1])/area*nktv2p; values_local[m+2] += fpair*(xi[2]-xj[2])/area*nktv2p; } - } - } - } - } // Compute kinetic contribution to pressure // counts local particles transfers across the plane - if (which[m] == KIN || which[m] == TOTAL) { + if ((which[m] == KIN) || (which[m] == TOTAL)) { double sgn; for (int i = 0; i < nlocal; i++) { @@ -383,13 +434,13 @@ void ComputeStressMop::compute_pairs() //coordinates at t-dt (based on Velocity-Verlet alg.) if (rmass) { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/rmass[i]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/rmass[i]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/rmass[i]*dt*dt*ftm2v; + xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/rmass[i]*dt*dt*ftm2v; + xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/rmass[i]*dt*dt*ftm2v; + xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/rmass[i]*dt*dt*ftm2v; } else { - xj[0] = xi[0]-vi[0]*dt+fi[0]/2/mass[itype]*dt*dt*ftm2v; - xj[1] = xi[1]-vi[1]*dt+fi[1]/2/mass[itype]*dt*dt*ftm2v; - xj[2] = xi[2]-vi[2]*dt+fi[2]/2/mass[itype]*dt*dt*ftm2v; + xj[0] = xi[0]-vi[0]*dt+fi[0]/2.0/mass[itype]*dt*dt*ftm2v; + xj[1] = xi[1]-vi[1]*dt+fi[1]/2.0/mass[itype]*dt*dt*ftm2v; + xj[2] = xi[2]-vi[2]*dt+fi[2]/2.0/mass[itype]*dt*dt*ftm2v; } // because LAMMPS does not put atoms back in the box @@ -399,21 +450,21 @@ void ComputeStressMop::compute_pairs() double pos_temp = pos+copysign(1.0,domain->prd_half[dir]-pos)*domain->prd[dir]; if (fabs(xi[dir]-pos)x; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; + + // initialization + for (int i = 0; i < nvalues; i++) bond_local[i] = 0.0; + + // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) && (tau >= 0)) { + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[0] += sgn*fpair*dx[0]/area*nktv2p; + local_contribution[1] += sgn*fpair*dx[1]/area*nktv2p; + local_contribution[2] += sgn*fpair*dx[2]/area*nktv2p; + } + } + } + + // loop over the keywords and if necessary add the bond contribution + int m = 0; + while (mx; + tagint *tag = atom->tag; + int *num_angle = atom->num_angle; + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; + int **angle_type = atom->angle_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int molecular = atom->molecular; + + // loop over all atoms and their angles + + Angle *angle = force->angle; + + double duang, du2ang; + double dx[3] = {0.0, 0.0, 0.0}; + double dx_left[3] = {0.0, 0.0, 0.0}; + double dx_right[3] = {0.0, 0.0, 0.0}; + double x_angle_left[3] = {0.0, 0.0, 0.0}; + double x_angle_middle[3] = {0.0, 0.0, 0.0}; + double x_angle_right[3] = {0.0, 0.0, 0.0}; + double dcos_theta[3] = {0.0, 0.0, 0.0}; + double local_contribution[3] = {0.0, 0.0, 0.0}; + + // initialization + for (int i = 0; i < nvalues; i++) angle_local[i] = 0.0; + + for (atom2 = 0; atom2 < nlocal; atom2++) { + if (!(mask[atom2] & groupbit)) continue; + + if (molecular == 1) + na = num_angle[atom2]; + else { + if (molindex[atom2] < 0) continue; + imol = molindex[atom2]; + iatom = molatom[atom2]; + na = onemols[imol]->num_angle[iatom]; + } + + for (int i = 0; i < na; i++) { + if (molecular == 1) { + if (tag[atom2] != angle_atom2[atom2][i]) continue; + atype = angle_type[atom2][i]; + atom1 = atom->map(angle_atom1[atom2][i]); + atom3 = atom->map(angle_atom3[atom2][i]); + } else { + if (tag[atom2] != onemols[imol]->angle_atom2[atom2][i]) continue; + atype = onemols[imol]->angle_type[atom2][i]; + tagprev = tag[atom2] - iatom - 1; + atom1 = atom->map(onemols[imol]->angle_atom1[atom2][i] + tagprev); + atom3 = atom->map(onemols[imol]->angle_atom3[atom2][i] + tagprev); + } + + if (atom1 < 0 || !(mask[atom1] & groupbit)) continue; + if (atom3 < 0 || !(mask[atom3] & groupbit)) continue; + if (atype <= 0) continue; + + // minimum image of atom1 with respect to the plane of interest + dx[0] = x[atom1][0]; + dx[1] = x[atom1][1]; + dx[2] = x[atom1][2]; + dx[dir] -= pos; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_angle_left[0] = dx[0]; + x_angle_left[1] = dx[1]; + x_angle_left[2] = dx[2]; + x_angle_left[dir] += pos; + // minimum image of atom2 with respect to atom1 + dx_left[0] = x[atom2][0] - x_angle_left[0]; + dx_left[1] = x[atom2][1] - x_angle_left[1]; + dx_left[2] = x[atom2][2] - x_angle_left[2]; + domain->minimum_image(dx_left[0], dx_left[1], dx_left[2]); + x_angle_middle[0] = x_angle_left[0] + dx_left[0]; + x_angle_middle[1] = x_angle_left[1] + dx_left[1]; + x_angle_middle[2] = x_angle_left[2] + dx_left[2]; + + // minimum image of atom3 with respect to atom2 + dx_right[0] = x[atom3][0] - x_angle_middle[0]; + dx_right[1] = x[atom3][1] - x_angle_middle[1]; + dx_right[2] = x[atom3][2] - x_angle_middle[2]; + domain->minimum_image(dx_right[0], dx_right[1], dx_right[2]); + x_angle_right[0] = x_angle_middle[0] + dx_right[0]; + x_angle_right[1] = x_angle_middle[1] + dx_right[1]; + x_angle_right[2] = x_angle_middle[2] + dx_right[2]; + + // check if any bond vector crosses the plane of interest + double tau_right = (x_angle_right[dir] - pos) / (x_angle_right[dir] - x_angle_middle[dir]); + double tau_left = (x_angle_middle[dir] - pos) / (x_angle_middle[dir] - x_angle_left[dir]); + bool right_cross = ((tau_right >=0) && (tau_right <= 1)); + bool left_cross = ((tau_left >=0) && (tau_left <= 1)); + + // no bonds crossing the plane + if (!right_cross && !left_cross) continue; + + // compute the cos(theta) of the angle + r1 = sqrt(dx_left[0]*dx_left[0] + dx_left[1]*dx_left[1] + dx_left[2]*dx_left[2]); + r2 = sqrt(dx_right[0]*dx_right[0] + dx_right[1]*dx_right[1] + dx_right[2]*dx_right[2]); + cos_theta = -(dx_right[0]*dx_left[0] + dx_right[1]*dx_left[1] + dx_right[2]*dx_left[2])/(r1*r2); + + if (cos_theta > 1.0) cos_theta = 1.0; + if (cos_theta < -1.0) cos_theta = -1.0; + + // The method returns derivative with regards to cos(theta) + angle->born_matrix(atype, atom1, atom2, atom3, duang, du2ang); + // only right bond crossing the plane + if (right_cross && !left_cross) + { + double sgn = copysign(1.0, x_angle_right[dir] - pos); + dcos_theta[0] = sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; + dcos_theta[1] = sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; + dcos_theta[2] = sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; + } + + // only left bond crossing the plane + if (!right_cross && left_cross) + { + double sgn = copysign(1.0, x_angle_left[dir] - pos); + dcos_theta[0] = -sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; + dcos_theta[1] = -sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; + dcos_theta[2] = -sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; + } + + // both bonds crossing the plane + if (right_cross && left_cross) + { + // due to right bond + double sgn = copysign(1.0, x_angle_middle[dir] - pos); + dcos_theta[0] = -sgn*(dx_right[0]*cos_theta/r2 + dx_left[0]/r1)/r2; + dcos_theta[1] = -sgn*(dx_right[1]*cos_theta/r2 + dx_left[1]/r1)/r2; + dcos_theta[2] = -sgn*(dx_right[2]*cos_theta/r2 + dx_left[2]/r1)/r2; + + // due to left bond + dcos_theta[0] += sgn*(dx_left[0]*cos_theta/r1 + dx_right[0]/r2)/r1; + dcos_theta[1] += sgn*(dx_left[1]*cos_theta/r1 + dx_right[1]/r2)/r1; + dcos_theta[2] += sgn*(dx_left[2]*cos_theta/r1 + dx_right[2]/r2)/r1; + } + + // final contribution of the given angle term + local_contribution[0] += duang*dcos_theta[0]/area*nktv2p; + local_contribution[1] += duang*dcos_theta[1]/area*nktv2p; + local_contribution[2] += duang*dcos_theta[2]/area*nktv2p; + } + } + // loop over the keywords and if necessary add the angle contribution + int m = 0; + while (m < nvalues) { + if (which[m] == CONF || which[m] == TOTAL || which[m] == ANGLE) { + angle_local[m] = local_contribution[0]; + angle_local[m+1] = local_contribution[1]; + angle_local[m+2] = local_contribution[2]; + } + m += 3; + } +} diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index 5357d36371..86140dc278 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -38,11 +38,17 @@ class ComputeStressMop : public Compute { private: void compute_pairs(); + void compute_bonds(); + void compute_angles(); - int me, nvalues, dir; + int nvalues, dir; int *which; + int bondflag, angleflag; + double *values_local, *values_global; + double *bond_local, *bond_global; + double *angle_local, *angle_global; double pos, pos1, dt, nktv2p, ftm2v; double area; class NeighList *list; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index 709f109cb1..1f1dc30733 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -14,47 +13,51 @@ /*------------------------------------------------------------------------ Contributing Authors : Romain Vermorel (LFCR), Laurent Joly (ULyon) + Support for bonds added by : Evangelos Voyiatzis (NovaMechanics) --------------------------------------------------------------------------*/ #include "compute_stress_mop_profile.h" #include "atom.h" -#include "update.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" #include "domain.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "neigh_list.h" #include "error.h" +#include "force.h" #include "memory.h" +#include "molecule.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" #include #include using namespace LAMMPS_NS; -enum{X,Y,Z}; -enum{LOWER,CENTER,UPPER,COORD}; -enum{TOTAL,CONF,KIN}; - -#define BIG 1000000000 +enum { X, Y, Z }; +enum { LOWER, CENTER, UPPER, COORD }; +enum { TOTAL, CONF, KIN, PAIR, BOND }; +// clang-format off /* ---------------------------------------------------------------------- */ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 7) error->all(FLERR,"Illegal compute stress/mop/profile command"); + if (narg < 7) utils::missing_cmd_args(FLERR, "compute stress/mop/profile", error); - MPI_Comm_rank(world,&me); + bondflag = 0; // set compute mode and direction of plane(s) for pressure calculation - if (strcmp(arg[3],"x")==0) { + if (strcmp(arg[3],"x") == 0) { dir = X; - } else if (strcmp(arg[3],"y")==0) { + } else if (strcmp(arg[3],"y") == 0) { dir = Y; - } else if (strcmp(arg[3],"z")==0) { + } else if (strcmp(arg[3],"z") == 0) { dir = Z; } else error->all(FLERR,"Illegal compute stress/mop/profile command"); @@ -64,8 +67,7 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a else if (strcmp(arg[4],"center") == 0) originflag = CENTER; else if (strcmp(arg[4],"upper") == 0) originflag = UPPER; else originflag = COORD; - if (originflag == COORD) - origin = utils::numeric(FLERR,arg[4],false,lmp); + if (originflag == COORD) origin = utils::numeric(FLERR,arg[4],false,lmp); delta = utils::numeric(FLERR,arg[5],false,lmp); invdelta = 1.0/delta; @@ -92,6 +94,16 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a which[nvalues] = TOTAL; nvalues++; } + } else if (strcmp(arg[iarg],"pair") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = PAIR; + nvalues++; + } + } else if (strcmp(arg[iarg],"bond") == 0) { + for (i=0; i<3; i++) { + which[nvalues] = BOND; + nvalues++; + } } else error->all(FLERR, "Illegal compute stress/mop/profile command"); //break; iarg++; @@ -114,6 +126,9 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a nbins = 0; coord = coordp = nullptr; values_local = values_global = array = nullptr; + bond_local = nullptr; + bond_global = nullptr; + local_contribution = nullptr; // bin setup @@ -133,13 +148,15 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a ComputeStressMopProfile::~ComputeStressMopProfile() { - - delete [] which; + delete[] which; memory->destroy(coord); memory->destroy(coordp); memory->destroy(values_local); memory->destroy(values_global); + memory->destroy(bond_local); + memory->destroy(bond_global); + memory->destroy(local_contribution); memory->destroy(array); } @@ -147,7 +164,6 @@ ComputeStressMopProfile::~ComputeStressMopProfile() void ComputeStressMopProfile::init() { - // conversion constants nktv2p = force->nktv2p; @@ -173,27 +189,30 @@ void ComputeStressMopProfile::init() //This compute requires a pair style with pair_single method implemented - if (force->pair == nullptr) + if (!force->pair) error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); - // Warnings + // Errors - if (me==0) { + if (comm->me == 0) { //Compute stress/mop/profile only accounts for pair interactions. - // issue a warning if any intramolecular potential or Kspace is defined. + // issue an error if any intramolecular potential or Kspace is defined. - if (force->bond!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); - if (force->angle!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=nullptr) - error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=nullptr) + if (force->bond) bondflag = 1; + + if (force->angle) + if ((strcmp(force->angle_style, "zero") != 0) && (strcmp(force->angle_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for angle potentials"); + if (force->dihedral) + if ((strcmp(force->dihedral_style, "zero") != 0) && (strcmp(force->dihedral_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); + if (force->improper) + if ((strcmp(force->improper_style, "zero") != 0) && (strcmp(force->improper_style, "none") != 0)) + error->all(FLERR,"compute stress/mop/profile does not account for improper potentials"); + if (force->kspace) error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } @@ -222,17 +241,29 @@ void ComputeStressMopProfile::compute_array() compute_pairs(); // sum pressure contributions over all procs - MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues, - MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&values_local[0][0],&values_global[0][0],nbins*nvalues,MPI_DOUBLE,MPI_SUM,world); - int ibin,m,mo; - for (ibin=0; ibinx; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + double dx[3] = {0.0, 0.0, 0.0}; + double x_bond_1[3] = {0.0, 0.0, 0.0}; + double x_bond_2[3] = {0.0, 0.0, 0.0}; + + // initialization + for (int m = 0; m < nbins; m++) { + for (int i = 0; i < nvalues; i++) { + bond_local[m][i] = 0.0; + } + local_contribution[m][0] = 0.0; + local_contribution[m][1] = 0.0; + local_contribution[m][2] = 0.0; + } + + // loop over all bonded atoms in the current proc + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + for (int ibin = 0; ibinminimum_image(dx[0], dx[1], dx[2]); + x_bond_1[0] = dx[0]; + x_bond_1[1] = dx[1]; + x_bond_1[2] = dx[2]; + x_bond_1[dir] += pos; + + // minimum image of atom2 with respect to atom1 + dx[0] = x[atom2][0] - x_bond_1[0]; + dx[1] = x[atom2][1] - x_bond_1[1]; + dx[2] = x[atom2][2] - x_bond_1[2]; + domain->minimum_image(dx[0], dx[1], dx[2]); + x_bond_2[0] = x_bond_1[0] + dx[0]; + x_bond_2[1] = x_bond_1[1] + dx[1]; + x_bond_2[2] = x_bond_1[2] + dx[2]; + + // check if the bond vector crosses the plane of interest + double tau = (x_bond_1[dir] - pos) / (x_bond_1[dir] - x_bond_2[dir]); + if ((tau <= 1) && (tau >= 0)) { + dx[0] = x_bond_1[0] - x_bond_2[0]; + dx[1] = x_bond_1[1] - x_bond_2[1]; + dx[2] = x_bond_1[2] - x_bond_2[2]; + rsq = dx[0] * dx[0] + dx[1] * dx[1] + dx[2] * dx[2]; + bond->single(btype, rsq, atom1, atom2, fpair); + + double sgn = copysign(1.0, x_bond_1[dir] - pos); + local_contribution[ibin][0] += sgn*fpair*dx[0]/area*nktv2p; + local_contribution[ibin][1] += sgn*fpair*dx[1]/area*nktv2p; + local_contribution[ibin][2] += sgn*fpair*dx[2]/area*nktv2p; + } + } + } + } + + // loop over the keywords and if necessary add the bond contribution + int m = 0; + while (m < nvalues) { + if ((which[m] == CONF) || (which[m] == TOTAL) || (which[m] == BOND)) { + for (int ibin = 0; ibin < nbins; ibin++) { + bond_local[ibin][m] = local_contribution[ibin][0]; + bond_local[ibin][m+1] = local_contribution[ibin][1]; + bond_local[ibin][m+2] = local_contribution[ibin][2]; + } + } + m += 3; + } +} + /* ---------------------------------------------------------------------- setup 1d bins and their extent and coordinates called at init() @@ -492,6 +646,9 @@ void ComputeStressMopProfile::setup_bins() memory->create(coordp,nbins,1,"stress/mop/profile:coordp"); memory->create(values_local,nbins,nvalues,"stress/mop/profile:values_local"); memory->create(values_global,nbins,nvalues,"stress/mop/profile:values_global"); + memory->create(bond_local,nbins,nvalues,"stress/mop/profile:bond_local"); + memory->create(bond_global,nbins,nvalues,"stress/mop/profile:bond_global"); + memory->create(local_contribution,nbins,3,"stress/mop/profile:local_contribution"); // set bin coordinates for (i = 0; i < nbins; i++) { diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index b58f762c12..2b0ffef0f8 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -38,16 +38,21 @@ class ComputeStressMopProfile : public Compute { private: void compute_pairs(); + void compute_bonds(); void setup_bins(); - int me, nvalues, dir; + int nvalues, dir; int *which; + int bondflag; + int originflag; double origin, delta, offset, invdelta; int nbins; double **coord, **coordp; double **values_local, **values_global; + double **bond_local, **bond_global; + double **local_contribution; double dt, nktv2p, ftm2v; double area; diff --git a/src/EXTRA-DUMP/dump_yaml.cpp b/src/EXTRA-DUMP/dump_yaml.cpp index 3c35ec43ba..3ca5c59edf 100644 --- a/src/EXTRA-DUMP/dump_yaml.cpp +++ b/src/EXTRA-DUMP/dump_yaml.cpp @@ -60,21 +60,29 @@ void DumpYAML::write_header(bigint ndump) std::string thermo_data; if (thermo) { Thermo *th = output->thermo; - thermo_data += "thermo:\n - keywords: [ "; - for (int i = 0; i < th->nfield; ++i) thermo_data += fmt::format("{}, ", th->keyword[i]); - thermo_data += "]\n - data: [ "; + // output thermo data only on timesteps where it was computed + if (update->ntimestep == *th->get_timestep()) { + int nfield = *th->get_nfield(); + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); - for (int i = 0; i < th->nfield; ++i) { - th->call_vfunc(i); - if (th->vtype[i] == Thermo::FLOAT) - thermo_data += fmt::format("{}, ", th->dvalue); - else if (th->vtype[i] == Thermo::INT) - thermo_data += fmt::format("{}, ", th->ivalue); - else if (th->vtype[i] == Thermo::BIGINT) - thermo_data += fmt::format("{}, ", th->bivalue); + thermo_data += "thermo:\n - keywords: [ "; + for (int i = 0; i < nfield; ++i) thermo_data += fmt::format("{}, ", keywords[i]); + thermo_data += "]\n - data: [ "; + + for (int i = 0; i < nfield; ++i) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) + thermo_data += fmt::format("{}, ", fields[i].data.d); + else if (fields[i].type == multitype::LAMMPS_INT) + thermo_data += fmt::format("{}, ", fields[i].data.i); + else if (fields[i].type == multitype::LAMMPS_INT64) + thermo_data += fmt::format("{}, ", fields[i].data.b); + else + thermo_data += ", "; + } + thermo_data += "]\n"; + MPI_Barrier(world); } - thermo_data += "]\n"; - MPI_Barrier(world); } if (comm->me == 0) { @@ -85,7 +93,7 @@ void DumpYAML::write_header(bigint ndump) fmt::print(fp, "natoms: {}\n", ndump); fputs("boundary: [ ", fp); - for (const auto bflag : boundary) { + for (const auto &bflag : boundary) { if (bflag == ' ') continue; fmt::print(fp, "{}, ", bflag); } diff --git a/src/EXTRA-FIX/fix_efield_tip4p.cpp b/src/EXTRA-FIX/fix_efield_tip4p.cpp index 3d6a2f66b7..47b1d9e27a 100644 --- a/src/EXTRA-FIX/fix_efield_tip4p.cpp +++ b/src/EXTRA-FIX/fix_efield_tip4p.cpp @@ -47,6 +47,7 @@ void FixEfieldTIP4P::init() if (atom->tag_enable == 0) error->all(FLERR, "Fix efield/tip4p requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Fix efield/tip4p requires atom attribute q"); if (!force->pair) error->all(FLERR, "A TIP4P pair style must be defined fix efield/tip4p"); + if (pstr) error->all(FLERR, "Fix efield/tip4p does not support the potential keyword"); int itmp; double *p_qdist = (double *) force->pair->extract("qdist", itmp); diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index 4a9421be6c..37f33f4ea0 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -175,7 +175,8 @@ void FixElectronStopping::post_force(int /*vflag*/) if (energy < Ecut) continue; if (energy < elstop_ranges[0][0]) continue; if (energy > elstop_ranges[0][table_entries - 1]) - error->one(FLERR, "Atom kinetic energy too high for fix electron/stopping"); + error->one(FLERR, "Fix electron/stopping: kinetic energy too high for atom {}: {} vs {}", + atom->tag[i], energy, elstop_ranges[0][table_entries - 1]); if (region) { // Only apply in the given region diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp index 380964f058..feb5a95c6f 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.cpp +++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp @@ -2461,7 +2461,7 @@ void FixNPTCauchy::CauchyStat_init() if (!init_store) init_store = dynamic_cast( - modify->add_fix(std::string(id_store) + " all STORE global 1 6")); + modify->add_fix(std::string(id_store) + " all STORE/GLOBAL 1 6")); initRUN = 0; initPK = 1; diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index fe0e982e80..16aafe2b15 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -463,7 +463,7 @@ void FixTTM::read_electron_temperatures(const std::string &filename) if (comm->me == 0) { int ***T_initial_set; - memory->create(T_initial_set,nxgrid,nygrid,nzgrid,"ttm:T_initial_set"); + memory->create(T_initial_set,nzgrid,nygrid,nxgrid,"ttm:T_initial_set"); memset(&T_initial_set[0][0][0],0,ngridtotal*sizeof(int)); // read initial electron temperature values from file diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index ec5ba2540e..d9c6f13e2f 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -281,7 +281,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) } // read the file - // Grid3d::read_file() calls back to read_grid_lines() with chunks of lines + // Grid3d::read_file() calls back to unpack_read_grid() with chunks of lines grid->read_file(Grid3d::FIX,this,fp,CHUNK,MAXLINE); @@ -419,7 +419,7 @@ void FixTTMGrid::write_restart_file(const char *file) } // write file - // Grid3d::write_file() calls back to pack_write_file() and unpack_write_file() + // Grid3d::write_file() calls back to pack_write_grid() and unpack_write_grid() grid->write_file(Grid3d::FIX,this,0,1,sizeof(double), MPI_DOUBLE); diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 65ccbda4c1..79af414f0a 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -75,10 +75,8 @@ static constexpr double SHIFT = 0.0; FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(nullptr), nsum(nullptr), nsum_all(nullptr), - gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), - T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), - sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + random(nullptr), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), net_energy_transfer(nullptr), net_energy_transfer_all(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); @@ -167,20 +165,14 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : // allocate 3d grid variables - memory->create(nsum,nxgrid,nygrid,nzgrid,"ttm/mod:nsum"); - memory->create(nsum_all,nxgrid,nygrid,nzgrid,"ttm/mod:nsum_all"); - memory->create(sum_vsq,nxgrid,nygrid,nzgrid,"ttm/mod:sum_vsq"); - memory->create(sum_mass_vsq,nxgrid,nygrid,nzgrid,"ttm/mod:sum_mass_vsq"); - memory->create(sum_vsq_all,nxgrid,nygrid,nzgrid,"ttm/mod:sum_vsq_all"); - memory->create(sum_mass_vsq_all,nxgrid,nygrid,nzgrid, - "ttm/mod:sum_mass_vsq_all"); - memory->create(T_electron_old,nxgrid,nygrid,nzgrid,"ttm/mod:T_electron_old"); - memory->create(T_electron_first,nxgrid,nygrid,nzgrid,"ttm/mod:T_electron_first"); - memory->create(T_electron,nxgrid,nygrid,nzgrid,"ttm/mod:T_electron"); - memory->create(net_energy_transfer,nxgrid,nygrid,nzgrid, + memory->create(T_electron_old,nzgrid,nygrid,nxgrid,"ttm/mod:T_electron_old"); + memory->create(T_electron_first,nzgrid,nygrid,nxgrid,"ttm/mod:T_electron_first"); + memory->create(T_electron,nzgrid,nygrid,nxgrid,"ttm/mod:T_electron"); + memory->create(net_energy_transfer,nzgrid,nygrid,nxgrid, "ttm/mod:net_energy_transfer"); - memory->create(net_energy_transfer_all,nxgrid,nygrid,nzgrid, + memory->create(net_energy_transfer_all,nzgrid,nygrid,nxgrid, "ttm/mod:net_energy_transfer_all"); + flangevin = nullptr; grow_arrays(atom->nmax); @@ -203,10 +195,10 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : // initialize electron temperatures on grid int ix,iy,iz; - for (ix = 0; ix < nxgrid; ix++) + for (iz = 0; iz < nzgrid; iz++) for (iy = 0; iy < nygrid; iy++) - for (iz = 0; iz < nzgrid; iz++) - T_electron[ix][iy][iz] = tinit; + for (ix = 0; ix < nxgrid; ix++) + T_electron[iz][iy][ix] = tinit; // if specified, read initial electron temperatures from file @@ -221,18 +213,13 @@ FixTTMMod::~FixTTMMod() delete[] gfactor1; delete[] gfactor2; - memory->destroy(nsum); - memory->destroy(nsum_all); - memory->destroy(sum_vsq); - memory->destroy(sum_mass_vsq); - memory->destroy(sum_vsq_all); - memory->destroy(sum_mass_vsq_all); memory->destroy(T_electron_first); memory->destroy(T_electron_old); memory->destroy(T_electron); - memory->destroy(flangevin); memory->destroy(net_energy_transfer); memory->destroy(net_energy_transfer_all); + + memory->destroy(flangevin); } /* ---------------------------------------------------------------------- */ @@ -265,10 +252,10 @@ void FixTTMMod::init() sqrt(24.0*force->boltz*gamma_p/update->dt/force->mvv2e) / force->ftm2v; } - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - net_energy_transfer_all[ix][iy][iz] = 0; + for (int ix = 0; ix < nxgrid; ix++) + net_energy_transfer_all[iz][iy][ix] = 0; if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = (dynamic_cast(update->integrate))->nlevels; @@ -320,10 +307,10 @@ void FixTTMMod::post_force(int /*vflag*/) while (iy < 0) iy += nygrid; while (iz < 0) iz += nzgrid; - if (T_electron[ix][iy][iz] < 0) + if (T_electron[iz][iy][ix] < 0) error->all(FLERR,"Electronic temperature dropped below zero"); - double tsqrt = sqrt(T_electron[ix][iy][iz]); + double tsqrt = sqrt(T_electron[iz][iy][ix]); gamma1 = gfactor1[type[i]]; double vsq = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; @@ -342,20 +329,14 @@ void FixTTMMod::post_force(int /*vflag*/) if (right_x == nxgrid) right_x = 0; if (right_y == nygrid) right_y = 0; if (right_z == nzgrid) right_z = 0; - int left_x = ix - 1; - int left_y = iy - 1; - int left_z = iz - 1; - if (left_x == -1) left_x = nxgrid - 1; - if (left_y == -1) left_y = nygrid - 1; - if (left_z == -1) left_z = nzgrid - 1; - double T_i = T_electron[ix][iy][iz]; - double T_ir = T_electron[right_x][iy][iz]; - double T_iu = T_electron[ix][right_y][iz]; - double T_if = T_electron[ix][iy][right_z]; - double C_i = el_properties(T_electron[ix][iy][iz]).el_heat_capacity; - double C_ir = el_properties(T_electron[right_x][iy][iz]).el_heat_capacity; - double C_iu = el_properties(T_electron[ix][right_y][iz]).el_heat_capacity; - double C_if = el_properties(T_electron[ix][iy][right_z]).el_heat_capacity; + double T_i = T_electron[iz][iy][ix]; + double T_ir = T_electron[iz][iy][right_x]; + double T_iu = T_electron[iz][right_y][ix]; + double T_if = T_electron[right_z][iy][ix]; + double C_i = el_properties(T_electron[iz][iy][ix]).el_heat_capacity; + double C_ir = el_properties(T_electron[iz][iy][right_x]).el_heat_capacity; + double C_iu = el_properties(T_electron[iz][right_y][ix]).el_heat_capacity; + double C_if = el_properties(T_electron[right_z][iy][ix]).el_heat_capacity; double diff_x = (x_at - x_surf)*(x_at - x_surf); diff_x = pow(diff_x,0.5); double len_factor = diff_x/(diff_x+free_path); @@ -587,7 +568,7 @@ void FixTTMMod::read_electron_temperatures(const std::string &filename) if (comm->me == 0) { int ***T_initial_set; - memory->create(T_initial_set,nxgrid,nygrid,nzgrid,"ttm/mod:T_initial_set"); + memory->create(T_initial_set,nzgrid,nygrid,nxgrid,"ttm/mod:T_initial_set"); memset(&T_initial_set[0][0][0],0,ngridtotal*sizeof(int)); // read initial electron temperature values from file @@ -601,9 +582,9 @@ void FixTTMMod::read_electron_temperatures(const std::string &filename) auto values = reader.next_values(4); ++nread; - int ix = values.next_int(); - int iy = values.next_int(); - int iz = values.next_int(); + int ix = values.next_int() - 1; + int iy = values.next_int() - 1; + int iz = values.next_int() - 1; double T_tmp = values.next_double(); // check correctness of input data @@ -656,9 +637,9 @@ void FixTTMMod::write_electron_temperatures(const std::string &filename) for (ix = 0; ix < nxgrid; ix++) for (iy = 0; iy < nygrid; iy++) for (iz = 0; iz < nzgrid; iz++) { - if (movsur == 1 && T_electron[ix][iy][iz] == 0.0) - T_electron[ix][iy][iz] = electron_temperature_min; - fprintf(fp,"%d %d %d %20.16g\n",ix,iy,iz,T_electron[ix][iy][iz]); + if (movsur == 1 && T_electron[iz][iy][ix] == 0.0) + T_electron[iz][iy][ix] = electron_temperature_min; + fprintf(fp,"%d %d %d %20.16g\n",ix+1,iy+1,iz+1,T_electron[iz][iy][ix]); } fclose(fp); @@ -678,6 +659,9 @@ el_heat_capacity_thermal_conductivity FixTTMMod::el_properties(double T_e) properties.el_thermal_conductivity = el_th_diff*properties.el_heat_capacity; // thermal conductivity return properties; } + +/* ---------------------------------------------------------------------- */ + double FixTTMMod::el_sp_heat_integral(double T_e) { double T_temp = T_e/1000.0, T_reduced = T_damp*T_temp; @@ -700,20 +684,21 @@ void FixTTMMod::end_of_step() int nlocal = atom->nlocal; if (movsur == 1) { - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) { - double TTT = T_electron[ix][iy][iz]; + for (int ix = 0; ix < nxgrid; ix++) { + double TTT = T_electron[iz][iy][ix]; if (TTT > 0) { if (ix < t_surface_l) t_surface_l = ix; } } } - for (int ix = 0; ix < nxgrid; ix++) + + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - net_energy_transfer[ix][iy][iz] = 0; + for (int ix = 0; ix < nxgrid; ix++) + net_energy_transfer[iz][iy][ix] = 0; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -731,7 +716,7 @@ void FixTTMMod::end_of_step() while (iz < 0) iz += nzgrid; if (ix >= t_surface_l) { if (ix < surface_r) - net_energy_transfer[ix][iy][iz] += + net_energy_transfer[iz][iy][ix] += (flangevin[i][0]*v[i][0] + flangevin[i][1]*v[i][1] + flangevin[i][2]*v[i][2]); } @@ -747,18 +732,16 @@ void FixTTMMod::end_of_step() double del_vol = dx*dy*dz; double el_specific_heat = 0.0; double el_thermal_conductivity = el_properties(electron_temperature_min).el_thermal_conductivity; - for (int ix = 0; ix < nxgrid; ix++) + + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - { - if (el_properties(T_electron[ix][iy][iz]).el_thermal_conductivity > el_thermal_conductivity) - el_thermal_conductivity = el_properties(T_electron[ix][iy][iz]).el_thermal_conductivity; - if (el_specific_heat > 0.0) - { - if ((T_electron[ix][iy][iz] > 0.0) && (el_properties(T_electron[ix][iy][iz]).el_heat_capacity < el_specific_heat)) - el_specific_heat = el_properties(T_electron[ix][iy][iz]).el_heat_capacity; - } - else if (T_electron[ix][iy][iz] > 0.0) el_specific_heat = el_properties(T_electron[ix][iy][iz]).el_heat_capacity; + for (int ix = 0; ix < nxgrid; ix++) { + if (el_properties(T_electron[iz][iy][ix]).el_thermal_conductivity > el_thermal_conductivity) + el_thermal_conductivity = el_properties(T_electron[iz][iy][ix]).el_thermal_conductivity; + if (el_specific_heat > 0.0) { + if ((T_electron[iz][iy][ix] > 0.0) && (el_properties(T_electron[iz][iy][ix]).el_heat_capacity < el_specific_heat)) + el_specific_heat = el_properties(T_electron[iz][iy][ix]).el_heat_capacity; + } else if (T_electron[iz][iy][ix] > 0.0) el_specific_heat = el_properties(T_electron[iz][iy][ix]).el_heat_capacity; } // num_inner_timesteps = # of inner steps (thermal solves) // required this MD step to maintain a stable explicit solve @@ -767,17 +750,16 @@ void FixTTMMod::end_of_step() double inner_dt = update->dt; double stability_criterion = 0.0; - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - T_electron_first[ix][iy][iz] = - T_electron[ix][iy][iz]; + for (int ix = 0; ix < nxgrid; ix++) + T_electron_first[iz][iy][ix] = T_electron[iz][iy][ix]; + do { - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - T_electron[ix][iy][iz] = - T_electron_first[ix][iy][iz]; + for (int ix = 0; ix < nxgrid; ix++) + T_electron[iz][iy][ix] = T_electron_first[iz][iy][ix]; stability_criterion = 1.0 - 2.0*inner_dt/el_specific_heat * @@ -792,16 +774,15 @@ void FixTTMMod::end_of_step() error->warning(FLERR,"Too many inner timesteps in fix ttm/mod"); for (int ith_inner_timestep = 0; ith_inner_timestep < num_inner_timesteps; ith_inner_timestep++) { - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - T_electron_old[ix][iy][iz] = - T_electron[ix][iy][iz]; + for (int ix = 0; ix < nxgrid; ix++) + T_electron_old[iz][iy][ix] = T_electron[iz][iy][ix]; // compute new electron T profile duration = duration + inner_dt; - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) { + for (int ix = 0; ix < nxgrid; ix++) { int right_x = ix + 1; int right_y = iy + 1; int right_z = iz + 1; @@ -821,50 +802,50 @@ void FixTTMMod::end_of_step() if (duration < width) { if (ix >= t_surface_l) mult_factor = (intensity/(dx*skin_layer_d))*exp((-1.0)*(ix_d - surface_d)/skin_layer_d); } - if (ix < t_surface_l) net_energy_transfer_all[ix][iy][iz] = 0.0; + if (ix < t_surface_l) net_energy_transfer_all[iz][iy][ix] = 0.0; double cr_vac = 1; - if (T_electron_old[ix][iy][iz] == 0) cr_vac = 0; + if (T_electron_old[iz][iy][ix] == 0) cr_vac = 0; double cr_v_l_x = 1; - if (T_electron_old[left_x][iy][iz] == 0) cr_v_l_x = 0; + if (T_electron_old[iz][iy][left_x] == 0) cr_v_l_x = 0; double cr_v_r_x = 1; - if (T_electron_old[right_x][iy][iz] == 0) cr_v_r_x = 0; + if (T_electron_old[iz][iy][right_x] == 0) cr_v_r_x = 0; double cr_v_l_y = 1; - if (T_electron_old[ix][left_y][iz] == 0) cr_v_l_y = 0; + if (T_electron_old[iz][left_y][ix] == 0) cr_v_l_y = 0; double cr_v_r_y = 1; - if (T_electron_old[ix][right_y][iz] == 0) cr_v_r_y = 0; + if (T_electron_old[iz][right_y][ix] == 0) cr_v_r_y = 0; double cr_v_l_z = 1; - if (T_electron_old[ix][iy][left_z] == 0) cr_v_l_z = 0; + if (T_electron_old[left_z][iy][ix] == 0) cr_v_l_z = 0; double cr_v_r_z = 1; - if (T_electron_old[ix][iy][right_z] == 0) cr_v_r_z = 0; + if (T_electron_old[right_z][iy][ix] == 0) cr_v_r_z = 0; if (cr_vac != 0) { - T_electron[ix][iy][iz] = - T_electron_old[ix][iy][iz] + - inner_dt/el_properties(T_electron_old[ix][iy][iz]).el_heat_capacity * - ((cr_v_r_x*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[right_x][iy][iz]/2.0).el_thermal_conductivity* - (T_electron_old[right_x][iy][iz]-T_electron_old[ix][iy][iz])/dx - - cr_v_l_x*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[left_x][iy][iz]/2.0).el_thermal_conductivity* - (T_electron_old[ix][iy][iz]-T_electron_old[left_x][iy][iz])/dx)/dx + - (cr_v_r_y*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[ix][right_y][iz]/2.0).el_thermal_conductivity* - (T_electron_old[ix][right_y][iz]-T_electron_old[ix][iy][iz])/dy - - cr_v_l_y*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[ix][left_y][iz]/2.0).el_thermal_conductivity* - (T_electron_old[ix][iy][iz]-T_electron_old[ix][left_y][iz])/dy)/dy + - (cr_v_r_z*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[ix][iy][right_z]/2.0).el_thermal_conductivity* - (T_electron_old[ix][iy][right_z]-T_electron_old[ix][iy][iz])/dz - - cr_v_l_z*el_properties(T_electron_old[ix][iy][iz]/2.0+T_electron_old[ix][iy][left_z]/2.0).el_thermal_conductivity* - (T_electron_old[ix][iy][iz]-T_electron_old[ix][iy][left_z])/dz)/dz); - T_electron[ix][iy][iz]+=inner_dt/el_properties(T_electron[ix][iy][iz]).el_heat_capacity* + T_electron[iz][iy][ix] = + T_electron_old[iz][iy][ix] + + inner_dt/el_properties(T_electron_old[iz][iy][ix]).el_heat_capacity * + ((cr_v_r_x*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[iz][iy][right_x]/2.0).el_thermal_conductivity* + (T_electron_old[iz][iy][right_x]-T_electron_old[iz][iy][ix])/dx - + cr_v_l_x*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[iz][iy][left_x]/2.0).el_thermal_conductivity* + (T_electron_old[iz][iy][ix]-T_electron_old[iz][iy][left_x])/dx)/dx + + (cr_v_r_y*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[iz][right_y][ix]/2.0).el_thermal_conductivity* + (T_electron_old[iz][right_y][ix]-T_electron_old[iz][iy][ix])/dy - + cr_v_l_y*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[iz][left_y][ix]/2.0).el_thermal_conductivity* + (T_electron_old[iz][iy][ix]-T_electron_old[iz][left_y][ix])/dy)/dy + + (cr_v_r_z*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[right_z][iy][ix]/2.0).el_thermal_conductivity* + (T_electron_old[right_z][iy][ix]-T_electron_old[iz][iy][ix])/dz - + cr_v_l_z*el_properties(T_electron_old[iz][iy][ix]/2.0+T_electron_old[left_z][iy][ix]/2.0).el_thermal_conductivity* + (T_electron_old[iz][iy][ix]-T_electron_old[left_z][iy][ix])/dz)/dz); + T_electron[iz][iy][ix]+=inner_dt/el_properties(T_electron[iz][iy][ix]).el_heat_capacity* (mult_factor - - net_energy_transfer_all[ix][iy][iz]/del_vol); + net_energy_transfer_all[iz][iy][ix]/del_vol); } - else T_electron[ix][iy][iz] = - T_electron_old[ix][iy][iz]; - if ((T_electron[ix][iy][iz] > 0.0) && (T_electron[ix][iy][iz] < electron_temperature_min)) - T_electron[ix][iy][iz] = T_electron[ix][iy][iz] + 0.5*(electron_temperature_min - T_electron[ix][iy][iz]); + else T_electron[iz][iy][ix] = T_electron_old[iz][iy][ix]; - if (el_properties(T_electron[ix][iy][iz]).el_thermal_conductivity > el_thermal_conductivity) - el_thermal_conductivity = el_properties(T_electron[ix][iy][iz]).el_thermal_conductivity; - if ((T_electron[ix][iy][iz] > 0.0) && (el_properties(T_electron[ix][iy][iz]).el_heat_capacity < el_specific_heat)) - el_specific_heat = el_properties(T_electron[ix][iy][iz]).el_heat_capacity; + if ((T_electron[iz][iy][ix] > 0.0) && (T_electron[iz][iy][ix] < electron_temperature_min)) + T_electron[iz][iy][ix] = T_electron[iz][iy][ix] + 0.5*(electron_temperature_min - T_electron[iz][iy][ix]); + + if (el_properties(T_electron[iz][iy][ix]).el_thermal_conductivity > el_thermal_conductivity) + el_thermal_conductivity = el_properties(T_electron[iz][iy][ix]).el_thermal_conductivity; + if ((T_electron[iz][iy][ix] > 0.0) && (el_properties(T_electron[iz][iy][ix]).el_heat_capacity < el_specific_heat)) + el_specific_heat = el_properties(T_electron[iz][iy][ix]).el_heat_capacity; } } stability_criterion = 1.0 - @@ -913,12 +894,11 @@ double FixTTMMod::compute_vector(int n) double dz = domain->zprd/nzgrid; double del_vol = dx*dy*dz; - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) { - e_energy += el_sp_heat_integral(T_electron[ix][iy][iz])*del_vol; - transfer_energy += - net_energy_transfer_all[ix][iy][iz]*update->dt; + for (int ix = 0; ix < nxgrid; ix++) { + e_energy += el_sp_heat_integral(T_electron[iz][iy][ix])*del_vol; + transfer_energy += net_energy_transfer_all[iz][iy][ix]*update->dt; } if (n == 0) return e_energy; @@ -933,7 +913,7 @@ double FixTTMMod::compute_vector(int n) void FixTTMMod::write_restart(FILE *fp) { double *rlist; - memory->create(rlist,nxgrid*nygrid*nzgrid+4,"ttm/mod:rlist"); + memory->create(rlist,nzgrid*nygrid*nxgrid + 4,"ttm/mod:rlist"); int n = 0; rlist[n++] = nxgrid; @@ -941,10 +921,10 @@ void FixTTMMod::write_restart(FILE *fp) rlist[n++] = nzgrid; rlist[n++] = seed; - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - rlist[n++] = T_electron[ix][iy][iz]; + for (int ix = 0; ix < nxgrid; ix++) + rlist[n++] = T_electron[iz][iy][ix]; if (comm->me == 0) { int size = n * sizeof(double); @@ -982,10 +962,10 @@ void FixTTMMod::restart(char *buf) // restore global frid values - for (int ix = 0; ix < nxgrid; ix++) + for (int iz = 0; iz < nzgrid; iz++) for (int iy = 0; iy < nygrid; iy++) - for (int iz = 0; iz < nzgrid; iz++) - T_electron[ix][iy][iz] = rlist[n++]; + for (int ix = 0; ix < nxgrid; ix++) + T_electron[iz][iy][ix] = rlist[n++]; } /* ---------------------------------------------------------------------- diff --git a/src/EXTRA-FIX/fix_ttm_mod.h b/src/EXTRA-FIX/fix_ttm_mod.h index 28c3209697..469a641d56 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.h +++ b/src/EXTRA-FIX/fix_ttm_mod.h @@ -64,11 +64,8 @@ class FixTTMMod : public Fix { int nxgrid, nygrid, nzgrid; int ngridtotal; - int ***nsum, ***nsum_all; double *gfactor1, *gfactor2, *ratio, **flangevin; double ***T_electron, ***T_electron_old, ***T_electron_first; - double ***sum_vsq, ***sum_mass_vsq; - double ***sum_vsq_all, ***sum_mass_vsq_all; double ***net_energy_transfer, ***net_energy_transfer_all; double gamma_p, gamma_s, v_0, v_0_sq; diff --git a/src/GRANULAR/gran_sub_mod_normal.cpp b/src/GRANULAR/gran_sub_mod_normal.cpp index fcd9cdd27f..ffc18b8c32 100644 --- a/src/GRANULAR/gran_sub_mod_normal.cpp +++ b/src/GRANULAR/gran_sub_mod_normal.cpp @@ -150,6 +150,7 @@ GranSubModNormalHertzMaterial::GranSubModNormalHertzMaterial(GranularModel *gm, material_properties = 1; num_coeffs = 3; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -159,10 +160,12 @@ void GranSubModNormalHertzMaterial::coeffs_to_local() Emod = coeffs[0]; damp = coeffs[1]; poiss = coeffs[2]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal Hertz material normal model"); @@ -175,6 +178,10 @@ void GranSubModNormalHertzMaterial::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[0] = mix_stiffnessE(icoeffs[0], jcoeffs[0], icoeffs[2], jcoeffs[2]); coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -188,6 +195,7 @@ GranSubModNormalDMT::GranSubModNormalDMT(GranularModel *gm, LAMMPS *lmp) : GranS cohesive_flag = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -198,10 +206,13 @@ void GranSubModNormalDMT::coeffs_to_local() damp = coeffs[1]; poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + k = FOURTHIRDS * mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + k = FOURTHIRDS * mix_stiffnessE_wall(Emod, poiss); + } } if (Emod < 0.0 || damp < 0.0) error->all(FLERR, "Illegal DMT normal model"); @@ -215,6 +226,10 @@ void GranSubModNormalDMT::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + k = FOURTHIRDS * coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } @@ -246,6 +261,7 @@ GranSubModNormalJKR::GranSubModNormalJKR(GranularModel *gm, LAMMPS *lmp) : GranS beyond_contact = 1; num_coeffs = 4; contact_radius_flag = 1; + mixed_coefficients = 0; } /* ---------------------------------------------------------------------- */ @@ -257,10 +273,12 @@ void GranSubModNormalJKR::coeffs_to_local() poiss = coeffs[2]; cohesion = coeffs[3]; - if (gm->contact_type == PAIR) { - Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); - } else { - Emix = mix_stiffnessE_wall(Emod, poiss); + if (!mixed_coefficients) { + if (gm->contact_type == PAIR) { + Emix = mix_stiffnessE(Emod, Emod, poiss, poiss); + } else { + Emix = mix_stiffnessE_wall(Emod, poiss); + } } k = FOURTHIRDS * Emix; @@ -276,6 +294,10 @@ void GranSubModNormalJKR::mix_coeffs(double *icoeffs, double *jcoeffs) coeffs[1] = mix_geom(icoeffs[1], jcoeffs[1]); coeffs[2] = mix_geom(icoeffs[2], jcoeffs[2]); coeffs[3] = mix_geom(icoeffs[3], jcoeffs[3]); + + Emix = coeffs[0]; + mixed_coefficients = 1; + coeffs_to_local(); } diff --git a/src/GRANULAR/gran_sub_mod_normal.h b/src/GRANULAR/gran_sub_mod_normal.h index 7fb4a259e0..6f2f3aabbe 100644 --- a/src/GRANULAR/gran_sub_mod_normal.h +++ b/src/GRANULAR/gran_sub_mod_normal.h @@ -29,6 +29,7 @@ GranSubModStyle(jkr,GranSubModNormalJKR,NORMAL); namespace LAMMPS_NS { namespace Granular_NS { + class GranSubModNormal : public GranSubMod { public: GranSubModNormal(class GranularModel *, class LAMMPS *); @@ -92,6 +93,8 @@ namespace Granular_NS { GranSubModNormalHertzMaterial(class GranularModel *, class LAMMPS *); void coeffs_to_local() override; void mix_coeffs(double *, double *) override; + private: + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -107,6 +110,7 @@ namespace Granular_NS { protected: double k, cohesion; double F_pulloff, Fne; + int mixed_coefficients; }; /* ---------------------------------------------------------------------- */ @@ -125,6 +129,7 @@ namespace Granular_NS { protected: double k, cohesion; double Emix, F_pulloff, Fne; + int mixed_coefficients; }; } // namespace Granular_NS diff --git a/src/INTEL/TEST/run_benchmarks.sh b/src/INTEL/TEST/run_benchmarks.sh index 01ddfbebf3..82eb51c928 100755 --- a/src/INTEL/TEST/run_benchmarks.sh +++ b/src/INTEL/TEST/run_benchmarks.sh @@ -7,12 +7,10 @@ # --------------------- MPI Launch Command export MPI="mpirun" -#export MPI="numactl -p 1 mpirun" # -- Systems w/ MCDRAM in flat mode # ------------- Name and location of the LAMMPS binary export LMP_BIN=../../lmp_intel_cpu_intelmpi -#export LMP_BIN=../../lmp_knl # ------------- Directory containing the LAMMPS installation @@ -20,21 +18,18 @@ export LMP_ROOT=../../../ # ------------- Number of physical cores (not HW threads) -export LMP_CORES=36 # -- For Intel Xeon E5-2697v4 SKU -#export LMP_CORES=68 # -- For Intel Xeon Phi x200 7250 SKU +export LMP_CORES=36 +# Set automatically with lscpu +export LMP_CORES=`lscpu | awk '$1=="Core(s)"{t=NF; cores=$t}$1=="Socket(s):"{t=NF; sockets=$t}END{print cores*sockets}'` # ------------- Number of HW threads to use in tests -export LMP_THREAD_LIST="2" # -- For 2 threads per core w/ HT enabled -#export LMP_THREAD_LIST="2 4" # -- For 2 threads per core w/ HT enabled +export LMP_THREAD_LIST="1 2" # -- Also test 2 threads per core w/ HT enabled # ------------- MPI Tuning Parameters -#export I_MPI_SHM_LMT=shm # -- Uncomment for Xeon Phi x200 series - -# ------------- Library locations for build - -#source /opt/intel/parallel_studio_xe_2017.2.050/psxevars.sh +export I_MPI_FABRICS=shm +export I_MPI_PIN_DOMAIN=core ######################################################################### # End settings for your system @@ -50,8 +45,6 @@ export DATE_STRING=`date +%s` export LOG_DIR=$LOG_DIR_HOST"_"$LOG_DIR_HEADER"_"$DATE_STRING mkdir $LOG_DIR -export I_MPI_PIN_DOMAIN=core -#export I_MPI_FABRICS=shm export KMP_BLOCKTIME=0 echo -n "Creating restart file...." @@ -73,6 +66,9 @@ do export LOGFILE=$LOG_DIR/$workload"_lrt".$LMP_CORES"c"$threads"t".log cmd="$MPI -np $LMP_CORES $LMP_BIN -in in.intel.$workload -log $LOGFILE $RLMP_ARGS"; rthreads=$((threads-1)) + if [ $rthreads -lt 1 ]; then + rthreads=1 + fi export KMP_AFFINITY=none export OMP_NUM_THREADS=$rthreads echo " $cmd" >> $LOG_DIR/commands.info @@ -82,4 +78,5 @@ do done # Performance reported by LAMMPS (Timesteps/second ignoring warm-up run) -grep Perf $LOG_DIR/*.log | awk 'BEGIN{n=1}n%2==0{print $0}{n++}' | sed 's/\/day//g' | sed 's/steps\/s/steps_s/g' | sed 's/hours\/ns//g' | sed 's/.*\///g' | sed 's/\.log:Performance://g' | awk '{c=NF-1; print $1,$c}' +grep Perf $LOG_DIR/*.log | awk 'n%2==1{c=NF-3; print $1,$c}{n++}' | sed -e 's/.*\///g' -e 's/:.*://g' + diff --git a/src/INTEL/angle_charmm_intel.cpp b/src/INTEL/angle_charmm_intel.cpp index 1ea9c8348e..e13448e28a 100644 --- a/src/INTEL/angle_charmm_intel.cpp +++ b/src/INTEL/angle_charmm_intel.cpp @@ -178,7 +178,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - flt_t ir12 = (flt_t)1.0/sqrt(rsq1); + flt_t ir12 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - ir12 *= (flt_t)1.0/sqrt(rsq2); + ir12 *= (flt_t)1.0/std::sqrt(rsq2); // Urey-Bradley bond @@ -196,7 +196,7 @@ void AngleCharmmIntel::eval(const int vflag, const flt_t delzUB = x[i3].z - x[i1].z; const flt_t rsqUB = delxUB*delxUB + delyUB*delyUB + delzUB*delzUB; - const flt_t irUB = (flt_t)1.0/sqrt(rsqUB); + const flt_t irUB = (flt_t)1.0/std::sqrt(rsqUB); // Urey-Bradley force & energy @@ -219,12 +219,12 @@ void AngleCharmmIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; if (EFLAG) eangle += tk*dtheta; diff --git a/src/INTEL/angle_harmonic_intel.cpp b/src/INTEL/angle_harmonic_intel.cpp index 8cdab1d43a..98125b164b 100644 --- a/src/INTEL/angle_harmonic_intel.cpp +++ b/src/INTEL/angle_harmonic_intel.cpp @@ -178,7 +178,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz1 = x[i1].z - x[i2].z; const flt_t rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - const flt_t r1 = (flt_t)1.0/sqrt(rsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rsq1); // 2nd bond @@ -187,7 +187,7 @@ void AngleHarmonicIntel::eval(const int vflag, const flt_t delz2 = x[i3].z - x[i2].z; const flt_t rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - const flt_t r2 = (flt_t)1.0/sqrt(rsq2); + const flt_t r2 = (flt_t)1.0/std::sqrt(rsq2); // angle (cos and sin) @@ -199,12 +199,12 @@ void AngleHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0/sqrt(sd); + flt_t s = (flt_t)1.0/std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // harmonic force & energy - const flt_t dtheta = acos(c) - fc.fc[type].theta0; + const flt_t dtheta = std::acos(c) - fc.fc[type].theta0; const flt_t tk = fc.fc[type].k * dtheta; flt_t eangle; diff --git a/src/INTEL/bond_harmonic_intel.cpp b/src/INTEL/bond_harmonic_intel.cpp index a60050bb6b..ab38cefea4 100644 --- a/src/INTEL/bond_harmonic_intel.cpp +++ b/src/INTEL/bond_harmonic_intel.cpp @@ -168,7 +168,7 @@ void BondHarmonicIntel::eval(const int vflag, const flt_t delz = x[i1].z - x[i2].z; const flt_t rsq = delx*delx + dely*dely + delz*delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t dr = r - fc.fc[type].r0; const flt_t rk = fc.fc[type].k * dr; diff --git a/src/INTEL/dihedral_charmm_intel.cpp b/src/INTEL/dihedral_charmm_intel.cpp index 6c3ae2c927..a41cfb867c 100644 --- a/src/INTEL/dihedral_charmm_intel.cpp +++ b/src/INTEL/dihedral_charmm_intel.cpp @@ -240,14 +240,14 @@ void DihedralCharmmIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); @@ -367,7 +367,7 @@ void DihedralCharmmIntel::eval(const int vflag, flt_t forcecoul; if (implicit) forcecoul = qqrd2e * q[i1]*q[i4]*r2inv; - else forcecoul = qqrd2e * q[i1]*q[i4]*sqrt(r2inv); + else forcecoul = qqrd2e * q[i1]*q[i4]*std::sqrt(r2inv); const flt_t forcelj = r6inv * (fc.ljp[itype][jtype].lj1*r6inv - fc.ljp[itype][jtype].lj2); const flt_t fpair = tweight * (forcelj+forcecoul)*r2inv; diff --git a/src/INTEL/dihedral_fourier_intel.cpp b/src/INTEL/dihedral_fourier_intel.cpp index 5448fdae98..595d747839 100644 --- a/src/INTEL/dihedral_fourier_intel.cpp +++ b/src/INTEL/dihedral_fourier_intel.cpp @@ -199,14 +199,14 @@ void DihedralFourierIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_harmonic_intel.cpp b/src/INTEL/dihedral_harmonic_intel.cpp index 8d91a3fd27..138545d94a 100644 --- a/src/INTEL/dihedral_harmonic_intel.cpp +++ b/src/INTEL/dihedral_harmonic_intel.cpp @@ -199,14 +199,14 @@ void DihedralHarmonicIntel::eval(const int vflag, const flt_t rasq = ax*ax + ay*ay + az*az; const flt_t rbsq = bx*bx + by*by + bz*bz; const flt_t rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rg = sqrt(rgsq); + const flt_t rg = std::sqrt(rgsq); flt_t rginv, ra2inv, rb2inv; rginv = ra2inv = rb2inv = (flt_t)0.0; if (rg > 0) rginv = (flt_t)1.0/rg; if (rasq > 0) ra2inv = (flt_t)1.0/rasq; if (rbsq > 0) rb2inv = (flt_t)1.0/rbsq; - const flt_t rabinv = sqrt(ra2inv*rb2inv); + const flt_t rabinv = std::sqrt(ra2inv*rb2inv); flt_t c = (ax*bx + ay*by + az*bz)*rabinv; const flt_t s = rg*rabinv*(ax*vb3x + ay*vb3y + az*vb3z); diff --git a/src/INTEL/dihedral_opls_intel.cpp b/src/INTEL/dihedral_opls_intel.cpp index 82151a8585..52763e6bd8 100644 --- a/src/INTEL/dihedral_opls_intel.cpp +++ b/src/INTEL/dihedral_opls_intel.cpp @@ -195,15 +195,15 @@ void DihedralOPLSIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x*vb3x + vb1y*vb3y + vb1z*vb3z) * rb1*rb3; @@ -219,11 +219,11 @@ void DihedralOPLSIntel::eval(const int vflag, // cos and sin of 2 angles and final c flt_t sin2 = MAX((flt_t)1.0 - c1mag*c1mag,(flt_t)0.0); - flt_t sc1 = (flt_t)1.0/sqrt(sin2); + flt_t sc1 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc1 = INVSMALL; sin2 = MAX((flt_t)1.0 - c2mag*c2mag,(flt_t)0.0); - flt_t sc2 = (flt_t)1.0/sqrt(sin2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sin2); if (sin2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; @@ -234,7 +234,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cx = vb1z*vb2ym - vb1y*vb2zm; const flt_t cy = vb1x*vb2zm - vb1z*vb2xm; const flt_t cz = vb1y*vb2xm - vb1x*vb2ym; - const flt_t cmag = (flt_t)1.0/sqrt(cx*cx + cy*cy + cz*cz); + const flt_t cmag = (flt_t)1.0/std::sqrt(cx*cx + cy*cy + cz*cz); const flt_t dx = (cx*vb3x + cy*vb3y + cz*vb3z)*cmag*rb3; // error check @@ -252,7 +252,7 @@ void DihedralOPLSIntel::eval(const int vflag, const flt_t cossq = c * c; const flt_t sinsq = (flt_t)1.0 - cossq; - flt_t siinv = (flt_t)1.0/sqrt(sinsq); + flt_t siinv = (flt_t)1.0/std::sqrt(sinsq); if (sinsq < SMALLER2 ) siinv = INVSMALLER; if (dx < (flt_t)0.0) siinv = -siinv; diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 1ce0b41338..4c46608677 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -61,6 +61,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _hybrid_nonpair = 0; _print_pkg_info = 1; _nthreads = comm->nthreads; + _torque_flag = 0; _precision_mode = PREC_MODE_MIXED; _offload_balance = -1.0; @@ -95,6 +96,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _allow_separate_buffers = 1; _offload_ghost = -1; _lrt = 0; + _p3m_table = 1; int iarg = 4; while (iarg < narg) { @@ -135,11 +137,14 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); _lrt = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } + } else if (strcmp(arg[iarg], "pppm_table") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); + _p3m_table = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; // undocumented options - else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { + } else if (strcmp(arg[iarg],"offload_affinity_balanced") == 0) { _offload_affinity_balanced = 1; iarg++; } else if (strcmp(arg[iarg],"buffers") == 0) { @@ -275,10 +280,8 @@ int FixIntel::setmask() int mask = 0; mask |= PRE_REVERSE; mask |= MIN_PRE_REVERSE; - #ifdef _LMP_INTEL_OFFLOAD mask |= POST_FORCE; mask |= MIN_POST_FORCE; - #endif mask |= POST_RUN; return mask; } @@ -299,14 +302,30 @@ void FixIntel::init() } #endif + _torque_flag = 0; + if (force->pair_match("gayberne/intel$", 0)) _torque_flag = 1; + const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != nullptr) { + if (force->pair_match("^hybrid", 0)) { _pair_hybrid_flag = 1; + + // Check if need to handle torque + auto hybrid = dynamic_cast(force->pair); + if (hybrid) { + for (int i = 0; i < hybrid->nstyles; i++) + if (utils::strmatch(hybrid->keywords[i],"/intel$") && + utils::strmatch(hybrid->keywords[i],"gayberne")) + _torque_flag = 1; + } if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR,"INTEL package requires fdotr virial with newton on."); } else _pair_hybrid_flag = 0; + if (_torque_flag && nstyles > 1) + error->all(FLERR,"gayberne/intel style cannot yet be used with other " + "intel pair styles."); + if (nstyles > 1 && _pair_hybrid_flag) _pair_hybrid_flag = 2; else if (force->newton_pair == 0) _pair_hybrid_flag = 0; @@ -333,14 +352,17 @@ void FixIntel::init() int off_mode = 0; if (_offload_balance != 0.0) off_mode = 1; if (_precision_mode == PREC_MODE_SINGLE) { + _single_buffers->set_torque_flag(_torque_flag); _single_buffers->zero_ev(); _single_buffers->grow_ncache(off_mode, comm->nthreads); _single_buffers->free_list_ptrs(); } else if (_precision_mode == PREC_MODE_MIXED) { + _mixed_buffers->set_torque_flag(_torque_flag); _mixed_buffers->zero_ev(); _mixed_buffers->grow_ncache(off_mode, comm->nthreads); _mixed_buffers->free_list_ptrs(); } else { + _double_buffers->set_torque_flag(_torque_flag); _double_buffers->zero_ev(); _double_buffers->grow_ncache(off_mode, comm->nthreads); _double_buffers->free_list_ptrs(); @@ -390,7 +412,7 @@ bool FixIntel::pair_hybrid_check() void FixIntel::pair_init_check(const bool cdmessage) { #ifdef INTEL_VMASK - atom->sortfreq = 1; + if (atom->sortfreq) atom->sortfreq = 1; #endif _nbor_pack_width = 1; @@ -597,6 +619,19 @@ void FixIntel::pre_reverse(int /*eflag*/, int /*vflag*/) /* ---------------------------------------------------------------------- */ +void FixIntel::post_force(int vflag) +{ + // Redundant call to sync Intel data structs with native for methods that + // call force compute but do not call prereverse + _sync_main_arrays(1); + + #ifdef LMP_INTEL_OFFLOAD + if (_sync_mode == 2) sync_coprocessor(); + #endif +} + +/* ---------------------------------------------------------------------- */ + template void FixIntel::reduce_results(acc_t * _noalias const f_scalar) { @@ -605,7 +640,7 @@ void FixIntel::reduce_results(acc_t * _noalias const f_scalar) o_range = atom->nlocal + atom->nghost; else o_range = atom->nlocal; - IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), lmp->atom->torque); + IP_PRE_get_stride(f_stride, o_range, (sizeof(acc_t)*4), _torque_flag); o_range *= 4; const int f_stride4 = f_stride * 4; @@ -704,7 +739,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, add_oresults(f_in, ev_global, eatom, vatom, 0, _offload_nlocal); const acc_t * _noalias const enull = 0; int offset = _offload_nlocal; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _offload_min_ghost, _offload_nghost); } else @@ -715,7 +750,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, _host_min_local, _host_used_local); const acc_t * _noalias const enull = 0; int offset = _host_used_local; - if (atom->torque) offset *= 2; + if (_torque_flag) offset *= 2; add_oresults(f_in + offset, enull, eatom, vatom, _host_min_ghost, _host_used_ghost); } else { @@ -764,7 +799,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, const int eatom, const int /*vatom*/, const int out_offset, const int nall) { lmp_ft * _noalias const f = (lmp_ft *) lmp->atom->f[0] + out_offset; - if (atom->torque) { + if (_torque_flag) { if (f_in[1].w) { if (f_in[1].w == 1) @@ -788,7 +823,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, #endif int ifrom, ito; IP_PRE_omp_range_align(ifrom, ito, tid, nall, packthreads, sizeof(acc_t)); - if (atom->torque) { + if (_torque_flag) { int ii = ifrom * 2; lmp_ft * _noalias const tor = (lmp_ft *) lmp->atom->torque[0] + out_offset; @@ -883,13 +918,6 @@ double FixIntel::memory_usage() /* ---------------------------------------------------------------------- */ -void FixIntel::post_force(int vflag) -{ - if (_sync_mode == 2) sync_coprocessor(); -} - -/* ---------------------------------------------------------------------- */ - template void FixIntel::add_off_results(const ft * _noalias const f_in, const acc_t * _noalias const ev_global) { @@ -919,7 +947,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, _offload_nlocal; } - if (atom->torque) + if (_torque_flag) if (f_in[1].w < 0.0) error->all(FLERR,"Bad matrix inversion in mldivide3"); add_results(f_in, ev_global, _off_results_eatom, _off_results_vatom, 1); diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 9214fe3419..08d0a534d9 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -55,6 +55,7 @@ class FixIntel : public Fix { void pre_reverse(int eflag = 0, int vflag = 0) override; inline void min_pre_reverse(int eflag = 0, int vflag = 0) override { pre_reverse(eflag, vflag); } + void post_force(int vflag) override; void post_run() override { _print_pkg_info = 1; } // Get all forces, calculation results from coprocesser @@ -102,7 +103,7 @@ class FixIntel : public Fix { inline int pppm_table() { if (force->kspace_match("^pppm/.*intel$", 0)) - return INTEL_P3M_TABLE; + return _p3m_table; else return 0; } @@ -115,7 +116,7 @@ class FixIntel : public Fix { int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; int _pair_intel_count, _pair_hybrid_flag, _print_pkg_info; // These should be removed in subsequent update w/ simpler hybrid arch - int _pair_hybrid_zero, _hybrid_nonpair, _zero_master; + int _pair_hybrid_zero, _hybrid_nonpair, _zero_master, _torque_flag; public: inline int *get_overflow_flag() { return _overflow_flag; } @@ -132,7 +133,6 @@ class FixIntel : public Fix { inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal); #ifdef _LMP_INTEL_OFFLOAD - void post_force(int vflag); inline int coprocessor_number() { return _cop; } inline int full_host_list() { return _full_host_list; } void set_offload_affinity(); @@ -194,7 +194,7 @@ class FixIntel : public Fix { protected: int _overflow_flag[5]; _alignvar(int _off_overflow_flag[5], 64); - int _allow_separate_buffers, _offload_ghost, _lrt; + int _allow_separate_buffers, _offload_ghost, _lrt, _p3m_table; IntelBuffers::vec3_acc_t *_force_array_s; IntelBuffers::vec3_acc_t *_force_array_m; diff --git a/src/INTEL/fix_nh_intel.cpp b/src/INTEL/fix_nh_intel.cpp index 87ce0dbe43..2c05c3f6fa 100644 --- a/src/INTEL/fix_nh_intel.cpp +++ b/src/INTEL/fix_nh_intel.cpp @@ -166,28 +166,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -200,7 +200,7 @@ void FixNHIntel::remap() if (p_flag[0]) { oldlo = domain->boxlo[0]; oldhi = domain->boxhi[0]; - expfac = exp(dto*omega_dot[0]); + expfac = std::exp(dto*omega_dot[0]); domain->boxlo[0] = (oldlo-fixedpoint[0])*expfac + fixedpoint[0]; domain->boxhi[0] = (oldhi-fixedpoint[0])*expfac + fixedpoint[0]; } @@ -208,7 +208,7 @@ void FixNHIntel::remap() if (p_flag[1]) { oldlo = domain->boxlo[1]; oldhi = domain->boxhi[1]; - expfac = exp(dto*omega_dot[1]); + expfac = std::exp(dto*omega_dot[1]); domain->boxlo[1] = (oldlo-fixedpoint[1])*expfac + fixedpoint[1]; domain->boxhi[1] = (oldhi-fixedpoint[1])*expfac + fixedpoint[1]; if (scalexy) h[5] *= expfac; @@ -217,7 +217,7 @@ void FixNHIntel::remap() if (p_flag[2]) { oldlo = domain->boxlo[2]; oldhi = domain->boxhi[2]; - expfac = exp(dto*omega_dot[2]); + expfac = std::exp(dto*omega_dot[2]); domain->boxlo[2] = (oldlo-fixedpoint[2])*expfac + fixedpoint[2]; domain->boxhi[2] = (oldhi-fixedpoint[2])*expfac + fixedpoint[2]; if (scalexz) h[4] *= expfac; @@ -229,28 +229,28 @@ void FixNHIntel::remap() if (pstyle == TRICLINIC) { if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; } if (p_flag[3]) { - expfac = exp(dto4*omega_dot[1]); + expfac = std::exp(dto4*omega_dot[1]); h[3] *= expfac; h[3] += dto2*(omega_dot[3]*h[2]); h[3] *= expfac; } if (p_flag[5]) { - expfac = exp(dto4*omega_dot[0]); + expfac = std::exp(dto4*omega_dot[0]); h[5] *= expfac; h[5] += dto2*(omega_dot[5]*h[1]); h[5] *= expfac; } if (p_flag[4]) { - expfac = exp(dto8*omega_dot[0]); + expfac = std::exp(dto8*omega_dot[0]); h[4] *= expfac; h[4] += dto4*(omega_dot[5]*h[3]+omega_dot[4]*h[2]); h[4] *= expfac; @@ -427,9 +427,9 @@ void FixNHIntel::nh_v_press() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; - double f0 = exp(-dt4*(omega_dot[0]+mtk_term2)); - double f1 = exp(-dt4*(omega_dot[1]+mtk_term2)); - double f2 = exp(-dt4*(omega_dot[2]+mtk_term2)); + double f0 = std::exp(-dt4*(omega_dot[0]+mtk_term2)); + double f1 = std::exp(-dt4*(omega_dot[1]+mtk_term2)); + double f2 = std::exp(-dt4*(omega_dot[2]+mtk_term2)); f0 *= f0; f1 *= f1; f2 *= f2; diff --git a/src/INTEL/improper_cvff_intel.cpp b/src/INTEL/improper_cvff_intel.cpp index 09b2d42167..a503f45541 100644 --- a/src/INTEL/improper_cvff_intel.cpp +++ b/src/INTEL/improper_cvff_intel.cpp @@ -191,15 +191,15 @@ void ImproperCvffIntel::eval(const int vflag, // 1st and 2nd angle const flt_t b1mag2 = vb1x*vb1x + vb1y*vb1y + vb1z*vb1z; - const flt_t rb1 = (flt_t)1.0 / sqrt(b1mag2); + const flt_t rb1 = (flt_t)1.0 / std::sqrt(b1mag2); const flt_t sb1 = (flt_t)1.0 / b1mag2; const flt_t b2mag2 = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; - const flt_t rb2 = (flt_t)1.0 / sqrt(b2mag2); + const flt_t rb2 = (flt_t)1.0 / std::sqrt(b2mag2); const flt_t sb2 = (flt_t)1.0 / b2mag2; const flt_t b3mag2 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t rb3 = (flt_t)1.0 / sqrt(b3mag2); + const flt_t rb3 = (flt_t)1.0 / std::sqrt(b3mag2); const flt_t sb3 = (flt_t)1.0 / b3mag2; const flt_t c0 = (vb1x * vb3x + vb1y * vb3y + vb1z * vb3z) * rb1 * rb3; @@ -215,11 +215,11 @@ void ImproperCvffIntel::eval(const int vflag, // cos and sin of 2 angles and final c const flt_t sd1 = (flt_t)1.0 - c1mag * c1mag; - flt_t sc1 = (flt_t)1.0/sqrt(sd1); + flt_t sc1 = (flt_t)1.0/std::sqrt(sd1); if (sd1 < SMALL2) sc1 = INVSMALL; const flt_t sd2 = (flt_t)1.0 - c2mag * c2mag; - flt_t sc2 = (flt_t)1.0/sqrt(sd2); + flt_t sc2 = (flt_t)1.0/std::sqrt(sd2); if (sc2 < SMALL2) sc2 = INVSMALL; const flt_t s1 = sc1 * sc1; diff --git a/src/INTEL/improper_harmonic_intel.cpp b/src/INTEL/improper_harmonic_intel.cpp index a9a152d5f0..869051ab6b 100644 --- a/src/INTEL/improper_harmonic_intel.cpp +++ b/src/INTEL/improper_harmonic_intel.cpp @@ -194,9 +194,9 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t ss2 = vb2x*vb2x + vb2y*vb2y + vb2z*vb2z; flt_t ss3 = vb3x*vb3x + vb3y*vb3y + vb3z*vb3z; - const flt_t r1 = (flt_t)1.0 / sqrt(ss1); - const flt_t r2 = (flt_t)1.0 / sqrt(ss2); - const flt_t r3 = (flt_t)1.0 / sqrt(ss3); + const flt_t r1 = (flt_t)1.0 / std::sqrt(ss1); + const flt_t r2 = (flt_t)1.0 / std::sqrt(ss2); + const flt_t r3 = (flt_t)1.0 / std::sqrt(ss3); ss1 = (flt_t)1.0 / ss1; ss2 = (flt_t)1.0 / ss2; @@ -214,7 +214,7 @@ void ImproperHarmonicIntel::eval(const int vflag, flt_t s2 = (flt_t)1.0 - c2*c2; if (s2 < SMALL) s2 = SMALL; - flt_t s12 = (flt_t)1.0 / sqrt(s1*s2); + flt_t s12 = (flt_t)1.0 / std::sqrt(s1*s2); s1 = (flt_t)1.0 / s1; s2 = (flt_t)1.0 / s2; flt_t c = (c1*c2 + c0) * s12; @@ -229,12 +229,12 @@ void ImproperHarmonicIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; const flt_t sd = (flt_t)1.0 - c * c; - flt_t s = (flt_t)1.0 / sqrt(sd); + flt_t s = (flt_t)1.0 / std::sqrt(sd); if (sd < SMALL2) s = INVSMALL; // force & energy - const flt_t domega = acos(c) - fc.fc[type].chi; + const flt_t domega = std::acos(c) - fc.fc[type].chi; flt_t a; a = fc.fc[type].k * domega; diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index bb54577097..6d4c9bffcd 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -28,6 +28,7 @@ template IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : lmp(lmp_in), _x(nullptr), _q(nullptr), _quat(nullptr), _f(nullptr), _off_threads(0), _n_list_ptrs(1), _max_list_ptrs(4), _buf_size(0), _buf_local_size(0) { + _torque_flag = 0; _neigh_list_ptrs = new IntelNeighListPtrs[_max_list_ptrs]; _neigh_list_ptrs[0].cnumneigh = nullptr; _list_alloc_atoms = 0; @@ -695,7 +696,7 @@ double IntelBuffers::memory_usage(const int nthreads) { double tmem = sizeof(atom_t); if (lmp->atom->q) tmem += sizeof(flt_t); - if (lmp->atom->torque) tmem += sizeof(quat_t); + if (_torque_flag) tmem += sizeof(quat_t); #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) tmem *= 2; #endif diff --git a/src/INTEL/intel_buffers.h b/src/INTEL/intel_buffers.h index 7422850184..1e9739c3b2 100644 --- a/src/INTEL/intel_buffers.h +++ b/src/INTEL/intel_buffers.h @@ -57,7 +57,7 @@ class IntelBuffers { inline int get_stride(int nall) { int stride; IP_PRE_get_stride(stride, nall, sizeof(vec3_acc_t), - lmp->atom->torque); + _torque_flag); return stride; } @@ -76,6 +76,8 @@ class IntelBuffers { _neigh_list_ptrs[0].numneighhalf = atombin; } + inline void set_torque_flag(const int in) { _torque_flag = in; } + inline void grow(const int nall, const int nlocal, const int nthreads, const int offload_end) { if (nall >= _buf_size || nlocal >= _buf_local_size) @@ -329,7 +331,7 @@ class IntelBuffers { flt_t *_q; quat_t *_quat; vec3_acc_t * _f; - int _off_threads, _off_map_listlocal; + int _torque_flag, _off_threads, _off_map_listlocal; int _list_alloc_atoms; int *_list_alloc, *_cnumneigh, *_atombin, *_binpacked; diff --git a/src/INTEL/intel_intrinsics.h b/src/INTEL/intel_intrinsics.h index 1ff405edd2..c106dfd411 100644 --- a/src/INTEL/intel_intrinsics.h +++ b/src/INTEL/intel_intrinsics.h @@ -1764,7 +1764,7 @@ struct vector_ops { return a < b; } static fvec invsqrt(const fvec &a) { - return 1. / sqrt(a); + return 1. / std::sqrt(a); } static fvec sincos(fvec *c, const fvec &a) { *c = cos(a); diff --git a/src/INTEL/intel_preprocess.h b/src/INTEL/intel_preprocess.h index a3c961f436..2c4b9a0c1b 100644 --- a/src/INTEL/intel_preprocess.h +++ b/src/INTEL/intel_preprocess.h @@ -86,8 +86,6 @@ enum {TIME_PACK, TIME_HOST_NEIGHBOR, TIME_HOST_PAIR, TIME_OFFLOAD_NEIGHBOR, #define INTEL_MAX_STENCIL_CHECK 4096 #define INTEL_P3M_MAXORDER 8 #define INTEL_P3M_ALIGNED_MAXORDER 8 -// PRECOMPUTE VALUES IN TABLE (DOESN'T AFFECT ACCURACY) -#define INTEL_P3M_TABLE 1 #ifdef __INTEL_COMPILER #ifdef __AVX__ diff --git a/src/INTEL/math_extra_intel.h b/src/INTEL/math_extra_intel.h index a8869f7384..556f3f4590 100644 --- a/src/INTEL/math_extra_intel.h +++ b/src/INTEL/math_extra_intel.h @@ -100,12 +100,12 @@ normalize a vector, return in ans ------------------------------------------------------------------------- */ -#define ME_normalize3(v0, v1, v2, ans) \ -{ \ - flt_t scale = (flt_t)1.0 / sqrt(v0*v0+v1*v1+v2*v2); \ - ans##_0 = v0 * scale; \ - ans##_1 = v1 * scale; \ - ans##_2 = v2 * scale; \ +#define ME_normalize3(v0, v1, v2, ans) \ +{ \ + flt_t scale = (flt_t)1.0 / std::sqrt(v0*v0+v1*v1+v2*v2); \ + ans##_0 = v0 * scale; \ + ans##_1 = v1 * scale; \ + ans##_2 = v2 * scale; \ } /* ---------------------------------------------------------------------- @@ -359,7 +359,7 @@ #define ME_qnormalize(q) \ { \ double norm = 1.0 / \ - sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ + std::sqrt(q##_w*q##_w + q##_i*q##_i + q##_j*q##_j + q##_k*q##_k); \ q##_w *= norm; \ q##_i *= norm; \ q##_j *= norm; \ diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index b7b9ee4aea..920c0c559a 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -292,12 +292,13 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, else ito -= wlocal - nlocal; int e_ito = ito; - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; int pack_offset = maxnbors; - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; const int toffs = tid * ncache_stride; flt_t * _noalias const tx = ncachex + toffs; @@ -558,7 +559,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } diff --git a/src/INTEL/npair_intel.cpp b/src/INTEL/npair_intel.cpp index b85873f677..600109d7ae 100644 --- a/src/INTEL/npair_intel.cpp +++ b/src/INTEL/npair_intel.cpp @@ -287,16 +287,17 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (imod) e_ito += pack_width - imod; } #endif - const int list_size = (e_ito + tid * 2 + 2) * maxnbors; + const bigint list_size = (bigint)(e_ito + tid * 2 + 2) * + (bigint)maxnbors; #ifdef LMP_INTEL_3BODY_FAST const int pack_offset = maxnbors * pack_width; - const int obound = pack_offset + maxnbors * 2; + const bigint obound = pack_offset + maxnbors * 2; #else const int pack_offset = 0; - const int obound = maxnbors * 3; + const bigint obound = maxnbors * 3; #endif - int ct = (ifrom + tid * 2) * maxnbors; + bigint ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; int * _noalias neighptr = intel_list + ct; int * _noalias neighptr2; if (THREE) neighptr2 = neighptr; @@ -722,7 +723,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } @@ -736,7 +737,7 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, if (ct + obound > list_size) { if (i < ito - 1) { *overflow = 1; - ct = (ifrom + tid * 2) * maxnbors; + ct = (bigint)(ifrom + tid * 2) * (bigint)maxnbors; } } } diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 0b05447dd7..7bc2b3edb8 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -905,7 +905,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, flt_t rho_k = ka->params.rho[ktype][1]; flt_t rho_j = ka->params.rho[jtype][1]; flt_t lamdajik = 4 * itype * ((rho_k - rikmag) - (rho_j - rijmag)); - flt_t ex_lam = exp(lamdajik); + flt_t ex_lam = overloaded::exp(lamdajik); flt_t rcminik = ka->params.rcmin[itype][ktype]; flt_t rcmaxik = ka->params.rcmax[itype][ktype]; flt_t dwik; diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 01a9f91bcf..424e38c16a 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -267,7 +267,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index ff57b571a4..48007c30d9 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -322,7 +322,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, const int jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); #ifdef INTEL_ALLOW_TABLE if (!ncoultablebits || rsq <= tabinnersq) { diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index 2461361788..1f2a033784 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -255,7 +255,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, const flt_t delz = ztmp - x[j].z; const int jtype = IP_PRE_dword_index(x[j].w); const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); const flt_t r2inv = (flt_t)1.0 / rsq; #ifdef INTEL_VMASK diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index 011979223e..7b11053d41 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -180,7 +180,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, ATOM_T * _noalias const x = buffers->get_x(offload); typedef struct { double x, y, z; } lmp_vt; auto *v = (lmp_vt *)atom->v[0]; - const flt_t dtinvsqrt = 1.0/sqrt(update->dt); + const flt_t dtinvsqrt = 1.0/std::sqrt(update->dt); const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; @@ -322,7 +322,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, icut = parami[jtype].icut; } const flt_t rsq = delx * delx + dely * dely + delz * delz; - const flt_t rinv = (flt_t)1.0/sqrt(rsq); + const flt_t rinv = (flt_t)1.0/std::sqrt(rsq); if (rinv > icut) { flt_t factor_dpd, factor_sqrt; diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index ba5047a15a..9c5d6da5e5 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -340,7 +340,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - flt_t p = sqrt(rsq)*frdr + (flt_t)1.0; + flt_t p = std::sqrt(rsq)*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); p -= m; @@ -546,7 +546,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int j = tj[jj] & NEIGHMASK; if (!ONETYPE) jtype = tjtype[jj]; const flt_t rsq = trsq[jj]; - const flt_t r = sqrt(rsq); + const flt_t r = std::sqrt(rsq); flt_t p = r*frdr + (flt_t)1.0; int m = static_cast (p); m = MIN(m,nr-1); diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index 5609479388..92e074e5e1 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -492,7 +492,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, flt_t r12hat_0, r12hat_1, r12hat_2; ME_normalize3(delx_form[jj], dely_form[jj], delz_form[jj], r12hat); - flt_t r = sqrt(rsq_form[jj]); + flt_t r = std::sqrt(rsq_form[jj]); // compute distance of closest approach diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index e920257ef4..faae6e5cbc 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -306,7 +306,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, const int sbindex = tj[jj] >> SBBITS & 3; const flt_t rsq = trsq[jj]; const flt_t r2inv = (flt_t)1.0 / rsq; - const flt_t r_inv = (flt_t)1.0 / sqrt(rsq); + const flt_t r_inv = (flt_t)1.0 / std::sqrt(rsq); forcecoul = qqrd2e * qtmp * q[j] * r_inv; if (rsq > cut_coul_innersq) { const flt_t ccr = cut_coulsq - rsq; diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 0a93621bcd..412af17357 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -339,7 +339,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); @@ -591,10 +591,10 @@ void PairLJCharmmCoulLongIntel::pack_force_const(ForceConst &fc, for (int j = 1; j < tp1; j++) { if (i <= j) { fc.lj[i][j].x = epsilon[i][j] * 4.0; - fc.lj[i][j].y = pow(sigma[i][j],6.0); + fc.lj[i][j].y = std::pow(sigma[i][j],6.0); } else { fc.lj[i][j].x = epsilon[j][i] * 4.0; - fc.lj[i][j].y = pow(sigma[j][i],6.0); + fc.lj[i][j].y = std::pow(sigma[j][i],6.0); } fc.cutsq[i][j] = cutsq[i][j]; } diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index 89e556defa..5eb3cbc1f7 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -332,7 +332,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, const flt_t EWALD_F = 1.12837917; const flt_t INV_EWALD_P = 1.0 / 0.3275911; - const flt_t r = (flt_t)1.0 / sqrt(r2inv); + const flt_t r = (flt_t)1.0 / std::sqrt(r2inv); const flt_t grij = g_ewald * r; const flt_t expm2 = std::exp(-grij * grij); const flt_t t = INV_EWALD_P / (INV_EWALD_P + grij); diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index 07d590ee2c..fa62f499de 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -382,7 +382,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq1 = trsq[jj]; const flt_t rinvsq1 = (flt_t)1.0 / rsq1; - const flt_t r1 = (flt_t)1.0/sqrt(rinvsq1); + const flt_t r1 = (flt_t)1.0/std::sqrt(rinvsq1); if (!ONETYPE) cut = p2f[ijtype].cut; const flt_t rainv1 = (flt_t)1.0 / (r1 - cut); @@ -475,7 +475,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t rsq2 = trsq[kk]; const flt_t rinvsq2 = (flt_t)1.0 / rsq2; - const flt_t r2 = (flt_t)1.0 / sqrt(rinvsq2); + const flt_t r2 = (flt_t)1.0 / std::sqrt(rinvsq2); const flt_t rainv2 = (flt_t)1.0 / (r2 - cut); const flt_t gsrainv2 = sigma_gamma * rainv2; const flt_t gsrainvsq2 = gsrainv2 * rainv2 / r2; diff --git a/src/INTEL/pppm_disp_intel.cpp b/src/INTEL/pppm_disp_intel.cpp index fdff23fe5e..cc4aa6ab93 100644 --- a/src/INTEL/pppm_disp_intel.cpp +++ b/src/INTEL/pppm_disp_intel.cpp @@ -124,8 +124,7 @@ void PPPMDispIntel::init() _use_lrt = fix->lrt(); if (_use_lrt) - error->all(FLERR, - "LRT mode is currently not supported for pppm/disp/intel"); + error->all(FLERR, "LRT mode is currently not supported for pppm/disp/intel"); // For vectorization, we need some padding in the end @@ -142,19 +141,15 @@ void PPPMDispIntel::init() if (_use_table) { rho_points = 5000; memory->destroy(rho_lookup); - memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho_lookup"); + memory->create(rho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho_lookup"); memory->destroy(rho6_lookup); - memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:rho6_lookup"); + memory->create(rho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:rho6_lookup"); if (differentiation_flag == 1) { memory->destroy(drho_lookup); - memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho_lookup"); + memory->create(drho_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho_lookup"); memory->destroy(drho6_lookup); - memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER, - "pppmdispintel:drho6_lookup"); + memory->create(drho6_lookup, rho_points, INTEL_P3M_ALIGNED_MAXORDER,"pppmdispintel:drho6_lookup"); } precompute_rho(); } @@ -662,8 +657,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) energy_1 -= g_ewald*qsqsum/MY_PIS + MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume); - energy_6 += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij + - 1.0/12.0*pow(g_ewald_6,6)*csum; + energy_6 += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij + + 1.0/12.0*std::pow(g_ewald_6,6)*csum; energy_1 *= qscale; } @@ -676,7 +671,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) MPI_Allreduce(virial_6,virial_all,6,MPI_DOUBLE,MPI_SUM,world); for (i = 0; i < 6; i++) virial[i] += 0.5*volume*virial_all[i]; if (function[1]+function[2]+function[3]) { - double a = MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij; + double a = MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)*csumij; virial[0] -= a; virial[1] -= a; virial[2] -= a; @@ -695,8 +690,8 @@ void PPPMDispIntel::compute(int eflag, int vflag) int tmp; for (i = 0; i < atom->nlocal; i++) { tmp = atom->type[i]; - eatom[i] += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumi[tmp] + - 1.0/12.0*pow(g_ewald_6,6)*cii[tmp]; + eatom[i] += - MY_PI*MY_PIS/(6*volume)*std::pow(g_ewald_6,3)* + csumi[tmp] + 1.0/12.0*std::pow(g_ewald_6,6)*cii[tmp]; } } } @@ -708,7 +703,7 @@ void PPPMDispIntel::compute(int eflag, int vflag) tmp = atom->type[i]; //dispersion self virial correction for (int n = 0; n < 3; n++) vatom[i][n] -= MY_PI*MY_PIS/(6*volume)* - pow(g_ewald_6,3)*csumi[tmp]; + std::pow(g_ewald_6,3)*csumi[tmp]; } } } @@ -1788,18 +1783,18 @@ void PPPMDispIntel::fieldforce_c_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i][0] += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i][1] += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i][2] += qfactor * particle_ekz[i] - fqqrd2es * sf; @@ -2160,18 +2155,18 @@ void PPPMDispIntel::fieldforce_g_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoljsq; f[i][0] += lj * particle_ekx[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoljsq; f[i][1] += lj * particle_eky[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoljsq; if (slabflag != 2) f[i][2] += lj * particle_ekz[i] - sf; @@ -2707,22 +2702,22 @@ void PPPMDispIntel::fieldforce_a_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][0] += lj0*particle_ekx0[i] + lj1*particle_ekx1[i] + lj2*particle_ekx2[i] + lj3*particle_ekx3[i] + lj4*particle_ekx4[i] + lj5*particle_ekx5[i] + lj6*particle_ekx6[i] - sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; f[i][1] += lj0*particle_eky0[i] + lj1*particle_eky1[i] + lj2*particle_eky2[i] + lj3*particle_eky3[i] + lj4*particle_eky4[i] + lj5*particle_eky5[i] + lj6*particle_eky6[i] - sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= 4*lj0*lj6 + 4*lj1*lj5 + 4*lj2*lj4 + 2*lj3*lj3; if (slabflag != 2) f[i][2] += lj0*particle_ekz0[i] + lj1*particle_ekz1[i] + @@ -3106,14 +3101,14 @@ void PPPMDispIntel::fieldforce_none_ad(IntelBuffers * /*buffers*/) const flt_t s1 = x[i][0] * hx_inv; const flt_t s2 = x[i][1] * hy_inv; const flt_t s3 = x[i][2] * hz_inv; - flt_t sf1 = fsf_coeff0 * sin(ftwo_pi * s1); - sf1 += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf1 = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf1 += fsf_coeff1 * std::sin(ffour_pi * s1); - flt_t sf2 = fsf_coeff2 * sin(ftwo_pi * s2); - sf2 += fsf_coeff3 * sin(ffour_pi * s2); + flt_t sf2 = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf2 += fsf_coeff3 * std::sin(ffour_pi * s2); - flt_t sf3 = fsf_coeff4 * sin(ftwo_pi * s3); - sf3 += fsf_coeff5 * sin(ffour_pi * s3); + flt_t sf3 = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf3 += fsf_coeff5 * std::sin(ffour_pi * s3); for (int k = 0; k < nsplit; k++) { const flt_t lj = B[nsplit*type + k]; const flt_t twoljsq = lj*lj * B[k] * 2; diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index 2ceca54d29..f67b3a89b3 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -953,18 +953,18 @@ void PPPMIntel::fieldforce_ad(IntelBuffers *buffers) const flt_t s1 = x[i].x * hx_inv; const flt_t s2 = x[i].y * hy_inv; const flt_t s3 = x[i].z * hz_inv; - flt_t sf = fsf_coeff0 * sin(ftwo_pi * s1); - sf += fsf_coeff1 * sin(ffour_pi * s1); + flt_t sf = fsf_coeff0 * std::sin(ftwo_pi * s1); + sf += fsf_coeff1 * std::sin(ffour_pi * s1); sf *= twoqsq; f[i].x += qfactor * particle_ekx[i] - fqqrd2es * sf; - sf = fsf_coeff2 * sin(ftwo_pi * s2); - sf += fsf_coeff3 * sin(ffour_pi * s2); + sf = fsf_coeff2 * std::sin(ftwo_pi * s2); + sf += fsf_coeff3 * std::sin(ffour_pi * s2); sf *= twoqsq; f[i].y += qfactor * particle_eky[i] - fqqrd2es * sf; - sf = fsf_coeff4 * sin(ftwo_pi * s3); - sf += fsf_coeff5 * sin(ffour_pi * s3); + sf = fsf_coeff4 * std::sin(ftwo_pi * s3); + sf += fsf_coeff5 * std::sin(ffour_pi * s3); sf *= twoqsq; if (slabflag != 2) f[i].z += qfactor * particle_ekz[i] - fqqrd2es * sf; diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 42414420b6..9df17d8cef 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -19,7 +19,6 @@ #include "atom_vec.h" #include "bond.h" #include "comm.h" -#include "compute.h" #include "dihedral.h" #include "domain.h" #include "error.h" @@ -27,7 +26,6 @@ #include "force.h" #include "improper.h" #include "kspace.h" -#include "memory.h" #include "modify.h" #include "neighbor.h" #include "output.h" @@ -35,9 +33,7 @@ #include "timer.h" #include "update.h" -#if defined(_OPENMP) -#include -#endif +#include using namespace LAMMPS_NS; @@ -67,7 +63,7 @@ void VerletLRTIntel::init() { Verlet::init(); - _intel_kspace = dynamic_cast(force->kspace_match("^pppm\\..*intel$", 0)); + _intel_kspace = dynamic_cast(force->kspace_match("^pppm/.*intel$", 0)); // include pppm/electrode/intel #ifndef LMP_INTEL_USELRT @@ -95,12 +91,15 @@ void VerletLRTIntel::setup(int flag) } #endif - if (comm->me == 0) { - fprintf(screen,"Setting up VerletLRTIntel run ...\n"); - fprintf(screen," Unit style : %s\n", update->unit_style); - fmt::print(screen," Current step : {}\n", update->ntimestep); - fprintf(screen," Time step : %g\n", update->dt); - timer->print_timeout(screen); + if (comm->me == 0 && screen) { + fputs("Setting up VerletLRTIntel run ...\n",screen); + if (flag) { + fmt::print(screen," Unit style : {}\n" + " Current step : {}\n" + " Time step : {}\n", + update->unit_style,update->ntimestep,update->dt); + timer->print_timeout(screen); + } } #if defined(_LMP_INTEL_LRT_PTHREAD) @@ -110,8 +109,9 @@ void VerletLRTIntel::setup(int flag) sched_getaffinity(0, sizeof(cpuset), &cpuset); int my_cpu_count = CPU_COUNT(&cpuset); if (my_cpu_count < comm->nthreads + 1) { - error->warning(FLERR, "Using {} threads per MPI rank, but only {} core(s) allocated " - "for each MPI rank", comm->nthreads + 1, my_cpu_count); + error->warning(FLERR, "Using {} threads per MPI rank, but only {} " + "core(s) allocated for each MPI rank", + comm->nthreads + 1, my_cpu_count); } } #endif @@ -144,6 +144,7 @@ void VerletLRTIntel::setup(int flag) domain->box_too_small_check(); modify->setup_pre_neighbor(); neighbor->build(1); + modify->setup_post_neighbor(); neighbor->ncalls = 0; // compute all forces @@ -189,11 +190,11 @@ void VerletLRTIntel::setup(int flag) if (kspace_compute_flag) _intel_kspace->compute_second(eflag,vflag); - modify->pre_reverse(eflag,vflag); + modify->setup_pre_reverse(eflag,vflag); if (force->newton) comm->reverse_comm(); modify->setup(vflag); - output->setup(); + output->setup(flag); update->setupflag = 0; } @@ -214,9 +215,10 @@ void VerletLRTIntel::run(int n) int n_post_integrate = modify->n_post_integrate; int n_pre_exchange = modify->n_pre_exchange; int n_pre_neighbor = modify->n_pre_neighbor; + int n_post_neighbor = modify->n_post_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force_any; + int n_post_force_any = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; @@ -279,6 +281,10 @@ void VerletLRTIntel::run(int n) } neighbor->build(1); timer->stamp(Timer::NEIGH); + if (n_post_neighbor) { + modify->post_neighbor(); + timer->stamp(Timer::MODIFY); + } } // force computations @@ -353,7 +359,7 @@ void VerletLRTIntel::run(int n) // force modifications, final time integration, diagnostics - if (n_post_force) modify->post_force(vflag); + if (n_post_force_any) modify->post_force(vflag); modify->final_integrate(); if (n_end_of_step) modify->end_of_step(); timer->stamp(Timer::MODIFY); diff --git a/src/INTERLAYER/pair_aip_water_2dm.cpp b/src/INTERLAYER/pair_aip_water_2dm.cpp new file mode 100644 index 0000000000..6e2bf7228d --- /dev/null +++ b/src/INTERLAYER/pair_aip_water_2dm.cpp @@ -0,0 +1,72 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + This is a full version of the potential described in + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +------------------------------------------------------------------------- */ + +#include "pair_aip_water_2dm.h" + +#include "citeme.h" +#include "error.h" +#include "force.h" + +#include +#include + +using namespace LAMMPS_NS; + +#define MAXLINE 1024 +#define DELTA 4 +#define PGDELTA 1 + +static const char cite_aip_water[] = + "aip/water/2dm potential doi/10.1021/acs.jpcc.2c08464\n" + "@Article{Feng2023\n" + " author = {Z. Feng, Y. Yao, J. Liu, B. Wu, Z. Liu, and W. Ouyang},\n" + " title = {Registry-Dependent Potential for Interfaces of Water with Graphene},\n" + " journal = {J. Phys. Chem. C},\n" + " volume = 127,\n" + " pages = {8704-8713}\n" + " year = 2023,\n" + "}\n\n"; + +/* ---------------------------------------------------------------------- */ + +PairAIPWATER2DM::PairAIPWATER2DM(LAMMPS *lmp) : PairILPGrapheneHBN(lmp), PairILPTMD(lmp) +{ + variant = AIP_WATER_2DM; + single_enable = 0; + + // for TMD, each atom have six neighbors + Nnei = 6; + + if (lmp->citeme) lmp->citeme->add(cite_aip_water); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairAIPWATER2DM::settings(int narg, char **arg) +{ + if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); + if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) + error->all(FLERR, "Pair style aip/water/2dm must be used as sub-style with hybrid/overlay"); + + cut_global = utils::numeric(FLERR, arg[0], false, lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); +} diff --git a/src/INTERLAYER/pair_aip_water_2dm.h b/src/INTERLAYER/pair_aip_water_2dm.h new file mode 100644 index 0000000000..295cdfffb9 --- /dev/null +++ b/src/INTERLAYER/pair_aip_water_2dm.h @@ -0,0 +1,39 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(aip/water/2dm,PairAIPWATER2DM); +// clang-format on +#else + +#ifndef LMP_PAIR_AIP_WATER_2DM_H +#define LMP_PAIR_AIP_WATER_2DM_H + +#include "pair_ilp_tmd.h" + +namespace LAMMPS_NS { + +class PairAIPWATER2DM : virtual public PairILPTMD { + public: + PairAIPWATER2DM(class LAMMPS *); + + protected: + void settings(int, char **) override; + +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/INTERLAYER/pair_coul_shield.cpp b/src/INTERLAYER/pair_coul_shield.cpp index e647e1ea91..a5e3e63442 100644 --- a/src/INTERLAYER/pair_coul_shield.cpp +++ b/src/INTERLAYER/pair_coul_shield.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com This is a Coulomb potential described in diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 0ff2811339..69896d7c0b 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -11,13 +11,11 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Maaravi et al, J. Phys. Chem. C 121, 22826-22835 (2017)] - The definition of normals are the same as that in - [Kolmogorov & Crespi, Phys. Rev. B 71, 235415 (2005)] + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] ------------------------------------------------------------------------- */ #include "pair_ilp_graphene_hbn.h" @@ -59,6 +57,7 @@ static const char cite_ilp[] = static std::map variant_map = { {PairILPGrapheneHBN::ILP_GrhBN, "ilp/graphene/hbn"}, {PairILPGrapheneHBN::ILP_TMD, "ilp/tmd"}, + {PairILPGrapheneHBN::AIP_WATER_2DM, "aip/water/2dm"}, {PairILPGrapheneHBN::SAIP_METAL, "saip/metal"}}; /* ---------------------------------------------------------------------- */ @@ -632,7 +631,7 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */) void PairILPGrapheneHBN::ILP_neigh() { - int i, j, ii, jj, n, allnum, jnum, itype, jtype; + int i, j, ii, jj, n, inum, jnum, itype, jtype; double xtmp, ytmp, ztmp, delx, dely, delz, rsq; int *ilist, *jlist, *numneigh, **firstneigh; int *neighptr; @@ -649,7 +648,7 @@ void PairILPGrapheneHBN::ILP_neigh() (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPGrapheneHBN:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -659,7 +658,7 @@ void PairILPGrapheneHBN::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; n = 0; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 9987830b1d..e151ecc801 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -39,7 +39,7 @@ class PairILPGrapheneHBN : public Pair { static constexpr int NPARAMS_PER_LINE = 13; - enum { ILP_GrhBN, ILP_TMD, SAIP_METAL }; // for telling class variants apart in shared code + enum { ILP_GrhBN, ILP_TMD, SAIP_METAL, AIP_WATER_2DM }; // for telling class variants apart in shared code protected: int me; diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index c024e23079..fd3a2f8c6f 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -15,7 +15,7 @@ e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Ouyang et al, J. Chem. Theory Comput. 17, 7237 (2021).] + [Ouyang et al., J. Chem. Theory Comput. 17, 7237 (2021).] ------------------------------------------------------------------------- */ #include "pair_ilp_tmd.h" @@ -35,10 +35,6 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 -#define DELTA 4 -#define PGDELTA 1 - static const char cite_ilp_tmd[] = "ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" "@Article{Ouyang2021\n" @@ -232,7 +228,7 @@ void PairILPTMD::calc_FRep(int eflag, int /* vflag */) void PairILPTMD::ILP_neigh() { - int i, j, l, ii, jj, ll, n, allnum, jnum, itype, jtype, ltype, imol, jmol, count; + int i, j, l, ii, jj, ll, n, inum, jnum, itype, jtype, ltype, imol, jmol, count; double xtmp, ytmp, ztmp, delx, dely, delz, deljx, deljy, deljz, rsq, rsqlj; int *ilist, *jlist, *numneigh, **firstneigh; int *neighsort; @@ -249,7 +245,7 @@ void PairILPTMD::ILP_neigh() ILP_firstneigh = (int **) memory->smalloc(maxlocal * sizeof(int *), "ILPTMD:firstneigh"); } - allnum = list->inum + list->gnum; + inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; @@ -259,7 +255,7 @@ void PairILPTMD::ILP_neigh() ipage->reset(); - for (ii = 0; ii < allnum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; //initialize varibles @@ -288,21 +284,21 @@ void PairILPTMD::ILP_neigh() delz = ztmp - x[j][2]; rsq = delx * delx + dely * dely + delz * delz; - // check if the atom i is TMD, i.e., Mo/S/W/Se - if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || - strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + // check if the atom i is a TMD atom, i.e., Mo/S/W/Se + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || strcmp(elements[itype], "Te") == 0) { if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol && type[i] == type[j]) { neighptr[n++] = j; } - } else { // atom i is C, B, N or H. + } else { // atom i can be P, C, B, N or H. if (rsq != 0 && rsq < cutILPsq[itype][jtype] && imol == jmol) { neighptr[n++] = j; } } } // loop over jj // if atom i is Mo/W/S/Se/Te, then sorting the orders of neighbors - if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || - strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || strcmp(elements[itype], "Te") == 0) { // initialize neighsort for (ll = 0; ll < n; ll++) { @@ -336,9 +332,6 @@ void PairILPTMD::ILP_neigh() } } // end of idenfying the first neighbor } else if (n > Nnei) { - fprintf(screen, "Molecule ID = %d\n", imol); - fprintf(screen, "Atom Type = %d\n", type[i]); - fprintf(screen, "Neinum = %d\n", n); error->one(FLERR, "There are too many neighbors for TMD atoms, please check your configuration"); } @@ -367,11 +360,11 @@ void PairILPTMD::ILP_neigh() ll++; } } // end of sorting the order of neighbors - } else { // for B/N/C/H atoms + } else { // for P/B/N/C/H atoms if (n > 3) error->one( FLERR, - "There are too many neighbors for B/N/C/H atoms, please check your configuration"); + "There are too many neighbors for P/B/N/C/H atoms, please check your configuration"); for (ll = 0; ll < n; ll++) { neighsort[ll] = neighptr[ll]; } } @@ -390,12 +383,14 @@ void PairILPTMD::calc_normal() { int i, j, ii, jj, inum, jnum; int cont, id, ip, m, k, itype; - double nn, xtp, ytp, ztp, delx, dely, delz, nn2; int *ilist, *jlist; + int iH1,iH2,jH1,jH2; double Nave[3], dni[3], dpvdri[3][3]; + double nn, xtp, ytp, ztp, delx, dely, delz, nn2; double **x = atom->x; int *type = atom->type; + tagint *tag = atom->tag; memory->destroy(dnn); memory->destroy(vect); @@ -479,9 +474,60 @@ void PairILPTMD::calc_normal() for (m = 0; m < Nnei; m++) { dnormal[i][id][m][ip] = 0.0; } } } + // for hydrogen in water molecule + if (strcmp(elements[itype], "Hw") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] - 1); + jH2 = atom->map(tag[i] - 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Ow") == 0 ) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + } else if (strcmp(elements[iH2], "Ow") == 0 ) { + vect[0][0] = x[jH2][0] - xtp; + vect[0][1] = x[jH2][1] - ytp; + vect[0][2] = x[jH2][2] - ztp; + } else { + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + Nave[0] = vect[0][0]; + Nave[1] = vect[0][1]; + Nave[2] = vect[0][2]; + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + if (ip == id) { dpvdri[id][ip] = -1.0;} + else {dpvdri[id][ip] = 0.0;} + } + } + + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + dnormal[i][id][0][ip] = -dnormdri[i][id][ip]; + } + } + } } //############################ For the edge atoms of TMD ################################ - else if (cont < Nnei) { + else if (cont > 1 && cont < Nnei) { if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0) { // derivatives of Ni[l] respect to the cont neighbors @@ -557,8 +603,7 @@ void PairILPTMD::calc_normal() for (m = 0; m < cont; m++) { for (id = 0; id < 3; id++) { dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + - Nave[2] * dNave[2][m][id]) / - nn; + Nave[2] * dNave[2][m][id]) / nn; } } // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. @@ -589,12 +634,99 @@ void PairILPTMD::calc_normal() } } } // for TMD + //############################ For Oxygen in the water molecule ####################### + else if (strcmp(elements[itype], "Ow") == 0) { + if(cont == 0) { + jH1 = atom->map(tag[i] + 1); + jH2 = atom->map(tag[i] + 2); + iH1 = map[type[jH1]]; + iH2 = map[type[jH2]]; + if (strcmp(elements[iH1], "Hw") == 0 && strcmp(elements[iH2], "Hw") == 0) { + vect[0][0] = x[jH1][0] - xtp; + vect[0][1] = x[jH1][1] - ytp; + vect[0][2] = x[jH1][2] - ztp; + + vect[1][0] = x[jH2][0] - xtp; + vect[1][1] = x[jH2][1] - ytp; + vect[1][2] = x[jH2][2] - ztp; + + cont = 2; + } else { + error->one(FLERR, "The order of atoms in water molecule should be O H H !"); + } + } + if (cont == 2) { + Nave[0] = (vect[0][0] + vect[1][0])/cont; + Nave[1] = (vect[0][1] + vect[1][1])/cont; + Nave[2] = (vect[0][2] + vect[1][2])/cont; + // the magnitude of the normal vector + nn2 = Nave[0] * Nave[0] + Nave[1] * Nave[1] + Nave[2] * Nave[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + // the unit normal vector + normal[i][0] = Nave[0] / nn; + normal[i][1] = Nave[1] / nn; + normal[i][2] = Nave[2] / nn; + + // derivatives of non-normalized normal vector, dNave:3xcontx3 array + // dNave[id][m][ip]: the derivatve of the id component of Nave + // respect to the ip component of atom m + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < cont; m++) { + if (ip == id) { dNave[id][m][ip] = 0.5;} + else {dNave[id][m][ip] = 0.0;} + } + } + } + // derivatives of nn, dnn:contx3 vector + // dnn[m][id]: the derivative of nn respect to r[m][id], m=0,...Nnei-1; id=0,1,2 + // r[m][id]: the id's component of atom m + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + + Nave[2] * dNave[2][m][id]) / nn; + } + } + // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. + // for atom m, which is a neighbor atom of atom i, m = 0,...,Nnei-1 + for (m = 0; m < cont; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormal[i][id][m][ip] = dNave[id][m][ip] / nn - Nave[id] * dnn[m][ip] / nn2; + } + } + } + // Calculte dNave/dri, defined as dpvdri + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dpvdri[id][ip] = 0.0; + for (k = 0; k < cont; k++) { dpvdri[id][ip] -= dNave[id][k][ip]; } + } + } + + // derivatives of nn, dnn:3x1 vector + dni[0] = (Nave[0] * dpvdri[0][0] + Nave[1] * dpvdri[1][0] + Nave[2] * dpvdri[2][0]) / nn; + dni[1] = (Nave[0] * dpvdri[0][1] + Nave[1] * dpvdri[1][1] + Nave[2] * dpvdri[2][1]) / nn; + dni[2] = (Nave[0] * dpvdri[0][2] + Nave[1] * dpvdri[1][2] + Nave[2] * dpvdri[2][2]) / nn; + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[i][id][ip] = dpvdri[id][ip] / nn - Nave[id] * dni[ip] / nn2; + } + } + } + else if (cont >= 3) { + error->one(FLERR, + "There are too many neighbors for calculating normals of water molecules"); + } + } //############################ For the edge & bulk atoms of GrhBN ################################ else { if (cont == 2) { for (ip = 0; ip < 3; ip++) { pvet[0][ip] = vect[0][modulo(ip + 1, 3)] * vect[1][modulo(ip + 2, 3)] - - vect[0][modulo(ip + 2, 3)] * vect[1][modulo(ip + 1, 3)]; + vect[0][modulo(ip + 2, 3)] * vect[1][modulo(ip + 1, 3)]; } // dpvet1[k][l][ip]: the derivatve of the k (=0,...cont-1)th Nik respect to the ip component of atom l // derivatives respect to atom l @@ -657,8 +789,7 @@ void PairILPTMD::calc_normal() for (m = 0; m < cont; m++) { for (id = 0; id < 3; id++) { dnn[m][id] = (Nave[0] * dNave[0][m][id] + Nave[1] * dNave[1][m][id] + - Nave[2] * dNave[2][m][id]) / - nn; + Nave[2] * dNave[2][m][id]) / nn; } } // dnormal[i][id][m][ip]: the derivative of normal[i][id] respect to r[m][ip], id,ip=0,1,2. diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index b2eba787b1..b497ae3568 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Wengen Ouyang (Tel Aviv University) + Contributing author: Wengen Ouyang (Wuhan University) e-mail: w.g.ouyang at gmail dot com based on previous versions by Jaap Kroes diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index 05fbfbf7f4..bd327391a4 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -15,7 +15,7 @@ e-mail: w.g.ouyang at gmail dot com This is a full version of the potential described in - [Ouyang et al, J. Chem. Theory Comput. 17, 7215-7223 (2021)] + [Ouyang et al., J. Chem. Theory Comput. 17, 7215-7223 (2021)] ------------------------------------------------------------------------- */ #include "pair_saip_metal.h" diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 14564162e2..ae2e6e6ea0 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -138,6 +138,10 @@ PairKIM::PairKIM(LAMMPS *lmp) : kim_init_ok = false; kim_particle_codes_ok = false; + // scale parameter and whether to apply it + scale = 1.0; + scale_extracted = false; + if (lmp->citeme) lmp->citeme->add(cite_openkim); } @@ -247,16 +251,25 @@ void PairKIM::compute(int eflag, int vflag) // compute via KIM model int kimerror = KIM_Model_Compute(pkim, pargs); - if (kimerror) error->all(FLERR,"KIM Compute returned error {}", kimerror); + if (kimerror) error->all(FLERR, "KIM Compute returned error {}", kimerror); + + // scale results for fix adapt if needed + if (scale_extracted) { + if (eflag_global != 0) eng_vdwl *= scale; + for (int i = 0; i < nall; i++) { + if (eflag_atom != 0) eatom[i] *= scale; + if (vflag_atom != 0) { + for (int j = 0; j < 6; j++) vatom[i][j] *= scale; + } + for (int j = 0; j < 3; j++) atom->f[i][j] *= scale; + } + } // compute virial before reverse comm! - if (vflag_global) - virial_fdotr_compute(); + if (vflag_global) virial_fdotr_compute(); // if newton is off, perform reverse comm - if (!lmps_using_newton) { - comm->reverse_comm(this); - } + if (!lmps_using_newton) comm->reverse_comm(this); if ((vflag_atom != 0) && KIM_SupportStatus_NotEqual(kim_model_support_for_particleVirial, @@ -1135,3 +1148,13 @@ void PairKIM::set_kim_model_has_flags() KIM_Model *PairKIM::get_kim_model() { return pkim; } std::string PairKIM::get_atom_type_list() { return atom_type_list; } + +void *PairKIM::extract(const char *str, int &dim) +{ + dim = 0; + if (strcmp(str,"scale") == 0) { + scale_extracted = true; + return (void *) &scale; + } + return nullptr; +} diff --git a/src/KIM/pair_kim.h b/src/KIM/pair_kim.h index 90adb863e2..55f70faad3 100644 --- a/src/KIM/pair_kim.h +++ b/src/KIM/pair_kim.h @@ -84,6 +84,7 @@ class PairKIM : public Pair { void init_style() override; void init_list(int id, NeighList *ptr) override; double init_one(int, int) override; + void *extract(const char *, int &) override; int pack_reverse_comm(int, int, double *) override; void unpack_reverse_comm(int, int *, double *) override; double memory_usage() override; @@ -100,6 +101,10 @@ class PairKIM : public Pair { int settings_call_count; int init_style_call_count; + // scale factor for fix adapt, and whether or not it's been modified + double scale; + bool scale_extracted; + // values set in settings() char *kim_modelname; diff --git a/src/KOKKOS/angle_cosine_kokkos.cpp b/src/KOKKOS/angle_cosine_kokkos.cpp index 24d1b5caea..189a156866 100644 --- a/src/KOKKOS/angle_cosine_kokkos.cpp +++ b/src/KOKKOS/angle_cosine_kokkos.cpp @@ -150,20 +150,26 @@ void AngleCosineKokkos::operator()(TagAngleCosineCompute::operator()(TagAngleCosineComputekokkos->sort_classic; +} + +/* ---------------------------------------------------------------------- */ + void AtomKokkos::sync(const ExecutionSpace space, unsigned int mask) { if (space == Device && lmp->kokkos->auto_sync) avecKK->modified(Host, mask); @@ -140,8 +162,37 @@ void AtomKokkos::allocate_type_arrays() void AtomKokkos::sort() { - int i, m, n, ix, iy, iz, ibin, empty; + // check if all fixes with atom-based arrays support sort on device + if (!sort_classic) { + int flag = 1; + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) { + auto fix_iextra = modify->fix[atom->extra_grow[iextra]]; + if (!fix_iextra->sort_device) { + flag = 0; + break; + } + } + if (!flag) { + if (comm->me == 0) { + error->warning(FLERR,"Fix with atom-based arrays not compatible with Kokkos sorting on device, " + "switching to classic host sorting"); + } + sort_classic = true; + } + } + + if (sort_classic) { + sync(Host, ALL_MASK); + Atom::sort(); + modified(Host, ALL_MASK); + } else sort_device(); +} + +/* ---------------------------------------------------------------------- */ + +void AtomKokkos::sort_device() +{ // set next timestep for sorting to take place nextsort = (update->ntimestep / sortfreq) * sortfreq + sortfreq; @@ -151,88 +202,40 @@ void AtomKokkos::sort() if (domain->box_change) setup_sort_bins(); if (nbins == 1) return; - // reallocate per-atom vectors if needed + // for triclinic, atoms must be in box coords (not lamda) to match bbox - if (atom->nmax > maxnext) { - memory->destroy(next); - memory->destroy(permute); - maxnext = atom->nmax; - memory->create(next, maxnext, "atom:next"); - memory->create(permute, maxnext, "atom:permute"); - } + if (domain->triclinic) domain->lamda2x(nlocal); - // ensure there is one extra atom location at end of arrays for swaps + auto d_x = k_x.d_view; + sync(Device, X_MASK); - if (nlocal == nmax) avec->grow(0); + // sort - sync(Host, ALL_MASK); - modified(Host, ALL_MASK); + int max_bins[3]; + max_bins[0] = nbinx; + max_bins[1] = nbiny; + max_bins[2] = nbinz; - // bin atoms in reverse order so linked list will be in forward order + using KeyViewType = DAT::t_x_array; + using BinOp = BinOp3DLAMMPS; + BinOp binner(max_bins, bboxlo, bboxhi); + Kokkos::BinSort Sorter(d_x, 0, nlocal, binner, false); + Sorter.create_permute_vector(LMPDeviceType()); - for (i = 0; i < nbins; i++) binhead[i] = -1; + avecKK->sort_kokkos(Sorter); - HAT::t_x_array_const h_x = k_x.view(); - for (i = nlocal - 1; i >= 0; i--) { - ix = static_cast((h_x(i, 0) - bboxlo[0]) * bininvx); - iy = static_cast((h_x(i, 1) - bboxlo[1]) * bininvy); - iz = static_cast((h_x(i, 2) - bboxlo[2]) * bininvz); - ix = MAX(ix, 0); - iy = MAX(iy, 0); - iz = MAX(iz, 0); - ix = MIN(ix, nbinx - 1); - iy = MIN(iy, nbiny - 1); - iz = MIN(iz, nbinz - 1); - ibin = iz * nbiny * nbinx + iy * nbinx + ix; - next[i] = binhead[ibin]; - binhead[ibin] = i; - } + if (atom->nextra_grow) { + for (int iextra = 0; iextra < atom->nextra_grow; iextra++) { + auto fix_iextra = modify->fix[atom->extra_grow[iextra]]; + KokkosBase *kkbase = dynamic_cast(fix_iextra); - // permute = desired permutation of atoms - // permute[I] = J means Ith new atom will be Jth old atom - - n = 0; - for (m = 0; m < nbins; m++) { - i = binhead[m]; - while (i >= 0) { - permute[n++] = i; - i = next[i]; + kkbase->sort_kokkos(Sorter); } } - // current = current permutation, just reuse next vector - // current[I] = J means Ith current atom is Jth old atom + // convert back to lamda coords - int *current = next; - for (i = 0; i < nlocal; i++) current[i] = i; - - // reorder local atom list, when done, current = permute - // perform "in place" using copy() to extra atom location at end of list - // inner while loop processes one cycle of the permutation - // copy before inner-loop moves an atom to end of atom list - // copy after inner-loop moves atom at end of list back into list - // empty = location in atom list that is currently empty - - for (i = 0; i < nlocal; i++) { - if (current[i] == permute[i]) continue; - avec->copy(i, nlocal, 0); - empty = i; - while (permute[empty] != i) { - avec->copy(permute[empty], empty, 0); - empty = current[empty] = permute[empty]; - } - avec->copy(nlocal, empty, 0); - current[empty] = permute[empty]; - } - - // sanity check that current = permute - - //int flag = 0; - //for (i = 0; i < nlocal; i++) - // if (current[i] != permute[i]) flag = 1; - //int flagall; - //MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - //if (flagall) errorX->all(FLERR,"Atom sort did not operate correctly"); + if (domain->triclinic) domain->x2lamda(nlocal); } /* ---------------------------------------------------------------------- @@ -241,7 +244,6 @@ void AtomKokkos::sort() void AtomKokkos::grow(unsigned int mask) { - if (mask & SPECIAL_MASK) { memoryKK->destroy_kokkos(k_special, special); sync(Device, mask); @@ -364,18 +366,7 @@ void AtomKokkos::deallocate_topology() memoryKK->destroy_kokkos(k_improper_atom4, improper_atom4); } -/* ---------------------------------------------------------------------- - perform sync and modify for each of 2 masks - called by individual styles to override default sync/modify calls - done at higher levels (Verlet,Modify,etc) -------------------------------------------------------------------------- */ - -void AtomKokkos::sync_modify(ExecutionSpace execution_space, unsigned int datamask_read, - unsigned int datamask_modify) -{ - sync(execution_space, datamask_read); - modified(execution_space, datamask_modify); -} +/* ---------------------------------------------------------------------- */ AtomVec *AtomKokkos::new_avec(const std::string &style, int trysuffix, int &sflag) { diff --git a/src/KOKKOS/atom_kokkos.h b/src/KOKKOS/atom_kokkos.h index 2dd0198111..23566cff03 100644 --- a/src/KOKKOS/atom_kokkos.h +++ b/src/KOKKOS/atom_kokkos.h @@ -15,6 +15,8 @@ #include "atom.h" // IWYU pragma: export #include "kokkos_type.h" +#include + #ifndef LMP_ATOM_KOKKOS_H #define LMP_ATOM_KOKKOS_H @@ -22,6 +24,8 @@ namespace LAMMPS_NS { class AtomKokkos : public Atom { public: + bool sort_classic; + DAT::tdual_tagint_1d k_tag; DAT::tdual_int_1d k_type, k_mask; DAT::tdual_imageint_1d k_image; @@ -71,19 +75,50 @@ class AtomKokkos : public Atom { ~AtomKokkos() override; void map_init(int check = 1) override; + void map_clear() override; void map_set() override; + void map_one(tagint, int) override; void map_delete() override; + int map_find_hash(tagint) override; + DAT::tdual_int_scalar k_error_flag; DAT::tdual_int_1d k_sametag; DAT::tdual_int_1d k_map_array; - DAT::tdual_int_scalar k_error_flag; dual_hash_type k_map_hash; + DAT::t_tagint_1d d_tag_sorted; + DAT::t_int_1d d_i_sorted; + + typedef Kokkos::DualView tdual_tagint_2; + typedef tdual_tagint_2::t_dev t_tagint_2; + typedef tdual_tagint_2::t_host t_host_tagint_2; + + t_tagint_2 d_tag_min_max; + t_host_tagint_2 h_tag_min_max; + + DAT::t_tagint_scalar d_tag_min,d_tag_max; + HAT::t_tagint_scalar h_tag_min,h_tag_max; + + using MapKeyViewType = decltype(d_tag_sorted); + using BinOpMap = Kokkos::BinOp1D; + Kokkos::BinSort Sorter; + class AtomVecKokkos* avecKK; // map lookup function inlined for efficiency // return -1 if no map defined + inline int map(tagint global) override + { + if (map_style == 1) { + k_map_array.sync_host(); + return map_array[global]; + } else if (map_style == 2) + return map_find_hash(global); + else + return -1; + }; + template KOKKOS_INLINE_FUNCTION static int map_kokkos(tagint global, int map_style, const DAT::tdual_int_1d &k_map_array, const dual_hash_type &k_map_hash) @@ -108,6 +143,7 @@ class AtomKokkos : public Atom { return local; } + void init() override; void allocate_type_arrays() override; void sync(const ExecutionSpace space, unsigned int mask); void modified(const ExecutionSpace space, unsigned int mask); @@ -117,8 +153,8 @@ class AtomKokkos : public Atom { int add_custom(const char *, int, int) override; void remove_custom(int, int, int) override; virtual void deallocate_topology(); - void sync_modify(ExecutionSpace, unsigned int, unsigned int) override; private: + void sort_device(); class AtomVec *new_avec(const std::string &, int, int &) override; }; diff --git a/src/KOKKOS/atom_map_kokkos.cpp b/src/KOKKOS/atom_map_kokkos.cpp index f8cc5ab2c4..92786b7e37 100644 --- a/src/KOKKOS/atom_map_kokkos.cpp +++ b/src/KOKKOS/atom_map_kokkos.cpp @@ -34,8 +34,6 @@ using namespace LAMMPS_NS; set entire array to -1 as initial values for hash option: map_nhash = length of hash table - map_nbucket = # of hash buckets, prime larger than map_nhash * 2 - so buckets will only be filled with 0 or 1 atoms on average ------------------------------------------------------------------------- */ void AtomKokkos::map_init(int check) @@ -58,15 +56,7 @@ void AtomKokkos::map_init(int check) // for hash, set all buckets to empty, put all entries in free list if (!recreate) { - if (map_style == MAP_ARRAY) { - for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1; - } else { - for (int i = 0; i < map_nbucket; i++) map_bucket[i] = -1; - map_nused = 0; - map_free = 0; - for (int i = 0; i < map_nhash; i++) map_hash[i].next = i + 1; - if (map_nhash > 0) map_hash[map_nhash - 1].next = -1; - } + map_clear(); // recreating: delete old map and create new one for array or hash @@ -76,7 +66,8 @@ void AtomKokkos::map_init(int check) if (map_style == MAP_ARRAY) { map_maxarray = map_tag_max; memoryKK->create_kokkos(k_map_array, map_array, map_maxarray + 1, "atom:map_array"); - for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1; + Kokkos::deep_copy(k_map_array.d_view,-1); + k_map_array.modify_device(); } else { @@ -90,35 +81,26 @@ void AtomKokkos::map_init(int check) map_nhash *= 2; map_nhash = MAX(map_nhash, 1000); - // map_nbucket = prime just larger than map_nhash - // next_prime() should be fast enough, - // about 10% of odd integers are prime above 1M - - map_nbucket = next_prime(map_nhash); - - // set all buckets to empty - // set hash to map_nhash in length - // put all hash entries in free list and point them to each other - - map_bucket = new int[map_nbucket]; - for (int i = 0; i < map_nbucket; i++) map_bucket[i] = -1; - - map_hash = new HashElem[map_nhash]; - map_nused = 0; - map_free = 0; - for (int i = 0; i < map_nhash; i++) map_hash[i].next = i + 1; - map_hash[map_nhash - 1].next = -1; - - // use "view" template method to avoid unnecessary deep_copy - - auto h_map_hash = k_map_hash.view(); // get type - h_map_hash = decltype(h_map_hash)(map_nhash); - k_map_hash.view() = h_map_hash; + k_map_hash = dual_hash_type(map_nhash); } } +} - k_sametag.modify_host(); - if (map_style == Atom::MAP_ARRAY) k_map_array.modify_host(); +/* ---------------------------------------------------------------------- + clear global -> local map for all of my own and ghost atoms + for hash table option: + global ID may not be in table if image atom was already cleared +------------------------------------------------------------------------- */ + +void AtomKokkos::map_clear() +{ + if (map_style == Atom::MAP_ARRAY) { + Kokkos::deep_copy(k_map_array.d_view,-1); + k_map_array.modify_device(); + } else { + k_map_hash.d_view.clear(); + k_map_hash.modify_device(); + } } /* ---------------------------------------------------------------------- @@ -135,28 +117,16 @@ void AtomKokkos::map_set() { int nall = nlocal + nghost; - atomKK->sync(Host, TAG_MASK); + // possible reallocation of sametag must come before loop over atoms + // since loop sets sametag - k_sametag.sync_host(); - if (map_style == Atom::MAP_ARRAY) k_map_array.sync_host(); + if (nall > max_same) { + max_same = nall + EXTRA; + memoryKK->destroy_kokkos(k_sametag, sametag); + memoryKK->create_kokkos(k_sametag, sametag, max_same, "atom:sametag"); + } - if (map_style == MAP_ARRAY) { - - // possible reallocation of sametag must come before loop over atoms - // since loop sets sametag - - if (nall > max_same) { - max_same = nall + EXTRA; - memoryKK->destroy_kokkos(k_sametag, sametag); - memoryKK->create_kokkos(k_sametag, sametag, max_same, "atom:sametag"); - } - - for (int i = nall - 1; i >= 0; i--) { - sametag[i] = map_array[tag[i]]; - map_array[tag[i]] = i; - } - - } else { + if (map_style == MAP_HASH) { // if this proc has more atoms than hash table size, call map_init() // call with 0 since max atomID in system has not changed @@ -164,107 +134,191 @@ void AtomKokkos::map_set() // b/c map_init() may invoke map_delete(), whacking sametag if (nall > map_nhash) map_init(0); - if (nall > max_same) { - max_same = nall + EXTRA; - memoryKK->destroy_kokkos(k_sametag, sametag); - memoryKK->create_kokkos(k_sametag, sametag, max_same, "atom:sametag"); - } - - int previous, ibucket, index; - tagint global; - - for (int i = nall - 1; i >= 0; i--) { - sametag[i] = map_find_hash(tag[i]); - - // search for key - // if found it, just overwrite local value with index - - previous = -1; - global = tag[i]; - ibucket = global % map_nbucket; - index = map_bucket[ibucket]; - while (index > -1) { - if (map_hash[index].global == global) break; - previous = index; - index = map_hash[index].next; - } - if (index > -1) { - map_hash[index].local = i; - continue; - } - - // take one entry from free list - // add the new global/local pair as entry at end of bucket list - // special logic if this entry is 1st in bucket - - index = map_free; - map_free = map_hash[map_free].next; - if (previous == -1) - map_bucket[ibucket] = index; - else - map_hash[previous].next = index; - map_hash[index].global = global; - map_hash[index].local = i; - map_hash[index].next = -1; - map_nused++; - } - - // Copy to Kokkos hash - - // use "view" template method to avoid unnecessary deep_copy - - auto h_map_hash = k_map_hash.view(); - h_map_hash.clear(); - - for (int i = nall - 1; i >= 0; i--) { - - // search for key - // if don't find it, done - - previous = -1; - global = tag[i]; - ibucket = global % map_nbucket; - index = map_bucket[ibucket]; - while (index > -1) { - if (map_hash[index].global == global) break; - previous = index; - index = map_hash[index].next; - } - if (index == -1) continue; - - int local = map_hash[index].local; - - auto insert_result = h_map_hash.insert(global, local); - if (insert_result.failed()) error->one(FLERR, "Kokkos::UnorderedMap insertion failed"); - } } - k_sametag.modify_host(); - if (map_style == Atom::MAP_ARRAY) - k_map_array.modify_host(); - else if (map_style == Atom::MAP_HASH) { + atomKK->sync(Device, TAG_MASK); - // use "view" template method to avoid unnecessary deep_copy + auto d_tag = atomKK->k_tag.d_view; + auto d_sametag = k_sametag.d_view; - auto h_map_hash = k_map_hash.view(); - auto d_map_hash = k_map_hash.view(); + // sort by tag - // check if fix shake or neigh bond needs a device hash + int nmax = atom->nmax; - int device_hash_flag = 0; - - auto neighborKK = (NeighborKokkos *) neighbor; - if (neighborKK->device_flag) device_hash_flag = 1; - - for (int n = 0; n < modify->nfix; n++) - if (utils::strmatch(modify->fix[n]->style, "^shake")) - if (modify->fix[n]->execution_space == Device) device_hash_flag = 1; - - if (device_hash_flag) { - Kokkos::deep_copy(d_map_hash, h_map_hash); - k_map_hash.view() = d_map_hash; - } + int realloc_flag = 0; + if (d_tag_sorted.extent(0) < nmax) { + MemKK::realloc_kokkos(d_tag_sorted,"atom:tag_sorted",nmax); + MemKK::realloc_kokkos(d_i_sorted,"atom:i_sorted",nmax); + realloc_flag = 1; } + + h_tag_min() = MAXTAGINT; + h_tag_max() = 0; + + Kokkos::deep_copy(d_tag_min_max,h_tag_min_max); + + auto l_tag_sorted = d_tag_sorted; + auto l_i_sorted = d_i_sorted; + auto l_tag_min = d_tag_min; + auto l_tag_max = d_tag_max; + int map_style_array = (map_style == MAP_ARRAY); + + Kokkos::parallel_for(nall, LAMMPS_LAMBDA(int i) { + l_i_sorted(i) = i; + tagint tag_i = d_tag(i); + l_tag_sorted(i) = tag_i; + Kokkos::atomic_min(&l_tag_min(),tag_i); + Kokkos::atomic_max(&l_tag_max(),tag_i); + }); + + Kokkos::deep_copy(h_tag_min_max,d_tag_min_max); + + tagint min = h_tag_min(); + tagint max = h_tag_max(); + + using MapKeyViewType = decltype(d_tag_sorted); + using BinOpMap = Kokkos::BinOp1D; + + auto binner = BinOpMap(nall, min, max); + + if (!Sorter.bin_offsets.data() || realloc_flag) { + Sorter = Kokkos::BinSort(d_tag_sorted, 0, nall, binner, true); + MemKK::realloc_kokkos(Sorter.bin_count_atomic,"Kokkos::SortImpl::BinSortFunctor::bin_count",nmax+1); + Kokkos::deep_copy(Sorter.bin_count_atomic,0); + Sorter.bin_count_const = Sorter.bin_count_atomic; + MemKK::realloc_kokkos(Sorter.bin_offsets,"Kokkos::SortImpl::BinSortFunctor::bin_offsets",nmax+1); + MemKK::realloc_kokkos(Sorter.sort_order,"Kokkos::SortImpl::BinSortFunctor::sort_order",nmax); + } else { + Kokkos::deep_copy(Sorter.bin_count_atomic,0); + Sorter.bin_op = binner; + Sorter.range_begin = 0; + Sorter.range_end = nall; + } + + Sorter.create_permute_vector(LMPDeviceType()); + Sorter.sort(LMPDeviceType(), d_tag_sorted, 0, nall); + Sorter.sort(LMPDeviceType(), d_i_sorted, 0, nall); + + auto d_map_array = k_map_array.d_view; + auto d_map_hash = k_map_hash.d_view; + d_map_hash.clear(); + + auto d_error_flag = k_error_flag.d_view; + Kokkos::deep_copy(d_error_flag,0); + + // for each tag find: + // neighboring atoms with closest local id for sametag + // atom with smallest local id for atom map + + Kokkos::parallel_for(nall, LAMMPS_LAMBDA(int ii) { + const int i = l_i_sorted(ii); + const tagint tag_i = l_tag_sorted(ii); + + int i_min = i; + int i_closest = MAXTAGINT; + + // search atoms with same tag in the forward direction + + int jj = ii+1; + int closest_flag = 0; + + while (jj < nall) { + const tagint tag_j = l_tag_sorted(jj); + if (tag_j != tag_i) break; + const int j = l_i_sorted(jj); + i_min = MIN(i_min,j); + if (j > i) { + i_closest = MIN(i_closest,j); + closest_flag = 1; + } + jj++; + } + + // search atoms with same tag in the reverse direction + + jj = ii-1; + + while (jj >= 0) { + const tagint tag_j = l_tag_sorted(jj); + if (tag_j != tag_i) break; + const int j = l_i_sorted(jj); + i_min = MIN(i_min,j); + if (j > i) { + i_closest = MIN(i_closest,j); + closest_flag = 1; + } + jj--; + } + + if (!closest_flag) + i_closest = -1; + + d_sametag(i) = i_closest; + + if (i == i_min) { + if (map_style_array) + d_map_array(tag_i) = i_min; + else { + auto insert_result = d_map_hash.insert(tag_i, i_min); + if (insert_result.failed()) d_error_flag() = 1; + } + } + + }); + + auto h_error_flag = k_error_flag.h_view; + Kokkos::deep_copy(h_error_flag,d_error_flag); + + if (h_error_flag()) + error->one(FLERR,"Failed to insert into Kokkos hash atom map"); + + k_sametag.modify_device(); + + if (map_style == MAP_ARRAY) + k_map_array.modify_device(); + else + k_map_hash.modify_device(); +} + +/* ---------------------------------------------------------------------- + set global to local map for one atom + for hash table option: + global ID may already be in table if atom was already set + called by Special class +------------------------------------------------------------------------- */ + +void AtomKokkos::map_one(tagint global, int local) +{ + if (map_style == MAP_ARRAY) { + k_map_array.sync_host(); + k_map_array.h_view[global] = local; + } else { + k_map_hash.sync_host(); + auto& h_map_hash = k_map_hash.h_view; + + auto insert_result = h_map_hash.insert(global, local); + if (insert_result.existing()) + h_map_hash.value_at(h_map_hash.find(global)) = local; + else if (insert_result.failed()) + error->one(FLERR,"Failed to insert into Kokkos hash atom map"); + } +} + +/* ---------------------------------------------------------------------- + lookup global ID in hash table, return local index + called by map() in atom.h +------------------------------------------------------------------------- */ + +int AtomKokkos::map_find_hash(tagint global) +{ + k_map_hash.sync_host(); + auto& h_map_hash = k_map_hash.h_view; + + int local = -1; + auto index = h_map_hash.find(global); + if (h_map_hash.valid_at(index)) + local = h_map_hash.value_at(index); + return local; } /* ---------------------------------------------------------------------- @@ -279,10 +333,6 @@ void AtomKokkos::map_delete() if (map_style == MAP_ARRAY) { memoryKK->destroy_kokkos(k_map_array, map_array); map_array = nullptr; - } else { - k_map_hash.h_view = host_hash_type(); - k_map_hash.d_view = hash_type(); - } - - Atom::map_delete(); + } else + k_map_hash = dual_hash_type(); } diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index f132298c2d..dd6be164c0 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -155,6 +155,35 @@ void AtomVecAngleKokkos::grow_pointers() h_angle_atom3 = atomKK->k_angle_atom3.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecAngleKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_molecule); + Sorter.sort(LMPDeviceType(), d_num_bond); + Sorter.sort(LMPDeviceType(), d_bond_type); + Sorter.sort(LMPDeviceType(), d_bond_atom); + Sorter.sort(LMPDeviceType(), d_nspecial); + Sorter.sort(LMPDeviceType(), d_special); + Sorter.sort(LMPDeviceType(), d_num_angle); + Sorter.sort(LMPDeviceType(), d_angle_type); + Sorter.sort(LMPDeviceType(), d_angle_atom1); + Sorter.sort(LMPDeviceType(), d_angle_atom2); + Sorter.sort(LMPDeviceType(), d_angle_atom3); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_angle_kokkos.h b/src/KOKKOS/atom_vec_angle_kokkos.h index a1c20c103b..44f1d824b2 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.h +++ b/src/KOKKOS/atom_vec_angle_kokkos.h @@ -34,6 +34,7 @@ class AtomVecAngleKokkos : public AtomVecKokkos, public AtomVecAngle { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.cpp b/src/KOKKOS/atom_vec_atomic_kokkos.cpp index e37779ace5..1ea8377a68 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.cpp +++ b/src/KOKKOS/atom_vec_atomic_kokkos.cpp @@ -100,6 +100,24 @@ void AtomVecAtomicKokkos::grow_pointers() h_f = atomKK->k_f.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecAtomicKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.h b/src/KOKKOS/atom_vec_atomic_kokkos.h index f72af73537..07631dda98 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.h +++ b/src/KOKKOS/atom_vec_atomic_kokkos.h @@ -35,6 +35,7 @@ class AtomVecAtomicKokkos : public AtomVecKokkos, public AtomVecAtomic { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/atom_vec_bond_kokkos.cpp b/src/KOKKOS/atom_vec_bond_kokkos.cpp index dcbe1876f4..c45bdedf38 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.cpp +++ b/src/KOKKOS/atom_vec_bond_kokkos.cpp @@ -126,6 +126,30 @@ void AtomVecBondKokkos::grow_pointers() h_bond_atom = atomKK->k_bond_atom.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecBondKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_molecule); + Sorter.sort(LMPDeviceType(), d_num_bond); + Sorter.sort(LMPDeviceType(), d_bond_type); + Sorter.sort(LMPDeviceType(), d_bond_atom); + Sorter.sort(LMPDeviceType(), d_nspecial); + Sorter.sort(LMPDeviceType(), d_special); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_bond_kokkos.h b/src/KOKKOS/atom_vec_bond_kokkos.h index fc3f02e916..5ed59432de 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.h +++ b/src/KOKKOS/atom_vec_bond_kokkos.h @@ -34,6 +34,7 @@ class AtomVecBondKokkos : public AtomVecKokkos, public AtomVecBond { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/atom_vec_charge_kokkos.cpp b/src/KOKKOS/atom_vec_charge_kokkos.cpp index a9975c1bb4..22fc63ff91 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.cpp +++ b/src/KOKKOS/atom_vec_charge_kokkos.cpp @@ -106,6 +106,25 @@ void AtomVecChargeKokkos::grow_pointers() h_q = atomKK->k_q.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecChargeKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_q); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_charge_kokkos.h b/src/KOKKOS/atom_vec_charge_kokkos.h index 072b5e6894..397a5ee4c0 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.h +++ b/src/KOKKOS/atom_vec_charge_kokkos.h @@ -35,6 +35,7 @@ class AtomVecChargeKokkos : public AtomVecKokkos, public AtomVecCharge { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/atom_vec_dipole_kokkos.cpp b/src/KOKKOS/atom_vec_dipole_kokkos.cpp index b2357ccb41..ad06570cdc 100644 --- a/src/KOKKOS/atom_vec_dipole_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dipole_kokkos.cpp @@ -107,6 +107,26 @@ void AtomVecDipoleKokkos::grow_pointers() h_mu = atomKK->k_mu.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecDipoleKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_q); + Sorter.sort(LMPDeviceType(), d_mu); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_dipole_kokkos.h b/src/KOKKOS/atom_vec_dipole_kokkos.h index f9abfc9a2a..97ec92c6c6 100644 --- a/src/KOKKOS/atom_vec_dipole_kokkos.h +++ b/src/KOKKOS/atom_vec_dipole_kokkos.h @@ -35,6 +35,7 @@ class AtomVecDipoleKokkos : public AtomVecKokkos, public AtomVecDipole { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index 6fa3277350..eda26a92dc 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -135,6 +135,30 @@ void AtomVecDPDKokkos::grow_pointers() h_duChem = atomKK->k_duChem.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecDPDKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK & ~DPDRHO_MASK & ~DUCHEM_MASK & ~DVECTOR_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_dpdTheta); + Sorter.sort(LMPDeviceType(), d_uCond); + Sorter.sort(LMPDeviceType(), d_uMech); + Sorter.sort(LMPDeviceType(), d_uChem); + Sorter.sort(LMPDeviceType(), d_uCG); + Sorter.sort(LMPDeviceType(), d_uCGnew); + + atomKK->modified(Device, ALL_MASK & ~F_MASK & ~DPDRHO_MASK & ~DUCHEM_MASK & ~DVECTOR_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.h b/src/KOKKOS/atom_vec_dpd_kokkos.h index c605246eba..a76d7f908a 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.h +++ b/src/KOKKOS/atom_vec_dpd_kokkos.h @@ -35,6 +35,7 @@ class AtomVecDPDKokkos : public AtomVecKokkos, public AtomVecDPD { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, diff --git a/src/KOKKOS/atom_vec_full_kokkos.cpp b/src/KOKKOS/atom_vec_full_kokkos.cpp index bb61c7fb46..829ebc75e6 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.cpp +++ b/src/KOKKOS/atom_vec_full_kokkos.cpp @@ -225,6 +225,48 @@ void AtomVecFullKokkos::grow_pointers() h_improper_atom4 = atomKK->k_improper_atom4.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecFullKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_q); + Sorter.sort(LMPDeviceType(), d_molecule); + Sorter.sort(LMPDeviceType(), d_num_bond); + Sorter.sort(LMPDeviceType(), d_bond_type); + Sorter.sort(LMPDeviceType(), d_bond_atom); + Sorter.sort(LMPDeviceType(), d_nspecial); + Sorter.sort(LMPDeviceType(), d_special); + Sorter.sort(LMPDeviceType(), d_num_angle); + Sorter.sort(LMPDeviceType(), d_angle_type); + Sorter.sort(LMPDeviceType(), d_angle_atom1); + Sorter.sort(LMPDeviceType(), d_angle_atom2); + Sorter.sort(LMPDeviceType(), d_angle_atom3); + Sorter.sort(LMPDeviceType(), d_num_dihedral); + Sorter.sort(LMPDeviceType(), d_dihedral_type); + Sorter.sort(LMPDeviceType(), d_dihedral_atom1); + Sorter.sort(LMPDeviceType(), d_dihedral_atom2); + Sorter.sort(LMPDeviceType(), d_dihedral_atom3); + Sorter.sort(LMPDeviceType(), d_dihedral_atom4); + Sorter.sort(LMPDeviceType(), d_num_improper); + Sorter.sort(LMPDeviceType(), d_improper_type); + Sorter.sort(LMPDeviceType(), d_improper_atom1); + Sorter.sort(LMPDeviceType(), d_improper_atom2); + Sorter.sort(LMPDeviceType(), d_improper_atom3); + Sorter.sort(LMPDeviceType(), d_improper_atom4); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_full_kokkos.h b/src/KOKKOS/atom_vec_full_kokkos.h index e6fcfd7e40..4937ef4152 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.h +++ b/src/KOKKOS/atom_vec_full_kokkos.h @@ -34,6 +34,7 @@ class AtomVecFullKokkos : public AtomVecKokkos, public AtomVecFull { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp index 03311d1c32..4e01ab5794 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp @@ -51,6 +51,16 @@ void AtomVecHybridKokkos::grow(int n) f = atom->f; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecHybridKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + for (int k = 0; k < nstyles; k++) + (dynamic_cast(styles[k]))->sort_kokkos(Sorter); +} + /* ---------------------------------------------------------------------- */ int AtomVecHybridKokkos::pack_comm_kokkos(const int &/*n*/, const DAT::tdual_int_2d &/*k_sendlist*/, diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.h b/src/KOKKOS/atom_vec_hybrid_kokkos.h index 862b43d80b..6f81c93673 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.h +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.h @@ -34,6 +34,7 @@ class AtomVecHybridKokkos : public AtomVecKokkos, public AtomVecHybrid { AtomVecHybridKokkos(class LAMMPS *); void grow(int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index b23222e684..93393e9e09 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -35,7 +35,7 @@ AtomVecKokkos::AtomVecKokkos(LAMMPS *lmp) : AtomVec(lmp) unpack_exchange_indices_flag = 0; size_exchange = 0; - k_count = DAT::tdual_int_1d("atom::k_count",1); + k_count = DAT::tdual_int_1d("atom:k_count",1); atomKK = (AtomKokkos *) atom; commKK = (CommKokkos *) comm; } diff --git a/src/KOKKOS/atom_vec_kokkos.h b/src/KOKKOS/atom_vec_kokkos.h index dfb4aecfcf..310f1f4d48 100644 --- a/src/KOKKOS/atom_vec_kokkos.h +++ b/src/KOKKOS/atom_vec_kokkos.h @@ -20,6 +20,8 @@ #include "kokkos_type.h" #include +#include + namespace LAMMPS_NS { union d_ubuf { @@ -38,6 +40,11 @@ class AtomVecKokkos : virtual public AtomVec { AtomVecKokkos(class LAMMPS *); ~AtomVecKokkos() override; + using KeyViewType = DAT::t_x_array; + using BinOp = BinOp3DLAMMPS; + virtual void + sort_kokkos(Kokkos::BinSort &Sorter) = 0; + virtual void sync(ExecutionSpace space, unsigned int mask) = 0; virtual void modified(ExecutionSpace space, unsigned int mask) = 0; virtual void sync_overlapping_device(ExecutionSpace space, unsigned int mask) = 0; @@ -117,7 +124,6 @@ class AtomVecKokkos : virtual public AtomVec { ExecutionSpace space, DAT::tdual_int_1d &k_indices) = 0; - int no_comm_vel_flag,no_border_vel_flag; int unpack_exchange_indices_flag; int size_exchange; diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.cpp b/src/KOKKOS/atom_vec_molecular_kokkos.cpp index 1bb75a1906..471dd0ad58 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.cpp +++ b/src/KOKKOS/atom_vec_molecular_kokkos.cpp @@ -217,6 +217,47 @@ void AtomVecMolecularKokkos::grow_pointers() h_improper_atom4 = atomKK->k_improper_atom4.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecMolecularKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_molecule); + Sorter.sort(LMPDeviceType(), d_num_bond); + Sorter.sort(LMPDeviceType(), d_bond_type); + Sorter.sort(LMPDeviceType(), d_bond_atom); + Sorter.sort(LMPDeviceType(), d_nspecial); + Sorter.sort(LMPDeviceType(), d_special); + Sorter.sort(LMPDeviceType(), d_num_angle); + Sorter.sort(LMPDeviceType(), d_angle_type); + Sorter.sort(LMPDeviceType(), d_angle_atom1); + Sorter.sort(LMPDeviceType(), d_angle_atom2); + Sorter.sort(LMPDeviceType(), d_angle_atom3); + Sorter.sort(LMPDeviceType(), d_num_dihedral); + Sorter.sort(LMPDeviceType(), d_dihedral_type); + Sorter.sort(LMPDeviceType(), d_dihedral_atom1); + Sorter.sort(LMPDeviceType(), d_dihedral_atom2); + Sorter.sort(LMPDeviceType(), d_dihedral_atom3); + Sorter.sort(LMPDeviceType(), d_dihedral_atom4); + Sorter.sort(LMPDeviceType(), d_num_improper); + Sorter.sort(LMPDeviceType(), d_improper_type); + Sorter.sort(LMPDeviceType(), d_improper_atom1); + Sorter.sort(LMPDeviceType(), d_improper_atom2); + Sorter.sort(LMPDeviceType(), d_improper_atom3); + Sorter.sort(LMPDeviceType(), d_improper_atom4); + + atomKK->modified(Device, ALL_MASK & ~F_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.h b/src/KOKKOS/atom_vec_molecular_kokkos.h index af8a2258e1..eb976e9073 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.h +++ b/src/KOKKOS/atom_vec_molecular_kokkos.h @@ -34,6 +34,7 @@ class AtomVecMolecularKokkos : public AtomVecKokkos, public AtomVecMolecular { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index 40af56489b..a9b64fc835 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -123,6 +123,27 @@ void AtomVecSphereKokkos::grow_pointers() h_torque = atomKK->k_torque.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecSphereKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, ALL_MASK & ~F_MASK & ~TORQUE_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_radius); + Sorter.sort(LMPDeviceType(), d_rmass); + Sorter.sort(LMPDeviceType(), d_omega); + + atomKK->modified(Device, ALL_MASK & ~F_MASK & ~TORQUE_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.h b/src/KOKKOS/atom_vec_sphere_kokkos.h index 32357fb600..34529320d9 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.h +++ b/src/KOKKOS/atom_vec_sphere_kokkos.h @@ -35,6 +35,7 @@ class AtomVecSphereKokkos : public AtomVecKokkos, public AtomVecSphere { void grow(int) override; void grow_pointers() override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, diff --git a/src/KOKKOS/atom_vec_spin_kokkos.cpp b/src/KOKKOS/atom_vec_spin_kokkos.cpp index 662072ead9..f5b8697352 100644 --- a/src/KOKKOS/atom_vec_spin_kokkos.cpp +++ b/src/KOKKOS/atom_vec_spin_kokkos.cpp @@ -129,6 +129,25 @@ void AtomVecSpinKokkos::grow_pointers() h_fm_long = atomKK->k_fm_long.h_view; } +/* ---------------------------------------------------------------------- + sort atom arrays on device +------------------------------------------------------------------------- */ + +void AtomVecSpinKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + atomKK->sync(Device, TAG_MASK|TYPE_MASK|MASK_MASK|IMAGE_MASK|X_MASK|V_MASK|SP_MASK); + + Sorter.sort(LMPDeviceType(), d_tag); + Sorter.sort(LMPDeviceType(), d_type); + Sorter.sort(LMPDeviceType(), d_mask); + Sorter.sort(LMPDeviceType(), d_image); + Sorter.sort(LMPDeviceType(), d_x); + Sorter.sort(LMPDeviceType(), d_v); + Sorter.sort(LMPDeviceType(), d_sp); + + atomKK->modified(Device, TAG_MASK|TYPE_MASK|MASK_MASK|IMAGE_MASK|X_MASK|V_MASK|SP_MASK); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/atom_vec_spin_kokkos.h b/src/KOKKOS/atom_vec_spin_kokkos.h index 6a48d195a2..d14d01fb62 100644 --- a/src/KOKKOS/atom_vec_spin_kokkos.h +++ b/src/KOKKOS/atom_vec_spin_kokkos.h @@ -34,7 +34,7 @@ class AtomVecSpinKokkos : public AtomVecKokkos, public AtomVecSpin { AtomVecSpinKokkos(class LAMMPS *); void grow(int) override; void grow_pointers() override; - // input lists to be checked + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) override; diff --git a/src/KOKKOS/bond_fene_kokkos.cpp b/src/KOKKOS/bond_fene_kokkos.cpp index 0a294bde36..a6bbb1edde 100644 --- a/src/KOKKOS/bond_fene_kokkos.cpp +++ b/src/KOKKOS/bond_fene_kokkos.cpp @@ -43,13 +43,8 @@ BondFENEKokkos::BondFENEKokkos(LAMMPS *lmp) : BondFENE(lmp) datamask_read = X_MASK | F_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - k_warning_flag = DAT::tdual_int_scalar("Bond:warning_flag"); - d_warning_flag = k_warning_flag.view(); - h_warning_flag = k_warning_flag.h_view; - - k_error_flag = DAT::tdual_int_scalar("Bond:error_flag"); - d_error_flag = k_error_flag.view(); - h_error_flag = k_error_flag.h_view; + d_flag = typename AT::t_int_scalar("bond:flag"); + h_flag = HAT::t_int_scalar("bond:flag_mirror"); } /* ---------------------------------------------------------------------- */ @@ -99,13 +94,7 @@ void BondFENEKokkos::compute(int eflag_in, int vflag_in) nlocal = atom->nlocal; newton_bond = force->newton_bond; - h_warning_flag() = 0; - k_warning_flag.template modify(); - k_warning_flag.template sync(); - - h_error_flag() = 0; - k_error_flag.template modify(); - k_error_flag.template sync(); + Kokkos::deep_copy(d_flag,0); copymode = 1; @@ -127,14 +116,11 @@ void BondFENEKokkos::compute(int eflag_in, int vflag_in) } } - k_warning_flag.template modify(); - k_warning_flag.template sync(); - if (h_warning_flag()) - error->warning(FLERR,"FENE bond too long"); + Kokkos::deep_copy(h_flag,d_flag); - k_error_flag.template modify(); - k_error_flag.template sync(); - if (h_error_flag()) + if (h_flag() == 1) + error->warning(FLERR,"FENE bond too long"); + else if (h_flag() == 2) error->one(FLERR,"Bad FENE bond"); if (eflag_global) energy += ev.evdwl; @@ -165,8 +151,6 @@ template KOKKOS_INLINE_FUNCTION void BondFENEKokkos::operator()(TagBondFENECompute, const int &n, EV_FLOAT& ev) const { - if (d_error_flag()) return; - // The f array is atomic Kokkos::View::value,Kokkos::MemoryTraits > a_f = f; @@ -178,10 +162,15 @@ void BondFENEKokkos::operator()(TagBondFENECompute r0, then rlogarg < 0.0 which is an error @@ -189,31 +178,32 @@ void BondFENEKokkos::operator()(TagBondFENECompute 2*r0 something serious is wrong, abort if (rlogarg < 0.1) { - if (!d_warning_flag()) - d_warning_flag() = 1; - if (rlogarg <= -3.0 && !d_error_flag()) - d_error_flag() = 1; + if (rlogarg <= -3.0) + d_flag() = 2; + else + d_flag() = 1; rlogarg = 0.1; } - F_FLOAT fbond = -d_k[type]/rlogarg; + F_FLOAT fbond = -k/rlogarg; // force from LJ term F_FLOAT sr6 = 0.0; - if (rsq < MY_CUBEROOT2*d_sigma[type]*d_sigma[type]) { - const F_FLOAT sr2 = d_sigma[type]*d_sigma[type]/rsq; + F_FLOAT sigma2 = sigma*sigma; + if (rsq < MY_CUBEROOT2*sigma2) { + const F_FLOAT sr2 = sigma2/rsq; sr6 = sr2*sr2*sr2; - fbond += 48.0*d_epsilon[type]*sr6*(sr6-0.5)/rsq; + fbond += 48.0*epsilon*sr6*(sr6-0.5)/rsq; } // energy F_FLOAT ebond = 0.0; if (eflag) { - ebond = -0.5 * d_k[type]*r0sq*log(rlogarg); - if (rsq < MY_CUBEROOT2*d_sigma[type]*d_sigma[type]) - ebond += 4.0*d_epsilon[type]*sr6*(sr6-1.0) + d_epsilon[type]; + ebond = -0.5 * k*r0sq*log(rlogarg); + if (rsq < MY_CUBEROOT2*sigma2) + ebond += 4.0*epsilon*sr6*(sr6-1.0) + epsilon; } // apply force to each of 2 atoms diff --git a/src/KOKKOS/bond_fene_kokkos.h b/src/KOKKOS/bond_fene_kokkos.h index e2ba64a114..18f8d87b6a 100644 --- a/src/KOKKOS/bond_fene_kokkos.h +++ b/src/KOKKOS/bond_fene_kokkos.h @@ -71,13 +71,8 @@ class BondFENEKokkos : public BondFENE { typename ArrayTypes::t_efloat_1d d_eatom; typename ArrayTypes::t_virial_array d_vatom; - DAT::tdual_int_scalar k_warning_flag; - typename AT::t_int_scalar d_warning_flag; - HAT::t_int_scalar h_warning_flag; - - DAT::tdual_int_scalar k_error_flag; - typename AT::t_int_scalar d_error_flag; - HAT::t_int_scalar h_error_flag; + typename AT::t_int_scalar d_flag; + HAT::t_int_scalar h_flag; int nlocal,newton_bond; int eflag,vflag; diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 3687216bf9..b0394821fc 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -729,13 +729,8 @@ void CommKokkos::exchange_device() double lo,hi; MPI_Request request; - // clear global->local map for owned and ghost atoms - // b/c atoms migrate to new procs in exchange() and - // new ghosts are created in borders() - // map_set() is done at end of borders() // clear ghost count and any ghost bonus data internal to AtomVec - if (map_style != Atom::MAP_NONE) atom->map_clear(); atom->nghost = 0; atom->avec->clear_bonus(); @@ -985,9 +980,9 @@ void CommKokkos::borders() } else { atomKK->sync(Host,ALL_MASK); k_sendlist.sync(); - CommBrick::borders(); k_sendlist.modify(); - atomKK->modified(Host,ALL_MASK); + atomKK->modified(Host,ALL_MASK); // needed here for atom map + CommBrick::borders(); } if (comm->nprocs == 1 && !ghost_velocity && !forward_comm_classic) @@ -1275,10 +1270,8 @@ void CommKokkos::borders_device() { // reset global->local map - if (map_style != Atom::MAP_NONE) { - atomKK->sync(Host,TAG_MASK); + if (map_style != Atom::MAP_NONE) atom->map_set(); - } } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/comm_tiled_kokkos.cpp b/src/KOKKOS/comm_tiled_kokkos.cpp index 428b4c79d7..e3286a73f5 100644 --- a/src/KOKKOS/comm_tiled_kokkos.cpp +++ b/src/KOKKOS/comm_tiled_kokkos.cpp @@ -226,13 +226,3 @@ void CommTiledKokkos::forward_comm_array(int nsize, double **array) { CommTiled::forward_comm_array(nsize,array); } - -/* ---------------------------------------------------------------------- - exchange info provided with all 6 stencil neighbors - NOTE: this method is currently not used -------------------------------------------------------------------------- */ - -int CommTiledKokkos::exchange_variable(int n, double *inbuf, double *&outbuf) -{ - return CommTiled::exchange_variable(n,inbuf,outbuf); -} diff --git a/src/KOKKOS/comm_tiled_kokkos.h b/src/KOKKOS/comm_tiled_kokkos.h index 833dc38294..c80436b454 100644 --- a/src/KOKKOS/comm_tiled_kokkos.h +++ b/src/KOKKOS/comm_tiled_kokkos.h @@ -46,13 +46,7 @@ class CommTiledKokkos : public CommTiled { void reverse_comm(class Dump *) override; // reverse comm from a Dump void forward_comm_array(int, double **) override; // forward comm of array - int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil - - private: - }; - } - #endif diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 9478aa939d..6311d45a3f 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -571,9 +571,11 @@ void DomainKokkos::lamda2x(int n) KOKKOS_INLINE_FUNCTION void DomainKokkos::operator()(TagDomain_lamda2x, const int &i) const { - x(i,0) = h[0]*x(i,0) + h[5]*x(i,1) + h[4]*x(i,2) + boxlo[0]; - x(i,1) = h[1]*x(i,1) + h[3]*x(i,2) + boxlo[1]; - x(i,2) = h[2]*x(i,2) + boxlo[2]; + const double xi1 = x(i,1); + const double xi2 = x(i,2); + x(i,0) = h[0]*x(i,0) + h[5]*xi1 + h[4]*xi2 + boxlo[0]; + x(i,1) = h[1]*xi1 + h[3]*xi2 + boxlo[1]; + x(i,2) = h[2]*xi2 + boxlo[2]; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp index 3a2447461e..1280a4d9a7 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.cpp @@ -49,6 +49,7 @@ FixACKS2ReaxFFKokkos(LAMMPS *lmp, int narg, char **arg) : FixACKS2ReaxFF(lmp, narg, arg) { kokkosable = 1; + sort_device = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; @@ -1912,6 +1913,25 @@ void FixACKS2ReaxFFKokkos::copy_arrays(int i, int j, int delflag) k_s_hist_X.template modify(); } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixACKS2ReaxFFKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_s_hist.sync_device(); + k_s_hist_X.sync_device(); + + Sorter.sort(LMPDeviceType(), k_s_hist.d_view); + Sorter.sort(LMPDeviceType(), k_s_hist_X.d_view); + + k_s_hist.modify_device(); + k_s_hist_X.modify_device(); +} + /* ---------------------------------------------------------------------- pack values in local atom-based array for exchange with another proc ------------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_acks2_reaxff_kokkos.h b/src/KOKKOS/fix_acks2_reaxff_kokkos.h index de49e8e72f..127c8d0402 100644 --- a/src/KOKKOS/fix_acks2_reaxff_kokkos.h +++ b/src/KOKKOS/fix_acks2_reaxff_kokkos.h @@ -27,6 +27,7 @@ FixStyle(acks2/reax/kk/host,FixACKS2ReaxFFKokkos); #include "fix_acks2_reaxff.h" #include "kokkos_type.h" +#include "kokkos_base.h" #include "neigh_list.h" #include "neigh_list_kokkos.h" @@ -57,7 +58,7 @@ struct TagACKS2ZeroQGhosts{}; struct TagACKS2CalculateQ{}; template -class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { +class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF, public KokkosBase { public: typedef DeviceType device_type; typedef double value_type; @@ -65,10 +66,10 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { FixACKS2ReaxFFKokkos(class LAMMPS *, int, char **); ~FixACKS2ReaxFFKokkos(); + void init() override; + void setup_pre_force(int) override; + void pre_force(int) override; void cleanup_copy(); - void init(); - void setup_pre_force(int); - void pre_force(int); DAT::tdual_ffloat_1d get_s() {return k_s;} @@ -234,11 +235,11 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { void init_shielding_k(); void init_hist(); - void allocate_matrix(); + void allocate_matrix() override; void allocate_array(); void deallocate_array(); int bicgstab_solve(); - void calculate_Q(); + void calculate_Q() override; int neighflag; int nlocal,nall,nmax,newton_pair; @@ -250,12 +251,13 @@ class FixACKS2ReaxFFKokkos : public FixACKS2ReaxFF { typename AT::t_int_2d d_sendlist; typename AT::t_xfloat_1d_um v_buf; - void grow_arrays(int); - void copy_arrays(int, int, int); - int pack_exchange(int, double *); - int unpack_exchange(int, double *); - void get_chi_field(); - double memory_usage(); + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + void get_chi_field() override; + double memory_usage() override; void sparse_matvec_acks2(typename AT::t_ffloat_1d &, typename AT::t_ffloat_1d &); }; diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index b7305644c9..437dd9daef 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -44,6 +44,8 @@ FixLangevinKokkos::FixLangevinKokkos(LAMMPS *lmp, int narg, char **a FixLangevin(lmp, narg, arg),rand_pool(seed + comm->me) { kokkosable = 1; + fuse_integrate_flag = 1; + sort_device = 1; atomKK = (AtomKokkos *) atom; int ntypes = atomKK->ntypes; @@ -169,6 +171,14 @@ void FixLangevinKokkos::initial_integrate_item(int i) const /* ---------------------------------------------------------------------- */ +template +void FixLangevinKokkos::fused_integrate(int vflag) +{ + initial_integrate(vflag); +} + +/* ---------------------------------------------------------------------- */ + template void FixLangevinKokkos::post_force(int /*vflag*/) { @@ -674,8 +684,6 @@ void FixLangevinKokkos::zero_force_item(int i) const template void FixLangevinKokkos::compute_target() { - atomKK->sync(Host, MASK_MASK); - mask = atomKK->k_mask.template view(); int nlocal = atomKK->nlocal; double delta = update->ntimestep - update->beginstep; @@ -700,12 +708,14 @@ void FixLangevinKokkos::compute_target() memoryKK->destroy_kokkos(k_tforce,tforce); memoryKK->create_kokkos(k_tforce,tforce,maxatom2,"langevin:tforce"); d_tforce = k_tforce.template view(); - h_tforce = k_tforce.template view(); + h_tforce = k_tforce.h_view; } input->variable->compute_atom(tvar,igroup,tforce,1,0); // tforce is modified on host - k_tforce.template modify(); + k_tforce.modify_host(); + atomKK->sync(Host, MASK_MASK); + auto h_mask = atomKK->k_mask.h_view; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) + if (h_mask[i] & groupbit) if (h_tforce[i] < 0.0) error->one(FLERR, "Fix langevin variable returned negative temperature"); @@ -889,6 +899,25 @@ void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixLangevinKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_franprev.sync_device(); + k_lv.sync_device(); + + Sorter.sort(LMPDeviceType(), k_franprev.d_view); + Sorter.sort(LMPDeviceType(), k_lv.d_view); + + k_franprev.modify_device(); + k_lv.modify_device(); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index f7142e6286..4fc22a1df1 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -25,6 +25,7 @@ FixStyle(langevin/kk/host,FixLangevinKokkos); #include "fix_langevin.h" #include "kokkos_type.h" +#include "kokkos_base.h" #include "Kokkos_Random.hpp" #include "comm_kokkos.h" @@ -61,7 +62,7 @@ namespace LAMMPS_NS { template struct FixLangevinKokkosTallyEnergyFunctor; template - class FixLangevinKokkos : public FixLangevin { + class FixLangevinKokkos : public FixLangevin, public KokkosBase { public: FixLangevinKokkos(class LAMMPS *, int, char **); ~FixLangevinKokkos() override; @@ -69,10 +70,12 @@ namespace LAMMPS_NS { void cleanup_copy(); void init() override; void initial_integrate(int) override; + void fused_integrate(int) override; void post_force(int) override; void reset_dt() override; void grow_arrays(int) override; void copy_arrays(int i, int j, int delflag) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; double compute_scalar() override; void end_of_step() override; diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index 07c78e86a3..e2106b3d03 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -27,6 +27,7 @@ using namespace FixConst; FixMinimizeKokkos::FixMinimizeKokkos(LAMMPS *lmp, int narg, char **arg) : FixMinimize(lmp, narg, arg) { + kokkosable = 1; atomKK = (AtomKokkos *) atom; } diff --git a/src/KOKKOS/fix_minimize_kokkos.h b/src/KOKKOS/fix_minimize_kokkos.h index e84cbd1ec2..5a7b06ba3d 100644 --- a/src/KOKKOS/fix_minimize_kokkos.h +++ b/src/KOKKOS/fix_minimize_kokkos.h @@ -25,10 +25,11 @@ FixStyle(MINIMIZE/kk/host,FixMinimizeKokkos); #include "fix_minimize.h" #include "kokkos_type.h" +#include "kokkos_base.h" namespace LAMMPS_NS { -class FixMinimizeKokkos : public FixMinimize { +class FixMinimizeKokkos : public FixMinimize, public KokkosBase { friend class MinLineSearchKokkos; public: diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index 198ab555f3..b4a852ba70 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -32,7 +32,7 @@ FixNeighHistoryKokkos::FixNeighHistoryKokkos(LAMMPS *lmp, int narg, FixNeighHistory(lmp, narg, arg) { kokkosable = 1; - exchange_comm_device = 1; + exchange_comm_device = sort_device = 1; atomKK = (AtomKokkos *)atom; execution_space = ExecutionSpaceFromDevice::space; @@ -325,6 +325,28 @@ void FixNeighHistoryKokkos::copy_arrays(int i, int j, int /*delflag* k_valuepartner.modify_host(); } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixNeighHistoryKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_npartner.sync_device(); + k_partner.sync_device(); + k_valuepartner.sync_device(); + + Sorter.sort(LMPDeviceType(), k_npartner.d_view); + Sorter.sort(LMPDeviceType(), k_partner.d_view); + Sorter.sort(LMPDeviceType(), k_valuepartner.d_view); + + k_npartner.modify_device(); + k_partner.modify_device(); + k_valuepartner.modify_device(); +} + /* ---------------------------------------------------------------------- pack values in local atom-based array for exchange with another proc ------------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_neigh_history_kokkos.h b/src/KOKKOS/fix_neigh_history_kokkos.h index 6f29c817b8..9c07a953c4 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.h +++ b/src/KOKKOS/fix_neigh_history_kokkos.h @@ -48,6 +48,7 @@ class FixNeighHistoryKokkos : public FixNeighHistory, public KokkosBase { void post_neighbor() override; void grow_arrays(int) override; void copy_arrays(int, int, int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_exchange(int, double *) override; int unpack_exchange(int, double *) override; double memory_usage() override; diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index 5dcb611d41..59cc90c088 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -29,6 +29,7 @@ FixNVEKokkos::FixNVEKokkos(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { kokkosable = 1; + fuse_integrate_flag = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; @@ -159,6 +160,66 @@ void FixNVEKokkos::final_integrate_rmass_item(int i) const } } +/* ---------------------------------------------------------------------- + allow for both per-type and per-atom mass +------------------------------------------------------------------------- */ + +template +void FixNVEKokkos::fused_integrate(int /*vflag*/) +{ + atomKK->sync(execution_space,datamask_read); + + x = atomKK->k_x.view(); + v = atomKK->k_v.view(); + f = atomKK->k_f.view(); + rmass = atomKK->k_rmass.view(); + mass = atomKK->k_mass.view(); + type = atomKK->k_type.view(); + mask = atomKK->k_mask.view(); + int nlocal = atomKK->nlocal; + if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst; + + if (rmass.data()) { + FixNVEKokkosFusedIntegrateFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + } else { + FixNVEKokkosFusedIntegrateFunctor functor(this); + Kokkos::parallel_for(nlocal,functor); + } + + atomKK->modified(execution_space,datamask_modify); +} + +template +KOKKOS_INLINE_FUNCTION +void FixNVEKokkos::fused_integrate_item(int i) const +{ + if (mask[i] & groupbit) { + const double dtfm = 2.0 * dtf / mass[type[i]]; + v(i,0) += dtfm * f(i,0); + v(i,1) += dtfm * f(i,1); + v(i,2) += dtfm * f(i,2); + x(i,0) += dtv * v(i,0); + x(i,1) += dtv * v(i,1); + x(i,2) += dtv * v(i,2); + } +} + +template +KOKKOS_INLINE_FUNCTION +void FixNVEKokkos::fused_integrate_rmass_item(int i) const +{ + if (mask[i] & groupbit) { + const double dtfm = 2.0 * dtf / rmass[i]; + v(i,0) += dtfm * f(i,0); + v(i,1) += dtfm * f(i,1); + v(i,2) += dtfm * f(i,2); + x(i,0) += dtv * v(i,0); + x(i,1) += dtv * v(i,1); + x(i,2) += dtv * v(i,2); + } +} + /* ---------------------------------------------------------------------- */ template @@ -168,6 +229,8 @@ void FixNVEKokkos::cleanup_copy() vatom = nullptr; } +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class FixNVEKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/fix_nve_kokkos.h b/src/KOKKOS/fix_nve_kokkos.h index 215aacb4a0..a1e8e1398c 100644 --- a/src/KOKKOS/fix_nve_kokkos.h +++ b/src/KOKKOS/fix_nve_kokkos.h @@ -46,6 +46,7 @@ class FixNVEKokkos : public FixNVE { void init() override; void initial_integrate(int) override; void final_integrate() override; + void fused_integrate(int) override; KOKKOS_INLINE_FUNCTION void initial_integrate_item(int) const; @@ -55,6 +56,10 @@ class FixNVEKokkos : public FixNVE { void final_integrate_item(int) const; KOKKOS_INLINE_FUNCTION void final_integrate_rmass_item(int) const; + KOKKOS_INLINE_FUNCTION + void fused_integrate_item(int) const; + KOKKOS_INLINE_FUNCTION + void fused_integrate_rmass_item(int) const; private: @@ -96,6 +101,22 @@ struct FixNVEKokkosFinalIntegrateFunctor { } }; +template +struct FixNVEKokkosFusedIntegrateFunctor { + typedef DeviceType device_type ; + FixNVEKokkos c; + + FixNVEKokkosFusedIntegrateFunctor(FixNVEKokkos* c_ptr): + c(*c_ptr) {c.cleanup_copy();}; + KOKKOS_INLINE_FUNCTION + void operator()(const int i) const { + if (RMass) + c.fused_integrate_rmass_item(i); + else + c.fused_integrate_item(i); + } +}; + } #endif diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.cpp b/src/KOKKOS/fix_nve_sphere_kokkos.cpp index 51e57b839e..38f6a40792 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.cpp +++ b/src/KOKKOS/fix_nve_sphere_kokkos.cpp @@ -28,6 +28,7 @@ FixNVESphereKokkos::FixNVESphereKokkos(LAMMPS *lmp, int narg, char * FixNVESphere(lmp, narg, arg) { kokkosable = 1; + fuse_integrate_flag = 1; atomKK = (AtomKokkos *)atom; execution_space = ExecutionSpaceFromDevice::space; @@ -164,6 +165,73 @@ void FixNVESphereKokkos::final_integrate_item(const int i) const } } +/* ---------------------------------------------------------------------- */ + +template +void FixNVESphereKokkos::fused_integrate(int /*vflag*/) +{ + if (extra == DIPOLE) + atomKK->sync(execution_space, X_MASK | V_MASK | OMEGA_MASK| F_MASK | TORQUE_MASK | RMASS_MASK | RADIUS_MASK | MASK_MASK | MU_MASK); + else + atomKK->sync(execution_space, X_MASK | V_MASK | OMEGA_MASK| F_MASK | TORQUE_MASK | RMASS_MASK | RADIUS_MASK | MASK_MASK); + + x = atomKK->k_x.view(); + v = atomKK->k_v.view(); + omega = atomKK->k_omega.view(); + f = atomKK->k_f.view(); + torque = atomKK->k_torque.view(); + mask = atomKK->k_mask.view(); + rmass = atomKK->k_rmass.view(); + radius = atomKK->k_radius.view(); + mu = atomKK->k_mu.view(); + + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + FixNVESphereKokkosFusedIntegrateFunctor f(this); + Kokkos::parallel_for(nlocal,f); + + if (extra == DIPOLE) + atomKK->modified(execution_space, X_MASK | V_MASK | OMEGA_MASK | MU_MASK); + else + atomKK->modified(execution_space, X_MASK | V_MASK | OMEGA_MASK); +} + +/* ---------------------------------------------------------------------- */ + +template +KOKKOS_INLINE_FUNCTION +void FixNVESphereKokkos::fused_integrate_item(const int i) const +{ + const double dtfrotate = dtf / inertia; + + if (mask(i) & groupbit) { + const double dtfm = 2.0 * dtf / rmass(i); + v(i,0) += dtfm * f(i,0); + v(i,1) += dtfm * f(i,1); + v(i,2) += dtfm * f(i,2); + x(i,0) += dtv * v(i,0); + x(i,1) += dtv * v(i,1); + x(i,2) += dtv * v(i,2); + + const double dtirotate = 2.0 * dtfrotate / (radius(i)*radius(i)*rmass(i)); + omega(i,0) += dtirotate * torque(i,0); + omega(i,1) += dtirotate * torque(i,1); + omega(i,2) += dtirotate * torque(i,2); + + if (extra == DIPOLE) { + const double g0 = mu(i,0) + dtv * (omega(i,1) * mu(i,2) - omega(i,2) * mu(i,1)); + const double g1 = mu(i,1) + dtv * (omega(i,2) * mu(i,0) - omega(i,0) * mu(i,2)); + const double g2 = mu(i,2) + dtv * (omega(i,0) * mu(i,1) - omega(i,1) * mu(i,0)); + const double msq = g0*g0 + g1*g1 + g2*g2; + const double scale = mu(i,3)/sqrt(msq); + mu(i,0) = g0*scale; + mu(i,1) = g1*scale; + mu(i,2) = g2*scale; + } + } +} + namespace LAMMPS_NS { template class FixNVESphereKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.h b/src/KOKKOS/fix_nve_sphere_kokkos.h index 268b4ea9ce..02acb466f2 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.h +++ b/src/KOKKOS/fix_nve_sphere_kokkos.h @@ -37,11 +37,14 @@ class FixNVESphereKokkos : public FixNVESphere { void init() override; void initial_integrate(int) override; void final_integrate() override; + void fused_integrate(int) override; KOKKOS_INLINE_FUNCTION void initial_integrate_item(const int i) const; KOKKOS_INLINE_FUNCTION void final_integrate_item(const int i) const; + KOKKOS_INLINE_FUNCTION + void fused_integrate_item(int) const; private: typename ArrayTypes::t_x_array x; @@ -77,6 +80,17 @@ struct FixNVESphereKokkosFinalIntegrateFunctor { } }; +template +struct FixNVESphereKokkosFusedIntegrateFunctor { + typedef DeviceType device_type; + FixNVESphereKokkos c; + FixNVESphereKokkosFusedIntegrateFunctor(FixNVESphereKokkos *c_ptr): c(*c_ptr) { c.cleanup_copy(); } + KOKKOS_INLINE_FUNCTION + void operator()(const int i) const { + c.fused_integrate_item(i); + } +}; + } // namespace LAMMPS_NS #endif // LMP_FIX_NVE_SPHERE_KOKKOS_H diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp index db0f7456dd..518677c643 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.cpp @@ -58,7 +58,7 @@ FixQEqReaxFFKokkos(LAMMPS *lmp, int narg, char **arg) : { kokkosable = 1; comm_forward = comm_reverse = 2; // fused - forward_comm_device = exchange_comm_device = 1; + forward_comm_device = exchange_comm_device = sort_device = 1; atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; @@ -1338,6 +1338,25 @@ void FixQEqReaxFFKokkos::copy_arrays(int i, int j, int /*delflag*/) k_t_hist.template modify(); } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixQEqReaxFFKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_s_hist.sync_device(); + k_t_hist.sync_device(); + + Sorter.sort(LMPDeviceType(), k_s_hist.d_view); + Sorter.sort(LMPDeviceType(), k_t_hist.d_view); + + k_s_hist.modify_device(); + k_t_hist.modify_device(); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/fix_qeq_reaxff_kokkos.h b/src/KOKKOS/fix_qeq_reaxff_kokkos.h index 29faefe56b..9bc38b0492 100644 --- a/src/KOKKOS/fix_qeq_reaxff_kokkos.h +++ b/src/KOKKOS/fix_qeq_reaxff_kokkos.h @@ -280,6 +280,7 @@ class FixQEqReaxFFKokkos : public FixQEqReaxFF, public KokkosBase { void grow_arrays(int) override; void copy_arrays(int, int, int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_exchange(int, double *) override; int unpack_exchange(int, double *) override; void get_chi_field() override; diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index b00195e5fd..3e88860622 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -53,7 +53,7 @@ FixShakeKokkos::FixShakeKokkos(LAMMPS *lmp, int narg, char **arg) : FixShake(lmp, narg, arg) { kokkosable = 1; - forward_comm_device = exchange_comm_device = 1; + forward_comm_device = exchange_comm_device = sort_device = 1; maxexchange = 9; atomKK = (AtomKokkos *)atom; execution_space = ExecutionSpaceFromDevice::space; @@ -221,6 +221,7 @@ void FixShakeKokkos::pre_neighbor() k_map_array.template sync(); } else if (map_style == Atom::MAP_HASH) { k_map_hash = atomKK->k_map_hash; + k_map_hash.template sync(); } k_shake_flag.sync(); @@ -248,6 +249,7 @@ void FixShakeKokkos::pre_neighbor() k_map_array.template sync(); } else if (map_style == Atom::MAP_HASH) { k_map_hash = atomKK->k_map_hash; + k_map_hash.template sync(); } atomKK->k_sametag.sync(); @@ -357,6 +359,7 @@ void FixShakeKokkos::post_force(int vflag) k_map_array.template sync(); } else if (map_style == Atom::MAP_HASH) { k_map_hash = atomKK->k_map_hash; + k_map_hash.template sync(); } if (d_rmass.data()) @@ -1484,6 +1487,28 @@ void FixShakeKokkos::copy_arrays(int i, int j, int delflag) k_shake_type.modify_host(); } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixShakeKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_shake_flag.sync_device(); + k_shake_atom.sync_device(); + k_shake_type.sync_device(); + + Sorter.sort(LMPDeviceType(), k_shake_flag.d_view); + Sorter.sort(LMPDeviceType(), k_shake_atom.d_view); + Sorter.sort(LMPDeviceType(), k_shake_type.d_view); + + k_shake_flag.modify_device(); + k_shake_atom.modify_device(); + k_shake_type.modify_device(); +} + /* ---------------------------------------------------------------------- initialize one atom's array values, called when atom is created ------------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_shake_kokkos.h b/src/KOKKOS/fix_shake_kokkos.h index 650ad52287..185e69ce86 100644 --- a/src/KOKKOS/fix_shake_kokkos.h +++ b/src/KOKKOS/fix_shake_kokkos.h @@ -61,6 +61,7 @@ class FixShakeKokkos : public FixShake, public KokkosBase { void grow_arrays(int) override; void copy_arrays(int, int, int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; void set_arrays(int) override; void update_arrays(int, int) override; void set_molecule(int, tagint, int, double *, double *, double *) override; diff --git a/src/KOKKOS/fix_wall_gran_kokkos.cpp b/src/KOKKOS/fix_wall_gran_kokkos.cpp index 1569065bbe..f870b0f240 100644 --- a/src/KOKKOS/fix_wall_gran_kokkos.cpp +++ b/src/KOKKOS/fix_wall_gran_kokkos.cpp @@ -32,7 +32,7 @@ FixWallGranKokkos::FixWallGranKokkos(LAMMPS *lmp, int narg, char **a FixWallGranOld(lmp, narg, arg) { kokkosable = 1; - exchange_comm_device = 1; + exchange_comm_device = sort_device = 1; maxexchange = size_history; atomKK = (AtomKokkos *)atom; execution_space = ExecutionSpaceFromDevice::space; @@ -313,6 +313,22 @@ void FixWallGranKokkos::copy_arrays(int i, int j, int delflag) } } +/* ---------------------------------------------------------------------- + sort local atom-based arrays +------------------------------------------------------------------------- */ + +template +void FixWallGranKokkos::sort_kokkos(Kokkos::BinSort &Sorter) +{ + // always sort on the device + + k_history_one.sync_device(); + + Sorter.sort(LMPDeviceType(), k_history_one.d_view); + + k_history_one.modify_device(); +} + /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/fix_wall_gran_kokkos.h b/src/KOKKOS/fix_wall_gran_kokkos.h index 4d80528fb8..c7d566ec72 100644 --- a/src/KOKKOS/fix_wall_gran_kokkos.h +++ b/src/KOKKOS/fix_wall_gran_kokkos.h @@ -47,6 +47,7 @@ class FixWallGranKokkos : public FixWallGranOld, public KokkosBase { void post_force(int) override; void grow_arrays(int) override; void copy_arrays(int, int, int) override; + void sort_kokkos(Kokkos::BinSort &Sorter) override; int pack_exchange(int, double *) override; int unpack_exchange(int, double *) override; diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 8b45c786e5..91ea6d37ac 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -93,6 +93,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) reverse_pair_comm_changed = 0; forward_fix_comm_changed = 0; reverse_comm_changed = 0; + sort_changed = 0; delete memory; memory = new MemoryKokkos(lmp); @@ -250,6 +251,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) exchange_comm_classic = forward_comm_classic = reverse_comm_classic = 0; forward_pair_comm_classic = reverse_pair_comm_classic = forward_fix_comm_classic = 0; + sort_classic = 0; exchange_comm_on_host = forward_comm_on_host = reverse_comm_on_host = 0; } else { @@ -264,6 +266,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) exchange_comm_classic = forward_comm_classic = reverse_comm_classic = 1; forward_pair_comm_classic = reverse_pair_comm_classic = forward_fix_comm_classic = 1; + sort_classic = 1; exchange_comm_on_host = forward_comm_on_host = reverse_comm_on_host = 0; } @@ -478,6 +481,14 @@ void KokkosLMP::accelerator(int narg, char **arg) } else error->all(FLERR,"Illegal package kokkos command"); reverse_comm_changed = 0; iarg += 2; + } else if (strcmp(arg[iarg],"sort") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command"); + else if (strcmp(arg[iarg+1],"no") == 0) sort_classic = 1; + else if (strcmp(arg[iarg+1],"host") == 0) sort_classic = 1; + else if (strcmp(arg[iarg+1],"device") == 0) sort_classic = 0; + else error->all(FLERR,"Illegal package kokkos command"); + sort_changed = 0; + iarg += 2; } else if ((strcmp(arg[iarg],"gpu/aware") == 0) || (strcmp(arg[iarg],"cuda/aware") == 0)) { if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command"); @@ -533,6 +544,13 @@ void KokkosLMP::accelerator(int narg, char **arg) } } + if (lmp->pair_only_flag) { + if (sort_classic == 0) { + sort_classic = 1; + sort_changed = 1; + } + } + // if "gpu/aware on" and "pair/only off", and comm flags were changed previously, change them back if (gpu_aware_flag && !lmp->pair_only_flag) { @@ -562,6 +580,13 @@ void KokkosLMP::accelerator(int narg, char **arg) } } + if (lmp->pair_only_flag) { + if (sort_changed) { + sort_classic = 0; + sort_changed = 0; + } + } + #endif // set newton flags diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h index 08b6730e50..adfc1fc646 100644 --- a/src/KOKKOS/kokkos.h +++ b/src/KOKKOS/kokkos.h @@ -33,6 +33,7 @@ class KokkosLMP : protected Pointers { int reverse_pair_comm_classic; int forward_fix_comm_classic; int reverse_comm_classic; + int sort_classic; int exchange_comm_on_host; int forward_comm_on_host; int reverse_comm_on_host; @@ -42,6 +43,7 @@ class KokkosLMP : protected Pointers { int reverse_pair_comm_changed; int forward_fix_comm_changed; int reverse_comm_changed; + int sort_changed; int nthreads,ngpus; int auto_sync; int gpu_aware_flag; diff --git a/src/KOKKOS/kokkos_base.h b/src/KOKKOS/kokkos_base.h index 463b271269..7d9ecb5d80 100644 --- a/src/KOKKOS/kokkos_base.h +++ b/src/KOKKOS/kokkos_base.h @@ -17,6 +17,8 @@ #include "kokkos_type.h" +#include + namespace LAMMPS_NS { class KokkosBase { @@ -51,6 +53,11 @@ class KokkosBase { virtual void unpack_exchange_kokkos(DAT::tdual_xfloat_2d & /*k_buf*/, DAT::tdual_int_1d & /*indices*/, int /*nrecv*/, ExecutionSpace /*space*/) {} + + using KeyViewType = DAT::t_x_array; + using BinOp = BinOp3DLAMMPS; + virtual void + sort_kokkos(Kokkos::BinSort & /*Sorter*/) {} }; } diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 69ebc91fec..fac75221bc 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -473,6 +473,64 @@ struct alignas(2*sizeof(F_FLOAT)) s_FLOAT2 { }; typedef struct s_FLOAT2 F_FLOAT2; +template +struct BinOp3DLAMMPS { + int max_bins_[3] = {}; + double mul_[3] = {}; + double min_[3] = {}; + + BinOp3DLAMMPS() = default; + + BinOp3DLAMMPS(int max_bins__[], typename KeyViewType::const_value_type min[], + typename KeyViewType::const_value_type max[]) { + max_bins_[0] = max_bins__[0]; + max_bins_[1] = max_bins__[1]; + max_bins_[2] = max_bins__[2]; + mul_[0] = static_cast(max_bins__[0]) / + (static_cast(max[0]) - static_cast(min[0])); + mul_[1] = static_cast(max_bins__[1]) / + (static_cast(max[1]) - static_cast(min[1])); + mul_[2] = static_cast(max_bins__[2]) / + (static_cast(max[2]) - static_cast(min[2])); + min_[0] = static_cast(min[0]); + min_[1] = static_cast(min[1]); + min_[2] = static_cast(min[2]); + } + + template + KOKKOS_INLINE_FUNCTION int bin(ViewType& keys, const int& i) const { + int ix = static_cast ((keys(i, 0) - min_[0]) * mul_[0]); + int iy = static_cast ((keys(i, 1) - min_[1]) * mul_[1]); + int iz = static_cast ((keys(i, 2) - min_[2]) * mul_[2]); + ix = MAX(ix,0); + iy = MAX(iy,0); + iz = MAX(iz,0); + ix = MIN(ix,max_bins_[0]-1); + iy = MIN(iy,max_bins_[1]-1); + iz = MIN(iz,max_bins_[2]-1); + const int ibin = iz*max_bins_[1]*max_bins_[0] + iy*max_bins_[0] + ix; + return ibin; + } + + KOKKOS_INLINE_FUNCTION + int max_bins() const { return max_bins_[0] * max_bins_[1] * max_bins_[2]; } + + template + KOKKOS_INLINE_FUNCTION bool operator()(ViewType& keys, iType1& i1, + iType2& i2) const { + if (keys(i1, 2) > keys(i2, 2)) + return true; + else if (keys(i1, 2) == keys(i2, 2)) { + if (keys(i1, 1) > keys(i2, 1)) + return true; + else if (keys(i1, 1) == keys(i2, 1)) { + if (keys(i1, 0) > keys(i2, 0)) return true; + } + } + return false; + } +}; + #ifndef PREC_POS #define PREC_POS PRECISION #endif @@ -512,6 +570,21 @@ struct dual_hash_type { hash_type d_view; host_hash_type h_view; + bool modified_device; + bool modified_host; + + dual_hash_type() { + modified_device = modified_host = false; + d_view = hash_type(); + h_view = host_hash_type(); + } + + dual_hash_type(int capacity) { + modified_device = modified_host = false; + d_view = hash_type(capacity); + h_view = host_hash_type(capacity); + } + template std::enable_if_t<(std::is_same::value || Kokkos::SpaceAccessibility::accessible),hash_type&> view() {return d_view;} @@ -526,6 +599,42 @@ struct dual_hash_type { KOKKOS_INLINE_FUNCTION std::enable_if_t::value || Kokkos::SpaceAccessibility::accessible),const host_hash_type&> const_view() const {return h_view;} + void modify_device() + { + modified_device = true; + if (modified_device && modified_host) + Kokkos::abort("Concurrent modification of host and device hashes"); + } + + void modify_host() + { + modified_host = true; + if (modified_device && modified_host) + Kokkos::abort("Concurrent modification of host and device hashes"); + } + + void sync_device() + { + if (modified_host) { + Kokkos::deep_copy(d_view,h_view); + modified_host = false; + } + } + + void sync_host() + { + if (modified_device) { + Kokkos::deep_copy(h_view,d_view); + modified_device = false; + } + } + + template + std::enable_if_t<(std::is_same::value || Kokkos::SpaceAccessibility::accessible),void> sync() {sync_device();} + + template + std::enable_if_t::value || Kokkos::SpaceAccessibility::accessible),void> sync() {sync_host();} + }; template @@ -543,6 +652,13 @@ typedef tdual_int_scalar::t_dev_const t_int_scalar_const; typedef tdual_int_scalar::t_dev_um t_int_scalar_um; typedef tdual_int_scalar::t_dev_const_um t_int_scalar_const_um; +typedef Kokkos:: + DualView tdual_tagint_scalar; +typedef tdual_tagint_scalar::t_dev t_tagint_scalar; +typedef tdual_tagint_scalar::t_dev_const t_tagint_scalar_const; +typedef tdual_tagint_scalar::t_dev_um t_tagint_scalar_um; +typedef tdual_tagint_scalar::t_dev_const_um t_tagint_scalar_const_um; + typedef Kokkos:: DualView tdual_float_scalar; @@ -861,6 +977,12 @@ typedef tdual_int_scalar::t_host_const t_int_scalar_const; typedef tdual_int_scalar::t_host_um t_int_scalar_um; typedef tdual_int_scalar::t_host_const_um t_int_scalar_const_um; +typedef Kokkos::DualView tdual_tagint_scalar; +typedef tdual_tagint_scalar::t_host t_tagint_scalar; +typedef tdual_tagint_scalar::t_host_const t_tagint_scalar_const; +typedef tdual_tagint_scalar::t_host_um t_tagint_scalar_um; +typedef tdual_tagint_scalar::t_host_const_um t_tagint_scalar_const_um; + typedef Kokkos::DualView tdual_float_scalar; typedef tdual_float_scalar::t_host t_float_scalar; typedef tdual_float_scalar::t_host_const t_float_scalar_const; @@ -1188,9 +1310,13 @@ struct alignas(4 * sizeof(int)) reax_int4 { #define SNAP_KOKKOS_HOST_VECLEN 1 #ifdef LMP_KOKKOS_GPU -#define SNAP_KOKKOS_DEVICE_VECLEN 32 + #if defined(KOKKOS_ENABLE_SYCL) + #define SNAP_KOKKOS_DEVICE_VECLEN 16 + #else + #define SNAP_KOKKOS_DEVICE_VECLEN 32 + #endif #else -#define SNAP_KOKKOS_DEVICE_VECLEN 1 + #define SNAP_KOKKOS_DEVICE_VECLEN 1 #endif diff --git a/src/KOKKOS/modify_kokkos.cpp b/src/KOKKOS/modify_kokkos.cpp index 9d8c16603e..0b81a1cabb 100644 --- a/src/KOKKOS/modify_kokkos.cpp +++ b/src/KOKKOS/modify_kokkos.cpp @@ -392,6 +392,24 @@ void ModifyKokkos::final_integrate() } } +/* ---------------------------------------------------------------------- + fused initial and final integrate call, only for relevant fixes +------------------------------------------------------------------------- */ + +void ModifyKokkos::fused_integrate(int vflag) +{ + for (int i = 0; i < n_final_integrate; i++) { + atomKK->sync(fix[list_final_integrate[i]]->execution_space, + fix[list_final_integrate[i]]->datamask_read); + int prev_auto_sync = lmp->kokkos->auto_sync; + if (!fix[list_final_integrate[i]]->kokkosable) lmp->kokkos->auto_sync = 1; + fix[list_final_integrate[i]]->fused_integrate(vflag); + lmp->kokkos->auto_sync = prev_auto_sync; + atomKK->modified(fix[list_final_integrate[i]]->execution_space, + fix[list_final_integrate[i]]->datamask_modify); + } +} + /* ---------------------------------------------------------------------- end-of-timestep call, only for relevant fixes only call fix->end_of_step() on timesteps that are multiples of nevery @@ -881,3 +899,22 @@ int ModifyKokkos::min_reset_ref() } return itmpall; } + +/* ---------------------------------------------------------------------- + check if initial and final integrate can be fused +------------------------------------------------------------------------- */ + +int ModifyKokkos::check_fuse_integrate() +{ + int fuse_integrate_flag = 1; + + for (int i = 0; i < n_initial_integrate; i++) + if (!fix[list_initial_integrate[i]]->fuse_integrate_flag) + fuse_integrate_flag = 0; + + for (int i = 0; i < n_final_integrate; i++) + if (!fix[list_final_integrate[i]]->fuse_integrate_flag) + fuse_integrate_flag = 0; + + return fuse_integrate_flag; +} diff --git a/src/KOKKOS/modify_kokkos.h b/src/KOKKOS/modify_kokkos.h index 5edf5cd662..527518219c 100644 --- a/src/KOKKOS/modify_kokkos.h +++ b/src/KOKKOS/modify_kokkos.h @@ -39,6 +39,7 @@ class ModifyKokkos : public Modify { void pre_reverse(int,int) override; void post_force(int) override; void final_integrate() override; + void fused_integrate(int) override; void end_of_step() override; double energy_couple() override; double energy_global() override; @@ -69,6 +70,8 @@ class ModifyKokkos : public Modify { int min_dof() override; int min_reset_ref() override; + int check_fuse_integrate(); + protected: }; diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index 5a250b6d23..9067284426 100644 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -50,13 +50,16 @@ NeighBondKokkos::NeighBondKokkos(LAMMPS *lmp) : Pointers(lmp) datamask_read = EMPTY_MASK; datamask_modify = EMPTY_MASK; - k_nlist = DAT::tdual_int_scalar("NeighBond:nlist"); - d_nlist = k_nlist.view(); - h_nlist = k_nlist.h_view; + // use 1D view for scalars to reduce GPU memory operations - k_fail_flag = DAT::tdual_int_scalar("NeighBond:fail_flag"); - d_fail_flag = k_fail_flag.view(); - h_fail_flag = k_fail_flag.h_view; + d_scalars = typename AT::t_int_1d("NeighBond:scalars",2); + h_scalars = HAT::t_int_1d("NeighBond:scalars_mirror",2); + + d_nlist = Kokkos::subview(d_scalars,0); + d_fail_flag = Kokkos::subview(d_scalars,1); + + h_nlist = Kokkos::subview(h_scalars,0); + h_fail_flag = Kokkos::subview(h_scalars,1); maxbond = 0; maxangle = 0; @@ -240,22 +243,14 @@ void NeighBondKokkos::bond_all() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nbondlist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxbond = neighbor->nbondlist + BONDDELTA; memoryKK->grow_kokkos(k_bondlist,neighbor->bondlist,maxbond,3,"neighbor:neighbor->bondlist"); @@ -327,22 +322,14 @@ void NeighBondKokkos::bond_partial() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nbondlist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxbond = neighbor->nbondlist + BONDDELTA; memoryKK->grow_kokkos(k_bondlist,neighbor->bondlist,maxbond,3,"neighbor:neighbor->bondlist"); @@ -440,22 +427,14 @@ void NeighBondKokkos::angle_all() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nanglelist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxangle = neighbor->nanglelist + BONDDELTA; memoryKK->grow_kokkos(k_anglelist,neighbor->anglelist,maxangle,4,"neighbor:neighbor->anglelist"); @@ -534,22 +513,14 @@ void NeighBondKokkos::angle_partial() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nanglelist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxangle = neighbor->nanglelist + BONDDELTA; memoryKK->grow_kokkos(k_anglelist,neighbor->anglelist,maxangle,4,"neighbor:neighbor->anglelist"); @@ -667,22 +638,14 @@ void NeighBondKokkos::dihedral_all() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->ndihedrallist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxdihedral = neighbor->ndihedrallist + BONDDELTA; memoryKK->grow_kokkos(k_dihedrallist,neighbor->dihedrallist,maxdihedral,5,"neighbor:neighbor->dihedrallist"); @@ -766,22 +729,14 @@ void NeighBondKokkos::dihedral_partial() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->ndihedrallist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maxdihedral = neighbor->ndihedrallist + BONDDELTA; memoryKK->grow_kokkos(k_dihedrallist,neighbor->dihedrallist,maxdihedral,5,"neighbor:neighbor->dihedrallist"); @@ -921,22 +876,14 @@ void NeighBondKokkos::improper_all() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nimproperlist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maximproper = neighbor->nimproperlist + BONDDELTA; memoryKK->grow_kokkos(k_improperlist,neighbor->improperlist,maximproper,5,"neighbor:neighbor->improperlist"); @@ -1020,22 +967,14 @@ void NeighBondKokkos::improper_partial() do { nmissing = 0; - h_nlist() = 0; - k_nlist.template modify(); - k_nlist.template sync(); - - h_fail_flag() = 0; - k_fail_flag.template modify(); - k_fail_flag.template sync(); + Kokkos::deep_copy(d_scalars,0); Kokkos::parallel_reduce(Kokkos::RangePolicy(0,nlocal),*this,nmissing); - k_nlist.template modify(); - k_nlist.template sync(); + Kokkos::deep_copy(h_scalars,d_scalars); + neighbor->nimproperlist = h_nlist(); - k_fail_flag.template modify(); - k_fail_flag.template sync(); if (h_fail_flag()) { maximproper = neighbor->nimproperlist + BONDDELTA; memoryKK->grow_kokkos(k_improperlist,neighbor->improperlist,maximproper,5,"neighbor:neighbor->improperlist"); @@ -1221,6 +1160,7 @@ void NeighBondKokkos::update_class_variables() k_map_array.template sync(); } else if (map_style == Atom::MAP_HASH) { k_map_hash = atomKK->k_map_hash; + k_map_hash.template sync(); } } diff --git a/src/KOKKOS/neigh_bond_kokkos.h b/src/KOKKOS/neigh_bond_kokkos.h index e4be1aeee3..480726c602 100644 --- a/src/KOKKOS/neigh_bond_kokkos.h +++ b/src/KOKKOS/neigh_bond_kokkos.h @@ -115,11 +115,10 @@ class NeighBondKokkos : protected Pointers { typename AT::t_tagint_2d improper_atom1,improper_atom2, improper_atom3,improper_atom4; - DAT::tdual_int_scalar k_nlist; + typename AT::t_int_1d d_scalars; + HAT::t_int_1d h_scalars; typename AT::t_int_scalar d_nlist; HAT::t_int_scalar h_nlist; - - DAT::tdual_int_scalar k_fail_flag; typename AT::t_int_scalar d_fail_flag; HAT::t_int_scalar h_fail_flag; diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 852a4a9280..06567cbeb6 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -240,22 +240,25 @@ void NPairKokkos::build(NeighList *list_) // assumes newton off NPairKokkosBuildFunctorGhost f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor); -#ifdef LMP_KOKKOS_GPU - if (ExecutionSpaceFromDevice::space == Device) { - int team_size = atoms_per_bin*factor; - int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); - if (team_size <= team_size_max) { - Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); - Kokkos::parallel_for(config, f); - } else { // fall back to flat method - f.sharedsize = 0; - Kokkos::parallel_for(nall, f); - } - } else - Kokkos::parallel_for(nall, f); -#else + +// temporarily disable team policy for ghost due to known bug + +//#ifdef LMP_KOKKOS_GPU +// if (ExecutionSpaceFromDevice::space == Device) { +// int team_size = atoms_per_bin*factor; +// int team_size_max = Kokkos::TeamPolicy(team_size,Kokkos::AUTO).team_size_max(f,Kokkos::ParallelForTag()); +// if (team_size <= team_size_max) { +// Kokkos::TeamPolicy config((mbins+factor-1)/factor,team_size); +// Kokkos::parallel_for(config, f); +// } else { // fall back to flat method +// f.sharedsize = 0; +// Kokkos::parallel_for(nall, f); +// } +// } else +// Kokkos::parallel_for(nall, f); +//#else Kokkos::parallel_for(nall, f); -#endif +//#endif } else { if (SIZE) { NPairKokkosBuildFunctorSize f(data,atoms_per_bin * 6 * sizeof(X_FLOAT) * factor); diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index ec72cabf33..2b81e21e2b 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMAlloyKokkos::PairEAMAlloyKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMAlloyKokkos::~PairEAMAlloyKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -208,41 +213,65 @@ void PairEAMAlloyKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMAlloyKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_i d_sendlist = k_sendlist.view(); iswap = iswap_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } @@ -445,7 +474,7 @@ void PairEAMAlloyKokkos::unpack_forward_comm_kokkos(int n, int first { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -588,6 +617,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -644,6 +674,7 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -806,6 +837,235 @@ void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMAlloyKokkos::operator()(TagPairEAMAlloyKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMAlloyKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1214,6 +1474,35 @@ void PairEAMAlloyKokkos::file2array_alloy() /* ---------------------------------------------------------------------- */ +template +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMAlloyKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMAlloyKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index c6cb73ca5d..2eb40189ac 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { ~PairEAMAlloyKokkos() override; void compute(int, int) override; void init_style() override; - void *extract(const char *, int &) override { return nullptr; } void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION @@ -93,6 +92,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMAlloyKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,17 +177,18 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_alloy(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; - //NeighListKokkos k_list; int iswap; int first; @@ -187,7 +202,6 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index 50abbc3191..4572d14e48 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -32,10 +32,10 @@ #include "potential_file_reader.h" #include -#include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + // Cannot use virtual inheritance on the GPU, so must duplicate code /* ---------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) respa_enable = 0; single_enable = 0; one_coeff = 1; + manybody_flag = 1; kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -59,10 +60,10 @@ PairEAMFSKokkos::PairEAMFSKokkos(LAMMPS *lmp) : PairEAM(lmp) template PairEAMFSKokkos::~PairEAMFSKokkos() { - if (!copymode) { - memoryKK->destroy_kokkos(k_eatom,eatom); - memoryKK->destroy_kokkos(k_vatom,vatom); - } + if (copymode) return; + + memoryKK->destroy_kokkos(k_eatom,eatom); + memoryKK->destroy_kokkos(k_vatom,vatom); } /* ---------------------------------------------------------------------- */ @@ -118,7 +119,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -138,9 +139,9 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // zero out density if (newton_pair) - Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nall),*this); else - Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,nlocal),*this); // loop over neighbors of my atoms @@ -152,15 +153,15 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -178,18 +179,22 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -197,7 +202,7 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) ev.evdwl = 0.0; } - // communicate derivative of embedding function (on the device) + // communicate derivative of embedding function k_fp.template modify(); comm->forward_comm(this); @@ -208,41 +213,65 @@ void PairEAMFSKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -427,7 +456,7 @@ int PairEAMFSKokkos::pack_forward_comm_kokkos(int n, DAT::tdual_int_ d_sendlist = k_sendlist.view(); iswap = iswap_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); return n; } @@ -445,7 +474,7 @@ void PairEAMFSKokkos::unpack_forward_comm_kokkos(int n, int first_in { first = first_in; v_buf = buf.view(); - Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); + Kokkos::parallel_for(Kokkos::RangePolicy(0,n),*this); } template @@ -645,6 +674,7 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); @@ -691,7 +721,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, const int &ii) const { - EV_FLOAT ev; + EV_FLOAT ev; this->template operator()(TagPairEAMFSKernelAB(), ii, ev); this->template operator()(TagPairEAMFSKernelAB(), ii, ev); } @@ -807,6 +837,235 @@ void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMFSKokkos::operator()(TagPairEAMFSKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMFSKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -1225,6 +1484,35 @@ void PairEAMFSKokkos::file2array_fs() /* ---------------------------------------------------------------------- */ +template +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMFSKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMFSKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 06a395cba7..bd03ab0015 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { ~PairEAMFSKokkos() override; void compute(int, int) override; void init_style() override; - void *extract(const char *, int &) override { return nullptr; } void coeff(int, char **) override; KOKKOS_INLINE_FUNCTION @@ -93,6 +92,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&, EV_FLOAT&) const; @@ -101,6 +108,14 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMFSKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -125,7 +140,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -139,7 +154,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; - NonDupScatterView ndup_rho; NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; @@ -163,13 +177,15 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { t_ffloat_2d_n7 d_frho_spline; t_ffloat_2d_n7 d_rhor_spline; t_ffloat_2d_n7 d_z2r_spline; - + void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void file2array() override; void file2array_fs(); void array2spline() override; - void interpolate(int, double, double *, t_host_ffloat_2d_n7, int); void read_file(char *) override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; @@ -186,7 +202,6 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { }; } - #endif #endif diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 6e1cd1feea..de6d3646bf 100644 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -31,9 +31,10 @@ #include "pair_kokkos.h" #include - using namespace LAMMPS_NS; +#define MAX_CACHE_ROWS 500 + /* ---------------------------------------------------------------------- */ template @@ -113,7 +114,7 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) d_numneigh = k_list->d_numneigh; d_neighbors = k_list->d_neighbors; d_ilist = k_list->d_ilist; - int inum = list->inum; + inum = list->inum; need_dup = lmp->kokkos->need_dup(); if (need_dup) { @@ -147,15 +148,15 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } } @@ -173,18 +174,22 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) // compute kernel B if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy>(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy>(0,inum),*this); } else if (neighflag == FULL) { // compute kernel AB if (eflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } if (eflag) { @@ -203,41 +208,65 @@ void PairEAMKokkos::compute(int eflag_in, int vflag_in) if (evflag) { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } else { - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce( + Kokkos::RangePolicy>(0,inum), + *this,ev); } } } else { if (neighflag == HALF) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == HALFTHREAD) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } else if (neighflag == FULL) { if (newton_pair) { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } else { - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for( + policyInstance>::get(inum), + *this); } } } @@ -583,6 +612,7 @@ template template KOKKOS_INLINE_FUNCTION void PairEAMKokkos::operator()(TagPairEAMKernelB, const int &ii, EV_FLOAT& ev) const { + // fp = derivative of embedding energy at each atom // phi = embedding energy at each atom // if rho > rhomax (e.g. due to close approach of two atoms), @@ -802,6 +832,235 @@ void PairEAMKokkos::operator()(TagPairEAMKernelC +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + // rho = density at each atom + // loop over neighbors of my atoms + const int m_max = d_rhor_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_rhor_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_rhor_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_rhor_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT rhotmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + F_FLOAT p = sqrt(rsq)*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + if (d_type2rhor_ji == 0 && d_rhor_spline_cached == 1) { + rhotmp += ((A(m,3)*p + A(m,4))*p + + A(m,5))*p + A(m,6); + } else + rhotmp += ((d_rhor_spline(d_type2rhor_ji,m,3)*p + d_rhor_spline(d_type2rhor_ji,m,4))*p + + d_rhor_spline(d_type2rhor_ji,m,5))*p + d_rhor_spline(d_type2rhor_ji,m,6); + } + + } + d_rho[i] += rhotmp; + + // fp = derivative of embedding energy at each atom + // phi = embedding energy at each atom + // if rho > rhomax (e.g. due to close approach of two atoms), + // will exceed table, so add linear term to conserve energy + + F_FLOAT p = d_rho[i]*rdrho + 1.0; + int m = static_cast (p); + m = MAX(1,MIN(m,nrho-1)); + p -= m; + p = MIN(p,1.0); + const int d_type2frho_i = d_type2frho[itype]; + d_fp[i] = (d_frho_spline(d_type2frho_i,m,0)*p + d_frho_spline(d_type2frho_i,m,1))*p + d_frho_spline(d_type2frho_i,m,2); + if (EFLAG) { + F_FLOAT phi = ((d_frho_spline(d_type2frho_i,m,3)*p + d_frho_spline(d_type2frho_i,m,4))*p + + d_frho_spline(d_type2frho_i,m,5))*p + d_frho_spline(d_type2frho_i,m,6); + if (d_rho[i] > rhomax) phi += d_fp[i] * (d_rho[i]-rhomax); + if (eflag_global) ev.evdwl += phi; + if (eflag_atom) d_eatom[i] += phi; + } + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelAB, + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelAB(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + +////Specialisation for Neighborlist types Half, HalfThread, Full +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + const typename Kokkos::TeamPolicy::member_type& team_member, + EV_FLOAT& ev) const { + + int ii = team_member.league_rank()*team_member.team_size() + team_member.team_rank(); + + // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial + + auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + auto a_f = v_f.template access>(); + + const int m_max = d_z2r_spline.extent_int(1); + const int j_max = t_ffloat_2d_n7::static_extent(2); + const int d_z2r_spline_cached = (m_max > MAX_CACHE_ROWS) ? 0 : 1; + Kokkos::View> A(team_member.team_scratch(0), MAX_CACHE_ROWS); + + if (d_z2r_spline_cached) { + for(int i = team_member.team_rank(); i < m_max*j_max; i+= team_member.team_size()) { + int j = i%j_max; + int m = i/j_max; + A(m,j) = d_z2r_spline(0,m,j); + } + team_member.team_barrier(); + } + if (ii < inum) { + const int i = d_ilist[ii]; + const X_FLOAT xtmp = x(i,0); + const X_FLOAT ytmp = x(i,1); + const X_FLOAT ztmp = x(i,2); + const int itype = type(i); + + const int jnum = d_numneigh[i]; + + F_FLOAT fxtmp = 0.0; + F_FLOAT fytmp = 0.0; + F_FLOAT fztmp = 0.0; + + for (int jj = 0; jj < jnum; jj++) { + int j = d_neighbors(i,jj); + j &= NEIGHMASK; + const X_FLOAT delx = xtmp - x(j,0); + const X_FLOAT dely = ytmp - x(j,1); + const X_FLOAT delz = ztmp - x(j,2); + const int jtype = type(j); + const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; + + if (rsq < cutforcesq) { + const F_FLOAT r = sqrt(rsq); + F_FLOAT p = r*rdr + 1.0; + int m = static_cast (p); + m = MIN(m,nr-1); + p -= m; + p = MIN(p,1.0); + + // rhoip = derivative of (density at atom j due to atom i) + // rhojp = derivative of (density at atom i due to atom j) + // phi = pair potential energy + // phip = phi' + // z2 = phi * r + // z2p = (phi * r)' = (phi' r) + phi + // psip needs both fp[i] and fp[j] terms since r_ij appears in two + // terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji) + // hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip + + const int d_type2rhor_ij = d_type2rhor(itype,jtype); + const F_FLOAT rhoip = (d_rhor_spline(d_type2rhor_ij,m,0)*p + d_rhor_spline(d_type2rhor_ij,m,1))*p + + d_rhor_spline(d_type2rhor_ij,m,2); + const int d_type2rhor_ji = d_type2rhor(jtype,itype); + const F_FLOAT rhojp = (d_rhor_spline(d_type2rhor_ji,m,0)*p + d_rhor_spline(d_type2rhor_ji,m,1))*p + + d_rhor_spline(d_type2rhor_ji,m,2); + const int d_type2z2r_ij = d_type2z2r(itype,jtype); + + const auto have_cache = (d_z2r_spline_cached == 1) && (0 == d_type2z2r_ij); + const auto z2r_spline_3 = (have_cache) ? A(m,3) : d_z2r_spline(d_type2z2r_ij,m,3); + const auto z2r_spline_4 = (have_cache) ? A(m,4) : d_z2r_spline(d_type2z2r_ij,m,4); + const auto z2r_spline_5 = (have_cache) ? A(m,5) : d_z2r_spline(d_type2z2r_ij,m,5); + const auto z2r_spline_6 = (have_cache) ? A(m,6) : d_z2r_spline(d_type2z2r_ij,m,6); + + const F_FLOAT z2p = (3.0*rdr*z2r_spline_3*p + 2.0*rdr*z2r_spline_4)*p + + rdr*z2r_spline_5; // the rdr and the factors of 3.0 and 2.0 come out of the interpolate function + const F_FLOAT z2 = ((z2r_spline_3*p + z2r_spline_4)*p + + z2r_spline_5)*p + z2r_spline_6; + + const F_FLOAT recip = 1.0/r; + const F_FLOAT phi = z2*recip; + const F_FLOAT phip = z2p*recip - phi*recip; + const F_FLOAT psip = d_fp[i]*rhojp + d_fp[j]*rhoip + phip; + const F_FLOAT fpair = -psip*recip; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + + if ((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD) && (NEWTON_PAIR || j < nlocal)) { + a_f(j,0) -= delx*fpair; + a_f(j,1) -= dely*fpair; + a_f(j,2) -= delz*fpair; + } + + if (EVFLAG) { + if (eflag) { + ev.evdwl += (((NEIGHFLAG==HALF || NEIGHFLAG==HALFTHREAD)&&(NEWTON_PAIR||(jtemplate ev_tally(ev,i,j,phi,fpair,delx,dely,delz); + } + + } + } + + a_f(i,0) += fxtmp; + a_f(i,1) += fytmp; + a_f(i,2) += fztmp; + } +} + +template +template +KOKKOS_INLINE_FUNCTION +void PairEAMKokkos::operator()(TagPairEAMKernelC, + /*const int &ii*/ + const typename Kokkos::TeamPolicy::member_type& team_member) const { + EV_FLOAT ev; + this->template operator()(TagPairEAMKernelC(), team_member, ev); +} + +/* ---------------------------------------------------------------------- */ + template template KOKKOS_INLINE_FUNCTION @@ -898,6 +1157,37 @@ void PairEAMKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int & } } +/* ---------------------------------------------------------------------- */ + +template +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + auto policy = Kokkos::RangePolicy(0,inum); + return policy; + } +}; + +#ifdef KOKKOS_ENABLE_HIP +template<> +template +struct PairEAMKokkos::policyInstance { + KOKKOS_INLINE_FUNCTION + static auto get(int inum) { + static_assert(t_ffloat_2d_n7::static_extent(2) == 7, + "Breaking assumption of spline dim for KernelAB and KernelC scratch caching"); + + auto policy = Kokkos::TeamPolicy((inum+1023)/1024, 1024) + .set_scratch_size(0, + Kokkos::PerTeam(MAX_CACHE_ROWS*7*sizeof(double))); + return policy; + } +}; +#endif + +/* ---------------------------------------------------------------------- */ + namespace LAMMPS_NS { template class PairEAMKokkos; #ifdef LMP_KOKKOS_GPU diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 006dceb1f2..9d066d40a0 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -60,6 +60,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void compute(int, int) override; void init_style() override; + KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; @@ -89,6 +90,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelAB, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelAB, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&, EV_FLOAT&) const; @@ -97,6 +106,14 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelC, const int&) const; + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&, EV_FLOAT&) const; + + template + KOKKOS_INLINE_FUNCTION + void operator()(TagPairEAMKernelC, const typename Kokkos::TeamPolicy::member_type&) const; + template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -121,7 +138,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { typename AT::t_efloat_1d d_eatom; typename AT::t_virial_array d_vatom; - int need_dup; + int need_dup,inum; using KKDeviceType = typename KKDevice::value; @@ -162,6 +179,9 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { void file2array() override; void array2spline() override; + template + struct policyInstance; + typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d d_ilist; typename AT::t_int_1d d_numneigh; diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp index cfdb9b7c63..387212f383 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp @@ -60,7 +60,7 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) int none = 0; if (m == nstyles) { if (strcmp(arg[2],"none") == 0) none = 1; - else error->all(FLERR,"Pair coeff for hybrid has invalid style"); + else error->all(FLERR,"Pair coeff for hybrid has invalid style: {}", arg[2]); } // move 1st/2nd args to 2nd/3rd args diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 0ff244f67d..f6925a376d 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -137,6 +137,12 @@ struct PairComputeFunctor { F_FLOAT fytmp = 0.0; F_FLOAT fztmp = 0.0; + if (NEIGHFLAG == FULL) { + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + } + for (int jj = 0; jj < jnum; jj++) { int j = neighbors_i(jj); const F_FLOAT factor_lj = c.special_lj[sbmask(j)]; @@ -205,6 +211,12 @@ struct PairComputeFunctor { F_FLOAT fytmp = 0.0; F_FLOAT fztmp = 0.0; + if (NEIGHFLAG == FULL) { + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + } + for (int jj = 0; jj < jnum; jj++) { int j = neighbors_i(jj); const F_FLOAT factor_lj = c.special_lj[sbmask(j)]; @@ -280,6 +292,12 @@ struct PairComputeFunctor { const X_FLOAT ztmp = c.x(i,2); const int itype = c.type(i); + Kokkos::single(Kokkos::PerThread(team), [&] (){ + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + }); + const AtomNeighborsConst neighbors_i = list.get_neighbors_const(i); const int jnum = list.d_numneigh[i]; @@ -337,6 +355,12 @@ struct PairComputeFunctor { const int itype = c.type(i); const F_FLOAT qtmp = c.q(i); + Kokkos::single(Kokkos::PerThread(team), [&] (){ + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + }); + const AtomNeighborsConst neighbors_i = list.get_neighbors_const(i); const int jnum = list.d_numneigh[i]; @@ -399,6 +423,12 @@ struct PairComputeFunctor { const X_FLOAT ztmp = c.x(i,2); const int itype = c.type(i); + Kokkos::single(Kokkos::PerThread(team), [&] (){ + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + }); + const AtomNeighborsConst neighbors_i = list.get_neighbors_const(i); const int jnum = list.d_numneigh[i]; @@ -495,6 +525,12 @@ struct PairComputeFunctor { const int itype = c.type(i); const F_FLOAT qtmp = c.q(i); + Kokkos::single(Kokkos::PerThread(team), [&] (){ + f(i,0) = 0.0; + f(i,1) = 0.0; + f(i,2) = 0.0; + }); + const AtomNeighborsConst neighbors_i = list.get_neighbors_const(i); const int jnum = list.d_numneigh[i]; @@ -743,6 +779,7 @@ EV_FLOAT pair_compute_neighlist (PairStyle* fpair, typename std::enable_if<(NEIG fpair->lmp->kokkos->neigh_thread = 1; if (fpair->lmp->kokkos->neigh_thread) { + int vector_length = 8; int atoms_per_team = 32; @@ -779,6 +816,7 @@ template EV_FLOAT pair_compute (PairStyle* fpair, NeighListKokkos* list) { EV_FLOAT ev; if (fpair->neighflag == FULL) { + fpair->fuse_force_clear_flag = 1; ev = pair_compute_neighlist (fpair,list); } else if (fpair->neighflag == HALFTHREAD) { ev = pair_compute_neighlist (fpair,list); @@ -834,11 +872,7 @@ void pair_virial_fdotr_compute(PairStyle* fpair) { fpair->virial[5] = virial.v[5]; } - - - } #endif #endif - diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index fba95a679e..ca1884bfd2 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -97,6 +97,17 @@ class PairSNAPKokkos : public PairSNAP { static constexpr int tile_size_transform_bi = 2; static constexpr int tile_size_compute_yi = 2; static constexpr int team_size_compute_fused_deidrj = 2; +#elif defined(KOKKOS_ENABLE_SYCL) + static constexpr int team_size_compute_neigh = 4; + static constexpr int tile_size_compute_ck = 4; + static constexpr int tile_size_pre_ui = 8; + static constexpr int team_size_compute_ui = 8; + static constexpr int tile_size_transform_ui = 8; + static constexpr int tile_size_compute_zi = 4; + static constexpr int tile_size_compute_bi = 4; + static constexpr int tile_size_transform_bi = 4; + static constexpr int tile_size_compute_yi = 8; + static constexpr int team_size_compute_fused_deidrj = 4; #else static constexpr int team_size_compute_neigh = 4; static constexpr int tile_size_compute_ck = 4; diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index f76cab6f0f..912ae36f6f 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -138,7 +138,7 @@ PPPMKokkos::~PPPMKokkos() template void PPPMKokkos::init() { - if (me == 0) utils::logmesg(lmp,"PPPM initialization ...\n"); + if (me == 0) utils::logmesg(lmp,"PPPM Kokkos initialization ...\n"); // error check @@ -146,6 +146,10 @@ void PPPMKokkos::init() error->all(FLERR,"Cannot (yet) use PPPM Kokkos with 'kspace_modify diff ad'"); triclinic_check(); + + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->triclinic && slabflag) error->all(FLERR,"Cannot (yet) use PPPM with triclinic box and slab correction"); if (domain->dimension == 2) diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 50b5ac0f35..2c6dcc4e15 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -430,7 +430,6 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { // triclinic - int triclinic; // domain settings, orthog or triclinic void setup_triclinic(); void compute_gf_ik_triclinic(); void poisson_ik_triclinic(); diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index fd58f1c4f3..d5690ea60a 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -2298,7 +2298,7 @@ void SNAKokkos::compute_s_dsfac(const real constexpr real_type zero = static_cast(0.0); constexpr real_type onehalf = static_cast(0.5); - if (switch_flag == 0) { sfac_outer = zero; dsfac_outer = zero; } + if (switch_flag == 0) { sfac_outer = one; dsfac_outer = zero; } else if (switch_flag == 1) { if (r <= rmin0) { sfac_outer = one; dsfac_outer = zero; } else if (r > rcut) { sfac = zero; dsfac = zero; return; } diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 01401542cd..7570f1d8fa 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -27,7 +27,7 @@ #include "kspace.h" #include "output.h" #include "update.h" -#include "modify.h" +#include "modify_kokkos.h" #include "timer.h" #include "memory_kokkos.h" #include "kokkos.h" @@ -276,6 +276,9 @@ void VerletKokkos::run(int n) lmp->kokkos->auto_sync = 0; + fuse_integrate = 0; + fuse_force_clear = 0; + if (atomKK->sortfreq > 0) sortflag = 1; else sortflag = 0; @@ -296,7 +299,8 @@ void VerletKokkos::run(int n) // initial time integration timer->stamp(); - modify->initial_integrate(vflag); + if (!fuse_integrate) + modify->initial_integrate(vflag); if (n_post_integrate) modify->post_integrate(); timer->stamp(Timer::MODIFY); @@ -357,12 +361,17 @@ void VerletKokkos::run(int n) } } + // check if kernels can be fused, must come after initial_integrate + + fuse_check(i,n); + // force computations // important for pair to come before bonded contributions // since some bonded potentials tally pairwise energy/virial // and Pair:ev_tally() needs to be called before any tallying - force_clear(); + if (!fuse_force_clear) + force_clear(); timer->stamp(); @@ -494,7 +503,10 @@ void VerletKokkos::run(int n) // force modifications, final time integration, diagnostics if (n_post_force) modify->post_force(vflag); - modify->final_integrate(); + + if (fuse_integrate) modify->fused_integrate(vflag); + else modify->final_integrate(); + if (n_end_of_step) modify->end_of_step(); timer->stamp(Timer::MODIFY); @@ -593,3 +605,35 @@ void VerletKokkos::force_clear() } } } + +/* ---------------------------------------------------------------------- + check if can fuse force_clear() with pair compute() + Requirements: + - no pre_force fixes + - no torques, SPIN forces, or includegroup set + - pair compute() must be called + - pair_style must support fusing + + check if can fuse initial_integrate() with final_integrate() + Requirements: + - no end_of_step fixes + - not on last or output step + - no timers to break out of loop + - integrate fix style must support fusing +------------------------------------------------------------------------- */ + +void VerletKokkos::fuse_check(int i, int n) +{ + fuse_force_clear = 1; + if (modify->n_pre_force) fuse_force_clear = 0; + else if (torqueflag || extraflag || neighbor->includegroup) fuse_force_clear = 0; + else if (!force->pair || !pair_compute_flag) fuse_force_clear = 0; + else if (!force->pair->fuse_force_clear_flag) fuse_force_clear = 0; + + fuse_integrate = 1; + if (modify->n_end_of_step) fuse_integrate = 0; + else if (i == n-1) fuse_integrate = 0; + else if (update->ntimestep == output->next) fuse_integrate = 0; + else if (timer->has_timeout()) fuse_integrate = 0; + else if (!((ModifyKokkos*)modify)->check_fuse_integrate()) fuse_integrate = 0; +} diff --git a/src/KOKKOS/verlet_kokkos.h b/src/KOKKOS/verlet_kokkos.h index 067df54f4f..c71211c542 100644 --- a/src/KOKKOS/verlet_kokkos.h +++ b/src/KOKKOS/verlet_kokkos.h @@ -46,6 +46,9 @@ class VerletKokkos : public Verlet { protected: DAT::t_f_array f_merge_copy,f; + int fuse_force_clear,fuse_integrate; + + void fuse_check(int, int); }; } diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 84a21b46e6..78ebad512a 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -110,6 +110,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), { triclinic_support = 0; pppmflag = dispersionflag = 1; + triclinic = domain->triclinic; nfactors = 3; factors = new int[nfactors]; @@ -242,12 +243,12 @@ void PPPMDisp::settings(int narg, char **arg) PPPMDisp::~PPPMDisp() { - delete [] factors; - delete [] B; + delete[] factors; + delete[] B; B = nullptr; - delete [] cii; + delete[] cii; cii = nullptr; - delete [] csumi; + delete[] csumi; csumi = nullptr; PPPMDisp::deallocate(); PPPMDisp::deallocate_peratom(); @@ -268,6 +269,9 @@ void PPPMDisp::init() triclinic_check(); + if (triclinic != domain->triclinic) + error->all(FLERR,"Must redefine kspace_style after changing to triclinic box"); + if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMDisp with 2d simulation"); if (comm->style != Comm::BRICK) @@ -1277,7 +1281,7 @@ void PPPMDisp::init_coeffs() int n = atom->ntypes; int converged; - delete [] B; + delete[] B; B = nullptr; // no mixing rule or arithmetic @@ -3352,10 +3356,10 @@ void PPPMDisp::calc_csum() int ntypes = atom->ntypes; int i,j,k; - delete [] cii; + delete[] cii; cii = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) cii[i] = 0.0; - delete [] csumi; + delete[] csumi; csumi = new double[ntypes+1]; for (i = 0; i<=ntypes; i++) csumi[i] = 0.0; int *neach = new int[ntypes+1]; @@ -3447,8 +3451,8 @@ void PPPMDisp::calc_csum() } } - delete [] neach; - delete [] neach_all; + delete[] neach; + delete[] neach_all; } /* ---------------------------------------------------------------------- @@ -6538,9 +6542,9 @@ void PPPMDisp::fieldforce_none_ik() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6660,9 +6664,9 @@ void PPPMDisp::fieldforce_none_ad() } } - delete [] ekx; - delete [] eky; - delete [] ekz; + delete[] ekx; + delete[] eky; + delete[] ekz; } /* ---------------------------------------------------------------------- @@ -6756,13 +6760,13 @@ void PPPMDisp::fieldforce_none_peratom() } } - delete [] u_pa; - delete [] v0; - delete [] v1; - delete [] v2; - delete [] v3; - delete [] v4; - delete [] v5; + delete[] u_pa; + delete[] v0; + delete[] v1; + delete[] v2; + delete[] v3; + delete[] v4; + delete[] v5; } /* ---------------------------------------------------------------------- diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index f38ba00861..c7c45bc865 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -14,7 +14,7 @@ /* ---------------------------------------------------------------------- Contributing author: Aidan Thompson (SNL) - original Tersoff implementation - Wengen Ouyang (TAU) - Shift addition + Wengen Ouyang (WHU) - Shift addition ------------------------------------------------------------------------- */ #include "pair_tersoff.h" diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 634b512936..ff8c5eb9c9 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2328,8 +2328,7 @@ double FixGCMC::energy_full() } if (overlaptest) break; } - MPI_Allreduce(&overlaptest, &overlaptestall, 1, - MPI_INT, MPI_MAX, world); + MPI_Allreduce(&overlaptest, &overlaptestall, 1, MPI_INT, MPI_MAX, world); if (overlaptestall) return MAXENERGYSIGNAL; } @@ -2352,12 +2351,6 @@ double FixGCMC::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c GCMC does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index a98f29da5e..cc2f1bc94d 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -1050,13 +1050,7 @@ double FixWidom::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - // unlike Verlet, not performing a reverse_comm() or forces here - // b/c Widom does not care about forces - // don't think it will mess up energy due to any post_force() fixes - // but Modify::pre_reverse() is needed for INTEL - - if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); - if (modify->n_pre_force) modify->pre_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which // operate at pre_force() or post_force() diff --git a/src/NETCDF/dump_netcdf.cpp b/src/NETCDF/dump_netcdf.cpp index 6fecf7f41b..a4699897a3 100644 --- a/src/NETCDF/dump_netcdf.cpp +++ b/src/NETCDF/dump_netcdf.cpp @@ -195,6 +195,7 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -223,7 +224,7 @@ void DumpNetCDF::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -321,8 +322,11 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( nc_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -433,21 +437,17 @@ void DumpNetCDF::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( nc_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, - &thermovar[i]), th->keyword[i].c_str() ); -#endif + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( nc_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -606,19 +606,30 @@ void DumpNetCDF::write() if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf always stores thermo data from last thermo output", + id, *th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = *th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( nc_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( nc_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( nc_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( nc_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } diff --git a/src/NETCDF/dump_netcdf.h b/src/NETCDF/dump_netcdf.h index 20c60ef104..982cd99fb5 100644 --- a/src/NETCDF/dump_netcdf.h +++ b/src/NETCDF/dump_netcdf.h @@ -65,6 +65,7 @@ class DumpNetCDF : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf diff --git a/src/NETCDF/dump_netcdf_mpiio.cpp b/src/NETCDF/dump_netcdf_mpiio.cpp index 0282903d77..2407678386 100644 --- a/src/NETCDF/dump_netcdf_mpiio.cpp +++ b/src/NETCDF/dump_netcdf_mpiio.cpp @@ -192,6 +192,7 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : type_nc_real = NC_FLOAT; thermo = false; + thermo_warn = true; thermovar = nullptr; framei = 0; @@ -220,7 +221,7 @@ void DumpNetCDFMPIIO::openfile() if (thermo && !singlefile_opened) { delete[] thermovar; - thermovar = new int[output->thermo->nfield]; + thermovar = new int[*output->thermo->get_nfield()]; } // now the computes and fixes have been initialized, so we can query @@ -319,8 +320,11 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - NCERRX( ncmpi_inq_varid(ncid, th->keyword[i].c_str(), &thermovar[i]), th->keyword[i].c_str() ); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() ); } } @@ -423,17 +427,17 @@ void DumpNetCDFMPIIO::openfile() // perframe variables if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { -#if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#else - NCERRX( ncmpi_def_var(ncid, th->keyword[i].c_str(), NC_LONG, 1, dims, &thermovar[i]), th->keyword[i].c_str() ); -#endif + const auto &fields = th->get_fields(); + const auto &keywords = th->get_keywords(); + const int nfield = *th->get_nfield(); + + for (int i = 0; i < nfield; i++) { + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), type_nc_real, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT, 1, dims, &thermovar[i]), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( ncmpi_def_var(ncid, keywords[i].c_str(), NC_INT64, 1, dims, &thermovar[i]), keywords[i].c_str() ); } } } @@ -595,25 +599,36 @@ void DumpNetCDFMPIIO::write() if (thermo) { Thermo *th = output->thermo; - for (int i = 0; i < th->nfield; i++) { - th->call_vfunc(i); + + // will output current thermo data only on timesteps where it was computed. + // warn (once) about using cached copy from old timestep. + + if (thermo_warn && (update->ntimestep != *th->get_timestep())) { + thermo_warn = false; + if (comm->me == 0) { + error->warning(FLERR, "Dump {} output on incompatible timestep with thermo output: {} vs {} \n" + " Dump netcdf/mpiio always stores thermo data from last thermo output", + id, *th->get_timestep(), update->ntimestep); + } + } + + const auto &keywords = th->get_keywords(); + const auto &fields = th->get_fields(); + int nfield = *th->get_nfield(); + for (int i = 0; i < nfield; i++) { if (filewriter) { - if (th->vtype[i] == Thermo::FLOAT) { - NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, - &th->dvalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::INT) { - NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &th->ivalue), - th->keyword[i].c_str() ); - } else if (th->vtype[i] == Thermo::BIGINT) { - NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &th->bivalue), - th->keyword[i].c_str() ); + if (fields[i].type == multitype::LAMMPS_DOUBLE) { + NCERRX( ncmpi_put_var1_double(ncid, thermovar[i], start, &fields[i].data.d), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT) { + NCERRX( ncmpi_put_var1_int(ncid, thermovar[i], start, &fields[i].data.i), keywords[i].c_str() ); + } else if (fields[i].type == multitype::LAMMPS_INT64) { + NCERRX( ncmpi_put_var1_bigint(ncid, thermovar[i], start, &fields[i].data.b), keywords[i].c_str() ); } } } } - // write timestep header + // write timestep header write_time_and_cell(); diff --git a/src/NETCDF/dump_netcdf_mpiio.h b/src/NETCDF/dump_netcdf_mpiio.h index 5948dc272b..14ee930e26 100644 --- a/src/NETCDF/dump_netcdf_mpiio.h +++ b/src/NETCDF/dump_netcdf_mpiio.h @@ -62,6 +62,7 @@ class DumpNetCDFMPIIO : public DumpCustom { int type_nc_real; // netcdf type to use for real variables: float or double bool thermo; // write thermo output to netcdf file + bool thermo_warn; // warn (once) that thermo output is on incompatible step bigint n_buffer; // size of buffer bigint *int_buffer; // buffer for passing data to netcdf diff --git a/src/OPT/pair_aip_water_2dm_opt.cpp b/src/OPT/pair_aip_water_2dm_opt.cpp new file mode 100644 index 0000000000..47c8c395db --- /dev/null +++ b/src/OPT/pair_aip_water_2dm_opt.cpp @@ -0,0 +1,63 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + This is an optimized version of aip/water/2dm based on the contribution of: + author: Wengen Ouyang (Wuhan University) + e-mail: w.g.ouyang at gmail dot com + + Optimizations are done by: + author1: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + e-mail: sunrise_duan at 126 dot com + + author2: Ping Gao (National Supercomputing Center in Wuxi, China) + e-mail: qdgaoping at gmail dot com + + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al.: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Feng and Ouyang et al, J. Phys. Chem. C 127, 8704-8713 (2023).] +*/ +#include "pair_aip_water_2dm_opt.h" + +#include "atom.h" +#include "memory.h" + +#include + +using namespace LAMMPS_NS; + +PairAIPWATER2DMOpt::PairAIPWATER2DMOpt(LAMMPS *lmp) : + PairILPGrapheneHBN(lmp), PairILPTMD(lmp), PairAIPWATER2DM(lmp), PairILPGrapheneHBNOpt(lmp) +{ +} + +void PairAIPWATER2DMOpt::coeff(int narg, char **args) +{ + PairILPTMD::coeff(narg, args); + memory->create(special_type, atom->ntypes + 1, "PairAIPWATER2DMOpt:check_sublayer"); + for (int i = 1; i <= atom->ntypes; i++) { + int itype = map[i]; + if (strcmp(elements[itype], "Mo") == 0 || strcmp(elements[itype], "W") == 0 || + strcmp(elements[itype], "S") == 0 || strcmp(elements[itype], "Se") == 0 || + strcmp(elements[itype], "Te") == 0) { + special_type[i] = TMD_METAL; + } else if (strcmp(elements[itype], "Hw") == 0 || strcmp(elements[itype], "Ow") == 0) { + special_type[i] = WATER; + } else { + special_type[i] = NOT_SPECIAL; + } + } +} diff --git a/src/OPT/pair_aip_water_2dm_opt.h b/src/OPT/pair_aip_water_2dm_opt.h new file mode 100644 index 0000000000..50b5043360 --- /dev/null +++ b/src/OPT/pair_aip_water_2dm_opt.h @@ -0,0 +1,38 @@ + /* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS +// clang-format off +PairStyle(aip/water/2dm/opt,PairAIPWATER2DMOpt); +// clang-format on +#else + +#ifndef LMP_PAIR_AIP_WATER_2DM_OPT_H +#define LMP_PAIR_AIP_WATER_2DM_OPT_H + +#include "pair_ilp_graphene_hbn_opt.h" +#include "pair_aip_water_2dm.h" + +namespace LAMMPS_NS { + +class PairAIPWATER2DMOpt : public PairAIPWATER2DM, public PairILPGrapheneHBNOpt { + public: + PairAIPWATER2DMOpt(class LAMMPS *); + void coeff(int narg, char **args) override; + + protected: +}; + +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 586c44be08..5cb896223e 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -11,12 +11,24 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Optimization author1: Ping Gao (National Supercomputing Center in Wuxi, China) + This is an optimized version of ilp/graphene/hbn based on the contirubtion of: + author: Wengen Ouyang (Wuhan University, China) + e-mail: w.g.ouyang at gmail dot com + + Optimizations are done by: + author1: Ping Gao (National Supercomputing Center in Wuxi, China) implements the base ILP potential. e-mail: qdgaoping at gmail dot com - Optimization author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + + author2: Xiaohui Duan (Shandong University, China) adjusts the framework to adopt SAIP, TMD, WATER2DM, etc. e-mail: sunrise_duan at 126 dot com - Provides some bugfixes and performance optimizations in this potential. + Optimizations are described in: + Gao, Ping and Duan, Xiaohui, et al: + LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors + DOI: 10.1145/3458817.3476137 + + Potential is described by: + [Ouyang et al., J. Chem. Theory Comput. 16(1), 666-676 (2020)] */ #include "pair_ilp_graphene_hbn_opt.h" @@ -28,19 +40,21 @@ #include "interlayer_taper.h" #include "memory.h" #include "neigh_list.h" +#include "neigh_request.h" #include "neighbor.h" +#include "pointers.h" #include -#include +#include using namespace LAMMPS_NS; using namespace InterLayer; static const char cite_ilp_cur[] = - "ilp/graphene/hbn/opt potential: doi:10.1145/3458817.3476137\n" + "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" "@inproceedings{gao2021lmff\n" - " author = {Gao, Ping and Duan, Xiaohui and others},\n" - " title = {{LMFF}: Efficient and Scalable Layered Materials Force Field on Heterogeneous " + " author = {Gao, Ping and Duan, Xiaohui and Others},\n" + " title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous " "Many-Core Processors},\n" " year = {2021},\n" " isbn = {9781450384421},\n" @@ -50,14 +64,12 @@ static const char cite_ilp_cur[] = " doi = {10.1145/3458817.3476137},\n" " booktitle = {Proceedings of the International Conference for High Performance Computing, " "Networking, Storage and Analysis},\n" - " pages = {42},\n" + " articleno = {42},\n" " numpages = {14},\n" - " location = {St.~Louis, Missouri},\n" + " location = {St. Louis, Missouri},\n" " series = {SC'21},\n" "}\n\n"; -static bool check_vdw(tagint itag, tagint jtag, double *xi, double *xj); - /* ---------------------------------------------------------------------- */ PairILPGrapheneHBNOpt::PairILPGrapheneHBNOpt(LAMMPS *lmp) : @@ -168,6 +180,36 @@ void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) } } } + } else if (variant == AIP_WATER_2DM) { + if (eflag_global || eflag_atom) { + if (vflag_either) { + if (tap_flag) { + eval<6, 1, 1, 1, AIP_WATER_2DM>(); + } else { + eval<6, 1, 1, 0, AIP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 1, 0, 1, AIP_WATER_2DM>(); + } else { + eval<6, 1, 0, 0, AIP_WATER_2DM>(); + } + } + } else { + if (vflag_either) { + if (tap_flag) { + eval<6, 0, 1, 1, AIP_WATER_2DM>(); + } else { + eval<6, 0, 1, 0, AIP_WATER_2DM>(); + } + } else { + if (tap_flag) { + eval<6, 0, 0, 1, AIP_WATER_2DM>(); + } else { + eval<6, 0, 0, 0, AIP_WATER_2DM>(); + } + } + } } else if (variant == SAIP_METAL) { if (eflag_global || eflag_atom) { if (vflag_either) { @@ -255,7 +297,7 @@ void PairILPGrapheneHBNOpt::eval() rsq = delx * delx + dely * dely + delz * delz; if (rsq != 0 && rsq < cutILPsq[itype_map][jtype]) { - if (VARIANT == ILP_TMD && special_type[itype] && itype != type[j]) continue; + if ((VARIANT == ILP_TMD || VARIANT == AIP_WATER_2DM) && special_type[itype] == TMD_METAL && itype != type[j]) continue; if (ILP_nneigh >= MAX_NNEIGH) { error->one(FLERR, "There are too many neighbors for calculating normals"); } @@ -269,7 +311,8 @@ void PairILPGrapheneHBNOpt::eval() dproddni[2] = 0.0; double norm[3], dnormdxi[3][3], dnormdxk[MAX_NNEIGH][3][3]; - calc_normal(i, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); + + calc_atom_normal(i, itype, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); for (jj = 0; jj < jnum_inter; jj++) { j = jlist_inter[jj]; @@ -298,7 +341,7 @@ void PairILPGrapheneHBNOpt::eval() Tap = 1.0; dTap = 0.0; } - if (VARIANT != SAIP_METAL || !special_type[itype]) { + if (VARIANT != SAIP_METAL || special_type[itype] != SAIP_BNCH) { // Calculate the transverse distance prodnorm1 = norm[0] * delx + norm[1] * dely + norm[2] * delz; rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij @@ -310,7 +353,7 @@ void PairILPGrapheneHBNOpt::eval() frho1 = exp1 * p.C; Erep = 0.5 * p.epsilon + frho1; - if (VARIANT == SAIP_METAL && special_type[jtype]) { Erep += 0.5 * p.epsilon + p.C; } + if (VARIANT == SAIP_METAL && special_type[jtype] == SAIP_BNCH) { Erep += 0.5 * p.epsilon + p.C; } Vilp = exp0 * Erep; // derivatives @@ -428,6 +471,18 @@ inline void deriv_normal(double dndr[3][3], double *del, double *n, double rnnor dndr[1][2] = (del[1] * n[0] * n[1] + del[0] * (n[0] * n[0] + n[2] * n[2])) * rnnorm; dndr[2][2] = (del[1] * n[0] * n[2] - del[0] * n[1] * n[2]) * rnnorm; } +inline void deriv_hat(double dnhatdn[3][3], double *n, double rnnorm, double factor){ + double cfactor = rnnorm * factor; + dnhatdn[0][0] = (n[1]*n[1]+n[2]*n[2])*cfactor; + dnhatdn[1][0] = -n[1]*n[0]*cfactor; + dnhatdn[2][0] = -n[2]*n[0]*cfactor; + dnhatdn[0][1] = -n[0]*n[1]*cfactor; + dnhatdn[1][1] = (n[0]*n[0]+n[2]*n[2])*cfactor; + dnhatdn[2][1] = -n[2]*n[1]*cfactor; + dnhatdn[0][2] = -n[0]*n[2]*cfactor; + dnhatdn[1][2] = -n[1]*n[2]*cfactor; + dnhatdn[2][2] = (n[0]*n[0]+n[1]*n[1])*cfactor; +} inline double normalize_factor(double *n) { double nnorm = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); @@ -441,7 +496,7 @@ inline double normalize_factor(double *n) Yet another normal calculation method for simpiler code. */ template -void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, double *n, +void PairILPGrapheneHBNOpt::calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *n, double (*dnormdri)[3], double (*dnormdrk)[3][3]) { double **x = atom->x; @@ -475,6 +530,32 @@ void PairILPGrapheneHBNOpt::calc_normal(int i, int *ILP_neigh, int nneigh, doubl vet[jj][2] = x[j][2] - x[i][2]; } + //specialize for AIP_WATER_2DM for hydrogen has special normal vector rule + if (variant == AIP_WATER_2DM && special_type[itype] == WATER) { + if (nneigh == 1){ + n[0] = vet[0][0]; + n[1] = vet[0][1]; + n[2] = vet[0][2]; + + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 1.0); + + } else if (nneigh == 2){ + n[0] = (vet[0][0] + vet[1][0])*0.5; + n[1] = (vet[0][1] + vet[1][1])*0.5; + n[2] = (vet[0][2] + vet[1][2])*0.5; + double rnnorm = normalize_factor(n); + + deriv_hat(dnormdri, n, rnnorm, -1.0); + deriv_hat(dnormdrk[0], n, rnnorm, 0.5); + deriv_hat(dnormdrk[1], n, rnnorm, 0.5); + } else { + error->one(FLERR, "malformed water"); + } + return; + } if (nneigh <= 1) { n[0] = 0.0; n[1] = 0.0; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h index 0721014e00..01b66bb2fa 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.h +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -35,7 +35,7 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { protected: void update_internal_list(); template - void calc_normal(int i, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], + void calc_atom_normal(int i, int itype, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], double (*dnormdrk)[3][3]); template void eval(); @@ -44,6 +44,14 @@ class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { int *special_type; int *num_intra, *num_inter, *num_vdw; int inum_max, jnum_max; + + enum special_type_const { + NOT_SPECIAL = 0, + TMD_METAL, + SAIP_BNCH, + WATER, + }; + }; } // namespace LAMMPS_NS diff --git a/src/OPT/pair_ilp_tmd_opt.cpp b/src/OPT/pair_ilp_tmd_opt.cpp index 834f2a0c9f..3fa95b7e10 100644 --- a/src/OPT/pair_ilp_tmd_opt.cpp +++ b/src/OPT/pair_ilp_tmd_opt.cpp @@ -23,7 +23,7 @@ e-mail: qdgaoping at gmail dot com Optimizations are described in: - Gao, Ping and Duan, Xiaohui, et al: + Gao, Ping and Duan, Xiaohui, et al.: LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous Many-Core Processors DOI: 10.1145/3458817.3476137 diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index c8112ca24d..394ce69d22 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -143,7 +143,8 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : FixQEq::~FixQEq() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); memory->destroy(s_hist); memory->destroy(t_hist); diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 784c163f70..83442ecb25 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -131,6 +131,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; rxnID = 0; + cuff = 1; maxnconstraints = 0; narrhenius = 0; status = PROCEED; @@ -250,8 +251,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(ghostly_rxn_count,nreacts,"bond/react:ghostly_rxn_count"); memory->create(reaction_count_total,nreacts,"bond/react:reaction_count_total"); + rescale_charges_anyflag = 0; for (int i = 0; i < nreacts; i++) { - fraction[i] = 1; + fraction[i] = 1.0; seed[i] = 12345; max_rxn[i] = INT_MAX; for (int j = 0; j < 3; j++) @@ -261,7 +263,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : rescale_charges_flag[i] = 0; create_atoms_flag[i] = 0; modify_create_fragid[i] = -1; - overlapsq[i] = 0; + overlapsq[i] = 0.0; molecule_keyword[i] = OFF; nconstraints[i] = 0; // set default limit duration to 60 timesteps @@ -388,8 +390,16 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'rescale_charges' has too few arguments"); if (strcmp(arg[iarg+1],"no") == 0) rescale_charges_flag[rxn] = 0; //default - else if (strcmp(arg[iarg+1],"yes") == 0) rescale_charges_flag[rxn] = 1; - else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); + else if (strcmp(arg[iarg+1],"yes") == 0) { + if (!atom->q_flag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without atomic charges enabled"); + twomol = atom->molecules[reacted_mol[rxn]]; + if (!twomol->qflag) error->all(FLERR,"Illegal fix bond/react command: cannot use " + "'rescale_charges' without Charges section in post-reaction template"); + rescale_charges_flag[rxn] = 1; // overloaded below to also indicate number of atoms to update + rescale_charges_anyflag = 1; + cuff = 2; // index shift for extra values carried around by mega_gloves + } else error->one(FLERR,"Bond/react: Illegal option for 'rescale_charges' keyword"); iarg += 2; } else if (strcmp(arg[iarg],"molecule") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " @@ -442,8 +452,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(delete_atoms,max_natoms,nreacts,"bond/react:delete_atoms"); memory->create(create_atoms,max_natoms,nreacts,"bond/react:create_atoms"); memory->create(chiral_atoms,max_natoms,6,nreacts,"bond/react:chiral_atoms"); + memory->create(mol_total_charge,nreacts,"bond/react:mol_total_charge"); for (int j = 0; j < nreacts; j++) { + mol_total_charge[j] = 0.0; for (int i = 0; i < max_natoms; i++) { edge[i][j] = 0; custom_charges[i][j] = 1; // update all partial charges by default @@ -483,6 +495,21 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (custom_charges_fragid[i] >= 0) CustomCharges(custom_charges_fragid[i],i); } + // charge rescaling values must be calculated after calling CustomCharges + for (int myrxn = 0; myrxn < nreacts; myrxn++) { + if (rescale_charges_flag[myrxn]) { + rescale_charges_flag[myrxn] = 0; // will now store number of updated atoms + twomol = atom->molecules[reacted_mol[myrxn]]; + for (int j = 0; j < twomol->natoms; j++) { + int jj = equivalences[j][1][myrxn]-1; + if (custom_charges[jj][myrxn] == 1 && delete_atoms[jj][myrxn] == 0) { + mol_total_charge[myrxn] += twomol->q[j]; + rescale_charges_flag[myrxn]++; + } + } + } + } + // get the names of per-atom variables needed by 'rxn' functions of custom constraint customvarnames(); @@ -605,6 +632,7 @@ FixBondReact::~FixBondReact() memory->destroy(delete_atoms); memory->destroy(create_atoms); memory->destroy(chiral_atoms); + memory->destroy(mol_total_charge); if (vvec != nullptr) memory->destroy(vvec); memory->destroy(rxn_name); @@ -1282,11 +1310,11 @@ void FixBondReact::superimpose_algorithm() memory->create(restore_pt,MAXGUESS,4,"bond/react:restore_pt"); memory->create(pioneers,max_natoms,"bond/react:pioneers"); memory->create(restore,max_natoms,MAXGUESS*4,"bond/react:restore"); - memory->create(my_mega_glove,max_natoms+1,allnattempt,"bond/react:local_mega_glove"); + memory->create(my_mega_glove,max_natoms+cuff,allnattempt,"bond/react:my_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < allnattempt; j++) - my_mega_glove[i][j] = 0; + my_mega_glove[i][j] = 0.0; attempted_rxn = 1; @@ -1336,9 +1364,10 @@ void FixBondReact::superimpose_algorithm() status = REJECT; } else { status = ACCEPT; - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -1384,9 +1413,10 @@ void FixBondReact::superimpose_algorithm() if (fraction[rxnID] < 1.0 && random[rxnID]->uniform() >= fraction[rxnID]) status = REJECT; else { - my_mega_glove[0][my_num_mega] = rxnID; + my_mega_glove[0][my_num_mega] = (double) rxnID; + if (rescale_charges_flag[rxnID]) my_mega_glove[1][my_num_mega] = get_totalcharge(); for (int i = 0; i < onemol->natoms; i++) { - my_mega_glove[i+1][my_num_mega] = glove[i][1]; + my_mega_glove[i+cuff][my_num_mega] = (double) glove[i][1]; } my_num_mega++; } @@ -1405,13 +1435,13 @@ void FixBondReact::superimpose_algorithm() global_megasize = 0; - memory->create(local_mega_glove,max_natoms+1,my_num_mega,"bond/react:local_mega_glove"); - memory->create(ghostly_mega_glove,max_natoms+1,my_num_mega,"bond/react:ghostly_mega_glove"); + memory->create(local_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:local_mega_glove"); + memory->create(ghostly_mega_glove,max_natoms+cuff,my_num_mega,"bond/react:ghostly_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < my_num_mega; j++) { - local_mega_glove[i][j] = 0; - ghostly_mega_glove[i][j] = 0; + local_mega_glove[i][j] = 0.0; + ghostly_mega_glove[i][j] = 0.0; } } @@ -2186,6 +2216,24 @@ double FixBondReact::get_temperature(tagint **myglove, int row_offset, int col) return t; } +/* ---------------------------------------------------------------------- +compute sum of partial charges in rxn site, for updated atoms +note: currently uses global rxnID and onemol variables +------------------------------------------------------------------------- */ + +double FixBondReact::get_totalcharge() +{ + int j,jj,ilocal; + double *q = atom->q; + double sim_total_charge = 0.0; + for (j = 0; j < onemol->natoms; j++) { + jj = equivalences[j][1][rxnID]-1; + if (custom_charges[jj][rxnID] == 1) + sim_total_charge += q[atom->map(glove[jj][1])]; + } + return sim_total_charge; +} + /* ---------------------------------------------------------------------- get per-atom variable names used by custom constraint ------------------------------------------------------------------------- */ @@ -2673,18 +2721,18 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) dedup_size = global_megasize; } - tagint **dedup_glove; - memory->create(dedup_glove,max_natoms+1,dedup_size,"bond/react:dedup_glove"); + double **dedup_glove; + memory->create(dedup_glove,max_natoms+cuff,dedup_size,"bond/react:dedup_glove"); if (dedup_mode == LOCAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = my_mega_glove[j][i]; } } } else if (dedup_mode == GLOBAL) { for (int i = 0; i < dedup_size; i++) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = global_mega_glove[j][i]; } } @@ -2700,16 +2748,16 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) // let's randomly mix up our reaction instances first // then we can feel okay about ignoring ones we've already deleted (or accepted) // based off std::shuffle - int *temp_rxn = new int[max_natoms+1]; + double *temp_rxn = new double[max_natoms+cuff]; for (int i = dedup_size-1; i > 0; --i) { //dedup_size // choose random entry to swap current one with int k = floor(random[0]->uniform()*(i+1)); // swap entries - for (int j = 0; j < max_natoms+1; j++) + for (int j = 0; j < max_natoms+cuff; j++) temp_rxn[j] = dedup_glove[j][i]; - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { dedup_glove[j][i] = dedup_glove[j][k]; dedup_glove[j][k] = temp_rxn[j]; } @@ -2721,13 +2769,13 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int myrxnid1 = dedup_glove[0][i]; onemol = atom->molecules[unreacted_mol[myrxnid1]]; for (int j = 0; j < onemol->natoms; j++) { - int check1 = dedup_glove[j+1][i]; + int check1 = dedup_glove[j+cuff][i]; for (int ii = i + 1; ii < dedup_size; ii++) { if (dedup_mask[ii] == 0) { int myrxnid2 = dedup_glove[0][ii]; twomol = atom->molecules[unreacted_mol[myrxnid2]]; for (int jj = 0; jj < twomol->natoms; jj++) { - int check2 = dedup_glove[jj+1][ii]; + int check2 = dedup_glove[jj+cuff][ii]; if (check2 == check1) { dedup_mask[ii] = 1; break; @@ -2745,7 +2793,7 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int my_new_megasize = 0; for (int i = 0; i < my_num_mega; i++) { if (dedup_mask[i] == 0) { - for (int j = 0; j < max_natoms+1; j++) { + for (int j = 0; j < max_natoms+cuff; j++) { my_mega_glove[j][my_new_megasize] = dedup_glove[j][i]; } my_new_megasize++; @@ -2760,8 +2808,8 @@ void FixBondReact::dedup_mega_gloves(int dedup_mode) int new_global_megasize = 0; for (int i = 0; i < global_megasize; i++) { if (dedup_mask[i] == 0) { - ghostly_rxn_count[dedup_glove[0][i]]++; - for (int j = 0; j < max_natoms + 1; j++) { + ghostly_rxn_count[(int) dedup_glove[0][i]]++; + for (int j = 0; j < max_natoms + cuff; j++) { global_mega_glove[j][new_global_megasize] = dedup_glove[j][i]; } new_global_megasize++; @@ -2830,7 +2878,7 @@ void FixBondReact::glove_ghostcheck() local_rxn_count[i] = 0; for (int i = 0; i < my_num_mega; i++) { - rxnID = my_mega_glove[0][i]; + rxnID = (int) my_mega_glove[0][i]; onemol = atom->molecules[unreacted_mol[rxnID]]; int ghostly = 0; #if !defined(MPI_STUBS) @@ -2839,7 +2887,7 @@ void FixBondReact::glove_ghostcheck() ghostly = 1; } else { for (int j = 0; j < onemol->natoms; j++) { - int ilocal = atom->map(my_mega_glove[j+1][i]); + int ilocal = atom->map((tagint) my_mega_glove[j+cuff][i]); if (ilocal >= atom->nlocal || localsendlist[ilocal] == 1) { ghostly = 1; break; @@ -2852,15 +2900,13 @@ void FixBondReact::glove_ghostcheck() #endif if (ghostly == 1) { - ghostly_mega_glove[0][ghostly_num_mega] = rxnID; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { ghostly_mega_glove[j][ghostly_num_mega] = my_mega_glove[j][i]; } ghostly_num_mega++; } else { - local_mega_glove[0][local_num_mega] = rxnID; local_rxn_count[rxnID]++; - for (int j = 0; j < onemol->natoms+1; j++) { + for (int j = 0; j < onemol->natoms+cuff; j++) { local_mega_glove[j][local_num_mega] = my_mega_glove[j][i]; } local_num_mega++; @@ -2899,23 +2945,23 @@ void FixBondReact::ghost_glovecast() } MPI_Allgather(&start, 1, MPI_INT, allstarts, 1, MPI_INT, world); MPI_Datatype columnunsized, column; - int sizes[2] = {max_natoms+1, global_megasize}; - int subsizes[2] = {max_natoms+1, 1}; + int sizes[2] = {max_natoms+cuff, global_megasize}; + int subsizes[2] = {max_natoms+cuff, 1}; int starts[2] = {0,0}; MPI_Type_create_subarray (2, sizes, subsizes, starts, MPI_ORDER_C, - MPI_LMP_TAGINT, &columnunsized); - MPI_Type_create_resized (columnunsized, 0, sizeof(tagint), &column); + MPI_DOUBLE, &columnunsized); + MPI_Type_create_resized (columnunsized, 0, sizeof(double), &column); MPI_Type_commit(&column); memory->destroy(global_mega_glove); - memory->create(global_mega_glove,max_natoms+1,global_megasize,"bond/react:global_mega_glove"); + memory->create(global_mega_glove,max_natoms+cuff,global_megasize,"bond/react:global_mega_glove"); - for (int i = 0; i < max_natoms+1; i++) + for (int i = 0; i < max_natoms+cuff; i++) for (int j = 0; j < global_megasize; j++) global_mega_glove[i][j] = 0; if (ghostly_num_mega > 0) { - for (int i = 0; i < max_natoms+1; i++) { + for (int i = 0; i < max_natoms+cuff; i++) { for (int j = 0; j < ghostly_num_mega; j++) { global_mega_glove[i][j+start] = ghostly_mega_glove[i][j]; } @@ -3006,7 +3052,12 @@ void FixBondReact::update_everything() int update_num_mega; tagint **update_mega_glove; - memory->create(update_mega_glove,max_natoms+1,MAX(local_num_mega,global_megasize),"bond/react:update_mega_glove"); + // for now, keeping rxnID in update_mega_glove, but not rest of cuff in update_mega_glove + int maxmega = MAX(local_num_mega,global_megasize); + memory->create(update_mega_glove,max_natoms+1,maxmega,"bond/react:update_mega_glove"); + + double *sim_total_charges; + if (rescale_charges_anyflag) memory->create(sim_total_charges,maxmega,"bond/react:sim_total_charges"); for (int pass = 0; pass < 2; pass++) { update_num_mega = 0; @@ -3014,15 +3065,20 @@ void FixBondReact::update_everything() for (int i = 0; i < nreacts; i++) iskip[i] = 0; if (pass == 0) { for (int i = 0; i < local_num_mega; i++) { - rxnID = local_mega_glove[0][i]; + rxnID = (int) local_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nlocalskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) local_mega_glove[j+cuff][i]; + // atoms inserted here for serial MPI_STUBS build only if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(local_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3030,23 +3086,27 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = local_mega_glove[j][i]; + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i]; update_num_mega++; } } else if (pass == 1) { for (int i = 0; i < global_megasize; i++) { - rxnID = global_mega_glove[0][i]; + rxnID = (int) global_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nghostlyskips[rxnID]) continue; + // this will be overwritten if reaction skipped by create_atoms below + update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i]; + for (int j = 0; j < max_natoms; j++) + update_mega_glove[j+1][update_num_mega] = (tagint) global_mega_glove[j+cuff][i]; + // we can insert atoms here, now that reactions are finalized // can't do it any earlier, due to skipped reactions (max_rxn) // for MPI build, reactions that create atoms are always treated as 'global' if (create_atoms_flag[rxnID] == 1) { onemol = atom->molecules[unreacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]]; - if (insert_atoms(global_mega_glove,i)) { + if (insert_atoms(update_mega_glove,update_num_mega)) { inserted_atoms_flag = 1; } else { // create aborted reaction_count_total[rxnID]--; @@ -3054,8 +3114,7 @@ void FixBondReact::update_everything() } } - for (int j = 0; j < max_natoms+1; j++) - update_mega_glove[j][update_num_mega] = global_mega_glove[j][i]; + if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i]; update_num_mega++; } } @@ -3090,38 +3149,18 @@ void FixBondReact::update_everything() } } - // get charge rescale delta - double charge_rescale_addend = 0; - if (rescale_charges_flag[rxnID] == 1) { - double sim_total_charge = 0; - double mol_total_charge = 0; - int n_custom_charge = 0; - for (int i = 0; i < update_num_mega; i++) { - rxnID = update_mega_glove[0][i]; - twomol = atom->molecules[reacted_mol[rxnID]]; - for (int j = 0; j < twomol->natoms; j++) { - int jj = equivalences[j][1][rxnID]-1; - if (atom->map(update_mega_glove[jj+1][i]) >= 0 && - atom->map(update_mega_glove[jj+1][i]) < nlocal) { - if (landlocked_atoms[j][rxnID] == 1) - type[atom->map(update_mega_glove[jj+1][i])] = twomol->type[j]; - if (twomol->qflag && atom->q_flag && custom_charges[jj][rxnID] == 1) { - double *q = atom->q; - sim_total_charge += q[atom->map(update_mega_glove[jj+1][i])]; - mol_total_charge += twomol->q[j]; - n_custom_charge++; - } - } - } - } - charge_rescale_addend = (sim_total_charge-mol_total_charge)/n_custom_charge; - } - // update charges and types of landlocked atoms // also keep track of 'stabilization' groups here + int n_custom_charge; + double charge_rescale_addend; for (int i = 0; i < update_num_mega; i++) { + charge_rescale_addend = 0; rxnID = update_mega_glove[0][i]; twomol = atom->molecules[reacted_mol[rxnID]]; + if (rescale_charges_flag[rxnID]) { + n_custom_charge = rescale_charges_flag[rxnID]; + charge_rescale_addend = (sim_total_charges[i]-mol_total_charge[rxnID])/n_custom_charge; + } for (int j = 0; j < twomol->natoms; j++) { int jj = equivalences[j][1][rxnID]-1; int ilocal = atom->map(update_mega_glove[jj+1][i]); @@ -3555,6 +3594,7 @@ void FixBondReact::update_everything() } memory->destroy(update_mega_glove); + if (rescale_charges_anyflag) memory->destroy(sim_total_charges); // delete atoms. taken from fix_evaporate. but don't think it needs to be in pre_exchange // loop in reverse order to avoid copying marked atoms @@ -3643,7 +3683,7 @@ void FixBondReact::update_everything() insert created atoms ------------------------------------------------------------------------- */ -int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) +int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate) { // inserting atoms based off fix_deposit->pre_exchange int flag; @@ -3692,14 +3732,15 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) n2superpose++; } - int ifit = atom->map(my_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc + int ifit = atom->map(my_update_mega_glove[ibonding[rxnID]+1][iupdate]); // use this local ID to find fitting proc Superpose3D superposer(n2superpose); int fitroot = 0; if (ifit >= 0 && ifit < atom->nlocal) { fitroot = comm->me; // get 'temperatere' averaged over site, used for created atoms' vels - t = get_temperature(my_mega_glove,1,iupdate); + // note: row_offset for my_update_mega_glove is unity, not 'cuff' + t = get_temperature(my_update_mega_glove,1,iupdate); double **xfrozen; // coordinates for the "frozen" target molecule double **xmobile; // coordinates for the "mobile" molecule @@ -3713,12 +3754,12 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) if (!twomol->fragmentmask[modify_create_fragid[rxnID]][j]) continue; int ipre = equivalences[j][1][rxnID]-1; // equiv pre-reaction template index if (!create_atoms[j][rxnID] && !delete_atoms[ipre][rxnID]) { - if (atom->map(my_mega_glove[ipre+1][iupdate]) < 0) { + if (atom->map(my_update_mega_glove[ipre+1][iupdate]) < 0) { error->warning(FLERR," eligible atoms skipped for created-atoms fit on rank {}\n", comm->me); continue; } - iatom = atom->map(my_mega_glove[ipre+1][iupdate]); + iatom = atom->map(my_update_mega_glove[ipre+1][iupdate]); if (iref == -1) iref = iatom; iatom = domain->closest_image(iref,iatom); for (int k = 0; k < 3; k++) { @@ -3838,7 +3879,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) atom->tag[n] = maxtag_all + add_count; // locally update mega_glove - my_mega_glove[preID][iupdate] = atom->tag[n]; + my_update_mega_glove[preID][iupdate] = atom->tag[n]; if (atom->molecule_flag) { if (twomol->moleculeflag) { @@ -3866,7 +3907,7 @@ int FixBondReact::insert_atoms(tagint **my_mega_glove, int iupdate) } // globally update mega_glove and equivalences MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world); - MPI_Bcast(&my_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); + MPI_Bcast(&my_update_mega_glove[preID][iupdate],1,MPI_LMP_TAGINT,root,world); equivalences[m][0][rxnID] = m+1; equivalences[m][1][rxnID] = preID; reverse_equiv[preID-1][0][rxnID] = preID; diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 66a5e4d6a0..534261e11d 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -71,7 +71,9 @@ class FixBondReact : public Fix { int **store_rxn_count; int *stabilize_steps_flag; int *custom_charges_fragid; - int *rescale_charges_flag; + int *rescale_charges_flag; // if nonzero, indicates number of atoms whose charges are updated + int rescale_charges_anyflag; // indicates if any reactions do charge rescaling + double *mol_total_charge; // sum of charges of post-reaction atoms whose charges are updated int *create_atoms_flag; int *modify_create_fragid; double *overlapsq; @@ -156,10 +158,12 @@ class FixBondReact : public Fix { int lcl_inst; // reaction instance tagint **glove; // 1st colmn: pre-reacted template, 2nd colmn: global IDs // for all mega_gloves: first row is the ID of bond/react - tagint **my_mega_glove; // local + ghostly reaction instances - tagint **local_mega_glove; // consolidation of local reaction instances - tagint **ghostly_mega_glove; // consolidation of nonlocal reaction instances - tagint **global_mega_glove; // consolidation (inter-processor) of gloves + // 'cuff' leaves room for additional values carried around + int cuff; // default = 1, w/ rescale_charges_flag = 2 + double **my_mega_glove; // local + ghostly reaction instances + double **local_mega_glove; // consolidation of local reaction instances + double **ghostly_mega_glove; // consolidation of nonlocal reaction instances + double **global_mega_glove; // consolidation (inter-processor) of gloves // containing nonlocal atoms int *localsendlist; // indicates ghosts of other procs @@ -191,6 +195,7 @@ class FixBondReact : public Fix { int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); + double get_totalcharge(); void customvarnames(); // get per-atom variables names used by custom constraint void get_customvars(); // evaluate local values for variables names used by custom constraint double custom_constraint(const std::string &); // evaulate expression for custom constraint diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 704b43e642..554b911151 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -404,9 +404,15 @@ void FixQEqReaxFF::init() efield->init(); if (strcmp(update->unit_style,"real") != 0) error->all(FLERR,"Must use unit_style real with fix {} and external fields", style); - if (efield->varflag != FixEfield::CONSTANT) - error->all(FLERR,"Cannot (yet) use fix {} with variable efield", style); + if (efield->varflag == FixEfield::ATOM && efield->pstyle != FixEfield::ATOM) + error->all(FLERR,"Atom-style external electric field requires atom-style " + "potential variable when used with fix {}", style); + if (((efield->xstyle != FixEfield::CONSTANT) && domain->xperiodic) || + ((efield->ystyle != FixEfield::CONSTANT) && domain->yperiodic) || + ((efield->zstyle != FixEfield::CONSTANT) && domain->zperiodic)) + error->all(FLERR,"Must not have electric field component in direction of periodic " + "boundary when using charge equilibration with ReaxFF."); if (((fabs(efield->ex) > SMALL) && domain->xperiodic) || ((fabs(efield->ey) > SMALL) && domain->yperiodic) || ((fabs(efield->ez) > SMALL) && domain->zperiodic)) @@ -1101,26 +1107,36 @@ void FixQEqReaxFF::get_chi_field() // efield energy is in real units of kcal/mol/angstrom, need to convert to eV - const double factor = -1.0/force->qe2f; + const double qe2f = force->qe2f; + const double factor = -1.0/qe2f; + + + if (efield->varflag != FixEfield::CONSTANT) + efield->update_efield_variables(); - // currently we only support constant efield // atom selection is for the group of fix efield - if (efield->varflag == FixEfield::CONSTANT) { - double unwrap[3]; - const double fx = efield->ex; - const double fy = efield->ey; - const double fz = efield->ez; - const int efgroupbit = efield->groupbit; + double unwrap[3]; + const double ex = efield->ex; + const double ey = efield->ey; + const double ez = efield->ez; + const int efgroupbit = efield->groupbit; // charge interactions // force = qE, potential energy = F dot x in unwrapped coords - + if (efield->varflag != FixEfield::ATOM) { for (int i = 0; i < nlocal; i++) { if (mask[i] & efgroupbit) { if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; domain->unmap(x[i],image[i],unwrap); - chi_field[i] = factor*(fx*unwrap[0] + fy*unwrap[1] + fz*unwrap[2]); + chi_field[i] = factor*(ex*unwrap[0] + ey*unwrap[1] + ez*unwrap[2]); + } + } + } else { // must use atom-style potential from FixEfield + for (int i = 0; i < nlocal; i++) { + if (mask[i] & efgroupbit) { + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + chi_field[i] = -efield->efield[i][3]; } } } diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 29441cd4b3..8fa06cafb3 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -28,11 +28,13 @@ #include "fix_ave_atom.h" #include "force.h" #include "group.h" +#include "input.h" #include "memory.h" #include "modify.h" #include "neigh_list.h" #include "neighbor.h" #include "update.h" +#include "variable.h" #include "pair_reaxff.h" #include "reaxff_defs.h" @@ -46,15 +48,16 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_reaxff_species_delete[] = - "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" - "@Article{Gissinger23,\n" - " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. Odegard, E. J. Siochi, K. E. Wise},\n" - " title = {Predicting char yield of high-temperature resins},\n" - " journal = {Carbon},\n" - " year = 2023,\n" - " volume = 202,\n" - " pages = {336-347}\n" - "}\n\n"; + "fix reaxff/species, 'delete' keyword: https://doi.org/10.1016/j.carbon.2022.11.002\n\n" + "@Article{Gissinger23,\n" + " author = {J. R. Gissinger, S. R. Zavada, J. G. Smith, J. Kemppainen, I. Gallegos, G. M. " + "Odegard, E. J. Siochi, K. E. Wise},\n" + " title = {Predicting char yield of high-temperature resins},\n" + " journal = {Carbon},\n" + " year = 2023,\n" + " volume = 202,\n" + " pages = {336-347}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -146,13 +149,11 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : setupflag = 0; // set default bond order cutoff - int itype, jtype; - double bo_cut; - bg_cut = 0.30; + double bo_cut = 0.30; int np1 = ntypes + 1; memory->create(BOCut, np1, np1, "reaxff/species:BOCut"); for (int i = 1; i < np1; i++) - for (int j = 1; j < np1; j++) BOCut[i][j] = bg_cut; + for (int j = 1; j < np1; j++) BOCut[i][j] = bo_cut; // optional args eletype = nullptr; @@ -170,16 +171,19 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : // set BO cutoff if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species cutoff", error); - itype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - jtype = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[iarg + 1], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[iarg + 2], 1, atom->ntypes, jlo, jhi, error); bo_cut = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - if ((itype <= 0) || (jtype <= 0) || (itype > ntypes) || (jtype > ntypes)) - error->all(FLERR, "Fix reaxff/species cutoff atom type(s) out of range"); if ((bo_cut > 1.0) || (bo_cut < 0.0)) error->all(FLERR, "Fix reaxff/species invalid cutoff value: {}", bo_cut); - BOCut[itype][jtype] = bo_cut; - BOCut[jtype][itype] = bo_cut; + for (int i = ilo; i <= ihi; ++i) { + for (int j = MAX(jlo, i); j <= jhi; ++j) { + BOCut[i][j] = bo_cut; + BOCut[j][i] = bo_cut; + } + } iarg += 4; // modify element type names @@ -238,9 +242,21 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Unknown fix reaxff/species delete option: {}", arg[iarg]); // rate limit when deleting molecules } else if (strcmp(arg[iarg], "delete_rate_limit") == 0) { - if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); - delete_Nlimit = utils::numeric(FLERR, arg[iarg+1], false, lmp); - delete_Nsteps = utils::numeric(FLERR, arg[iarg+2], false, lmp); + if (iarg + 3 > narg) + utils::missing_cmd_args(FLERR, "fix reaxff/species delete_rate_limit", error); + delete_Nlimit_varid = -1; + if (strncmp(arg[iarg + 1], "v_", 2) == 0) { + delete_Nlimit_varname = &arg[iarg + 1][2]; + delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); + if (delete_Nlimit_varid < 0) + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); + if (!input->variable->equalstyle(delete_Nlimit_varid)) + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); + } else + delete_Nlimit = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + delete_Nsteps = utils::numeric(FLERR, arg[iarg + 2], false, lmp); iarg += 3; // position of molecules } else if (strcmp(arg[iarg], "position") == 0) { @@ -280,12 +296,11 @@ FixReaxFFSpecies::FixReaxFFSpecies(LAMMPS *lmp, int narg, char **arg) : if (delflag && specieslistflag && masslimitflag) error->all(FLERR, "Incompatible combination fix reaxff/species command options"); - if (delete_Nlimit > 0) { + if (delete_Nsteps > 0) { if (lmp->citeme) lmp->citeme->add(cite_reaxff_species_delete); - memory->create(delete_Tcount,delete_Nsteps,"reaxff/species:delete_Tcount"); + memory->create(delete_Tcount, delete_Nsteps, "reaxff/species:delete_Tcount"); - for (int i = 0; i < delete_Nsteps; i++) - delete_Tcount[i] = -1; + for (int i = 0; i < delete_Nsteps; i++) delete_Tcount[i] = -1; delete_Tcount[0] = 0; } @@ -378,6 +393,17 @@ void FixReaxFFSpecies::init() f_SPECBOND = dynamic_cast(modify->add_fix(fixcmd)); setupflag = 1; } + + // check for valid variable name for delete Nlimit keyword + if (delete_Nsteps > 0) { + delete_Nlimit_varid = input->variable->find(delete_Nlimit_varname.c_str()); + if (delete_Nlimit_varid < 0) + error->all(FLERR, "Fix reaxff/species: Variable name {} does not exist", + delete_Nlimit_varname); + if (!input->variable->equalstyle(delete_Nlimit_varid)) + error->all(FLERR, "Fix reaxff/species: Variable {} is not equal-style", + delete_Nlimit_varname); + } } /* ---------------------------------------------------------------------- */ @@ -407,9 +433,8 @@ void FixReaxFFSpecies::Output_ReaxFF_Bonds(bigint ntimestep, FILE * /*fp*/) if (ntimestep != nvalid) { // push back delete_Tcount on every step - if (delete_Nlimit > 0) - for (int i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + if (delete_Nsteps > 0) + for (int i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; return; } @@ -713,31 +738,31 @@ void FixReaxFFSpecies::WriteFormulas(int Nmole, int Nspec) int i, j, itemp; bigint ntimestep = update->ntimestep; - fprintf(fp, "# Timestep No_Moles No_Specs "); + fprintf(fp, "# Timestep No_Moles No_Specs"); Nmoltype = 0; for (i = 0; i < Nspec; i++) nd[i] = CheckExistence(i, ntypes); for (i = 0; i < Nmoltype; i++) { + std::string molname; for (j = 0; j < ntypes; j++) { itemp = MolType[ntypes * i + j]; if (itemp != 0) { if (eletype) - fprintf(fp, "%s", eletype[j]); + molname += eletype[j]; else - fprintf(fp, "%c", ele[j]); - if (itemp != 1) fprintf(fp, "%d", itemp); + molname += ele[j]; + if (itemp != 1) molname += std::to_string(itemp); } } - fputs("\t", fp); + fmt::print(fp, " {:>11}", molname); } fputs("\n", fp); - fmt::print(fp, "{} {:11} {:11}\t", ntimestep, Nmole, Nspec); - - for (i = 0; i < Nmoltype; i++) fprintf(fp, " %d\t", NMol[i]); - fprintf(fp, "\n"); + fmt::print(fp, "{:>11} {:>11} {:>11}", ntimestep, Nmole, Nspec); + for (i = 0; i < Nmoltype; i++) fmt::print(fp, " {:>11}", NMol[i]); + fputs("\n", fp); } /* ---------------------------------------------------------------------- */ @@ -864,9 +889,11 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) { int ndeletions; int headroom = -1; - if (delete_Nlimit > 0) { - if (delete_Tcount[delete_Nsteps-1] == -1) return; - ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps-1]; + if (delete_Nsteps > 0) { + if (delete_Tcount[delete_Nsteps - 1] == -1) return; + ndeletions = delete_Tcount[0] - delete_Tcount[delete_Nsteps - 1]; + if (delete_Nlimit_varid > -1) + delete_Nlimit = input->variable->compute_equal(delete_Nlimit_varid); headroom = MAX(0, delete_Nlimit - ndeletions); if (headroom == 0) return; } @@ -904,13 +931,11 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) std::random_device rnd; std::minstd_rand park_rng(rnd()); int *molrange; - memory->create(molrange,Nmole,"reaxff/species:molrange"); - for (m = 0; m < Nmole; m++) - molrange[m] = m + 1; - if (delete_Nlimit > 0) { + memory->create(molrange, Nmole, "reaxff/species:molrange"); + for (m = 0; m < Nmole; m++) molrange[m] = m + 1; + if (delete_Nsteps > 0) { // shuffle index when using rate_limit, in case order is biased - if (comm->me == 0) - std::shuffle(&molrange[0],&molrange[Nmole], park_rng); + if (comm->me == 0) std::shuffle(&molrange[0], &molrange[Nmole], park_rng); MPI_Bcast(&molrange[0], Nmole, MPI_INT, 0, world); } @@ -1039,11 +1064,9 @@ void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) } } - // push back delete_Tcount on every step - if (delete_Nlimit > 0) { - for (i = delete_Nsteps-1; i > 0; i--) - delete_Tcount[i] = delete_Tcount[i-1]; + if (delete_Nsteps > 0) { + for (i = delete_Nsteps - 1; i > 0; i--) delete_Tcount[i] = delete_Tcount[i - 1]; delete_Tcount[0] += this_delete_Tcount; } diff --git a/src/REAXFF/fix_reaxff_species.h b/src/REAXFF/fix_reaxff_species.h index 329e17145b..f711cdeb11 100644 --- a/src/REAXFF/fix_reaxff_species.h +++ b/src/REAXFF/fix_reaxff_species.h @@ -51,8 +51,6 @@ class FixReaxFFSpecies : public Fix { int *Mol2Spec; double *clusterID; AtomCoord *x0; - - double bg_cut; double **BOCut; std::vector del_species; @@ -60,7 +58,9 @@ class FixReaxFFSpecies : public Fix { FILE *fp, *pos, *fdel; int eleflag, posflag, multipos, padflag, setupflag; int delflag, specieslistflag, masslimitflag; - int delete_Nlimit, delete_Nsteps, *delete_Tcount; + int delete_Nlimit, delete_Nlimit_varid; + std::string delete_Nlimit_varname; + int delete_Nsteps, *delete_Tcount; double massmin, massmax; int singlepos_opened, multipos_opened, del_opened; char *ele, **eletype, *filepos, *filedel; diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp new file mode 100644 index 0000000000..75280fd3d5 --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.cpp @@ -0,0 +1,1494 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Package FixPIMDLangevin + Purpose Path Integral Molecular Dynamics with Langevin Thermostat + + Yifan Li @ Princeton University (yifanl0716@gmail.com) + Current Features: + - Multi-processor parallelism for each bead + - White-noise Langevin thermostat + - Bussi-Zykova-Parrinello barostat (isotropic and anisotropic) + - Several quantum estimators + Futher plans: + - Triclinic barostat +------------------------------------------------------------------------- */ + +#include "fix_pimd_langevin.h" + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "universe.h" +#include "update.h" +#include "utils.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +using MathConst::MY_PI; +using MathConst::THIRD; + +enum { NMPIMD }; +enum { PHYSICAL, NORMAL }; +enum { BAOAB, OBABO }; +enum { ISO, ANISO, TRICLINIC }; +enum { PILE_L }; +enum { MTTK, BZP }; +enum { NVE, NVT, NPH, NPT }; +enum { SINGLE_PROC, MULTI_PROC }; + +static std::map Barostats{{MTTK, "MTTK"}, {BZP, "BZP"}}; +static std::map Ensembles{{NVE, "NVE"}, {NVT, "NVT"}, {NPH, "NPH"}, {NPT, "NPT"}}; + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::FixPIMDLangevin(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), mass(nullptr), plansend(nullptr), planrecv(nullptr), tagsend(nullptr), + tagrecv(nullptr), bufsend(nullptr), bufrecv(nullptr), bufbeads(nullptr), bufsorted(nullptr), + bufsortedall(nullptr), outsorted(nullptr), buftransall(nullptr), tagsendall(nullptr), + tagrecvall(nullptr), bufsendall(nullptr), bufrecvall(nullptr), counts(nullptr), + displacements(nullptr), lam(nullptr), M_x2xp(nullptr), M_xp2x(nullptr), M_f2fp(nullptr), + M_fp2f(nullptr), modeindex(nullptr), tau_k(nullptr), c1_k(nullptr), c2_k(nullptr), + _omega_k(nullptr), Lan_s(nullptr), Lan_c(nullptr), random(nullptr), xc(nullptr), xcall(nullptr), + x_unwrap(nullptr), id_pe(nullptr), id_press(nullptr), c_pe(nullptr), c_press(nullptr) +{ + restart_global = 1; + time_integrate = 1; + + ntotal = 0; + maxlocal = maxunwrap = maxxc = 0; + + sizeplan = 0; + + method = NMPIMD; + ensemble = NVT; + integrator = OBABO; + thermostat = PILE_L; + barostat = BZP; + fmass = 1.0; + np = universe->nworlds; + inverse_np = 1.0 / np; + sp = 1.0; + temp = 298.15; + Lan_temp = 298.15; + tau = 1.0; + tau_p = 1.0; + Pext = 1.0; + pdim = 0; + pilescale = 1.0; + tstat_flag = 1; + pstat_flag = 0; + mapflag = 1; + removecomflag = 1; + fmmode = PHYSICAL; + pstyle = ISO; + totenthalpy = 0.0; + + int seed = -1; + + for (int i = 0; i < 6; i++) { + p_flag[i] = 0; + p_target[i] = 0.0; + } + + for (int i = 3; i < narg - 1; i += 2) { + if (strcmp(arg[i], "method") == 0) { + if (strcmp(arg[i + 1], "nmpimd") == 0) + method = NMPIMD; + else + error->universe_all(FLERR, "Unknown method parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "integrator") == 0) { + if (strcmp(arg[i + 1], "obabo") == 0) + integrator = OBABO; + else if (strcmp(arg[i + 1], "baoab") == 0) + integrator = BAOAB; + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + } else if (strcmp(arg[i], "ensemble") == 0) { + if (strcmp(arg[i + 1], "nve") == 0) { + ensemble = NVE; + tstat_flag = 0; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nvt") == 0) { + ensemble = NVT; + tstat_flag = 1; + pstat_flag = 0; + } else if (strcmp(arg[i + 1], "nph") == 0) { + ensemble = NPH; + tstat_flag = 0; + pstat_flag = 1; + } else if (strcmp(arg[i + 1], "npt") == 0) { + ensemble = NPT; + tstat_flag = 1; + pstat_flag = 1; + } else + error->universe_all(FLERR, + "Unknown ensemble parameter for fix pimd/langevin. Only nve, nvt, nph, " + "and npt ensembles are supported!"); + } else if (strcmp(arg[i], "fmass") == 0) { + fmass = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (fmass < 0.0 || fmass > np) + error->universe_all(FLERR, "Invalid fmass value for fix pimd/langevin"); + } else if (strcmp(arg[i], "sp") == 0) { + sp = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (sp < 0.0) error->universe_all(FLERR, "Invalid sp value for fix pimd/nvt"); + } else if (strcmp(arg[i], "fmmode") == 0) { + if (strcmp(arg[i + 1], "physical") == 0) + fmmode = PHYSICAL; + else if (strcmp(arg[i + 1], "normal") == 0) + fmmode = NORMAL; + else + error->universe_all(FLERR, + "Unknown fictitious mass mode for fix pimd/langevin. Only physical " + "mass and normal mode mass are supported!"); + } else if (strcmp(arg[i], "scale") == 0) { + pilescale = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (pilescale < 0.0) + error->universe_all(FLERR, "Invalid pile scale value for fix pimd/langevin"); + } else if (strcmp(arg[i], "temp") == 0) { + temp = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (temp < 0.0) error->universe_all(FLERR, "Invalid temp value for fix pimd/langevin"); + } else if (strcmp(arg[i], "lj") == 0) { + lj_epsilon = utils::numeric(FLERR, arg[i + 1], false, lmp); + lj_sigma = utils::numeric(FLERR, arg[i + 2], false, lmp); + lj_mass = utils::numeric(FLERR, arg[i + 3], false, lmp); + other_planck = utils::numeric(FLERR, arg[i + 4], false, lmp); + other_mvv2e = utils::numeric(FLERR, arg[i + 5], false, lmp); + i += 4; + } else if (strcmp(arg[i], "thermostat") == 0) { + if (strcmp(arg[i + 1], "PILE_L") == 0) { + thermostat = PILE_L; + seed = utils::inumeric(FLERR, arg[i + 2], false, lmp); + i++; + } + } else if (strcmp(arg[i], "tau") == 0) { + tau = utils::numeric(FLERR, arg[i + 1], false, lmp); + } else if (strcmp(arg[i], "barostat") == 0) { + if (strcmp(arg[i + 1], "MTTK") == 0) { + barostat = MTTK; + } else if (strcmp(arg[i + 1], "BZP") == 0) { + barostat = BZP; + } else + error->universe_all(FLERR, "Unknown barostat parameter for fix pimd/langevin"); + } else if (strcmp(arg[i], "iso") == 0) { + pstyle = ISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; + } else if (strcmp(arg[i], "aniso") == 0) { + pstyle = ANISO; + p_flag[0] = p_flag[1] = p_flag[2] = 1; + Pext = utils::numeric(FLERR, arg[i + 1], false, lmp); + p_target[0] = p_target[1] = p_target[2] = Pext; + pdim = 3; + } else if (strcmp(arg[i], "x") == 0) { + pstyle = ANISO; + p_flag[0] = 1; + p_target[0] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "y") == 0) { + pstyle = ANISO; + p_flag[1] = 1; + p_target[1] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "z") == 0) { + pstyle = ANISO; + p_flag[2] = 1; + p_target[2] = utils::numeric(FLERR, arg[i + 1], false, lmp); + pdim++; + } else if (strcmp(arg[i], "taup") == 0) { + tau_p = utils::numeric(FLERR, arg[i + 1], false, lmp); + if (tau_p <= 0.0) error->universe_all(FLERR, "Invalid tau_p value for fix pimd/langevin"); + } else if (strcmp(arg[i], "fixcom") == 0) { + if (strcmp(arg[i + 1], "yes") == 0) + removecomflag = 1; + else if (strcmp(arg[i + 1], "no") == 0) + removecomflag = 0; + } else { + error->universe_all(FLERR, fmt::format("Unknown keyword {} for fix {}", arg[i], style)); + } + } + + if (pstat_flag && !pdim) + error->universe_all( + FLERR, fmt::format("Must use pressure coupling with {} ensemble", Ensembles[ensemble])); + if (!pstat_flag && pdim) + error->universe_all( + FLERR, fmt::format("Must not use pressure coupling with {} ensemble", Ensembles[ensemble])); + + /* Initiation */ + + global_freq = 1; + vector_flag = 1; + if (!pstat_flag) { + size_vector = 10; + } else if (pstat_flag) { + if (pstyle == ISO) { + size_vector = 15; + } else if (pstyle == ANISO) { + size_vector = 17; + } + } + extvector = 1; + kt = force->boltz * temp; + if (pstat_flag) FixPIMDLangevin::baro_init(); + + // some initilizations + + id_pe = utils::strdup(std::string(id) + "_pimd_pe"); + modify->add_compute(std::string(id_pe) + " all pe"); + + id_press = utils::strdup(std::string(id) + "_pimd_press"); + modify->add_compute(std::string(id_press) + " all pressure thermo_temp virial"); + + vol0 = domain->xprd * domain->yprd * domain->zprd; + + fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); + fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); + fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); + if (pstat_flag) p_hydro = (p_target[0] + p_target[1] + p_target[2]) / pdim; + + // initialize Marsaglia RNG with processor-unique seed + + if (tstat_flag) { + if (integrator == BAOAB || integrator == OBABO) { + Lan_temp = temp; + random = new RanMars(lmp, seed + universe->me); + } + } + + me = comm->me; + nprocs = comm->nprocs; + if (nprocs == 1) + cmode = SINGLE_PROC; + else + cmode = MULTI_PROC; + + nprocs_universe = universe->nprocs; + nreplica = universe->nworlds; + ireplica = universe->iworld; + + if (nreplica == 1) + mapflag = 0; + else + mapflag = 1; + + int *iroots = new int[nreplica]; + MPI_Group uworldgroup, rootgroup; + + for (int i = 0; i < nreplica; i++) iroots[i] = universe->root_proc[i]; + MPI_Comm_group(universe->uworld, &uworldgroup); + MPI_Group_incl(uworldgroup, nreplica, iroots, &rootgroup); + MPI_Comm_create(universe->uworld, rootgroup, &rootworld); + if (rootgroup != MPI_GROUP_NULL) MPI_Group_free(&rootgroup); + if (uworldgroup != MPI_GROUP_NULL) MPI_Group_free(&uworldgroup); + delete[] iroots; + + ntotal = atom->natoms; + if (atom->nmax > maxlocal) reallocate(); + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); + memory->create(xcall, ntotal * 3, "FixPIMDLangevin:xcall"); + + if (cmode == SINGLE_PROC) { + memory->create(bufsorted, ntotal, 3, "FixPIMDLangevin:bufsorted"); + memory->create(outsorted, ntotal, 3, "FixPIMDLangevin:outsorted"); + memory->create(bufsortedall, nreplica * ntotal, 3, "FixPIMDLangevin:bufsortedall"); + memory->create(buftransall, nreplica * ntotal, 3, "FixPIMDLangevin:buftransall"); + memory->create(counts, nreplica, "FixPIMDLangevin:counts"); + memory->create(displacements, nreplica, "FixPIMDLangevin:displacements"); + } + + if ((cmode == MULTI_PROC) && (counts == nullptr)) { + memory->create(bufsendall, ntotal, 3, "FixPIMDLangevin:bufsendall"); + memory->create(bufrecvall, ntotal, 3, "FixPIMDLangevin:bufrecvall"); + memory->create(tagsendall, ntotal, "FixPIMDLangevin:tagsendall"); + memory->create(tagrecvall, ntotal, "FixPIMDLangevin:tagrecvall"); + memory->create(counts, nprocs, "FixPIMDLangevin:counts"); + memory->create(displacements, nprocs, "FixPIMDLangevin:displacements"); + } +} + +/* ---------------------------------------------------------------------- */ + +FixPIMDLangevin::~FixPIMDLangevin() +{ + modify->delete_compute(id_pe); + modify->delete_compute(id_press); + delete[] id_pe; + delete[] id_press; + delete random; + delete[] mass; + delete[] _omega_k; + delete[] Lan_c; + delete[] Lan_s; + delete[] tau_k; + delete[] c1_k; + delete[] c2_k; + delete[] plansend; + delete[] planrecv; + delete[] modeindex; + memory->destroy(xcall); + if (cmode == SINGLE_PROC) { + memory->destroy(bufsorted); + memory->destroy(outsorted); + memory->destroy(bufsortedall); + memory->destroy(buftransall); + memory->destroy(counts); + memory->destroy(displacements); + } + + if (cmode == MULTI_PROC) { + memory->destroy(bufsendall); + memory->destroy(bufrecvall); + memory->destroy(tagsendall); + memory->destroy(tagrecvall); + memory->destroy(counts); + memory->destroy(displacements); + } + memory->destroy(M_x2xp); + memory->destroy(M_xp2x); + memory->destroy(xc); + memory->destroy(x_unwrap); + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::init() +{ + if (atom->map_style == Atom::MAP_NONE) + error->all(FLERR, "fix pimd/langevin requires an atom map, see atom_modify"); + + if (universe->me == 0 && universe->uscreen) + fprintf(universe->uscreen, "fix pimd/langevin initializing Path-Integral ...\n"); + + // prepare the constants + + masstotal = group->mass(igroup); + + double planck; + if (strcmp(update->unit_style, "lj") == 0) { + double planck_star = sqrt(lj_epsilon) * sqrt(lj_mass) * lj_sigma * sqrt(other_mvv2e); + planck = other_planck / planck_star; + } else { + planck = force->hplanck; + } + planck *= sp; + hbar = planck / (2.0 * MY_PI); + double beta = 1.0 / (force->boltz * temp); + double _fbond = 1.0 * np * np / (beta * beta * hbar * hbar); + + omega_np = np / (hbar * beta) * sqrt(force->mvv2e); + beta_np = 1.0 / force->boltz / temp * inverse_np; + fbond = _fbond * force->mvv2e; + + if ((universe->me == 0) && (universe->uscreen)) + fprintf(universe->uscreen, + "fix pimd/langevin -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); + + if (integrator == OBABO) { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else if (integrator == BAOAB) { + dtf = 0.5 * update->dt * force->ftm2v; + dtv = 0.5 * update->dt; + dtv2 = dtv * dtv; + dtv3 = THIRD * dtv2 * dtv * force->ftm2v; + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } + + comm_init(); + + mass = new double[atom->ntypes + 1]; + + nmpimd_init(); + + langevin_init(); + + c_pe = modify->get_compute_by_id(id_pe); + c_press = modify->get_compute_by_id(id_press); + + t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::setup(int vflag) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + imageint *image = atom->image; + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); + } + + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + collect_xc(); + compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap_inv(x[i], image[i]); + } + + post_force(vflag); + compute_totke(); + end_of_step(); + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::initial_integrate(int /*vflag*/) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + imageint *image = atom->image; + if (mapflag) { + for (int i = 0; i < nlocal; i++) domain->unmap(x[i], image[i]); + } + if (integrator == OBABO) { + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + qc_step(); + a_step(); + } else if (integrator == BAOAB) { + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_x2xp[universe->iworld]); + } + qc_step(); + a_step(); + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + qc_step(); + a_step(); + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } + collect_xc(); + compute_spring_energy(); + compute_t_prim(); + compute_p_prim(); + + if (method == NMPIMD) { + inter_replica_comm(x); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, x, M_xp2x[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, x, M_xp2x[universe->iworld]); + } + + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap_inv(x[i], image[i]); } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::final_integrate() +{ + if (pstat_flag) { + compute_totke(); + compute_p_cv(); + press_v_step(); + } + b_step(); + if (integrator == OBABO) { + if (tstat_flag) { + o_step(); + if (removecomflag) remove_com_motion(); + if (pstat_flag) press_o_step(); + } + } else if (integrator == BAOAB) { + + } else { + error->universe_all(FLERR, "Unknown integrator parameter for fix pimd/langevin"); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::post_force(int /*flag*/) +{ + if (atom->nmax > maxunwrap) reallocate_x_unwrap(); + if (atom->nmax > maxxc) reallocate_xc(); + int nlocal = atom->nlocal; + double **x = atom->x; + double **f = atom->f; + imageint *image = atom->image; + tagint *tag = atom->tag; + for (int i = 0; i < nlocal; i++) { + x_unwrap[i][0] = x[i][0]; + x_unwrap[i][1] = x[i][1]; + x_unwrap[i][2] = x[i][2]; + } + if (mapflag) { + for (int i = 0; i < nlocal; i++) { domain->unmap(x_unwrap[i], image[i]); } + } + for (int i = 0; i < nlocal; i++) { + xc[i][0] = xcall[3 * (tag[i] - 1) + 0]; + xc[i][1] = xcall[3 * (tag[i] - 1) + 1]; + xc[i][2] = xcall[3 * (tag[i] - 1) + 2]; + } + + compute_vir(); + compute_cvir(); + compute_t_vir(); + compute_pote(); + if (method == NMPIMD) { + inter_replica_comm(f); + if (cmode == SINGLE_PROC) + nmpimd_transform(bufsortedall, f, M_x2xp[universe->iworld]); + else if (cmode == MULTI_PROC) + nmpimd_transform(bufbeads, f, M_x2xp[universe->iworld]); + } + c_pe->addstep(update->ntimestep + 1); + c_press->addstep(update->ntimestep + 1); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::end_of_step() +{ + compute_totke(); + compute_p_cv(); + compute_tote(); + if (pstat_flag) compute_totenthalpy(); +} + +void FixPIMDLangevin::collect_xc() +{ + int nlocal = atom->nlocal; + double **x = atom->x; + tagint *tag = atom->tag; + if (ireplica == 0) { + if (cmode == SINGLE_PROC) { + for (int i = 0; i < nlocal; i++) { + xcall[3 * i + 0] = xcall[3 * i + 1] = xcall[3 * i + 2] = 0.0; + } + } else if (cmode == MULTI_PROC) { + for (int i = 0; i < ntotal; i++) { + xcall[3 * i + 0] = xcall[3 * i + 1] = xcall[3 * i + 2] = 0.0; + } + } + + for (int i = 0; i < nlocal; i++) { + xcall[3 * (tag[i] - 1) + 0] = x[i][0] / sqrt(np); + xcall[3 * (tag[i] - 1) + 1] = x[i][1] / sqrt(np); + xcall[3 * (tag[i] - 1) + 2] = x[i][2] / sqrt(np); + } + + if (cmode == MULTI_PROC) { + MPI_Allreduce(MPI_IN_PLACE, xcall, ntotal * 3, MPI_DOUBLE, MPI_SUM, world); + } + } + MPI_Bcast(xcall, ntotal * 3, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::b_step() +{ + + int n = atom->nlocal; + int *type = atom->type; + double **v = atom->v; + double **f = atom->f; + + for (int i = 0; i < n; i++) { + double dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::qc_step() +{ + int nlocal = atom->nlocal; + double **x = atom->x; + double **v = atom->v; + double oldlo, oldhi; + + if (!pstat_flag) { + if (universe->iworld == 0) { + for (int i = 0; i < nlocal; i++) { + x[i][0] += dtv * v[i][0]; + x[i][1] += dtv * v[i][1]; + x[i][2] += dtv * v[i][2]; + } + } + } else { + if (universe->iworld == 0) { + double expp[3], expq[3]; + if (pstyle == ISO) { + vw[1] = vw[0]; + vw[2] = vw[0]; + } + for (int j = 0; j < 3; j++) { + expq[j] = exp(dtv * vw[j]); + expp[j] = exp(-dtv * vw[j]); + } + if (barostat == BZP) { + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + if (p_flag[j]) { + x[i][j] = expq[j] * x[i][j] + (expq[j] - expp[j]) / 2. / vw[j] * v[i][j]; + v[i][j] = expp[j] * v[i][j]; + } else { + x[i][j] += dtv * v[i][j]; + } + } + } + oldlo = domain->boxlo[0]; + oldhi = domain->boxhi[0]; + + domain->boxlo[0] = (oldlo - fixedpoint[0]) * expq[0] + fixedpoint[0]; + domain->boxhi[0] = (oldhi - fixedpoint[0]) * expq[0] + fixedpoint[0]; + + oldlo = domain->boxlo[1]; + oldhi = domain->boxhi[1]; + domain->boxlo[1] = (oldlo - fixedpoint[1]) * expq[1] + fixedpoint[1]; + domain->boxhi[1] = (oldhi - fixedpoint[1]) * expq[1] + fixedpoint[1]; + + oldlo = domain->boxlo[2]; + oldhi = domain->boxhi[2]; + domain->boxlo[2] = (oldlo - fixedpoint[2]) * expq[2] + fixedpoint[2]; + domain->boxhi[2] = (oldhi - fixedpoint[2]) * expq[2] + fixedpoint[2]; + } + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&domain->boxlo[0], 3, MPI_DOUBLE, 0, universe->uworld); + MPI_Bcast(&domain->boxhi[0], 3, MPI_DOUBLE, 0, universe->uworld); + domain->set_global_box(); + domain->set_local_box(); + } + volume = domain->xprd * domain->yprd * domain->zprd; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::a_step() +{ + int n = atom->nlocal; + double **x = atom->x; + double **v = atom->v; + double x0, x1, x2, v0, v1, v2; // three components of x[i] and v[i] + + if (universe->iworld != 0) { + for (int i = 0; i < n; i++) { + x0 = x[i][0]; + x1 = x[i][1]; + x2 = x[i][2]; + v0 = v[i][0]; + v1 = v[i][1]; + v2 = v[i][2]; + x[i][0] = Lan_c[universe->iworld] * x0 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v0; + x[i][1] = Lan_c[universe->iworld] * x1 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v1; + x[i][2] = Lan_c[universe->iworld] * x2 + + 1.0 / _omega_k[universe->iworld] * Lan_s[universe->iworld] * v2; + v[i][0] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x0 + + Lan_c[universe->iworld] * v0; + v[i][1] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x1 + + Lan_c[universe->iworld] * v1; + v[i][2] = -1.0 * _omega_k[universe->iworld] * Lan_s[universe->iworld] * x2 + + Lan_c[universe->iworld] * v2; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::baro_init() +{ + vw[0] = vw[1] = vw[2] = vw[3] = vw[4] = vw[5] = 0.0; + if (pstyle == ISO) { + W = 3 * (atom->natoms) * tau_p * tau_p * np * kt; + } // consistent with the definition in i-Pi + else if (pstyle == ANISO) { + W = atom->natoms * tau_p * tau_p * np * kt; + } + Vcoeff = 1.0; + std::string out = fmt::format("\nInitializing PIMD {:s} barostat...\n", Barostats[barostat]); + out += fmt::format("The barostat mass is W = {:.16e}\n", W); + utils::logmesg(lmp, out); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_v_step() +{ + int nlocal = atom->nlocal; + double **f = atom->f; + double **v = atom->v; + int *type = atom->type; + volume = domain->xprd * domain->yprd * domain->zprd; + + if (pstyle == ISO) { + if (barostat == BZP) { + vw[0] += dtv * 3 * (volume * np * (p_cv - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { + double dvw_proc = 0.0, dvw = 0.0; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + dvw_proc += dtv2 * f[i][j] * v[i][j] / W + dtv3 * f[i][j] * f[i][j] / mass[type[i]] / W; + } + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[0] += dvw; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } else if (barostat == MTTK) { + mtk_term1 = 2. / atom->natoms * totke / 3; + f_omega = (volume * np * (p_md - p_hydro) + mtk_term1) / W; + vw[0] += 0.5 * dtv * f_omega; + } + } else if (pstyle == ANISO) { + compute_stress_tensor(); + for (int ii = 0; ii < 3; ii++) { + if (p_flag[ii]) { + vw[ii] += dtv * + (volume * np * (stress_tensor[ii] - p_hydro) / force->nktv2p + Vcoeff / beta_np) / W; + if (universe->iworld == 0) { + double dvw_proc = 0.0, dvw = 0.0; + for (int i = 0; i < nlocal; i++) { + dvw_proc += + dtv2 * f[i][ii] * v[i][ii] / W + dtv3 * f[i][ii] * f[i][ii] / mass[type[i]] / W; + } + MPI_Allreduce(&dvw_proc, &dvw, 1, MPI_DOUBLE, MPI_SUM, world); + vw[ii] += dvw; + } + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::press_o_step() +{ + if (pstyle == ISO) { + if (universe->me == 0) { + r1 = random->gaussian(); + vw[0] = c1 * vw[0] + c2 * sqrt(1.0 / W / beta_np) * r1; + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw[0], 1, MPI_DOUBLE, 0, universe->uworld); + } else if (pstyle == ANISO) { + if (universe->me == 0) { + for (int ii = 0; ii < 3; ii++) { + if (p_flag[ii]) { + r1 = random->gaussian(); + vw[ii] = c1 * vw[ii] + c2 * sqrt(1.0 / W / beta_np) * r1; + } + } + } + MPI_Barrier(universe->uworld); + MPI_Bcast(&vw, 3, MPI_DOUBLE, 0, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::langevin_init() +{ + double beta = 1.0 / kt; + _omega_np = np / beta / hbar; + double _omega_np_dt_half = _omega_np * update->dt * 0.5; + + _omega_k = new double[np]; + Lan_c = new double[np]; + Lan_s = new double[np]; + if (fmmode == PHYSICAL) { + for (int i = 0; i < np; i++) { + _omega_k[i] = _omega_np * sqrt(lam[i]) / sqrt(fmass); + Lan_c[i] = cos(sqrt(lam[i]) * _omega_np_dt_half); + Lan_s[i] = sin(sqrt(lam[i]) * _omega_np_dt_half); + } + } else if (fmmode == NORMAL) { + for (int i = 0; i < np; i++) { + _omega_k[i] = _omega_np / sqrt(fmass); + Lan_c[i] = cos(_omega_np_dt_half); + Lan_s[i] = sin(_omega_np_dt_half); + } + } + if (tau > 0) + gamma = 1.0 / tau; + else + gamma = np / beta / hbar; + + if (integrator == OBABO) + c1 = exp(-gamma * 0.5 * update->dt); // tau is the damping time of the centroid mode. + else if (integrator == BAOAB) + c1 = exp(-gamma * update->dt); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + + c2 = sqrt(1.0 - c1 * c1); // note that c1 and c2 here only works for the centroid mode. + + if (thermostat == PILE_L) { + std::string out = "\nInitializing PI Langevin equation thermostat...\n"; + out += "Bead ID | omega | tau | c1 | c2\n"; + tau_k = new double[np]; + c1_k = new double[np]; + c2_k = new double[np]; + tau_k[0] = tau; + c1_k[0] = c1; + c2_k[0] = c2; + for (int i = 1; i < np; i++) { + tau_k[i] = 0.5 / pilescale / _omega_k[i]; + if (integrator == OBABO) + c1_k[i] = exp(-0.5 * update->dt / tau_k[i]); + else if (integrator == BAOAB) + c1_k[i] = exp(-1.0 * update->dt / tau_k[i]); + else + error->universe_all(FLERR, + "Unknown integrator parameter for fix pimd/langevin. Only obabo and " + "baoab integrators are supported!"); + c2_k[i] = sqrt(1.0 - c1_k[i] * c1_k[i]); + } + for (int i = 0; i < np; i++) { + out += fmt::format(" {:d} {:.8e} {:.8e} {:.8e} {:.8e}\n", i, _omega_k[i], tau_k[i], + c1_k[i], c2_k[i]); + } + if (thermostat == PILE_L) out += "PILE_L thermostat successfully initialized!\n"; + out += "\n"; + utils::logmesg(lmp, out); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::o_step() +{ + int nlocal = atom->nlocal; + int *type = atom->type; + double beta_np = 1.0 / force->boltz / Lan_temp * inverse_np * force->mvv2e; + if (thermostat == PILE_L) { + for (int i = 0; i < nlocal; i++) { + r1 = random->gaussian(); + r2 = random->gaussian(); + r3 = random->gaussian(); + atom->v[i][0] = c1_k[universe->iworld] * atom->v[i][0] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r1; + atom->v[i][1] = c1_k[universe->iworld] * atom->v[i][1] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r2; + atom->v[i][2] = c1_k[universe->iworld] * atom->v[i][2] + + c2_k[universe->iworld] * sqrt(1.0 / mass[type[i]] / beta_np) * r3; + } + } +} + +/* ---------------------------------------------------------------------- + Normal Mode PIMD +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_init() +{ + memory->create(M_x2xp, np, np, "fix_feynman:M_x2xp"); + memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); + + lam = (double *) memory->smalloc(sizeof(double) * np, "FixPIMDLangevin::lam"); + + // Set up eigenvalues + for (int i = 0; i < np; i++) { + double sin_tmp = sin(i * MY_PI / np); + lam[i] = 4 * sin_tmp * sin_tmp; + } + + // Set up eigenvectors for degenerated modes + for (int j = 0; j < np; j++) { + for (int i = 1; i < int(np / 2) + 1; i++) { + M_x2xp[i][j] = sqrt(2.0) * cos(2.0 * MY_PI * double(i) * double(j) / double(np)) / sqrt(np); + } + for (int i = int(np / 2) + 1; i < np; i++) { + M_x2xp[i][j] = sqrt(2.0) * sin(2.0 * MY_PI * double(i) * double(j) / double(np)) / sqrt(np); + } + } + + // Set up eigenvectors for non-degenerated modes + for (int i = 0; i < np; i++) { + M_x2xp[0][i] = 1.0 / sqrt(np); + if (np % 2 == 0) M_x2xp[np / 2][i] = 1.0 / sqrt(np) * pow(-1.0, i); + } + + // Set up Ut + for (int i = 0; i < np; i++) + for (int j = 0; j < np; j++) { M_xp2x[i][j] = M_x2xp[j][i]; } + + // Set up fictitious masses + int iworld = universe->iworld; + for (int i = 1; i <= atom->ntypes; i++) { + mass[i] = atom->mass[i]; + mass[i] *= fmass; + if (iworld) { + if (fmmode == PHYSICAL) { + mass[i] *= 1.0; + } else if (fmmode == NORMAL) { + mass[i] *= lam[iworld]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::nmpimd_transform(double **src, double **des, double *vector) +{ + if (cmode == SINGLE_PROC) { + for (int i = 0; i < ntotal; i++) { + for (int d = 0; d < 3; d++) { + bufsorted[i][d] = 0.0; + for (int j = 0; j < nreplica; j++) { + bufsorted[i][d] += src[j * ntotal + i][d] * vector[j]; + } + } + } + for (int i = 0; i < ntotal; i++) { + tagint tagtmp = atom->tag[i]; + for (int d = 0; d < 3; d++) { des[i][d] = bufsorted[tagtmp - 1][d]; } + } + } else if (cmode == MULTI_PROC) { + int n = atom->nlocal; + int m = 0; + + for (int i = 0; i < n; i++) + for (int d = 0; d < 3; d++) { + des[i][d] = 0.0; + for (int j = 0; j < np; j++) { des[i][d] += (src[j][m] * vector[j]); } + m++; + } + } +} + +/* ---------------------------------------------------------------------- + Comm operations +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::comm_init() +{ + if (sizeplan) { + delete[] plansend; + delete[] planrecv; + } + + sizeplan = np - 1; + plansend = new int[sizeplan]; + planrecv = new int[sizeplan]; + modeindex = new int[sizeplan]; + for (int i = 0; i < sizeplan; i++) { + int isend, irecv; + isend = ireplica + i + 1; + if (isend >= nreplica) isend -= nreplica; + irecv = ireplica - (i + 1); + if (irecv < 0) irecv += nreplica; + plansend[i] = universe->root_proc[isend]; + planrecv[i] = universe->root_proc[irecv]; + modeindex[i] = irecv; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_xc() +{ + maxxc = atom->nmax; + memory->destroy(xc); + memory->create(xc, maxxc, 3, "FixPIMDLangevin:xc"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate_x_unwrap() +{ + maxunwrap = atom->nmax; + memory->destroy(x_unwrap); + memory->create(x_unwrap, maxunwrap, 3, "FixPIMDLangevin:x_unwrap"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::reallocate() +{ + maxlocal = atom->nmax; + memory->destroy(bufsend); + memory->destroy(bufrecv); + memory->destroy(tagsend); + memory->destroy(tagrecv); + memory->destroy(bufbeads); + memory->create(bufsend, maxlocal, 3, "FixPIMDLangevin:bufsend"); + memory->create(bufrecv, maxlocal, 3, "FixPIMDLangevin:bufrecv"); + memory->create(tagsend, maxlocal, "FixPIMDLangevin:tagsend"); + memory->create(tagrecv, maxlocal, "FixPIMDLangevin:tagrecv"); + memory->create(bufbeads, nreplica, maxlocal * 3, "FixPIMDLangevin:bufrecv"); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::inter_replica_comm(double **ptr) +{ + MPI_Request requests[2]; + MPI_Status statuses[2]; + if (atom->nmax > maxlocal) reallocate(); + int nlocal = atom->nlocal; + tagint *tag = atom->tag; + int i, m; + + // copy local values + for (i = 0; i < nlocal; i++) { + bufbeads[ireplica][3 * i + 0] = ptr[i][0]; + bufbeads[ireplica][3 * i + 1] = ptr[i][1]; + bufbeads[ireplica][3 * i + 2] = ptr[i][2]; + } + + // communicate values from the other beads + if (cmode == SINGLE_PROC) { + m = 0; + for (i = 0; i < nlocal; i++) { + tagint tagtmp = atom->tag[i]; + bufsorted[tagtmp - 1][0] = ptr[i][0]; + bufsorted[tagtmp - 1][1] = ptr[i][1]; + bufsorted[tagtmp - 1][2] = ptr[i][2]; + m++; + } + MPI_Allgather(&m, 1, MPI_INT, counts, 1, MPI_INT, universe->uworld); + for (i = 0; i < nreplica; i++) counts[i] *= 3; + displacements[0] = 0; + for (i = 0; i < nreplica - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Allgatherv(bufsorted[0], 3 * m, MPI_DOUBLE, bufsortedall[0], counts, displacements, + MPI_DOUBLE, universe->uworld); + } else if (cmode == MULTI_PROC) { + m = 0; + for (i = 0; i < nlocal; i++) { + tagsend[m] = tag[i]; + bufsend[m][0] = ptr[i][0]; + bufsend[m][1] = ptr[i][1]; + bufsend[m][2] = ptr[i][2]; + m++; + } + MPI_Gather(&m, 1, MPI_INT, counts, 1, MPI_INT, 0, world); + displacements[0] = 0; + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Gatherv(tagsend, m, MPI_LMP_TAGINT, tagsendall, counts, displacements, MPI_LMP_TAGINT, 0, + world); + for (i = 0; i < nprocs; i++) counts[i] *= 3; + for (i = 0; i < nprocs - 1; i++) displacements[i + 1] = displacements[i] + counts[i]; + MPI_Gatherv(bufsend[0], 3 * m, MPI_DOUBLE, bufsendall[0], counts, displacements, MPI_DOUBLE, 0, + world); + for (int iplan = 0; iplan < sizeplan; iplan++) { + if (me == 0) { + MPI_Irecv(bufrecvall[0], 3 * ntotal, MPI_DOUBLE, planrecv[iplan], 0, universe->uworld, + &requests[0]); + MPI_Irecv(tagrecvall, ntotal, MPI_LMP_TAGINT, planrecv[iplan], 0, universe->uworld, + &requests[1]); + MPI_Send(bufsendall[0], 3 * ntotal, MPI_DOUBLE, plansend[iplan], 0, universe->uworld); + MPI_Send(tagsendall, ntotal, MPI_LMP_TAGINT, plansend[iplan], 0, universe->uworld); + MPI_Waitall(2, requests, statuses); + } + MPI_Bcast(tagrecvall, ntotal, MPI_LMP_TAGINT, 0, world); + MPI_Bcast(bufrecvall[0], 3 * ntotal, MPI_DOUBLE, 0, world); + for (i = 0; i < ntotal; i++) { + m = atom->map(tagrecvall[i]); + if (m < 0 || m >= nlocal) continue; + bufbeads[modeindex[iplan]][3 * m + 0] = bufrecvall[i][0]; + bufbeads[modeindex[iplan]][3 * m + 1] = bufrecvall[i][1]; + bufbeads[modeindex[iplan]][3 * m + 2] = bufrecvall[i][2]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::remove_com_motion() +{ + if (universe->iworld == 0) { + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (dynamic) masstotal = group->mass(igroup); + double vcm[3]; + group->vcm(igroup, masstotal, vcm); + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + v[i][0] -= vcm[0]; + v[i][1] -= vcm[1]; + v[i][2] -= vcm[2]; + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_cvir() +{ + int nlocal = atom->nlocal; + xf = vir_ = xcf = centroid_vir = 0.0; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { + xf += x_unwrap[i][j] * atom->f[i][j]; + xcf += (x_unwrap[i][j] - xc[i][j]) * atom->f[i][j]; + } + } + MPI_Allreduce(&xf, &vir_, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(&xcf, ¢roid_vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + if (pstyle == ANISO) { + for (int i = 0; i < 6; i++) c_vir_tensor[i] = 0.0; + for (int i = 0; i < nlocal; i++) { + c_vir_tensor[0] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][0]; + c_vir_tensor[1] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][1]; + c_vir_tensor[2] += (x_unwrap[i][2] - xc[i][2]) * atom->f[i][2]; + c_vir_tensor[3] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][1]; + c_vir_tensor[4] += (x_unwrap[i][0] - xc[i][0]) * atom->f[i][2]; + c_vir_tensor[5] += (x_unwrap[i][1] - xc[i][1]) * atom->f[i][2]; + } + MPI_Allreduce(MPI_IN_PLACE, &c_vir_tensor, 6, MPI_DOUBLE, MPI_SUM, universe->uworld); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_vir() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + c_press->compute_vector(); + virial[0] = c_press->vector[0] * volume; + virial[1] = c_press->vector[1] * volume; + virial[2] = c_press->vector[2] * volume; + virial[3] = c_press->vector[3] * volume; + virial[4] = c_press->vector[4] * volume; + virial[5] = c_press->vector[5] * volume; + for (int i = 0; i < 6; i++) virial[i] /= universe->procs_per_world[universe->iworld]; + double vir_bead = (virial[0] + virial[1] + virial[2]); + MPI_Allreduce(&vir_bead, &vir, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + MPI_Allreduce(MPI_IN_PLACE, &virial[0], 6, MPI_DOUBLE, MPI_SUM, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_stress_tensor() +{ + int nlocal = atom->nlocal; + int *type = atom->type; + if (universe->iworld == 0) { + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + for (int i = 0; i < 6; i++) ke_tensor[i] = 0.0; + for (int i = 0; i < nlocal; i++) { + ke_tensor[0] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][0] * force->mvv2e; + ke_tensor[1] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][1] * force->mvv2e; + ke_tensor[2] += 0.5 * mass[type[i]] * atom->v[i][2] * atom->v[i][2] * force->mvv2e; + ke_tensor[3] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][1] * force->mvv2e; + ke_tensor[4] += 0.5 * mass[type[i]] * atom->v[i][0] * atom->v[i][2] * force->mvv2e; + ke_tensor[5] += 0.5 * mass[type[i]] * atom->v[i][1] * atom->v[i][2] * force->mvv2e; + } + MPI_Allreduce(MPI_IN_PLACE, &ke_tensor, 6, MPI_DOUBLE, MPI_SUM, world); + for (int i = 0; i < 6; i++) { + stress_tensor[i] = + inv_volume * ((2 * ke_tensor[i] - c_vir_tensor[i]) * force->nktv2p + virial[i]) / np; + } + } + MPI_Bcast(&stress_tensor, 6, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totke() +{ + kine = 0.0; + totke = ke_bead = 0.0; + int nlocal = atom->nlocal; + int *type = atom->type; + for (int i = 0; i < nlocal; i++) { + for (int j = 0; j < 3; j++) { kine += 0.5 * mass[type[i]] * atom->v[i][j] * atom->v[i][j]; } + } + kine *= force->mvv2e; + MPI_Allreduce(&kine, &ke_bead, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&ke_bead, &totke, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + totke /= universe->procs_per_world[universe->iworld]; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_spring_energy() +{ + spring_energy = 0.0; + total_spring_energy = se_bead = 0.0; + + double **x = atom->x; + double *_mass = atom->mass; + int *type = atom->type; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + spring_energy += 0.5 * _mass[type[i]] * fbond * lam[universe->iworld] * + (x[i][0] * x[i][0] + x[i][1] * x[i][1] + x[i][2] * x[i][2]); + } + MPI_Allreduce(&spring_energy, &se_bead, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&se_bead, &total_spring_energy, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); + total_spring_energy /= universe->procs_per_world[universe->iworld]; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_pote() +{ + pe_bead = 0.0; + pot_energy_partition = 0.0; + pote = 0.0; + c_pe->compute_scalar(); + pe_bead = c_pe->scalar; + pot_energy_partition = pe_bead / universe->procs_per_world[universe->iworld]; + MPI_Allreduce(&pot_energy_partition, &pote, 1, MPI_DOUBLE, MPI_SUM, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_tote() +{ + tote = totke + pote + total_spring_energy; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_t_prim() +{ + t_prim = 1.5 * atom->natoms * np * force->boltz * temp - total_spring_energy; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_t_vir() +{ + t_vir = -0.5 * inverse_np * vir_; + t_cv = 1.5 * atom->natoms * force->boltz * temp - 0.5 * inverse_np * centroid_vir; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_p_prim() +{ + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + p_prim = atom->natoms * np * force->boltz * temp * inv_volume - + 1.0 / 1.5 * inv_volume * total_spring_energy; + p_prim *= force->nktv2p; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_p_cv() +{ + double inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); + if (universe->iworld == 0) { + p_cv = THIRD * inv_volume * ((2.0 * ke_bead - centroid_vir) * force->nktv2p + vir) / np; + } + p_md = THIRD * inv_volume * (totke + vir); + MPI_Bcast(&p_cv, 1, MPI_DOUBLE, 0, universe->uworld); +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::compute_totenthalpy() +{ + volume = domain->xprd * domain->yprd * domain->zprd; + if (barostat == BZP) { + if (pstyle == ISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * volume / force->nktv2p - + Vcoeff * kt * log(volume); + } else if (pstyle == ANISO) { + totenthalpy = tote + 0.5 * W * vw[0] * vw[0] * inverse_np + + 0.5 * W * vw[1] * vw[1] * inverse_np + 0.5 * W * vw[2] * vw[2] * inverse_np + + p_hydro * volume / force->nktv2p - Vcoeff * kt * log(volume); + } + } else if (barostat == MTTK) + totenthalpy = tote + 1.5 * W * vw[0] * vw[0] * inverse_np + p_hydro * (volume - vol0); +} + +/* ---------------------------------------------------------------------- + pack entire state of Fix into one write +------------------------------------------------------------------------- */ + +void FixPIMDLangevin::write_restart(FILE *fp) +{ + int nsize = size_restart_global(); + + double *list; + memory->create(list, nsize, "FixPIMDLangevin:list"); + + pack_restart_data(list); + + if (comm->me == 0) { + int size = nsize * sizeof(double); + fwrite(&size, sizeof(int), 1, fp); + fwrite(list, sizeof(double), nsize, fp); + } + + memory->destroy(list); +} +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::size_restart_global() +{ + int nsize = 6; + + return nsize; +} + +/* ---------------------------------------------------------------------- */ + +int FixPIMDLangevin::pack_restart_data(double *list) +{ + int n = 0; + for (int i = 0; i < 6; i++) list[n++] = vw[i]; + return n; +} + +/* ---------------------------------------------------------------------- */ + +void FixPIMDLangevin::restart(char *buf) +{ + int n = 0; + auto list = (double *) buf; + for (int i = 0; i < 6; i++) vw[i] = list[n++]; +} + +/* ---------------------------------------------------------------------- */ + +double FixPIMDLangevin::compute_vector(int n) +{ + if (n == 0) return ke_bead; + if (n == 1) return se_bead; + if (n == 2) return pe_bead; + if (n == 3) return tote; + if (n == 4) return t_prim; + if (n == 5) return t_vir; + if (n == 6) return t_cv; + if (n == 7) return p_prim; + if (n == 8) return p_md; + if (n == 9) return p_cv; + + if (pstat_flag) { + volume = domain->xprd * domain->yprd * domain->zprd; + if (pstyle == ISO) { + if (n == 10) return vw[0]; + if (barostat == BZP) { + if (n == 11) return 0.5 * W * vw[0] * vw[0]; + } else if (barostat == MTTK) { + if (n == 11) return 1.5 * W * vw[0] * vw[0]; + } + if (n == 12) { return np * Pext * volume / force->nktv2p; } + if (n == 13) { return -Vcoeff * np * kt * log(volume); } + if (n == 14) return totenthalpy; + } else if (pstyle == ANISO) { + if (n == 10) return vw[0]; + if (n == 11) return vw[1]; + if (n == 12) return vw[2]; + if (n == 13) return 0.5 * W * (vw[0] * vw[0] + vw[1] * vw[1] + vw[2] * vw[2]); + if (n == 14) { return np * Pext * volume / force->nktv2p; } + if (n == 15) { + volume = domain->xprd * domain->yprd * domain->zprd; + return -Vcoeff * np * kt * log(volume); + } + if (n == 16) return totenthalpy; + } + } + + return 0.0; +} diff --git a/src/REPLICA/fix_pimd_langevin.h b/src/REPLICA/fix_pimd_langevin.h new file mode 100644 index 0000000000..d3b9d5b77e --- /dev/null +++ b/src/REPLICA/fix_pimd_langevin.h @@ -0,0 +1,188 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(pimd/langevin,FixPIMDLangevin); +// clang-format on +#else + +#ifndef FIX_PIMD_LANGEVIN_H +#define FIX_PIMD_LANGEVIN_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixPIMDLangevin : public Fix { + public: + FixPIMDLangevin(class LAMMPS *, int, char **); + ~FixPIMDLangevin() override; + + int setmask() override; + + void init() override; + void setup(int) override; + void post_force(int) override; + void initial_integrate(int) override; + void final_integrate() override; + void end_of_step() override; + + double compute_vector(int) override; + + protected: + // System setting variables + int method; // PIMD or NMPIMD or CMD + int fmmode; // physical or normal + int np; // number of beads + double inverse_np; // 1.0/np + double temp; // temperature + double hbar; // Planck's constant + double lj_epsilon, lj_sigma, lj_mass; // LJ unit energy, length, and mass scales + double other_planck; + double other_mvv2e; + double kt; // k_B * temp + double beta, beta_np; // beta = 1./kBT beta_np = 1./kBT/np + int thermostat; // NHC or PILE_L + int barostat; // BZP + int integrator; // obabo or baoab + int ensemble; // nve or nvt or nph or npt + int mapflag; // should be 1 if number of beads > 1 + int removecomflag; + double masstotal; + + double fixedpoint[3]; // location of dilation fixed-point + + // ring-polymer model + + double omega_np, fbond, spring_energy, sp; + + // fictitious mass + + double fmass, *mass; + + // inter-partition communication + + MPI_Comm rootworld; + int me, nprocs, ireplica, nreplica, nprocs_universe; + int ntotal, maxlocal; + + int cmode; + int sizeplan; + int *plansend, *planrecv; + + tagint *tagsend, *tagrecv; + double **bufsend, **bufrecv, **bufbeads; + double **bufsorted, **bufsortedall; + double **outsorted, **buftransall; + + tagint *tagsendall, *tagrecvall; + double **bufsendall, **bufrecvall; + + int *counts, *displacements; + + void comm_init(); + void inter_replica_comm(double **ptr); + + /* normal-mode operations */ + + double *lam, **M_x2xp, **M_xp2x, **M_f2fp, **M_fp2f; + int *modeindex; + + void reallocate(); + void nmpimd_init(); + void nmpimd_transform(double **, double **, double *); + + /* Langevin integration */ + + double dtv, dtf, dtv2, dtv3; + double gamma, c1, c2, tau; + double *tau_k, *c1_k, *c2_k; + double pilescale; + double Lan_temp; + double r1, r2, r3; + double _omega_np, *_omega_k, *Lan_s, *Lan_c; // sin(omega_k*dt*0.5), cos(omega_k*dt*0.5) + + class RanMars *random; + + int tstat_flag; // tstat_flat = 1 if thermostat if used + void langevin_init(); + void b_step(); // integrate for dt/2 according to B part (v <- v + f * dt/2) + void + a_step(); // integrate for dt/2 according to A part (non-centroid mode, harmonic force between replicas) + void qc_step(); // integrate for dt/2 for the centroid mode (x <- x + v * dt/2) + void o_step(); // integrate for dt according to O part (O-U process, for thermostating) + + /* Bussi-Zykova-Parrinello barostat */ + + double f_omega, mtk_term1; + int pstat_flag; // pstat_flag = 1 if barostat is used + int pstyle; // pstyle = ISO or ANISO (will support TRICLINIC in the future) + double W, tau_p, Pext, p_hydro, totenthalpy, Vcoeff; + int pdim; + int p_flag[6]; + double p_target[6]; + double vw[6]; // barostat velocity + double ke_tensor[6]; // kinetic energy tensor + double c_vir_tensor[6]; // centroid-virial tensor + double stress_tensor[6]; // path integral centroid-virial stress tensor + + void baro_init(); + void press_v_step(); + void press_o_step(); + + /* centroid-virial estimator computation */ + double vol0 = 0.0; + double volume; + double **xc, *xcall; + int maxxc; + int maxunwrap; + double **x_unwrap; + void reallocate_x_unwrap(); + void reallocate_xc(); + void collect_xc(); + void remove_com_motion(); + double xf, vir, vir_, xcf, centroid_vir; + double t_prim, t_vir, t_cv, p_prim, p_vir, p_cv, p_md; + + /* Computes */ + double kine, pote, tote, totke; + double ke_bead, se_bead, pe_bead, pot_energy_partition; + double total_spring_energy; + char *id_pe; + char *id_press; + class Compute *c_pe; + class Compute *c_press; + + void compute_totke(); // 1: kinetic energy + void compute_spring_energy(); // 2: spring elastic energy + void compute_pote(); // 3: potential energy + void compute_tote(); // 4: total energy: 1+2+3 for all the beads + void compute_stress_tensor(); + void compute_t_prim(); + void compute_t_vir(); + void compute_t_cv(); + void compute_p_prim(); + void compute_p_cv(); // centroid-virial pressure estimator + void compute_vir(); + void compute_cvir(); + void compute_totenthalpy(); + + void write_restart(FILE *fp) override; + int size_restart_global(); + int pack_restart_data(double *list); + void restart(char *buf) override; +}; +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/REPLICA/fix_pimd_nvt.cpp b/src/REPLICA/fix_pimd_nvt.cpp index 1f2f29f35c..e899c75a27 100644 --- a/src/REPLICA/fix_pimd_nvt.cpp +++ b/src/REPLICA/fix_pimd_nvt.cpp @@ -219,7 +219,7 @@ void FixPIMDNVT::init() const double Boltzmann = force->boltz; const double Plank = force->hplanck; - double hbar = Plank / (2.0 * MY_PI); + double hbar = Plank / (2.0 * MY_PI) * sp; double beta = 1.0 / (Boltzmann * nhc_temp); double _fbond = 1.0 * np / (beta * beta * hbar * hbar); diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 94b1f860bd..630427b690 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -44,7 +44,7 @@ enum { DEFAULT, TERSE, VERBOSE }; /* ---------------------------------------------------------------------- */ -NEB::NEB(LAMMPS *lmp) : Command(lmp), all(nullptr), rdist(nullptr) {} +NEB::NEB(LAMMPS *lmp) : Command(lmp), fp(nullptr), all(nullptr), rdist(nullptr) {} /* ---------------------------------------------------------------------- internal NEB constructor, called from TAD @@ -52,7 +52,8 @@ NEB::NEB(LAMMPS *lmp) : Command(lmp), all(nullptr), rdist(nullptr) {} NEB::NEB(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in, int n2steps_in, int nevery_in, double *buf_init, double *buf_final) : - Command(lmp), fp(nullptr), all(nullptr), rdist(nullptr) + Command(lmp), + fp(nullptr), all(nullptr), rdist(nullptr) { double delx, dely, delz; @@ -170,14 +171,14 @@ void NEB::command(int narg, char **arg) } else if (strcmp(arg[iarg], "verbosity") == 0) { if (iarg + 2 > narg) error->universe_all(FLERR, "Illegal NEB verbosity command: missing arguments"); - if (strcmp(arg[iarg+1], "verbose") == 0) + if (strcmp(arg[iarg + 1], "verbose") == 0) print_mode = VERBOSE; - else if (strcmp(arg[iarg+1], "default") == 0) + else if (strcmp(arg[iarg + 1], "default") == 0) print_mode = DEFAULT; - else if (strcmp(arg[iarg+1], "terse") == 0) + else if (strcmp(arg[iarg + 1], "terse") == 0) print_mode = TERSE; else - error->universe_all(FLERR, fmt::format("Unknown NEB verbosity option {}", arg[iarg+1])); + error->universe_all(FLERR, fmt::format("Unknown NEB verbosity option {}", arg[iarg + 1])); iarg += 2; } else error->universe_all(FLERR, fmt::format("Unknown NEB command keyword: {}", arg[iarg])); diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index df49d84439..44427d2914 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -610,7 +610,7 @@ FixRigid::~FixRigid() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); delete random; delete[] inpfile; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 089c644f1e..bf0a847d48 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -259,7 +259,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { - p_start[2] = p_stop[2] = p_period[2] = 0.0; + p_start[2] = p_stop[2] = p_period[2] = 0.0; p_flag[2] = 0; } iarg += 4; @@ -275,7 +275,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; - p_flag[2] = 0; + p_flag[2] = 0; } iarg += 4; @@ -481,7 +481,7 @@ FixRigidSmall::~FixRigidSmall() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // delete locally stored arrays diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 6cd624c755..94c7668453 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -255,7 +255,7 @@ FixShake::~FixShake() // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id,Atom::GROW); // set bond_type and angle_type back to positive for SHAKE clusters // must set for all SHAKE bonds and angles stored by each atom diff --git a/src/TALLY/compute_force_tally.cpp b/src/TALLY/compute_force_tally.cpp index 8346edf928..e2243e02a7 100644 --- a/src/TALLY/compute_force_tally.cpp +++ b/src/TALLY/compute_force_tally.cpp @@ -21,6 +21,7 @@ #include "memory.h" #include "pair.h" #include "update.h" + #include using namespace LAMMPS_NS; @@ -29,10 +30,11 @@ using namespace LAMMPS_NS; ComputeForceTally::ComputeForceTally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute force/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute force/tally", error); igroup2 = group->find(arg[3]); - if (igroup2 == -1) error->all(FLERR, "Could not find compute force/tally second group ID"); + if (igroup2 == -1) + error->all(FLERR, "Could not find compute force/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; scalar_flag = 1; @@ -177,7 +179,10 @@ double ComputeForceTally::compute_scalar() { invoked_scalar = update->ntimestep; if ((did_setup != invoked_scalar) || (update->eflag_global != invoked_scalar)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // sum accumulated forces across procs @@ -193,7 +198,10 @@ void ComputeForceTally::compute_peratom() { invoked_peratom = update->ntimestep; if ((did_setup != invoked_peratom) || (update->eflag_global != invoked_peratom)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // collect contributions from ghost atoms diff --git a/src/TALLY/compute_heat_flux_tally.cpp b/src/TALLY/compute_heat_flux_tally.cpp index 2af809af22..47b9fb5681 100644 --- a/src/TALLY/compute_heat_flux_tally.cpp +++ b/src/TALLY/compute_heat_flux_tally.cpp @@ -29,10 +29,11 @@ using namespace LAMMPS_NS; ComputeHeatFluxTally::ComputeHeatFluxTally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute heat/flux/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute heat/flux/tally", error); igroup2 = group->find(arg[3]); - if (igroup2 == -1) error->all(FLERR, "Could not find compute heat/flux/tally second group ID"); + if (igroup2 == -1) + error->all(FLERR, "Could not find compute heat/flux/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; vector_flag = 1; @@ -204,7 +205,10 @@ void ComputeHeatFluxTally::compute_vector() { invoked_vector = update->ntimestep; if ((did_setup != invoked_vector) || (update->eflag_global != invoked_vector)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // collect contributions from ghost atoms diff --git a/src/TALLY/compute_heat_flux_virial_tally.cpp b/src/TALLY/compute_heat_flux_virial_tally.cpp index 29d409c660..7e4b27f361 100644 --- a/src/TALLY/compute_heat_flux_virial_tally.cpp +++ b/src/TALLY/compute_heat_flux_virial_tally.cpp @@ -29,11 +29,11 @@ using namespace LAMMPS_NS; ComputeHeatFluxVirialTally::ComputeHeatFluxVirialTally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute heat/flux/virial/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute heat/flux/virial/tally", error); igroup2 = group->find(arg[3]); if (igroup2 == -1) - error->all(FLERR, "Could not find compute heat/flux/virial/tally second group ID"); + error->all(FLERR, "Could not find compute heat/flux/virial/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; scalar_flag = 1; @@ -191,7 +191,10 @@ double ComputeHeatFluxVirialTally::compute_scalar() invoked_scalar = update->ntimestep; if ((did_setup != invoked_scalar) || (update->eflag_global != invoked_scalar)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // sum heat flux across procs double hflux = 0.0; @@ -210,7 +213,10 @@ void ComputeHeatFluxVirialTally::compute_peratom() { invoked_peratom = update->ntimestep; if ((did_setup != invoked_peratom) || (update->eflag_global != invoked_peratom)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // collect contributions from ghost atoms diff --git a/src/TALLY/compute_pe_mol_tally.cpp b/src/TALLY/compute_pe_mol_tally.cpp index b4f2ccd832..66e9972464 100644 --- a/src/TALLY/compute_pe_mol_tally.cpp +++ b/src/TALLY/compute_pe_mol_tally.cpp @@ -27,10 +27,11 @@ using namespace LAMMPS_NS; ComputePEMolTally::ComputePEMolTally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute pe/mol/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute pe/mol/tally", error); igroup2 = group->find(arg[3]); - if (igroup2 == -1) error->all(FLERR, "Could not find compute pe/mol/tally second group ID"); + if (igroup2 == -1) + error->all(FLERR, "Could not find compute pe/mol/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; vector_flag = 1; @@ -127,6 +128,9 @@ void ComputePEMolTally::compute_vector() if ((did_setup != invoked_vector) || (update->eflag_global != invoked_vector)) error->all(FLERR, "Energy was not tallied on needed timestep"); + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Energy was not tallied by pair style"); + // sum accumulated energies across procs MPI_Allreduce(etotal, vector, size_vector, MPI_DOUBLE, MPI_SUM, world); diff --git a/src/TALLY/compute_pe_tally.cpp b/src/TALLY/compute_pe_tally.cpp index d6af993afe..c2dd133016 100644 --- a/src/TALLY/compute_pe_tally.cpp +++ b/src/TALLY/compute_pe_tally.cpp @@ -28,10 +28,10 @@ using namespace LAMMPS_NS; ComputePETally::ComputePETally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute pe/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute pe/tally", error); igroup2 = group->find(arg[3]); - if (igroup2 == -1) error->all(FLERR, "Could not find compute pe/tally second group ID"); + if (igroup2 == -1) error->all(FLERR, "Could not find compute pe/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; scalar_flag = 1; @@ -169,6 +169,9 @@ double ComputePETally::compute_scalar() if ((did_setup != invoked_scalar) || (update->eflag_global != invoked_scalar)) error->all(FLERR, "Energy was not tallied on needed timestep"); + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Energy was not tallied by pair style"); + // sum accumulated energies across procs MPI_Allreduce(etotal, vector, size_peratom_cols, MPI_DOUBLE, MPI_SUM, world); @@ -185,6 +188,9 @@ void ComputePETally::compute_peratom() if ((did_setup != invoked_peratom) || (update->eflag_global != invoked_peratom)) error->all(FLERR, "Energy was not tallied on needed timestep"); + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Energy was not tallied by pair style"); + // collect contributions from ghost atoms if (force->newton_pair) { diff --git a/src/TALLY/compute_stress_tally.cpp b/src/TALLY/compute_stress_tally.cpp index f04640a2d2..b5b54c495c 100644 --- a/src/TALLY/compute_stress_tally.cpp +++ b/src/TALLY/compute_stress_tally.cpp @@ -29,10 +29,11 @@ using namespace LAMMPS_NS; ComputeStressTally::ComputeStressTally(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg < 4) error->all(FLERR, "Illegal compute stress/tally command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "compute stress/tally", error); igroup2 = group->find(arg[3]); - if (igroup2 == -1) error->all(FLERR, "Could not find compute stress/tally second group ID"); + if (igroup2 == -1) + error->all(FLERR, "Could not find compute stress/tally second group ID {}", arg[3]); groupbit2 = group->bitmask[igroup2]; scalar_flag = 1; @@ -201,7 +202,10 @@ double ComputeStressTally::compute_scalar() { invoked_scalar = update->ntimestep; if ((did_setup != invoked_scalar) || (update->eflag_global != invoked_scalar)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // sum accumulated forces across procs @@ -221,7 +225,10 @@ void ComputeStressTally::compute_peratom() { invoked_peratom = update->ntimestep; if ((did_setup != invoked_peratom) || (update->eflag_global != invoked_peratom)) - error->all(FLERR, "Energy was not tallied on needed timestep"); + error->all(FLERR, "Stress was not tallied on needed timestep"); + + if ((comm->me == 0) && !force->pair->did_tally_callback()) + error->warning(FLERR, "Stress was not tallied by pair style"); // collect contributions from ghost atoms diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index 75033684ae..3667180bc9 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -294,21 +294,15 @@ int DumpVTK::count() } // invoke Computes for per-atom quantities - // only if within a run or minimize - // else require that computes are current - // this prevents a compute from being invoked by the WriteDump class + // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->whichflag == 0) { - for (i = 0; i < ncompute; i++) - if (compute[i]->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in dump between runs is not current"); - } else { - for (i = 0; i < ncompute; i++) { - if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { - compute[i]->compute_peratom(); - compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; - } + if (update->first_update == 0) + error->all(FLERR,"Dump compute cannot be invoked before first run"); + for (i = 0; i < ncompute; i++) { + if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { + compute[i]->compute_peratom(); + compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; } } } diff --git a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp index 5266901318..dbbab7e5fe 100644 --- a/src/YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -165,7 +165,6 @@ void PairLJSwitch3CoulGaussLong::compute(int eflag, int vflag) // Correction for Gaussian radii if (lj2[itype][jtype]==0.0) { // This means a point charge is considered, so the correction is zero - expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; prefactor2 = 0.0; @@ -616,7 +615,6 @@ double PairLJSwitch3CoulGaussLong::single(int i, int j, int itype, int jtype, r6inv = r2inv*r2inv*r2inv; forcelj = r6inv*(12.0*lj3[itype][jtype]*r6inv-6.0*lj4[itype][jtype]); if (lj2[itype][jtype] == 0.0) { - expn2 = 0.0; erfc2 = 0.0; forcecoul2 = 0.0; prefactor2 = 0.0; diff --git a/src/atom.cpp b/src/atom.cpp index 87be0fa4b0..08e9639440 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -823,9 +823,9 @@ void Atom::modify_params(int narg, char **arg) if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify map", error); if (domain->box_exist) error->all(FLERR,"Atom_modify map command after simulation box is defined"); - if (strcmp(arg[iarg+1],"array") == 0) map_user = 1; - else if (strcmp(arg[iarg+1],"hash") == 0) map_user = 2; - else if (strcmp(arg[iarg+1],"yes") == 0) map_user = 3; + if (strcmp(arg[iarg+1],"array") == 0) map_user = MAP_ARRAY; + else if (strcmp(arg[iarg+1],"hash") == 0) map_user = MAP_HASH; + else if (strcmp(arg[iarg+1],"yes") == 0) map_user = MAP_YES; else error->all(FLERR,"Illegal atom_modify map command argument {}", arg[iarg+1]); map_style = map_user; iarg += 2; @@ -2129,14 +2129,18 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off // initialize custom per-atom properties to zero if present - for (int i = 0; i < nivector; ++i) ivector[i][ilocal] = 0; - for (int i = 0; i < ndvector; ++i) dvector[i][ilocal] = 0.0; + for (int i = 0; i < nivector; ++i) + if (ivname[i]) ivector[i][ilocal] = 0; + for (int i = 0; i < ndvector; ++i) + if (dvname[i]) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) - for (int j = 0; j < icols[i]; ++j) - iarray[i][ilocal][j] = 0; + if (ianame[i]) + for (int j = 0; j < icols[i]; ++j) + iarray[i][ilocal][j] = 0; for (int i = 0; i < ndarray; ++i) - for (int j = 0; j < dcols[i]; ++j) - darray[i][ilocal][j] = 0.0; + if (daname[i]) + for (int j = 0; j < dcols[i]; ++j) + darray[i][ilocal][j] = 0.0; if (molecular != Atom::MOLECULAR) return; @@ -2271,6 +2275,10 @@ void Atom::sort() for (i = 0; i < nbins; i++) binhead[i] = -1; + // for triclinic, atoms must be in box coords (not lamda) to match bbox + + if (domain->triclinic) domain->lamda2x(nlocal); + for (i = nlocal-1; i >= 0; i--) { ix = static_cast ((x[i][0]-bboxlo[0])*bininvx); iy = static_cast ((x[i][1]-bboxlo[1])*bininvy); @@ -2286,6 +2294,10 @@ void Atom::sort() binhead[ibin] = i; } + // convert back to lamda coords + + if (domain->triclinic) domain->x2lamda(nlocal); + // permute = desired permutation of atoms // permute[I] = J means Ith new atom will be Jth old atom diff --git a/src/atom.h b/src/atom.h index d2e8030108..548168ac59 100644 --- a/src/atom.h +++ b/src/atom.h @@ -312,7 +312,7 @@ class Atom : protected Pointers { void create_avec(const std::string &, int, char **, int); virtual AtomVec *new_avec(const std::string &, int, int &); - void init(); + virtual void init(); void setup(); std::string get_style(); @@ -366,8 +366,6 @@ class Atom : protected Pointers { virtual int add_custom(const char *, int, int); virtual void remove_custom(int, int, int); - virtual void sync_modify(ExecutionSpace, unsigned int, unsigned int) {} - void *extract(const char *); int extract_datatype(const char *); @@ -385,7 +383,7 @@ class Atom : protected Pointers { // map lookup function inlined for efficiency // return -1 if no map defined - inline int map(tagint global) + virtual inline int map(tagint global) { if (map_style == 1) return map_array[global]; @@ -398,10 +396,10 @@ class Atom : protected Pointers { virtual void map_init(int check = 1); virtual void map_clear(); virtual void map_set(); - void map_one(tagint, int); + virtual void map_one(tagint, int); int map_style_set(); virtual void map_delete(); - int map_find_hash(tagint); + virtual int map_find_hash(tagint); protected: // global to local ID mapping diff --git a/src/comm.h b/src/comm.h index 7bbf4a55b5..5d803c1afa 100644 --- a/src/comm.h +++ b/src/comm.h @@ -100,11 +100,8 @@ class Comm : protected Pointers { virtual void reverse_comm(class Dump *) = 0; // forward comm of an array - // exchange of info on neigh stencil - // set processor mapping options virtual void forward_comm_array(int, double **) = 0; - virtual int exchange_variable(int, double *, double *&) = 0; // map a point to a processor, based on current decomposition diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 921286a3da..08d372187e 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -1455,58 +1455,6 @@ void CommBrick::forward_comm_array(int nsize, double **array) } } -/* ---------------------------------------------------------------------- - exchange info provided with all 6 stencil neighbors -------------------------------------------------------------------------- */ - -int CommBrick::exchange_variable(int n, double *inbuf, double *&outbuf) -{ - int nsend,nrecv,nrecv1,nrecv2; - MPI_Request request; - - nrecv = n; - if (nrecv > maxrecv) grow_recv(nrecv); - memcpy(buf_recv,inbuf,nrecv*sizeof(double)); - - // loop over dimensions - - for (int dim = 0; dim < 3; dim++) { - - // no exchange if only one proc in a dimension - - if (procgrid[dim] == 1) continue; - - // send/recv info in both directions using same buf_recv - // if 2 procs in dimension, single send/recv - // if more than 2 procs in dimension, send/recv to both neighbors - - nsend = nrecv; - MPI_Sendrecv(&nsend,1,MPI_INT,procneigh[dim][0],0, - &nrecv1,1,MPI_INT,procneigh[dim][1],0,world,MPI_STATUS_IGNORE); - nrecv += nrecv1; - if (procgrid[dim] > 2) { - MPI_Sendrecv(&nsend,1,MPI_INT,procneigh[dim][1],0, - &nrecv2,1,MPI_INT,procneigh[dim][0],0,world,MPI_STATUS_IGNORE); - nrecv += nrecv2; - } else nrecv2 = 0; - - if (nrecv > maxrecv) grow_recv(nrecv); - - MPI_Irecv(&buf_recv[nsend],nrecv1,MPI_DOUBLE,procneigh[dim][1],0,world,&request); - MPI_Send(buf_recv,nsend,MPI_DOUBLE,procneigh[dim][0],0,world); - MPI_Wait(&request,MPI_STATUS_IGNORE); - - if (procgrid[dim] > 2) { - MPI_Irecv(&buf_recv[nsend+nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0,world,&request); - MPI_Send(buf_recv,nsend,MPI_DOUBLE,procneigh[dim][1],0,world); - MPI_Wait(&request,MPI_STATUS_IGNORE); - } - } - - outbuf = buf_recv; - return nrecv; -} - /* ---------------------------------------------------------------------- realloc the size of the send buffer as needed with BUFFACTOR and bufextra flag = 0, don't need to realloc with copy, just free/malloc w/ BUFFACTOR diff --git a/src/comm_brick.h b/src/comm_brick.h index 38483af9de..518e290fa1 100644 --- a/src/comm_brick.h +++ b/src/comm_brick.h @@ -45,7 +45,6 @@ class CommBrick : public Comm { void reverse_comm(class Dump *) override; // reverse comm from a Dump void forward_comm_array(int, double **) override; // forward comm of array - int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil void *extract(const char *, int &) override; double memory_usage() override; diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 4f6dac2b5e..f2d91c07fa 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -1848,17 +1848,6 @@ void CommTiled::forward_comm_array(int nsize, double **array) } } -/* ---------------------------------------------------------------------- - exchange info provided with all 6 stencil neighbors - NOTE: this method is currently not used -------------------------------------------------------------------------- */ - -int CommTiled::exchange_variable(int n, double * /*inbuf*/, double *& /*outbuf*/) -{ - int nrecv = n; - return nrecv; -} - /* ---------------------------------------------------------------------- determine overlap list of Noverlap procs the lo/hi box overlaps overlap = non-zero area in common between box and proc sub-domain diff --git a/src/comm_tiled.h b/src/comm_tiled.h index 526c6166a8..c9434e6164 100644 --- a/src/comm_tiled.h +++ b/src/comm_tiled.h @@ -45,7 +45,6 @@ class CommTiled : public Comm { void reverse_comm(class Dump *) override; // reverse comm from a Dump void forward_comm_array(int, double **) override; // forward comm of array - int exchange_variable(int, double *, double *&) override; // exchange on neigh stencil void coord2proc_setup() override; int coord2proc(double *, int &, int &, int &) override; diff --git a/src/compute.cpp b/src/compute.cpp index d7e8e8d5a4..dcad4954fc 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -36,11 +36,9 @@ int Compute::instance_total = 0; /* ---------------------------------------------------------------------- */ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : - Pointers(lmp), - id(nullptr), style(nullptr), - vector(nullptr), array(nullptr), vector_atom(nullptr), - array_atom(nullptr), vector_local(nullptr), array_local(nullptr), extlist(nullptr), - tlist(nullptr), vbiasall(nullptr) + Pointers(lmp), id(nullptr), style(nullptr), vector(nullptr), array(nullptr), + vector_atom(nullptr), array_atom(nullptr), vector_local(nullptr), array_local(nullptr), + extlist(nullptr), tlist(nullptr), vbiasall(nullptr) { instance_me = instance_total++; @@ -69,6 +67,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : pressatomflag = peatomflag = 0; create_attribute = 0; tempbias = 0; + scalar = 0.0; timeflag = 0; comm_forward = comm_reverse = 0; @@ -105,8 +104,8 @@ Compute::~Compute() { if (copymode) return; - delete [] id; - delete [] style; + delete[] id; + delete[] style; memory->destroy(tlist); } diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 933cf0af0c..53b8517c22 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -106,7 +106,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : } else if (val.which == ArgInfo::FIX) { auto ifix = modify->get_fix_by_id(val.id); - if (ifix) + if (!ifix) error->all(FLERR,"Fix ID {} for compute chunk/spread/atom does not exist", val.id); if (val.argindex == 0) { if (!ifix->vector_flag) diff --git a/src/compute_count_type.cpp b/src/compute_count_type.cpp new file mode 100644 index 0000000000..3cb2e6bc3a --- /dev/null +++ b/src/compute_count_type.cpp @@ -0,0 +1,400 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "compute_count_type.h" + +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "update.h" + +using namespace LAMMPS_NS; + +enum { ATOM, BOND, ANGLE, DIHEDRAL, IMPROPER }; + +/* ---------------------------------------------------------------------- */ + +ComputeCountType::ComputeCountType(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), count(nullptr), bcount_me(nullptr), bcount(nullptr) +{ + if (narg != 4) error->all(FLERR, "Incorrect number of args for compute count/type command"); + + // process args + + if (strcmp(arg[3], "atom") == 0) + mode = ATOM; + else if (strcmp(arg[3], "bond") == 0) + mode = BOND; + else if (strcmp(arg[3], "angle") == 0) + mode = ANGLE; + else if (strcmp(arg[3], "dihedral") == 0) + mode = DIHEDRAL; + else if (strcmp(arg[3], "improper") == 0) + mode = IMPROPER; + else + error->all(FLERR, "Invalid compute count/type keyword {}", arg[3]); + + // error check + + if (mode == BOND && !atom->nbondtypes) + error->all(FLERR, "Compute count/type bond command with no bonds defined"); + if (mode == ANGLE && !atom->nangletypes) + error->all(FLERR, "Compute count/type bond command with no angles defined"); + if (mode == DIHEDRAL && !atom->ndihedraltypes) + error->all(FLERR, "Compute count/type dihedral command with no dihedrals defined"); + if (mode == IMPROPER && !atom->nimpropertypes) + error->all(FLERR, "Compute count/type improper command with no impropers defined"); + + // set vector lengths + + if (mode == ATOM) { + vector_flag = 1; + size_vector = atom->ntypes; + extvector = 1; + } else if (mode == BOND) { + scalar_flag = vector_flag = 1; + size_vector = atom->nbondtypes; + extscalar = 1; + extvector = 1; + } else if (mode == ANGLE) { + vector_flag = 1; + size_vector = atom->nangletypes; + extvector = 1; + } else if (mode == DIHEDRAL) { + vector_flag = 1; + size_vector = atom->ndihedraltypes; + extvector = 1; + } else if (mode == IMPROPER) { + vector_flag = 1; + size_vector = atom->nimpropertypes; + extvector = 1; + } + + // output vector + + vector = new double[size_vector]; + + // work vectors + + count = new int[size_vector]; + bcount_me = new bigint[size_vector]; + bcount = new bigint[size_vector]; +} + +/* ---------------------------------------------------------------------- */ + +ComputeCountType::~ComputeCountType() +{ + delete[] vector; + + delete[] count; + delete[] bcount_me; + delete[] bcount; +} + +/* ---------------------------------------------------------------------- + only invoked for mode = BOND to count broken bonds + broken bonds have bond_type = 0 +---------------------------------------------------------------------- */ + +double ComputeCountType::compute_scalar() +{ + invoked_scalar = update->ntimestep; + + int *num_bond = atom->num_bond; + int **bond_type = atom->bond_type; + int nlocal = atom->nlocal; + + // count broken bonds with bond_type = 0 + // ignore group setting since 2 atoms in a broken bond + // can be arbitrarily far apart + + int count = 0; + for (int i = 0; i < nlocal; i++) { + int nbond = num_bond[i]; + for (int m = 0; m < nbond; m++) + if (bond_type[i][m] == 0) count++; + } + + // sum across procs as bigint, then convert to double + // correct for double counting if newton_bond off + + bigint bcount = 0; + bigint bcount_me = count; + MPI_Allreduce(&bcount_me, &bcount, 1, MPI_LMP_BIGINT, MPI_SUM, world); + if (force->newton_bond == 0) bcount /= 2; + + if (bcount > MAXDOUBLEINT) error->all(FLERR, "Compute count/type overflow"); + scalar = bcount; + return scalar; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeCountType::compute_vector() +{ + invoked_vector = update->ntimestep; + + int nvec; + + if (mode == ATOM) + nvec = count_atoms(); + else if (mode == BOND) + nvec = count_bonds(); + else if (mode == ANGLE) + nvec = count_angles(); + else if (mode == DIHEDRAL) + nvec = count_dihedrals(); + else if (mode == IMPROPER) + nvec = count_impropers(); + + // sum across procs as bigint, then convert to double + // correct for multiple counting if newton_bond off + + for (int m = 0; m < nvec; m++) bcount_me[m] = count[m]; + MPI_Allreduce(bcount_me, bcount, nvec, MPI_LMP_BIGINT, MPI_SUM, world); + + if (force->newton_bond == 0) { + if (mode == BOND) + for (int m = 0; m < nvec; m++) bcount[m] /= 2; + else if (mode == ANGLE) + for (int m = 0; m < nvec; m++) bcount[m] /= 3; + if (mode == DIHEDRAL || mode == IMPROPER) + for (int m = 0; m < nvec; m++) bcount[m] /= 4; + } + + for (int m = 0; m < nvec; m++) + if (bcount[m] > MAXDOUBLEINT) error->all(FLERR, "Compute count/type overflow"); + for (int m = 0; m < nvec; m++) vector[m] = bcount[m]; +} + +/* ---------------------------------------------------------------------- + count atoms by type + atom must be in group to be counted +---------------------------------------------------------------------- */ + +int ComputeCountType::count_atoms() +{ + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int ntypes = atom->ntypes; + + for (int m = 0; m < ntypes; m++) count[m] = 0; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) count[type[i] - 1]++; + + return ntypes; +} + +/* ---------------------------------------------------------------------- + count bonds by type + both atoms in bond must be in group to be counted + skip type = 0 bonds, they are counted by compute_scalar() + bond types can be negative, count them as if positive +---------------------------------------------------------------------- */ + +int ComputeCountType::count_bonds() +{ + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *num_bond = atom->num_bond; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int nbondtypes = atom->nbondtypes; + + int flag = 0; + for (int m = 0; m < nbondtypes; m++) count[m] = 0; + + for (int i = 0; i < nlocal; i++) { + int nbond = num_bond[i]; + for (int m = 0; m < nbond; m++) { + int itype = bond_type[i][m]; + if (itype == 0) continue; + + int j = atom->map(bond_atom[i][m]); + if (j < 0) { + flag = 1; + continue; + } + + if ((mask[i] & groupbit) && (mask[j] & groupbit)) { + if (itype > 0) + count[itype - 1]++; + else + count[-itype - 1]++; + } + } + } + + int flagany; + MPI_Allreduce(&flag, &flagany, 1, MPI_INT, MPI_SUM, world); + if (flagany) error->all(FLERR, "Missing bond atom in compute count/type"); + + return nbondtypes; +} + +/* ---------------------------------------------------------------------- + count angles by type + all 3 atoms in angle must be in group to be counted + angle types can be negative, count them as if positive +---------------------------------------------------------------------- */ + +int ComputeCountType::count_angles() +{ + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; + int **angle_type = atom->angle_type; + int *num_angle = atom->num_angle; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int nangletypes = atom->nangletypes; + + int flag = 0; + for (int m = 0; m < nangletypes; m++) count[m] = 0; + + for (int i = 0; i < nlocal; i++) { + int nangle = num_angle[i]; + for (int m = 0; m < nangle; m++) { + int itype = angle_type[i][m]; + + int j1 = atom->map(angle_atom1[i][m]); + int j2 = atom->map(angle_atom2[i][m]); + int j3 = atom->map(angle_atom3[i][m]); + if (j1 < 0 || j2 < 0 || j3 < 0) { + flag = 1; + continue; + } + + if ((mask[j1] & groupbit) && (mask[j2] & groupbit) && (mask[j3] & groupbit)) { + if (itype > 0) + count[itype - 1]++; + else if (itype < 0) + count[-itype - 1]++; + } + } + } + + int flagany; + MPI_Allreduce(&flag, &flagany, 1, MPI_INT, MPI_SUM, world); + if (flagany) error->all(FLERR, "Missing angle atom in compute count/type"); + + return nangletypes; +} + +/* ---------------------------------------------------------------------- + count dihedrals by type + all 4 atoms in dihedral must be in group to be counted + dihedral types can be negative, count them as if positive +---------------------------------------------------------------------- */ + +int ComputeCountType::count_dihedrals() +{ + tagint **dihedral_atom1 = atom->dihedral_atom1; + tagint **dihedral_atom2 = atom->dihedral_atom2; + tagint **dihedral_atom3 = atom->dihedral_atom3; + tagint **dihedral_atom4 = atom->dihedral_atom4; + int **dihedral_type = atom->dihedral_type; + int *num_dihedral = atom->num_dihedral; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int ndihedraltypes = atom->ndihedraltypes; + + int flag = 0; + for (int m = 0; m < ndihedraltypes; m++) count[m] = 0; + + for (int i = 0; i < nlocal; i++) { + int ndihedral = num_dihedral[i]; + for (int m = 0; m < ndihedral; m++) { + int itype = dihedral_type[i][m]; + + int j1 = atom->map(dihedral_atom1[i][m]); + int j2 = atom->map(dihedral_atom2[i][m]); + int j3 = atom->map(dihedral_atom3[i][m]); + int j4 = atom->map(dihedral_atom4[i][m]); + if (j1 < 0 || j2 < 0 || j3 < 0 || j4 < 0) { + flag = 1; + continue; + } + + if ((mask[j1] & groupbit) && (mask[j2] & groupbit) && (mask[j3] & groupbit) && + (mask[j4] & groupbit)) { + if (itype > 0) + count[itype - 1]++; + else if (itype < 0) + count[-itype - 1]++; + } + } + } + + int flagany; + MPI_Allreduce(&flag, &flagany, 1, MPI_INT, MPI_SUM, world); + if (flagany) error->all(FLERR, "Missing dihedral atom in compute count/type"); + + return ndihedraltypes; +} + +/* ---------------------------------------------------------------------- + count impropers by type + all 4 atoms in improper must be in group to be counted + improper types can be negative, count them as if positive +---------------------------------------------------------------------- */ + +int ComputeCountType::count_impropers() +{ + tagint **improper_atom1 = atom->improper_atom1; + tagint **improper_atom2 = atom->improper_atom2; + tagint **improper_atom3 = atom->improper_atom3; + tagint **improper_atom4 = atom->improper_atom4; + int **improper_type = atom->improper_type; + int *num_improper = atom->num_improper; + int *mask = atom->mask; + int nlocal = atom->nlocal; + int nimpropertypes = atom->nimpropertypes; + + int flag = 0; + for (int m = 0; m < nimpropertypes; m++) count[m] = 0; + + for (int i = 0; i < nlocal; i++) { + int nimproper = num_improper[i]; + for (int m = 0; m < nimproper; m++) { + int itype = improper_type[i][m]; + + int j1 = atom->map(improper_atom1[i][m]); + int j2 = atom->map(improper_atom2[i][m]); + int j3 = atom->map(improper_atom3[i][m]); + int j4 = atom->map(improper_atom4[i][m]); + if (j1 < 0 || j2 < 0 || j3 < 0 || j4 < 0) { + flag = 1; + continue; + } + + if ((mask[j1] & groupbit) && (mask[j2] & groupbit) && (mask[j3] & groupbit) && + (mask[j4] & groupbit)) { + if (itype > 0) + count[itype - 1]++; + else if (itype < 0) + count[-itype - 1]++; + } + } + } + + int flagany; + MPI_Allreduce(&flag, &flagany, 1, MPI_INT, MPI_SUM, world); + if (flagany) error->all(FLERR, "Missing improper atom in compute count/type"); + + return nimpropertypes; +} diff --git a/src/compute_count_type.h b/src/compute_count_type.h new file mode 100644 index 0000000000..b766edfae8 --- /dev/null +++ b/src/compute_count_type.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef COMPUTE_CLASS +// clang-format off +ComputeStyle(count/type,ComputeCountType); +// clang-format on +#else + +#ifndef LMP_COMPUTE_COMPUTE_TYPE_H +#define LMP_COMPUTE_COMPUTE_TYPE_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeCountType : public Compute { + public: + ComputeCountType(class LAMMPS *, int, char **); + ~ComputeCountType() override; + void init() override {} + double compute_scalar() override; + void compute_vector() override; + + protected: + int mode; + + int *count; + bigint *bcount_me; + bigint *bcount; + + int count_atoms(); + int count_bonds(); + int count_angles(); + int count_dihedrals(); + int count_impropers(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index 30b83c4996..2c90af5fc1 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -36,10 +36,9 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - vptr(nullptr), id_temp(nullptr), pstyle(nullptr) + Compute(lmp, narg, arg), vptr(nullptr), id_temp(nullptr), pstyle(nullptr) { - if (narg < 4) error->all(FLERR,"Illegal compute pressure command"); + if (narg < 4) utils::missing_cmd_args(FLERR,"compute pressure", error); if (igroup) error->all(FLERR,"Compute pressure must use group all"); scalar_flag = vector_flag = 1; @@ -52,16 +51,15 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by pressure computation // ensure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; - else { + if (strcmp(arg[3],"NULL") == 0) { + id_temp = nullptr; + } else { id_temp = utils::strdup(arg[3]); - - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Could not find compute pressure temperature ID"); - if (modify->compute[icompute]->tempflag == 0) - error->all(FLERR,"Compute pressure temperature ID does not " - "compute temperature"); + auto icompute = modify->get_compute_by_id(id_temp); + if (!icompute) + error->all(FLERR,"Could not find compute pressure temperature ID {}", id_temp); + if (!icompute->tempflag) + error->all(FLERR,"Compute pressure temperature ID {} does not compute temperature", id_temp); } // process optional args @@ -129,8 +127,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // error check if (keflag && id_temp == nullptr) - error->all(FLERR,"Compute pressure requires temperature ID " - "to include kinetic energy"); + error->all(FLERR,"Compute pressure requires temperature ID to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; @@ -141,10 +138,10 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : ComputePressure::~ComputePressure() { - delete [] id_temp; - delete [] vector; - delete [] vptr; - delete [] pstyle; + delete[] id_temp; + delete[] vector; + delete[] vptr; + delete[] pstyle; } /* ---------------------------------------------------------------------- */ @@ -159,10 +156,9 @@ void ComputePressure::init() // fixes could have changed or compute_modify could have changed it if (keflag) { - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Could not find compute pressure temperature ID"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR,"Could not find compute pressure temperature ID {}", id_temp); } // recheck if pair style with and without suffix exists @@ -348,6 +344,6 @@ void ComputePressure::virial_compute(int n, int ndiag) void ComputePressure::reset_extra_compute_fix(const char *id_new) { - delete [] id_temp; + delete[] id_temp; id_temp = utils::strdup(id_new); } diff --git a/src/domain.cpp b/src/domain.cpp index edca633508..3627af26cf 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1432,6 +1432,29 @@ void Domain::remap_near(double *xnew, double *xold) if (triclinic) lamda2x(coordnew,xnew); } +/* ---------------------------------------------------------------------- + remap the point to specific image flags + x overwritten with result, reset image flag + for triclinic, use h[] to add in tilt factors in other dims as needed +------------------------------------------------------------------------- */ + +void Domain::unmap_inv(double *x, imageint image) +{ + int xbox = (image & IMGMASK) - IMGMAX; + int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX; + int zbox = (image >> IMG2BITS) - IMGMAX; + + if (triclinic == 0) { + x[0] -= xbox*xprd; + x[1] -= ybox*yprd; + x[2] -= zbox*zprd; + } else { + x[0] -= h[0]*xbox + h[5]*ybox + h[4]*zbox; + x[1] -= h[1]*ybox + h[3]*zbox; + x[2] -= h[2]*zbox; + } +} + /* ---------------------------------------------------------------------- unmap the point via image flags x overwritten with result, don't reset image flag diff --git a/src/domain.h b/src/domain.h index da574bd46f..ab054f1b50 100644 --- a/src/domain.h +++ b/src/domain.h @@ -125,6 +125,7 @@ class Domain : protected Pointers { void remap(double *, imageint &); void remap(double *); void remap_near(double *, double *); + void unmap_inv(double *x, imageint); void unmap(double *, imageint); void unmap(const double *, imageint, double *); void image_flip(int, int, int); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 415bc4c7f0..33cfba2cef 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -61,12 +61,12 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) { - if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); + if (narg == 5) error->all(FLERR,"No dump {} arguments specified", style); clearstep = 1; nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal dump custom command"); + if (nevery <= 0) error->all(FLERR,"Illegal dump {} command: output frequency must be > 0", style); // expand args if any have wildcard character "*" // ok to include trailing optional args, @@ -141,7 +141,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::BIGINT) cols += BIGINT_FORMAT " "; vformat[i] = nullptr; } - cols.resize(cols.size()-1); + if (nfield > 0) cols.resize(cols.size()-1); format_default = utils::strdup(cols); format_column_user = new char*[nfield]; @@ -309,20 +309,20 @@ void DumpCustom::init_style() for (i = 0; i < ncompute; i++) { compute[i] = modify->get_compute_by_id(id_compute[i]); - if (!compute[i]) error->all(FLERR,"Could not find dump custom compute ID {}",id_compute[i]); + if (!compute[i]) error->all(FLERR,"Could not find dump {} compute ID {}",style,id_compute[i]); } for (i = 0; i < nfix; i++) { fix[i] = modify->get_fix_by_id(id_fix[i]); - if (!fix[i]) error->all(FLERR,"Could not find dump custom fix ID {}", id_fix[i]); + if (!fix[i]) error->all(FLERR,"Could not find dump {} fix ID {}", style, id_fix[i]); if (nevery % fix[i]->peratom_freq) - error->all(FLERR,"Dump custom and fix not computed at compatible times"); + error->all(FLERR,"Dump {} and fix not computed at compatible times", style); } for (i = 0; i < nvariable; i++) { int ivariable = input->variable->find(id_variable[i]); if (ivariable < 0) - error->all(FLERR,"Could not find dump custom variable name {}", id_variable[i]); + error->all(FLERR,"Could not find dump {} variable name {}", style, id_variable[i]); variable[i] = ivariable; } @@ -330,7 +330,7 @@ void DumpCustom::init_style() for (int i = 0; i < ncustom; i++) { icustom = atom->find_custom(id_custom[i],flag,cols); if (icustom < 0) - error->all(FLERR,"Could not find dump custom atom property name"); + error->all(FLERR,"Could not find dump {} atom property name", style); custom[i] = icustom; if (!flag && !cols) custom_flag[i] = IVEC; else if (flag && !cols) custom_flag[i] = DVEC; @@ -341,7 +341,7 @@ void DumpCustom::init_style() // check validity of region if (idregion && !domain->get_region_by_id(idregion)) - error->all(FLERR,"Region {} for dump custom does not exist", idregion); + error->all(FLERR,"Region {} for dump {} does not exist", idregion, style); // open single file, one time only @@ -556,21 +556,15 @@ int DumpCustom::count() } // invoke Computes for per-atom quantities - // only if within a run or minimize - // else require that computes are current - // this prevents a compute from being invoked by the WriteDump class + // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->whichflag == 0) { - for (i = 0; i < ncompute; i++) - if (compute[i]->invoked_peratom != update->ntimestep) - error->all(FLERR,"Compute used in dump between runs is not current"); - } else { - for (i = 0; i < ncompute; i++) { - if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { - compute[i]->compute_peratom(); - compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; - } + if (update->first_update == 0) + error->all(FLERR,"Dump compute cannot be invoked before first run"); + for (i = 0; i < ncompute; i++) { + if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) { + compute[i]->compute_peratom(); + compute[i]->invoked_flag |= Compute::INVOKED_PERATOM; } } } @@ -1467,7 +1461,8 @@ int DumpCustom::parse_fields(int narg, char **arg) switch (argi.get_type()) { case ArgInfo::UNKNOWN: - error->all(FLERR,"Invalid attribute in dump custom command"); + case ArgInfo::NONE: + error->all(FLERR,"Invalid attribute {} in dump {} command",arg[iarg],style); break; // compute value = c_ID @@ -1478,15 +1473,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; icompute = modify->get_compute_by_id(name); - if (!icompute) error->all(FLERR,"Could not find dump custom compute ID: {}",name); + if (!icompute) error->all(FLERR,"Could not find dump {} compute ID: {}", style, name); if (icompute->peratom_flag == 0) - error->all(FLERR,"Dump custom compute {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} compute {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && icompute->size_peratom_cols > 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom vector",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom vector", style, name); if (argi.get_dim() > 0 && icompute->size_peratom_cols == 0) - error->all(FLERR,"Dump custom compute {} does not calculate per-atom array",name); + error->all(FLERR,"Dump {} compute {} does not calculate per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > icompute->size_peratom_cols) - error->all(FLERR,"Dump custom compute {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} compute {} vector is accessed out-of-range", style, name); field2index[iarg] = add_compute(name); break; @@ -1499,15 +1494,15 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; ifix = modify->get_fix_by_id(name); - if (!ifix) error->all(FLERR,"Could not find dump custom fix ID: {}",name); + if (!ifix) error->all(FLERR,"Could not find dump {} fix ID: {}", style, name); if (ifix->peratom_flag == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom info",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom info", style, name); if (argi.get_dim() == 0 && ifix->size_peratom_cols > 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom vector",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom vector", style, name); if (argi.get_dim() > 0 && ifix->size_peratom_cols == 0) - error->all(FLERR,"Dump custom fix {} does not compute per-atom array",name); + error->all(FLERR,"Dump {} fix {} does not compute per-atom array", style, name); if (argi.get_dim() > 0 && argi.get_index1() > ifix->size_peratom_cols) - error->all(FLERR,"Dump custom fix {} vector is accessed out-of-range",name); + error->all(FLERR,"Dump {} fix {} vector is accessed out-of-range", style, name); field2index[iarg] = add_fix(name); break; @@ -1519,9 +1514,9 @@ int DumpCustom::parse_fields(int narg, char **arg) vtype[iarg] = Dump::DOUBLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump custom variable name {}",name); + if (n < 0) error->all(FLERR,"Could not find dump {} variable name {}", style, name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump custom variable {} is not atom-style variable",name); + error->all(FLERR,"Dump {} variable {} is not atom-style variable", style, name); field2index[iarg] = add_variable(name); break; @@ -1538,12 +1533,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector {} for dump custom does not exist",name); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); } else { if (!flag || !cols) - error->all(FLERR,"Property double array {} for dump custom does not exist",name); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,1); @@ -1561,12 +1556,12 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[iarg] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector {} for dump custom does not exist",name); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); } else { if (flag || !cols) - error->all(FLERR,"Property integer array {} for dump custom does not exist",name); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[iarg] > atom->icols[n]) - error->all(FLERR,"Dump custom property array {} is accessed out-of-range",name); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); } field2index[iarg] = add_custom(name,0); @@ -1951,9 +1946,9 @@ int DumpCustom::modify_param(int narg, char **arg) case ArgInfo::VARIABLE: thresh_array[nthresh] = VARIABLE; n = input->variable->find(name); - if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}",name); + if (n < 0) error->all(FLERR,"Could not find dump modify variable name: {}", name); if (input->variable->atomstyle(n) == 0) - error->all(FLERR,"Dump modify variable {} is not atom-style variable",name); + error->all(FLERR,"Dump modify variable {} is not atom-style variable", name); field2index[nfield+nthresh] = add_variable(name); break; @@ -1967,13 +1962,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (!flag || cols) - error->all(FLERR,"Property double vector for dump custom does not exist"); + error->all(FLERR,"Property double vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = DVEC; } else { if (!flag || !cols) - error->all(FLERR,"Property double array for dump custom does not exist"); + error->all(FLERR,"Property double array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->dcols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = DARRAY; } @@ -1989,13 +1984,13 @@ int DumpCustom::modify_param(int narg, char **arg) error->all(FLERR,"Could not find custom per-atom property ID: {}", name); if (argindex[nfield+nthresh] == 0) { if (flag || cols) - error->all(FLERR,"Property integer vector for dump custom does not exist"); + error->all(FLERR,"Property integer vector {} for dump {} does not exist", name, style); thresh_array[nthresh] = IVEC; } else { if (flag || !cols) - error->all(FLERR,"Property integer array for dump custom does not exist"); + error->all(FLERR,"Property integer array {} for dump {} does not exist", name, style); if (argindex[nfield+nthresh] > atom->icols[n]) - error->all(FLERR,"Dump custom property array is accessed out-of-range"); + error->all(FLERR,"Dump {} property array {} is accessed out-of-range", style, name); thresh_array[nthresh] = IARRAY; } @@ -2005,7 +2000,7 @@ int DumpCustom::modify_param(int narg, char **arg) // no match default: - error->all(FLERR,"Invalid dump_modify thresh attribute: {}",name); + error->all(FLERR,"Invalid dump_modify thresh attribute: {}", name); break; } } diff --git a/src/dump_grid.cpp b/src/dump_grid.cpp index 2ca4f6c5d4..056cac1095 100644 --- a/src/dump_grid.cpp +++ b/src/dump_grid.cpp @@ -522,21 +522,15 @@ int DumpGrid::count() } // invoke Computes for per-grid quantities - // only if within a run or minimize - // else require that computes are current - // this prevents a compute from being invoked by the WriteDump class + // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->whichflag == 0) { - for (i = 0; i < ncompute; i++) - if (compute[i]->invoked_pergrid != update->ntimestep) - error->all(FLERR,"Compute {} used in dump between runs is not current", compute[i]->id); - } else { - for (i = 0; i < ncompute; i++) { - if (!(compute[i]->invoked_flag & Compute::INVOKED_PERGRID)) { - compute[i]->compute_pergrid(); - compute[i]->invoked_flag |= Compute::INVOKED_PERGRID; - } + if (update->first_update == 0) + error->all(FLERR,"Dump compute cannot be invoked before first run"); + for (i = 0; i < ncompute; i++) { + if (!(compute[i]->invoked_flag & Compute::INVOKED_PERGRID)) { + compute[i]->compute_pergrid(); + compute[i]->invoked_flag |= Compute::INVOKED_PERGRID; } } } diff --git a/src/dump_image.cpp b/src/dump_image.cpp index aea052046e..0d54c60595 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -201,7 +201,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (iflag == ArgInfo::COMPUTE) id_grid_compute = utils::strdup(id); else if (iflag == ArgInfo::FIX) id_grid_fix = utils::strdup(id); - delete [] id; + delete[] id; grid_igrid = igrid; grid_idata = idata; grid_index = index; @@ -461,18 +461,18 @@ DumpImage::~DumpImage() { delete image; - delete [] diamtype; - delete [] diamelement; - delete [] colortype; - delete [] colorelement; - delete [] bdiamtype; - delete [] bcolortype; + delete[] diamtype; + delete[] diamelement; + delete[] colortype; + delete[] colorelement; + delete[] bdiamtype; + delete[] bcolortype; memory->destroy(chooseghost); memory->destroy(bufcopy); memory->destroy(gbuf); - delete [] id_grid_compute; - delete [] id_grid_fix; + delete[] id_grid_compute; + delete[] id_grid_fix; } /* ---------------------------------------------------------------------- */ @@ -664,20 +664,14 @@ void DumpImage::write() } // invoke Compute for per-grid quantities - // only if within a run or minimize - // else require the compute is current - // this prevents the compute from being invoked by the WriteDump class + // cannot invoke before first run, otherwise invoke if necessary if (grid_compute) { - if (update->whichflag == 0) { - if (grid_compute->invoked_pergrid != update->ntimestep) - error->all(FLERR,"Grid compute {} used in dump image between runs is not current", - grid_compute->id); - } else { - if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) { - grid_compute->compute_pergrid(); - grid_compute->invoked_flag |= Compute::INVOKED_PERGRID; - } + if (update->first_update == 0) + error->all(FLERR,"Grid compute used in dump image cannot be invoked before first run"); + if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) { + grid_compute->compute_pergrid(); + grid_compute->invoked_flag |= Compute::INVOKED_PERGRID; } } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 9c18b7f94f..097589ea41 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -325,21 +325,15 @@ int DumpLocal::count() int i; // invoke Computes for local quantities - // only if within a run or minimize - // else require that computes are current - // this prevents a compute from being invoked by the WriteDump class + // cannot invoke before first run, otherwise invoke if necessary if (ncompute) { - if (update->whichflag == 0) { - for (i = 0; i < ncompute; i++) - if (compute[i]->invoked_local != update->ntimestep) - error->all(FLERR,"Compute used in dump between runs is not current"); - } else { - for (i = 0; i < ncompute; i++) { - if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) { - compute[i]->compute_local(); - compute[i]->invoked_flag |= Compute::INVOKED_LOCAL; - } + if (update->first_update == 0) + error->all(FLERR,"Dump compute cannot be invoked before first run"); + for (i = 0; i < ncompute; i++) { + if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) { + compute[i]->compute_local(); + compute[i]->invoked_flag |= Compute::INVOKED_LOCAL; } } } diff --git a/src/fix.cpp b/src/fix.cpp index 1d41ad3943..82389ba433 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -102,15 +102,15 @@ Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : vflag_atom = cvflag_atom = 0; centroidstressflag = CENTROID_SAME; - // KOKKOS per-fix data masks + // KOKKOS package execution_space = Host; datamask_read = ALL_MASK; datamask_modify = ALL_MASK; - kokkosable = 0; - forward_comm_device = exchange_comm_device = 0; - copymode = 0; + kokkosable = copymode = 0; + forward_comm_device = exchange_comm_device = sort_device = 0; + fuse_integrate_flag = 0; } /* ---------------------------------------------------------------------- */ @@ -145,13 +145,13 @@ void Fix::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); thermo_energy = utils::logical(FLERR,arg[iarg+1],false,lmp); if (thermo_energy && !energy_global_flag && !energy_peratom_flag) - error->all(FLERR,"Illegal fix_modify command"); + error->all(FLERR,"Fix {} {} does not support fix_modify energy command", id, style); iarg += 2; } else if (strcmp(arg[iarg],"virial") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); thermo_virial = utils::logical(FLERR,arg[iarg+1],false,lmp); if (thermo_virial && !virial_global_flag && !virial_peratom_flag) - error->all(FLERR,"Illegal fix_modify command"); + error->all(FLERR,"Fix {} {} does not support fix_modify virial command", id, style); iarg += 2; } else if (strcmp(arg[iarg],"respa") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); diff --git a/src/fix.h b/src/fix.h index b47cfb2f4a..30373ab6f2 100644 --- a/src/fix.h +++ b/src/fix.h @@ -127,11 +127,13 @@ class Fix : protected Pointers { int restart_reset; // 1 if restart just re-initialized fix - // KOKKOS host/device flag and data masks + // KOKKOS flags and variables int kokkosable; // 1 if Kokkos fix int forward_comm_device; // 1 if forward comm on Device int exchange_comm_device; // 1 if exchange comm on Device + int fuse_integrate_flag; // 1 if can fuse initial integrate with final integrate + int sort_device; // 1 if sort on Device ExecutionSpace execution_space; unsigned int datamask_read, datamask_modify; @@ -160,6 +162,7 @@ class Fix : protected Pointers { virtual void pre_reverse(int, int) {} virtual void post_force(int) {} virtual void final_integrate() {} + virtual void fused_integrate(int) {} virtual void end_of_step() {} virtual void post_run() {} virtual void write_restart(FILE *) {} diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 5c60fbab2d..4920d57f4a 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -103,6 +103,11 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : maxatom = 1; memory->create(sforce, maxatom, 4, "addforce:sforce"); + + // KOKKOS package + + datamask_read = X_MASK | F_MASK | MASK_MASK | IMAGE_MASK; + datamask_modify = F_MASK; } /* ---------------------------------------------------------------------- */ @@ -121,8 +126,6 @@ FixAddForce::~FixAddForce() int FixAddForce::setmask() { - datamask_read = datamask_modify = 0; - int mask = 0; mask |= POST_FORCE; mask |= POST_FORCE_RESPA; @@ -238,9 +241,6 @@ void FixAddForce::post_force(int vflag) v_init(vflag); - if (lmp->kokkos) - atom->sync_modify(Host, (unsigned int) (F_MASK | MASK_MASK), (unsigned int) F_MASK); - // update region if necessary if (region) region->prematch(); diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index d1765ed536..d01a498d39 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), - idregion(nullptr), region(nullptr), efield(nullptr) + pstr(nullptr), idregion(nullptr), region(nullptr), efield(nullptr) { if (narg < 6) utils::missing_cmd_args(FLERR, std::string("fix ") + style, error); @@ -58,7 +58,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_global_flag = virial_peratom_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = nullptr; + xstyle = ystyle = zstyle = estyle = pstyle = NONE; if (utils::strmatch(arg[3], "^v_")) { xstr = utils::strdup(arg[3] + 2); @@ -100,11 +100,22 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); iarg += 2; + } else if (strcmp(arg[iarg], "potential") == 0) { + if (iarg + 2 > narg) + utils::missing_cmd_args(FLERR, std::string("fix ") + style + "potential", error); + if (utils::strmatch(arg[iarg + 1], "^v_")) { + pstr = utils::strdup(arg[iarg + 1] + 2); + } else + error->all(FLERR, "Unsupported argument for fix {} energy command: {}", style, arg[iarg]); + iarg += 2; } else { error->all(FLERR, "Unknown keyword for fix {} command: {}", style, arg[iarg]); } } + if (estr && pstr) + error->all(FLERR, "Must not use energy and potential keywords at the same time with fix efield"); + force_flag = 0; fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; @@ -122,6 +133,7 @@ FixEfield::~FixEfield() delete[] ystr; delete[] zstr; delete[] estr; + delete[] pstr; delete[] idregion; memory->destroy(efield); } @@ -157,43 +169,54 @@ void FixEfield::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", xstr, style); + if (xvar < 0) error->all(FLERR, "Variable {} for x-field in fix {} does not exist", xstr, style); if (input->variable->equalstyle(xvar)) xstyle = EQUAL; else if (input->variable->atomstyle(xvar)) xstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", xstr, style); + error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style); } + if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", ystr, style); + if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style); if (input->variable->equalstyle(yvar)) ystyle = EQUAL; else if (input->variable->atomstyle(yvar)) ystyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", ystr, style); + error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style); } + if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", zstr, style); + if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style); if (input->variable->equalstyle(zvar)) zstyle = EQUAL; else if (input->variable->atomstyle(zvar)) zstyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", zstr, style); + error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style); } + if (estr) { evar = input->variable->find(estr); - if (evar < 0) error->all(FLERR, "Variable {} for fix {} does not exist", estr, style); + if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style); if (input->variable->atomstyle(evar)) estyle = ATOM; else - error->all(FLERR, "Variable {} for fix {} is invalid style", estr, style); - } else - estyle = NONE; + error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style); + } + + if (pstr) { + pvar = input->variable->find(pstr); + if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style); + if (input->variable->atomstyle(pvar)) + pstyle = ATOM; + else + error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style); + } // set index and check validity of region @@ -217,8 +240,10 @@ void FixEfield::init() if (varflag == CONSTANT && estyle != NONE) error->all(FLERR, "Cannot use variable energy with constant efield in fix {}", style); - if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE) - error->all(FLERR, "Must use variable energy with fix {}", style); + if (varflag == CONSTANT && pstyle != NONE) + error->all(FLERR, "Cannot use variable potential with constant efield in fix {}", style); + if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE && pstyle == NONE) + error->all(FLERR, "Must use variable energy or potential with fix {} during minimization", style); if (utils::strmatch(update->integrate_style, "^respa")) { ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; @@ -346,26 +371,7 @@ void FixEfield::post_force(int vflag) } else { - modify->clearstep_compute(); - - if (xstyle == EQUAL) { - ex = qe2f * input->variable->compute_equal(xvar); - } else if (xstyle == ATOM) { - input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); - } - if (ystyle == EQUAL) { - ey = qe2f * input->variable->compute_equal(yvar); - } else if (ystyle == ATOM) { - input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); - } - if (zstyle == EQUAL) { - ez = qe2f * input->variable->compute_equal(zvar); - } else if (zstyle == ATOM) { - input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); - } - if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); - - modify->addstep_compute(update->ntimestep + 1); + update_efield_variables(); // charge interactions // force = qE @@ -395,7 +401,8 @@ void FixEfield::post_force(int vflag) } f[i][2] += fz; fsum[3] += fz; - if (estyle == ATOM) fsum[0] += efield[0][3]; + if (pstyle == ATOM) fsum[0] += qe2f * q[i] * efield[i][3]; + else if (estyle == ATOM) fsum[0] += efield[i][3]; } } @@ -470,3 +477,33 @@ double FixEfield::compute_vector(int n) } return fsum_all[n + 1]; } + +/* ---------------------------------------------------------------------- + update efield variables without doing anything else + called by fix_qeq_reaxff +------------------------------------------------------------------------- */ + +void FixEfield::update_efield_variables() +{ + modify->clearstep_compute(); + + if (xstyle == EQUAL) { + ex = qe2f * input->variable->compute_equal(xvar); + } else if (xstyle == ATOM) { + input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); + } + if (ystyle == EQUAL) { + ey = qe2f * input->variable->compute_equal(yvar); + } else if (ystyle == ATOM) { + input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); + } + if (zstyle == EQUAL) { + ez = qe2f * input->variable->compute_equal(zvar); + } else if (zstyle == ATOM) { + input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); + } + if (pstyle == ATOM) input->variable->compute_atom(pvar, igroup, &efield[0][3], 4, 0); + else if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); + + modify->addstep_compute(update->ntimestep + 1); +} diff --git a/src/fix_efield.h b/src/fix_efield.h index 52c827bb50..72fd204898 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -46,10 +46,11 @@ class FixEfield : public Fix { protected: double ex, ey, ez; int varflag; - char *xstr, *ystr, *zstr, *estr; + char *xstr, *ystr, *zstr, *estr, *pstr; char *idregion; class Region *region; - int xvar, yvar, zvar, evar, xstyle, ystyle, zstyle, estyle; + int xvar, yvar, zvar, xstyle, ystyle, zstyle; + int evar, pvar, estyle, pstyle; int ilevel_respa; double qe2f; int qflag, muflag; @@ -59,6 +60,7 @@ class FixEfield : public Fix { int force_flag; double fsum[4], fsum_all[4]; + void update_efield_variables(); }; } // namespace LAMMPS_NS #endif diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index adfa651147..35bffb24fa 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -203,7 +203,7 @@ FixLangevin::~FixLangevin() if (gjfflag) { memory->destroy(franprev); memory->destroy(lv); - atom->delete_callback(id, Atom::GROW); + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); } } @@ -215,7 +215,7 @@ int FixLangevin::setmask() if (gjfflag) mask |= INITIAL_INTEGRATE; mask |= POST_FORCE; mask |= POST_FORCE_RESPA; - mask |= END_OF_STEP; + if (tallyflag || gjfflag) mask |= END_OF_STEP; return mask; } @@ -915,8 +915,6 @@ void FixLangevin::angmom_thermostat() void FixLangevin::end_of_step() { - if (!tallyflag && !gjfflag) return; - double **v = atom->v; int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/fix_pair.cpp b/src/fix_pair.cpp index 81e62ba966..66212684a8 100644 --- a/src/fix_pair.cpp +++ b/src/fix_pair.cpp @@ -283,11 +283,14 @@ void FixPair::post_force(int /*vflag*/) } else { double **parray = (double **) pvoid; - for (int i = 0; i < nlocal; i++) + int icoltmp = icol; + for (int i = 0; i < nlocal; i++) { + icol = icoltmp; for (int m = 0; m < columns; m++) { array[i][icol] = parray[i][m]; icol++; } + } } } diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index da49b3dbdb..e27a4560f0 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -491,7 +491,7 @@ int FixPressBerendsen::modify_param(int narg, char **arg) id_press = utils::strdup(arg[1]); pressure = modify->get_compute_by_id(arg[1]); - if (pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); + if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2; diff --git a/src/fmt/core.h b/src/fmt/core.h index 0634f94412..86d60485f2 100644 --- a/src/fmt/core.h +++ b/src/fmt/core.h @@ -1742,7 +1742,14 @@ constexpr auto encode_types() -> unsigned long long { template FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value { +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 1300 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdangling-reference" const auto& arg = arg_mapper().map(FMT_FORWARD(val)); +# pragma GCC diagnostic pop +#else + const auto& arg = arg_mapper().map(FMT_FORWARD(val)); +#endif constexpr bool formattable_char = !std::is_same::value; diff --git a/src/lammps.cpp b/src/lammps.cpp index 4ce23f0ba2..eb7915487b 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -132,6 +132,12 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : num_ver = utils::date2num(version); restart_ver = -1; + // append git descriptor info to update string when compiling development or maintenance version + + std::string update_string = UPDATE_STRING; + if (has_git_info() && (update_string == " - Development") || (update_string == " - Maintenance")) + update_string += fmt::format(" - {}", git_descriptor()); + external_comm = 0; mdicomm = nullptr; @@ -524,7 +530,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (infile == nullptr) error->one(FLERR,"Cannot open input script {}: {}", arg[inflag], utils::getsyserror()); if (!helpflag) - utils::logmesg(this,fmt::format("LAMMPS ({}{})\n",version,UPDATE_STRING)); + utils::logmesg(this,fmt::format("LAMMPS ({}{})\n", version, update_string)); // warn against using I/O redirection in parallel runs if ((inflag == 0) && (universe->nprocs > 1)) diff --git a/src/library.cpp b/src/library.cpp index 135f7d65ef..6ceaa28449 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -238,6 +238,8 @@ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function is a version of :cpp:func:`lammps_open`, that uses an integer for the MPI communicator as the MPI Fortran interface does. It is used in the :f:func:`lammps` constructor of the LAMMPS Fortran @@ -248,8 +250,6 @@ communicator with ``MPI_Comm_f2c()`` and then calls If for some reason the creation or initialization of the LAMMPS instance fails a null pointer is returned. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran`, :cpp:func:`lammps_open_no_mpi` @@ -295,13 +295,13 @@ void lammps_close(void *handle) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application must call ``MPI_Init()`` exactly once before performing any other MPI function calls. This function checks, whether MPI is already initialized and calls ``MPI_Init()`` in case it is not. -.. versionadded:: 18Sep2020 - \endverbatim */ void lammps_mpi_init() @@ -324,6 +324,8 @@ void lammps_mpi_init() * \verbatim embed:rst +.. versionadded:: 18Sep2020 + The MPI standard requires that any MPI application calls ``MPI_Finalize()`` before exiting. Even if a calling program does not do any MPI calls, MPI is still initialized internally to avoid errors @@ -332,8 +334,6 @@ before exiting the program to wait until all (parallel) tasks are completed and then MPI is cleanly shut down. After calling this function no more MPI calls may be made. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_kokkos_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -357,6 +357,8 @@ void lammps_mpi_finalize() * \verbatim embed:rst +.. versionadded:: 2Jul2021 + The Kokkos library may only be initialized once during the execution of a process. This is done automatically the first time Kokkos functionality is used. This requires that the Kokkos environment @@ -364,8 +366,6 @@ must be explicitly shut down after any LAMMPS instance using it is closed (to release associated resources). After calling this function no Kokkos functionality may be used. -.. versionadded:: 2Jul2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_python_finalize` \endverbatim */ @@ -381,6 +381,8 @@ void lammps_kokkos_finalize() * \verbatim embed:rst +.. versionadded:: 20Sep2021 + This function resets and clears an embedded Python environment by calling the `Py_Finalize() function `_ @@ -400,8 +402,6 @@ after calling Py_Finalize(). This function can be called to explicitly clear the Python environment in case it is safe to do so. -.. versionadded:: 20Sep2021 - *See also* :cpp:func:`lammps_mpi_finalize`, :cpp:func:`lammps_kokkos_finalize` \endverbatim */ @@ -418,6 +418,8 @@ void lammps_python_finalize() * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function is a wrapper around functions in the ``Error`` to print an error message and then stop LAMMPS. @@ -426,8 +428,6 @@ of constants from :cpp:enum:`_LMP_ERROR_CONST`. If the value does not match any valid combination of constants a warning is printed and the function returns. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -708,14 +708,16 @@ double lammps_get_natoms(void *handle) /* ---------------------------------------------------------------------- */ -/** Get current value of a thermo keyword. +/** Evaluate a thermo keyword. * \verbatim embed:rst -This function returns the current value of a :doc:`thermo keyword -`. Unlike :cpp:func:`lammps_extract_global` it does not -give access to the storage of the desired data but returns its value as -a ``double``, so it can also return information that is computed on-the-fly. +This function returns the current value of a :doc:`thermo keyword `. +Unlike :cpp:func:`lammps_extract_global` it does not give access to the +storage of the desired data but returns its value as a ``double``, so it +can also return information that is computed on-the-fly. +Use :cpp:func:`lammps_last_thermo` to get access to the cached data from +the last thermo output. \endverbatim * @@ -739,6 +741,106 @@ double lammps_get_thermo(void *handle, const char *keyword) /* ---------------------------------------------------------------------- */ +/** Access cached data from last thermo output + * +\verbatim embed:rst + +.. versionadded:: 15Jun2023 + +This function provides access to cached data from the last thermo output. +This differs from :cpp:func:`lammps_get_thermo` in that it does not trigger +an evaluation. Instead it provides direct access to a read-only location +of the last thermo output data and the corresponding keyword strings. +The how to handle the return value depends on the value of the *what* +argument string. + +.. note:: + + The *type* property points to a static location that is reassigned + with every call, so the returned pointer should be recast, + dereferenced, and assigned immediately. Otherwise, its value may be + changed with the next invocation of the function. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Value of *what* + - Description of return value + - Data type + - Uses index + * - step + - timestep when the last thermo output was generated or -1 + - pointer to bigint + - no + * - num + - number of fields in thermo output + - pointer to int + - no + * - keyword + - column keyword for thermo output + - pointer to 0-terminated const char array + - yes + * - type + - data type of thermo output column; see :cpp:enum:`_LMP_DATATYPE_CONST` + - pointer to int + - yes + * - data + - actual field data for column + - pointer to int, int64_t or double + - yes + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param what string with the kind of data requested + * \param index integer with index into data arrays, ignored for scalar data + * \return pointer to location of requested data cast to void or NULL */ + +void *lammps_last_thermo(void *handle, const char *what, int index) +{ + auto lmp = (LAMMPS *) handle; + void *val = nullptr; + Thermo *th = lmp->output->thermo; + if (!th) return nullptr; + const int nfield = *th->get_nfield(); + + BEGIN_CAPTURE + { + if (strcmp(what, "step") == 0) { + val = (void *) th->get_timestep(); + + } else if (strcmp(what, "num") == 0) { + val = (void *) th->get_nfield(); + + } else if (strcmp(what, "keyword") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &keywords = th->get_keywords(); + val = (void *) keywords[index].c_str(); + + } else if (strcmp(what, "type") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; + val = (void *) &field.type; + } else if (strcmp(what, "data") == 0) { + if ((index < 0) || (index >= nfield)) return nullptr; + const auto &field = th->get_fields()[index]; + if (field.type == multitype::LAMMPS_INT) { + val = (void *) &field.data.i; + } else if (field.type == multitype::LAMMPS_INT64) { + val = (void *) &field.data.b; + } else if (field.type == multitype::LAMMPS_DOUBLE) { + val = (void *) &field.data.d; + } + + } else val = nullptr; + } + END_CAPTURE + return val; +} + +/* ---------------------------------------------------------------------- */ + /** Extract simulation box parameters. * \verbatim embed:rst @@ -866,6 +968,8 @@ void lammps_reset_box(void *handle, double *boxlo, double *boxhi, * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function will retrieve memory usage information for the current LAMMPS instance or process. The *meminfo* buffer will be filled with 3 different numbers (if supported by the operating system). The first @@ -878,8 +982,6 @@ third number is the maximum amount of RAM (not swap) used by the process so far. If any of the two latter parameters is not supported by the operating system it will be set to zero. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -899,6 +1001,8 @@ void lammps_memory_usage(void *handle, double *meminfo) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This will take the LAMMPS "world" communicator and convert it to an integer using ``MPI_Comm_c2f()``, so it is equivalent to the corresponding MPI communicator in Fortran. This way it can be safely @@ -907,8 +1011,6 @@ to the C language representation use ``MPI_Comm_f2c()``. If LAMMPS was compiled with MPI_STUBS, this function returns -1. -.. versionadded:: 18Sep2020 - *See also* :cpp:func:`lammps_open_fortran` @@ -1171,13 +1273,13 @@ int lammps_extract_setting(void *handle, const char *keyword) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the global property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_global` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance (unused) @@ -1227,6 +1329,13 @@ int lammps_extract_global_datatype(void * /*handle*/, const char *name) if (strcmp(name,"q_flag") == 0) return LAMMPS_INT; if (strcmp(name,"units") == 0) return LAMMPS_STRING; + if (strcmp(name,"atom_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"pair_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"bond_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"angle_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"dihedral_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"improper_style") == 0) return LAMMPS_STRING; + if (strcmp(name,"kspace_style") == 0) return LAMMPS_STRING; if (strcmp(name,"boltz") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"hplanck") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"mvv2e") == 0) return LAMMPS_DOUBLE; @@ -1473,6 +1582,34 @@ report the "native" data type. The following tables are provided: - int - 1 - **deprecated**. Use :cpp:func:`lammps_extract_setting` instead. + * - atom_style + - char \* + - 1 + - string with the current atom style. + * - pair_style + - char \* + - 1 + - string with the current pair style. + * - bond_style + - char \* + - 1 + - string with the current bond style. + * - angle_style + - char \* + - 1 + - string with the current angle style. + * - dihedral_style + - char \* + - 1 + - string with the current dihedral style. + * - improper_style + - char \* + - 1 + - string with the current improper style. + * - kspace_style + - char \* + - 1 + - string with the current KSpace style. .. _extract_unit_settings: @@ -1579,6 +1716,13 @@ void *lammps_extract_global(void *handle, const char *name) auto lmp = (LAMMPS *) handle; if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; + if (strcmp(name,"atom_style") == 0) return (void *) lmp->atom->atom_style; + if (strcmp(name,"pair_style") == 0) return (void *) lmp->force->pair_style; + if (strcmp(name,"bond_style") == 0) return (void *) lmp->force->bond_style; + if (strcmp(name,"angle_style") == 0) return (void *) lmp->force->angle_style; + if (strcmp(name,"dihedral_style") == 0) return (void *) lmp->force->dihedral_style; + if (strcmp(name,"improper_style") == 0) return (void *) lmp->force->improper_style; + if (strcmp(name,"kspace_style") == 0) return (void *) lmp->force->kspace_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep; // update->atime can be referenced as a pointer @@ -1660,13 +1804,13 @@ void *lammps_extract_global(void *handle, const char *name) * \verbatim embed:rst +.. versionadded:: 18Sep2020 + This function returns an integer that encodes the data type of the per-atom property with the specified name. See :cpp:enum:`_LMP_DATATYPE_CONST` for valid values. Callers of :cpp:func:`lammps_extract_atom` can use this information to then decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 18Sep2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -2193,13 +2337,13 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) * \verbatim embed:rst +.. versionadded:: 3Nov2022 + This function returns an integer that encodes the data type of the variable with the specified name. See :cpp:enum:`_LMP_VAR_CONST` for valid values. Callers of :cpp:func:`lammps_extract_variable` can use this information to decide how to cast the ``void *`` pointer and access the data. -.. versionadded:: 3Nov2022 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance @@ -3051,6 +3195,8 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type, * \verbatim embed:rst +.. versionadded:: 28Jul2021 + This function copies the list of all bonds into a buffer provided by the calling code. The buffer will be filled with bond type, bond atom 1, bond atom 2 for each bond. Thus the buffer has to be allocated to the @@ -3065,8 +3211,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** bonds in the system. -.. versionadded:: 28Jul2021 - Below is a brief C code demonstrating accessing this collected bond information. .. code-block:: c @@ -3146,7 +3290,8 @@ void lammps_gather_bonds(void *handle, void *data) } tagint **bonds; - lmp->memory->create(bonds, localbonds, 3, "library:gather_bonds:localbonds"); + // add 1 to localbonds, so "bonds" does not become a NULL pointer + lmp->memory->create(bonds, localbonds+1, 3, "library:gather_bonds:localbonds"); lmp->atom->avec->pack_bond(bonds); MPI_Allgatherv(&bonds[0][0], 3*localbonds, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3161,6 +3306,8 @@ void lammps_gather_bonds(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all angles into a buffer provided by the calling code. The buffer will be filled with angle type, angle atom 1, angle atom 2, angle atom 3 for each angle. Thus the buffer has to be allocated to the @@ -3175,8 +3322,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** angles in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected angle information. .. code-block:: c @@ -3256,7 +3401,8 @@ void lammps_gather_angles(void *handle, void *data) } tagint **angles; - lmp->memory->create(angles, localangles, 4, "library:gather_angles:localangles"); + // add 1 to localangles, so "angles" does not become a NULL pointer + lmp->memory->create(angles, localangles+1, 4, "library:gather_angles:localangles"); lmp->atom->avec->pack_angle(angles); MPI_Allgatherv(&angles[0][0], 4*localangles, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3271,6 +3417,8 @@ void lammps_gather_angles(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all dihedrals into a buffer provided by the calling code. The buffer will be filled with dihedral type, dihedral atom 1, dihedral atom 2, dihedral atom 3, dihedral atom 4 for each dihedral. @@ -3286,8 +3434,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** dihedrals in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected dihedral information. .. code-block:: c @@ -3367,7 +3513,8 @@ void lammps_gather_dihedrals(void *handle, void *data) } tagint **dihedrals; - lmp->memory->create(dihedrals, localdihedrals, 5, "library:gather_dihedrals:localdihedrals"); + // add 1 to localdihedrals, so "dihedrals" does not become a NULL pointer + lmp->memory->create(dihedrals, localdihedrals+1, 5, "library:gather_dihedrals:localdihedrals"); lmp->atom->avec->pack_dihedral(dihedrals); MPI_Allgatherv(&dihedrals[0][0], 5*localdihedrals, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -3382,6 +3529,8 @@ void lammps_gather_dihedrals(void *handle, void *data) * \verbatim embed:rst +.. versionadded:: 8Feb2023 + This function copies the list of all impropers into a buffer provided by the calling code. The buffer will be filled with improper type, improper atom 1, improper atom 2, improper atom 3, improper atom 4 for each improper. @@ -3397,8 +3546,6 @@ When running in parallel, the data buffer must be allocated on **all** MPI ranks and will be filled with the information for **all** impropers in the system. -.. versionadded:: 8Feb2023 - Below is a brief C code demonstrating accessing this collected improper information. .. code-block:: c @@ -3478,7 +3625,8 @@ void lammps_gather_impropers(void *handle, void *data) } tagint **impropers; - lmp->memory->create(impropers, localimpropers, 5, "library:gather_impropers:localimpropers"); + // add 1 to localimpropers, so "impropers" does not become a NULL pointer + lmp->memory->create(impropers, localimpropers+1, 5, "library:gather_impropers:localimpropers"); lmp->atom->avec->pack_improper(impropers); MPI_Allgatherv(&impropers[0][0], 5*localimpropers, MPI_LMP_TAGINT, data, bufsizes, bufoffsets, MPI_LMP_TAGINT, lmp->world); @@ -5191,6 +5339,8 @@ int lammps_version(void *handle) * \verbatim embed:rst +.. versionadded:: 9Oct2020 + The :cpp:func:`lammps_get_os_info` function can be used to retrieve detailed information about the hosting operating system and compiler/runtime. @@ -5199,8 +5349,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. The string is typically a few hundred bytes long. -.. versionadded:: 9Oct2020 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5429,6 +5577,8 @@ int lammps_config_accelerator(const char *package, * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_has_gpu_device` function checks at runtime if an accelerator device is present that can be used with the :doc:`GPU package `. If at least one suitable device is @@ -5438,8 +5588,6 @@ More detailed information about the available device or devices can be obtained by calling the :cpp:func:`lammps_get_gpu_device_info` function. -.. versionadded:: 14May2021 - \endverbatim * * \return 1 if viable device is available, 0 if not. */ @@ -5453,6 +5601,8 @@ int lammps_has_gpu_device() * \verbatim embed:rst +.. versionadded:: 14May2021 + The :cpp:func:`lammps_get_gpu_device_info` function can be used to retrieve detailed information about any accelerator devices that are viable for use with the :doc:`GPU package `. It will produce a string that is @@ -5464,8 +5614,6 @@ A suitable buffer for a C-style string has to be provided and its length. The assembled text will be truncated to not overflow this buffer. This string can be several kilobytes long, if multiple devices are present. -.. versionadded:: 14May2021 - \endverbatim * * \param buffer string buffer to copy the information to @@ -5562,12 +5710,13 @@ int lammps_style_name(void *handle, const char *category, int idx, /** Check if a specific ID exists in the current LAMMPS instance * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function checks if the current LAMMPS instance a *category* ID of the given *name* exists. Valid categories are: *compute*\ , *dump*\ , *fix*\ , *group*\ , *molecule*\ , *region*\ , and *variable*\ . -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5601,13 +5750,14 @@ int lammps_has_id(void *handle, const char *category, const char *name) { /** Count the number of IDs of a category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function counts how many IDs in the provided *category* are defined in the current LAMMPS instance. Please see :cpp:func:`lammps_has_id` for a list of valid categories. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5639,6 +5789,9 @@ int lammps_id_count(void *handle, const char *category) { /** Look up the name of an ID by index in the list of IDs of a given category. * \verbatim embed:rst + +.. versionadded:: 9Oct2020 + This function copies the name of the *category* ID with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5646,8 +5799,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 9Oct2020 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5710,10 +5861,11 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in /** Count the number of loaded plugins * \verbatim embed:rst -This function counts how many plugins are currently loaded. .. versionadded:: 10Mar2021 +This function counts how many plugins are currently loaded. + \endverbatim * * \return number of loaded plugins @@ -5732,6 +5884,9 @@ int lammps_plugin_count() /** Look up the info of a loaded plugin by its index in the list of plugins * \verbatim embed:rst + +.. versionadded:: 10Mar2021 + This function copies the name of the *style* plugin with the index *idx* into the provided C-style string buffer. The length of the buffer must be provided as *buf_size* argument. If the name of the style @@ -5739,8 +5894,6 @@ exceeds the length of the buffer, it will be truncated accordingly. If the index is out of range, the function returns 0 and *buffer* is set to an empty string, otherwise 1. -.. versionadded:: 10Mar2021 - \endverbatim * * \param idx index of the plugin in the list all or *style* plugins @@ -5899,9 +6052,11 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF \verbatim embed:rst -Fix :doc:`external ` allows programs that are running LAMMPS through -its library interface to add or modify certain LAMMPS properties on specific -timesteps, similar to the way other fixes do. +.. versionadded:: 28Jul2021 + +Fix :doc:`external ` allows programs that are running +LAMMPS through its library interface to add or modify certain LAMMPS +properties on specific timesteps, similar to the way other fixes do. This function provides access to the per-atom force storage in a fix external instance with the given fix-ID to be added to the individual @@ -5914,12 +6069,12 @@ data structures can change as well as the order of atom as they migrate between MPI processes because of the domain decomposition parallelization, this function should be always called immediately before the forces are going to be set to get an up-to-date pointer. -You can use, for example, :cpp:func:`lammps_extract_setting` to obtain the -number of local atoms `nlocal` and then assume the dimensions of the returned -force array as ``double force[nlocal][3]``. +You can use, for example, :cpp:func:`lammps_extract_setting` to obtain +the number of local atoms `nlocal` and then assume the dimensions of +the returned force array as ``double force[nlocal][3]``. -This is an alternative to the callback mechanism in fix external set up by -:cpp:func:`lammps_set_fix_external_callback`. The main difference is +This is an alternative to the callback mechanism in fix external set up +by :cpp:func:`lammps_set_fix_external_callback`. The main difference is that this mechanism can be used when forces are be pre-computed and the control alternates between LAMMPS and the external code, while the callback mechanism can call the external code to compute the force when @@ -5929,8 +6084,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -5961,6 +6114,8 @@ double **lammps_fix_external_get_force(void *handle, const char *id) \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to also set the contribution to the global energy from the external code. The value of the *eng* @@ -5977,8 +6132,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6007,6 +6160,8 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the contribution to the global virial from the external code. @@ -6025,8 +6180,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6055,6 +6208,8 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom energy contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6073,8 +6228,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6103,6 +6256,8 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` to set the per-atom virial contribution due to the fix from the external code as part of the callback function. For this to work, the handle to the @@ -6124,8 +6279,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6154,6 +6307,8 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the length of a global vector of properties that will be stored with the fix via @@ -6168,8 +6323,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6198,6 +6351,8 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len \verbatim embed:rst +.. versionadded:: 28Jul2021 + This is a companion function to :cpp:func:`lammps_set_fix_external_callback` and :cpp:func:`lammps_fix_external_get_force` to set the values of a global vector of properties that will be stored with the fix. And can be accessed from @@ -6221,8 +6376,6 @@ Please see the documentation for :doc:`fix external ` for more information about how to use the fix and how to couple it with an external code. -.. versionadded:: 28Jul2021 - \endverbatim * * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. @@ -6375,12 +6528,13 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size) { /** Return API version of embedded Python interpreter \verbatim embed:rst + +.. versionadded:: 3Nov2022 + This function is used by the ML-IAP python code (mliappy) to verify the API version of the embedded python interpreter of the PYTHON package. It returns -1 if the PYTHON package is not enabled. -.. versionadded:: 3Nov2022 - \endverbatim * * \return PYTHON_API_VERSION constant of the python interpreter or -1 */ diff --git a/src/library.h b/src/library.h index 340b0edb7b..30a12ebdef 100644 --- a/src/library.h +++ b/src/library.h @@ -41,10 +41,11 @@ /** Data type constants for extracting data from atoms, computes and fixes * * Must be kept in sync with the equivalent constants in ``python/lammps/constants.py``, - * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, and + * ``fortran/lammps.f90``, ``tools/swig/lammps.i``, ``src/lmptype.h``, and *``examples/COUPLE/plugin/liblammpsplugin.h`` */ enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ LAMMPS_INT = 0, /*!< 32-bit integer (array) */ LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ @@ -148,6 +149,7 @@ void lammps_commands_string(void *handle, const char *str); double lammps_get_natoms(void *handle); double lammps_get_thermo(void *handle, const char *keyword); +void *lammps_last_thermo(void *handle, const char *what, int index); void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag); diff --git a/src/lmptype.h b/src/lmptype.h index bf56d07d77..2089350f48 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -95,6 +95,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT_MAX #define MAXBIGINT INT64_MAX +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT @@ -132,6 +133,7 @@ typedef int64_t bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT64_MAX #define MAXBIGINT INT64_MAX +#define MAXDOUBLEINT 9007199254740992 // 2^53 #define MPI_LMP_TAGINT MPI_LL #define MPI_LMP_IMAGEINT MPI_LL @@ -168,6 +170,7 @@ typedef int bigint; #define MAXSMALLINT INT_MAX #define MAXTAGINT INT_MAX #define MAXBIGINT INT_MAX +#define MAXDOUBLEINT INT_MAX #define MPI_LMP_TAGINT MPI_INT #define MPI_LMP_IMAGEINT MPI_INT @@ -229,6 +232,98 @@ union ubuf { ubuf(const int64_t &arg) : i(arg) {} ubuf(const int &arg) : i(arg) {} }; + +/** Data structure for dynamic typing of int, bigint, and double + * + * Using this union allows to store any of the supported data types + * in the same container and allows to "see" its current type. +\verbatim embed:rst + +**Usage:** + +.. code-block:: c++ + :caption: To store data in multitype array: + + multitype m[5]; + int foo = 1; + double bar = 2.5; + bigint baz = 1<<40 - 1; + m[0] = foo; + m[1] = bar; + m[2] = -1; + m[3] = 2.0; + m[4] = baz; + +.. code-block:: c++ + :caption: To format data from multitype array into a space separated string: + + std::string str; + for (int i = 0; i < 5; ++i) { + switch (m[i].type) { + case multitype::DOUBLE: + str += std::to_string(m[i].data.d) + ' '; + break; + case multitype::INT: + str += std::to_string(m[i].data.i) + ' '; + break; + case multitype::BIGINT: + str += std::to_string(m[i].data.b) + ' '; + break; + default: + break; + } + } +\endverbatim + */ +struct multitype { + /** Data type constants for extracting data from atoms, computes and fixes + * + * This enum must be kept in sync with the corresponding enum or constants + * in ``python/lammps/constants.py``, ``fortran/lammps.f90``, ``tools/swig/lammps.i``, + * ``src/library.h``, and ``examples/COUPLE/plugin/liblammpsplugin.h`` */ + enum _LMP_DATATYPE_CONST { + LAMMPS_NONE = -1, /*!< no data type assigned (yet) */ + LAMMPS_INT = 0, /*!< 32-bit integer (array) */ + LAMMPS_INT_2D = 1, /*!< two-dimensional 32-bit integer array */ + LAMMPS_DOUBLE = 2, /*!< 64-bit double (array) */ + LAMMPS_DOUBLE_2D = 3, /*!< two-dimensional 64-bit double array */ + LAMMPS_INT64 = 4, /*!< 64-bit integer (array) */ + LAMMPS_INT64_2D = 5, /*!< two-dimensional 64-bit integer array */ + LAMMPS_STRING = 6 /*!< C-String */ + }; + + int type; + union { + double d; + int i; + int64_t b; + } data; + + multitype() : type(LAMMPS_NONE) { data.d = 0.0; } + multitype(const multitype &) = default; + multitype(multitype &&) = default; + ~multitype() = default; + + multitype &operator=(const double &_d) + { + type = LAMMPS_DOUBLE; + data.d = _d; + return *this; + } + multitype &operator=(const int &_i) + { + type = LAMMPS_INT; + data.i = _i; + return *this; + } + multitype &operator=(const int64_t &_b) + { + type = LAMMPS_INT64; + data.b = _b; + return *this; + } +}; + } // namespace LAMMPS_NS // preprocessor macros for compiler specific settings diff --git a/src/modify.h b/src/modify.h index 7a3f54c277..6ca4b4ad26 100644 --- a/src/modify.h +++ b/src/modify.h @@ -69,6 +69,7 @@ class Modify : protected Pointers { virtual void pre_reverse(int, int); virtual void post_force(int); virtual void final_integrate(); + virtual void fused_integrate(int) {} virtual void end_of_step(); virtual double energy_couple(); virtual double energy_global(); diff --git a/src/my_page.h b/src/my_page.h index 6c06abd71e..ea19dc8e74 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -104,6 +104,9 @@ template class MyPage { int errorflag; // flag > 0 if error has occurred // 1 = chunk size exceeded maxchunk // 2 = memory allocation error +#if defined(_OPENMP) + char pad[64]; // to avoid false sharing with multi-threading +#endif void allocate(); void deallocate(); }; diff --git a/src/npair_skip_size_off2on_oneside.cpp b/src/npair_skip_size_off2on_oneside.cpp index eecf293755..3300ef1526 100644 --- a/src/npair_skip_size_off2on_oneside.cpp +++ b/src/npair_skip_size_off2on_oneside.cpp @@ -36,7 +36,7 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : void NPairSkipSizeOff2onOneside::build(NeighList *list) { - int i,j,ii,jj,n,itype,jnum,joriginal,flip,tmp; + int i,j,ii,jj,itype,jnum,joriginal,flip,tmp; int *surf,*jlist; int *type = atom->type; @@ -76,8 +76,6 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) itype = type[i]; if (iskip[itype]) continue; - n = 0; - // loop over parent non-skip size list jlist = firstneigh_skip[i]; @@ -108,8 +106,7 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list) for (i = 0; i < nlocal; i++) { if (numneigh[i] == 0) continue; - n = numneigh[i]; - firstneigh[i] = ipage->get(n); + firstneigh[i] = ipage->get(numneigh[i]); if (ipage->status()) error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); } diff --git a/src/output.cpp b/src/output.cpp index 6282b85b76..6e57122ffe 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -190,6 +190,32 @@ void Output::setup(int memflag) { bigint ntimestep = update->ntimestep; + // print memory usage unless being called between multiple runs + + if (memflag) memory_usage(); + + // set next_thermo to multiple of every or variable eval if var defined + // ensure thermo output on last step of run + // thermo may invoke computes so wrap with clear/add + + modify->clearstep_compute(); + + thermo->header(); + thermo->compute(0); + last_thermo = ntimestep; + + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) { + next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; + next_thermo = MIN(next_thermo,update->laststep); + } else next_thermo = update->laststep; + + modify->addstep_compute(next_thermo); + // consider all dumps // decide whether to write snapshot and/or calculate next step for dump @@ -257,7 +283,7 @@ void Output::setup(int memflag) next_dump_any = MIN(next_dump_any,next_dump[idump]); } - // if no dumps, set next_dump_any to last+1 so will not influence next + // if no dumps, set next_dump_any to last+1 so will not influence next } else next_dump_any = update->laststep + 1; @@ -276,7 +302,8 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; } } else next_restart_single = update->laststep + 1; @@ -289,39 +316,14 @@ void Output::setup(int memflag) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_double = nextrestart; } } else next_restart_double = update->laststep + 1; next_restart = MIN(next_restart_single,next_restart_double); } else next_restart = update->laststep + 1; - // print memory usage unless being called between multiple runs - - if (memflag) memory_usage(); - - // set next_thermo to multiple of every or variable eval if var defined - // ensure thermo output on last step of run - // thermo may invoke computes so wrap with clear/add - - modify->clearstep_compute(); - - thermo->header(); - thermo->compute(0); - last_thermo = ntimestep; - - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) { - next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every; - next_thermo = MIN(next_thermo,update->laststep); - } else next_thermo = update->laststep; - - modify->addstep_compute(next_thermo); - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); @@ -336,6 +338,24 @@ void Output::setup(int memflag) void Output::write(bigint ntimestep) { + // ensure next_thermo forces output on last step of run + // thermo may invoke computes so wrap with clear/add + + if (next_thermo == ntimestep) { + modify->clearstep_compute(); + if (last_thermo != ntimestep) thermo->compute(1); + last_thermo = ntimestep; + if (var_thermo) { + next_thermo = static_cast + (input->variable->compute_equal(ivar_thermo)); + if (next_thermo <= ntimestep) + error->all(FLERR,"Thermo every variable returned a bad timestep"); + } else if (thermo_every) next_thermo += thermo_every; + else next_thermo = update->laststep; + next_thermo = MIN(next_thermo,update->laststep); + modify->addstep_compute(next_thermo); + } + // perform dump if its next_dump = current ntimestep // but not if it was already written on this step // set next_dump and also next_time_dump for mode_dump = 1 @@ -401,7 +421,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} vs {}", + nextrestart, ntimestep); next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); } @@ -424,7 +445,8 @@ void Output::write(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); } @@ -433,24 +455,6 @@ void Output::write(bigint ntimestep) next_restart = MIN(next_restart_single,next_restart_double); } - // ensure next_thermo forces output on last step of run - // thermo may invoke computes so wrap with clear/add - - if (next_thermo == ntimestep) { - modify->clearstep_compute(); - if (last_thermo != ntimestep) thermo->compute(1); - last_thermo = ntimestep; - if (var_thermo) { - next_thermo = static_cast - (input->variable->compute_equal(ivar_thermo)); - if (next_thermo <= ntimestep) - error->all(FLERR,"Thermo every variable returned a bad timestep"); - } else if (thermo_every) next_thermo += thermo_every; - else next_thermo = update->laststep; - next_thermo = MIN(next_thermo,update->laststep); - modify->addstep_compute(next_thermo); - } - // next = next timestep any output will be done next = MIN(next_dump_any,next_restart); @@ -647,7 +651,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_single = nextrestart; modify->addstep_compute(next_restart_single); @@ -666,7 +671,8 @@ void Output::reset_timestep(bigint ntimestep) auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart < ntimestep) - error->all(FLERR,"Restart variable returned a bad timestep"); + error->all(FLERR,"Restart variable returned a bad next timestep: {} <= {}", + nextrestart, ntimestep); update->ntimestep++; next_restart_double = nextrestart; modify->addstep_compute(next_restart_double); diff --git a/src/pair.cpp b/src/pair.cpp index 32c7faaf90..34c8e4978e 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -109,21 +109,21 @@ Pair::Pair(LAMMPS *lmp) : maxeatom = maxvatom = maxcvatom = 0; num_tally_compute = 0; + did_tally_flag = 0; nelements = nparams = maxparam = 0; nondefault_history_transfer = 0; beyond_contact = 0; - // KOKKOS per-fix data masks + // KOKKOS package execution_space = Host; datamask_read = ALL_MASK; datamask_modify = ALL_MASK; - kokkosable = 0; - reverse_comm_device = 0; - copymode = 0; + kokkosable = copymode = 0; + reverse_comm_device = fuse_force_clear_flag = 0; } /* ---------------------------------------------------------------------- */ @@ -295,6 +295,9 @@ void Pair::init() utils::logmesg(lmp,"Generated {} of {} mixed pair_coeff terms from {} mixing rule\n", mixed_count, num_mixed_pairs, mixing_rule_names[mix_flag]); } + + // for monitoring, if Pair::ev_tally() was called. + did_tally_flag = 0; } /* ---------------------------------------------------------------------- @@ -1095,6 +1098,7 @@ void Pair::ev_tally(int i, int j, int nlocal, int newton_pair, } if (num_tally_compute > 0) { + did_tally_flag = 1; for (int k=0; k < num_tally_compute; ++k) { Compute *c = list_tally_compute[k]; c->pair_tally_callback(i, j, nlocal, newton_pair, diff --git a/src/pair.h b/src/pair.h index 885a2c45ff..d36b48f340 100644 --- a/src/pair.h +++ b/src/pair.h @@ -119,12 +119,13 @@ class Pair : protected Pointers { int beyond_contact, nondefault_history_transfer; // for granular styles - // KOKKOS host/device flag and data masks + // KOKKOS flags and variables ExecutionSpace execution_space; unsigned int datamask_read, datamask_modify; int kokkosable; // 1 if Kokkos pair int reverse_comm_device; // 1 if reverse comm on Device + int fuse_force_clear_flag; // 1 if can fuse force clear with force compute Pair(class LAMMPS *); ~Pair() override; @@ -230,12 +231,13 @@ class Pair : protected Pointers { // management of callbacks to be run from ev_tally() protected: - int num_tally_compute; + int num_tally_compute, did_tally_flag; class Compute **list_tally_compute; public: virtual void add_tally_callback(class Compute *); virtual void del_tally_callback(class Compute *); + bool did_tally_callback() const { return did_tally_flag != 0; } protected: int instance_me; // which Pair class instantiation I am diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 12c84c3a71..118403d345 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -60,7 +60,7 @@ void PairHybridOverlay::coeff(int narg, char **arg) int none = 0; if (m == nstyles) { if (strcmp(arg[2],"none") == 0) none = 1; - else error->all(FLERR,"Pair coeff for hybrid has invalid style"); + else error->all(FLERR,"Pair coeff for hybrid has invalid style: {}", arg[2]); } // move 1st/2nd args to 2nd/3rd args diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 7cfc4a4c48..69ff037e4a 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -516,7 +516,7 @@ void PairHybridScaled::coeff(int narg, char **arg) if (strcmp(arg[2], "none") == 0) none = 1; else - error->all(FLERR, "Pair coeff for hybrid has invalid style"); + error->all(FLERR, "Pair coeff for hybrid has invalid style: {}", arg[2]); } // move 1st/2nd args to 2nd/3rd args diff --git a/src/reset_atoms_image.cpp b/src/reset_atoms_image.cpp index 56a1bf9f99..d39ea0fec1 100644 --- a/src/reset_atoms_image.cpp +++ b/src/reset_atoms_image.cpp @@ -22,6 +22,7 @@ #include "group.h" #include "input.h" #include "modify.h" +#include "update.h" #include "variable.h" #include @@ -92,6 +93,14 @@ void ResetAtomsImage::command(int narg, char **arg) "c_ifmax_r_i_f[*] c_ifmin_r_i_f[*]"); // trigger computes + // need to ensure update->first_update = 1 + // to allow this input script command prior to first run/minimize + // this is b/c internal variables are evaulated which invoke computes + // that will trigger an error unless first_update = 1 + // reset update->first_update when done + + int first_update_saved = update->first_update; + update->first_update = 1; frags->compute_peratom(); chunk->compute_peratom(); @@ -100,6 +109,8 @@ void ResetAtomsImage::command(int narg, char **arg) ifmax->compute_array(); cdist->compute_peratom(); + update->first_update = first_update_saved; + // reset image flags for atoms in group const int *const mask = atom->mask; diff --git a/src/thermo.cpp b/src/thermo.cpp index 302bf566d2..6122edec83 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -111,6 +111,7 @@ Thermo::Thermo(LAMMPS *_lmp, int narg, char **arg) : lostflag = lostbond = Thermo::ERROR; lostbefore = warnbefore = 0; flushflag = 0; + ntimestep = -1; // set style and corresponding lineflag // custom style builds its own line of keywords, including wildcard expansion @@ -201,6 +202,8 @@ void Thermo::init() ValueTokenizer *format_line = nullptr; if (format_line_user.size()) format_line = new ValueTokenizer(format_line_user); + field_data.clear(); + field_data.resize(nfield); std::string format_this, format_line_user_def; for (int i = 0; i < nfield; i++) { @@ -208,6 +211,14 @@ void Thermo::init() format_this.clear(); format_line_user_def.clear(); + if (vtype[i] == FLOAT) { + field_data[i] = (double) 0.0; + } else if (vtype[i] == INT) { + field_data[i] = (int) 0; + } else if (vtype[i] == BIGINT) { + field_data[i] = (bigint) 0; + } + if ((lineflag == MULTILINE) && ((i % 3) == 0)) format[i] += "\n"; if ((lineflag == YAMLLINE) && (i == 0)) format[i] += " - ["; if (format_line) format_line_user_def = format_line->next_string(); @@ -361,7 +372,7 @@ void Thermo::compute(int flag) int i; firststep = flag; - bigint ntimestep = update->ntimestep; + ntimestep = update->ntimestep; // check for lost atoms // turn off normflag if natoms = 0 to avoid divide by 0 @@ -405,18 +416,23 @@ void Thermo::compute(int flag) } // add each thermo value to line with its specific format + field_data.clear(); + field_data.resize(nfield); for (ifield = 0; ifield < nfield; ifield++) { (this->*vfunc[ifield])(); if (vtype[ifield] == FLOAT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), dvalue); line += fmtbuf; + field_data[ifield] = dvalue; } else if (vtype[ifield] == INT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), ivalue); line += fmtbuf; + field_data[ifield] = ivalue; } else if (vtype[ifield] == BIGINT) { snprintf(fmtbuf, sizeof(fmtbuf), format[ifield].c_str(), bivalue); line += fmtbuf; + field_data[ifield] = bivalue; } } @@ -433,16 +449,6 @@ void Thermo::compute(int flag) firststep = 1; } -/* ---------------------------------------------------------------------- - call function to compute property -------------------------------------------------------------------------- */ - -void Thermo::call_vfunc(int ifield_in) -{ - ifield = ifield_in; - (this->*vfunc[ifield])(); -} - /* ---------------------------------------------------------------------- check for lost atoms, return current number of atoms also could number of warnings across MPI ranks and update total @@ -1062,6 +1068,8 @@ void Thermo::parse_fields(const std::string &str) } } } + field_data.clear(); + field_data.resize(nfield); } /* ---------------------------------------------------------------------- @@ -1118,7 +1126,7 @@ int Thermo::add_variable(const char *id) } /* ---------------------------------------------------------------------- - check whether temperature compute is defined, available, and current + check whether temperature compute is defined, active, and needs invoking ------------------------------------------------------------------------- */ void Thermo::check_temp(const std::string &keyword) @@ -1126,18 +1134,16 @@ void Thermo::check_temp(const std::string &keyword) if (!temperature) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init temperature", keyword); - if (update->whichflag == 0) { - if (temperature->invoked_scalar != update->ntimestep) - error->all(FLERR, "Compute {} {} used in variable thermo keyword between runs is not current", - temperature->style, temperature->id); - } else if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { + if (update->first_update == 0) + error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) { temperature->compute_scalar(); temperature->invoked_flag |= Compute::INVOKED_SCALAR; } } /* ---------------------------------------------------------------------- - check whether potential energy compute is defined, available, and current + check whether potential energy compute is defined, active, and needs invoking ------------------------------------------------------------------------- */ void Thermo::check_pe(const std::string &keyword) @@ -1147,47 +1153,41 @@ void Thermo::check_pe(const std::string &keyword) if (!pe) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init potential energy", keyword); - if (update->whichflag == 0) { - if (pe->invoked_scalar != update->ntimestep) - error->all(FLERR, "Compute {} {} used in variable thermo keyword between runs is not current", - pe->style, pe->id); - } else { + if (update->first_update == 0) + error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!(pe->invoked_flag & Compute::INVOKED_SCALAR)) { pe->compute_scalar(); pe->invoked_flag |= Compute::INVOKED_SCALAR; } } /* ---------------------------------------------------------------------- - check whether scalar pressure compute is defined, available, and current + check whether scalar pressure compute is defined, active, and needs invoking ------------------------------------------------------------------------- */ void Thermo::check_press_scalar(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->whichflag == 0) { - if (pressure->invoked_scalar != update->ntimestep) - error->all(FLERR, "Compute {} {} used in variable thermo keyword between runs is not current", - pressure->style, pressure->id); - } else if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { + if (update->first_update == 0) + error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) { pressure->compute_scalar(); pressure->invoked_flag |= Compute::INVOKED_SCALAR; } } /* ---------------------------------------------------------------------- - check whether pressure tensor compute is defined, available, and current + check whether tensor pressure compute is defined, active, and needs invoking ------------------------------------------------------------------------- */ void Thermo::check_press_vector(const std::string &keyword) { if (!pressure) error->all(FLERR, "Thermo keyword {} in variable requires thermo to use/init press", keyword); - if (update->whichflag == 0) { - if (pressure->invoked_vector != update->ntimestep) - error->all(FLERR, "Compute {} {} used in variable thermo keyword between runs is not current", - pressure->style, pressure->id); - } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { + if (update->first_update == 0) + error->all(FLERR,"Thermo keyword {} cannot be invoked before first run",keyword); + if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) { pressure->compute_vector(); pressure->invoked_flag |= Compute::INVOKED_VECTOR; } @@ -1214,8 +1214,6 @@ int Thermo::evaluate_keyword(const std::string &word, double *answer) // invoke a lo-level thermo routine to compute the variable value // if keyword requires a compute, error if thermo doesn't use the compute - // if inbetween runs and needed compute is not current, error - // if in middle of run and needed compute is not current, invoke it // for keywords that use energy (evdwl, ebond, etc): // check if energy was tallied on this timestep and set pe->invoked_flag // this will trigger next timestep for energy tallying via addstep() diff --git a/src/thermo.h b/src/thermo.h index eaec3eb9f8..333a282ca0 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -21,9 +21,6 @@ namespace LAMMPS_NS { class Thermo : protected Pointers { friend class MinCG; // accesses compute_pe - friend class DumpNetCDF; // accesses thermo properties - friend class DumpNetCDFMPIIO; // accesses thermo properties - friend class DumpYAML; // accesses thermo properties public: char *style; @@ -45,6 +42,12 @@ class Thermo : protected Pointers { void compute(int); int evaluate_keyword(const std::string &, double *); + // for accessing cached thermo data + const int *get_nfield() const { return &nfield; } + const bigint *get_timestep() const { return &ntimestep; } + const std::vector &get_fields() const { return field_data; } + const std::vector &get_keywords() const { return keyword; } + private: int nfield, nfield_initial; int *vtype; @@ -52,6 +55,7 @@ class Thermo : protected Pointers { std::vector keyword, format, format_column_user, keyword_user; std::string format_line_user, format_float_user, format_int_user, format_bigint_user; std::map key2col; + std::vector field_data; int normvalue; // use this for normflag unless natoms = 0 int normuserflag; // 0 if user has not set, 1 if has @@ -66,6 +70,7 @@ class Thermo : protected Pointers { bigint last_step; bigint natoms; + bigint ntimestep; // data used by routines that compute single values int ivalue; // integer value to print @@ -114,7 +119,6 @@ class Thermo : protected Pointers { typedef void (Thermo::*FnPtr)(); void addfield(const char *, FnPtr, int); FnPtr *vfunc; // list of ptrs to functions - void call_vfunc(int ifield); void compute_compute(); // functions that compute a single value void compute_fix(); // via calls to Compute,Fix,Variable classes diff --git a/src/timer.cpp b/src/timer.cpp index f97449e797..409135cbaf 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -249,8 +249,8 @@ void Timer::modify_params(int narg, char **arg) // format timeout setting std::string timeout = "off"; if (_timeout >= 0) { - std::time_t tv = _timeout; - timeout = fmt::format("{:%H:%M:%S}", fmt::gmtime(tv)); + std::tm tv = fmt::gmtime((std::time_t) _timeout); + timeout = fmt::format("{:02d}:{:%M:%S}", tv.tm_yday * 24 + tv.tm_hour, tv); } utils::logmesg(lmp, "New timer settings: style={} mode={} timeout={}\n", timer_style[_level], diff --git a/src/timer.h b/src/timer.h index 5c100db1c0..f7efa5ac64 100644 --- a/src/timer.h +++ b/src/timer.h @@ -63,6 +63,7 @@ class Timer : protected Pointers { bool has_normal() const { return (_level >= NORMAL); } bool has_full() const { return (_level >= FULL); } bool has_sync() const { return (_sync != OFF); } + bool has_timeout() const { return (_timeout >= 0.0); } // flag if wallclock time is expired bool is_timeout() const { return (_timeout == 0.0); } diff --git a/src/variable.cpp b/src/variable.cpp index b9b3661af8..456359de2f 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -38,6 +38,8 @@ #include "universe.h" #include "update.h" +#include "fmt/ranges.h" + #include #include #include @@ -72,10 +74,10 @@ enum{DONE,ADD,SUBTRACT,MULTIPLY,DIVIDE,CARAT,MODULO,UNARY, enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE}; - static constexpr double BIG = 1.0e20; -// INT64_MAX cannot be represented with a double. reduce to avoid overflow when casting back. +// INT64_MAX cannot be represented with a double. reduce to avoid overflow when casting back + #if defined(LAMMPS_SMALLBIG) || defined(LAMMPS_BIGBIG) static constexpr double MAXBIGINT_DOUBLE = (double) (MAXBIGINT-512); #else @@ -222,7 +224,7 @@ void Variable::set(int narg, char **arg) if (narg == 5 && strcmp(arg[4],"pad") == 0) { pad[nvar] = fmt::format("{}",nlast).size(); } else pad[nvar] = 0; - } else error->all(FLERR,"Illegal variable loop command: too much arguments"); + } else error->all(FLERR,"Illegal variable loop command: too many arguments"); num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; @@ -477,8 +479,10 @@ void Variable::set(int narg, char **arg) // VECTOR // replace pre-existing var if also style VECTOR (allows it to be reset) - // num = 1, which = 1st value - // data = 1 value, string to eval + // num = 2, which = 1st value + // data = 2 values, 1st is string to eval, 2nd is formatted output string [1,2,3] + // if formula string is [value,value,...] then + // immediately store it as N-length vector and set dynamic flag to 0 } else if (strcmp(arg[1],"vector") == 0) { if (narg != 3) error->all(FLERR,"Illegal variable command: expected 3 arguments but found {}", narg); @@ -487,16 +491,34 @@ void Variable::set(int narg, char **arg) if (style[ivar] != VECTOR) error->all(FLERR,"Cannot redefine variable as a different style"); delete[] data[ivar][0]; + delete[] data[ivar][1]; data[ivar][0] = utils::strdup(arg[2]); + if (data[ivar][0][0] != '[') + vecs[ivar].dynamic = 1; + else { + vecs[ivar].dynamic = 0; + parse_vector(ivar,data[ivar][0]); + std::vector vec(vecs[ivar].values,vecs[ivar].values + vecs[ivar].n); + data[ivar][1] = utils::strdup(fmt::format("[{}]", fmt::join(vec,","))); + } replaceflag = 1; } else { if (nvar == maxvar) grow(); style[nvar] = VECTOR; - num[nvar] = 1; + num[nvar] = 2; which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; data[nvar][0] = utils::strdup(arg[2]); + if (data[nvar][0][0] != '[') { + vecs[nvar].dynamic = 1; + data[nvar][1] = nullptr; + } else { + vecs[nvar].dynamic = 0; + parse_vector(nvar,data[nvar][0]); + std::vector vec(vecs[nvar].values,vecs[nvar].values + vecs[nvar].n); + data[nvar][1] = utils::strdup(fmt::format("[{}]", fmt::join(vec,","))); + } } // PYTHON @@ -935,8 +957,9 @@ int Variable::internalstyle(int ivar) if GETENV, query environment and put result in str if PYTHON, evaluate Python function, it will put result in str if INTERNAL, convert dvalue and put result in str - if ATOM or ATOMFILE or VECTOR, return nullptr - return nullptr if no variable with name, or which value is bad, + if VECTOR, return str = [value,value,...] + if ATOM or ATOMFILE, return nullptr + return nullptr if no variable with name or if which value is bad, caller must respond ------------------------------------------------------------------------- */ @@ -956,17 +979,21 @@ char *Variable::retrieve(const char *name) style[ivar] == UNIVERSE || style[ivar] == STRING || style[ivar] == SCALARFILE) { str = data[ivar][which[ivar]]; + } else if (style[ivar] == LOOP || style[ivar] == ULOOP) { + std::string result; if (pad[ivar] == 0) result = std::to_string(which[ivar]+1); else result = fmt::format("{:0>{}d}",which[ivar]+1, pad[ivar]); delete[] data[ivar][0]; str = data[ivar][0] = utils::strdup(result); + } else if (style[ivar] == EQUAL) { double answer = evaluate(data[ivar][0],nullptr,ivar); delete[] data[ivar][1]; data[ivar][1] = utils::strdup(fmt::format("{:.15g}",answer)); str = data[ivar][1]; + } else if (style[ivar] == FORMAT) { int jvar = find(data[ivar][0]); if (jvar < 0) @@ -977,11 +1004,13 @@ char *Variable::retrieve(const char *name) double answer = compute_equal(jvar); sprintf(data[ivar][2],data[ivar][1],answer); str = data[ivar][2]; + } else if (style[ivar] == GETENV) { const char *result = getenv(data[ivar][0]); if (result == nullptr) result = (const char *) ""; delete[] data[ivar][1]; str = data[ivar][1] = utils::strdup(result); + } else if (style[ivar] == PYTHON) { int ifunc = python->variable_match(data[ivar][0],name,0); if (ifunc < 0) { @@ -1001,16 +1030,39 @@ char *Variable::retrieve(const char *name) } python->invoke_function(ifunc,data[ivar][1]); str = data[ivar][1]; + // if Python func returns a string longer than VALUELENGTH // then the Python class stores the result, query it via long_string() + char *strlong = python->long_string(ifunc); if (strlong) str = strlong; + } else if (style[ivar] == TIMER || style[ivar] == INTERNAL) { delete[] data[ivar][0]; data[ivar][0] = utils::strdup(fmt::format("{:.15g}",dvalue[ivar])); str = data[ivar][0]; - } else if (style[ivar] == ATOM || style[ivar] == ATOMFILE || - style[ivar] == VECTOR) return nullptr; + + } else if (style[ivar] == VECTOR) { + + // check if vector variable needs to be re-computed + // if no, just return previously formatted string in data[ivar][1] + // if yes, invoke compute_vector() and convert vector to formatted string + // must also turn off eval_in_progress b/c compute_vector() checks it + + if (vecs[ivar].dynamic || vecs[ivar].currentstep != update->ntimestep) { + eval_in_progress[ivar] = 0; + double *result; + compute_vector(ivar,&result); + delete[] data[ivar][1]; + std::vector vectmp(vecs[ivar].values,vecs[ivar].values + vecs[ivar].n); + std::string str = fmt::format("[{}]", fmt::join(vectmp,",")); + data[ivar][1] = utils::strdup(str); + } + + str = data[ivar][1]; + + } else if (style[ivar] == ATOM || style[ivar] == ATOMFILE) + return nullptr; eval_in_progress[ivar] = 0; @@ -1137,18 +1189,30 @@ void Variable::compute_atom(int ivar, int igroup, double *result, int stride, in compute result of vector-style variable evaluation return length of vector and result pointer to vector values if length == 0 or -1 (mismatch), generate an error - if variable already computed on this timestep, just return - else evaluate the formula and its length, store results in VecVar entry + if necessary, evaluate the formula and its length, + store results in VecVar entry and return them ------------------------------------------------------------------------- */ int Variable::compute_vector(int ivar, double **result) { Tree *tree = nullptr; + + // if vector is not dynamic, just return stored values + + if (!vecs[ivar].dynamic) { + *result = vecs[ivar].values; + return vecs[ivar].n; + } + + // if vector already computed on this timestep, just return stored values + if (vecs[ivar].currentstep == update->ntimestep) { *result = vecs[ivar].values; return vecs[ivar].n; } + // evaluate vector variable afresh + if (eval_in_progress[ivar]) print_var_error(FLERR,"has a circular dependency",ivar); @@ -1246,7 +1310,8 @@ void Variable::grow() vecs = (VecVar *) memory->srealloc(vecs,maxvar*sizeof(VecVar),"var:vecvar"); for (int i = old; i < maxvar; i++) { - vecs[i].nmax = 0; + vecs[i].n = vecs[i].nmax = 0; + vecs[i].dynamic = 1; vecs[i].currentstep = -1; vecs[i].values = nullptr; } @@ -1440,10 +1505,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (nbracket == 0 && compute->scalar_flag && lowercase) { - if (update->whichflag == 0) { - if (compute->invoked_scalar != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { compute->compute_scalar(); compute->invoked_flag |= Compute::INVOKED_SCALAR; } @@ -1463,10 +1527,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index1 > compute->size_vector && compute->size_vector_variable == 0) print_var_error(FLERR,"Variable formula compute vector is accessed out-of-range",ivar,0); - if (update->whichflag == 0) { - if (compute->invoked_vector != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; } @@ -1490,10 +1553,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); if (index2 > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->whichflag == 0) { - if (compute->invoked_array != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; } @@ -1518,10 +1580,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_vector == 0) print_var_error(FLERR,"Variable formula compute vector is zero length",ivar); - if (update->whichflag == 0) { - if (compute->invoked_vector != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; } @@ -1543,10 +1604,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Compute global vector in atom-style variable formula",ivar); if (compute->size_array_rows == 0) print_var_error(FLERR,"Variable formula compute array is zero length",ivar); - if (update->whichflag == 0) { - if (compute->invoked_array != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; } @@ -1563,10 +1623,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (update->whichflag == 0) { - if (compute->invoked_peratom != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; } @@ -1581,10 +1640,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (index2 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->whichflag == 0) { - if (compute->invoked_peratom != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; } @@ -1605,10 +1663,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); - if (update->whichflag == 0) { - if (compute->invoked_peratom != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; } @@ -1630,10 +1687,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Per-atom compute in vector-style variable formula",ivar); if (index1 > compute->size_peratom_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->whichflag == 0) { - if (compute->invoked_peratom != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= Compute::INVOKED_PERATOM; } @@ -2031,7 +2087,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (math_function(word,contents,tree,treestack,ntreestack,argstack,nargstack,ivar)); else if (group_function(word,contents,tree,treestack,ntreestack,argstack,nargstack,ivar)); else if (special_function(word,contents,tree,treestack,ntreestack,argstack,nargstack,ivar)); - else print_var_error(FLERR,fmt::format("Invalid math/group/special function '{}()' " + else if (feature_function(word,contents,tree,treestack,ntreestack,argstack,nargstack,ivar)); + else print_var_error(FLERR,fmt::format("Invalid math/group/special/feature function '{}()' " "in variable formula", word),ivar); delete[] contents; @@ -2247,7 +2304,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (nopstack) print_var_error(FLERR,"Invalid syntax in variable formula",ivar); - // for atom-style variable, return remaining tree + // for atom-style and vector-style variable, return remaining tree // for equal-style variable, return remaining arg if (tree) { @@ -3979,11 +4036,12 @@ Region *Variable::region_function(char *id, int ivar) process a special function in formula push result onto tree or arg stack word = special function - contents = str between parentheses with one,two,three args + contents = str between parentheses with one or more args return 0 if not a match, 1 if successfully processed customize by adding a special function: sum(x),min(x),max(x),ave(x),trap(x),slope(x), - gmask(x),rmask(x),grmask(x,y),next(x) + gmask(x),rmask(x),grmask(x,y),next(x),is_file(x),is_ox(x), + extract_setting(x),label2type(x,y),is_typelabel(x,y) ------------------------------------------------------------------------- */ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **treestack, @@ -3992,20 +4050,76 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t double sx,sxx; double value,sy,sxy; - // word not a match to any special function + // word is not a match to any special function - if (strcmp(word,"sum") != 0 && strcmp(word,"min") && strcmp(word,"max") != 0 && strcmp(word,"ave") != 0 && - strcmp(word,"trap") != 0 && strcmp(word,"slope") != 0 && strcmp(word,"gmask") != 0 && strcmp(word,"rmask") != 0 && - strcmp(word,"grmask") != 0 && strcmp(word,"next") != 0 && strcmp(word,"is_active") != 0 && - strcmp(word,"is_defined") != 0 && strcmp(word,"is_available") != 0 && strcmp(word,"is_file") != 0 && - strcmp(word,"is_os") != 0 && strcmp(word,"extract_setting") != 0 && strcmp(word,"label2type") != 0) + if (strcmp(word,"sum") != 0 && strcmp(word,"min") && strcmp(word,"max") != 0 && + strcmp(word,"ave") != 0 && strcmp(word,"trap") != 0 && strcmp(word,"slope") != 0 && + strcmp(word,"gmask") != 0 && strcmp(word,"rmask") != 0 && strcmp(word,"grmask") != 0 && + strcmp(word,"next") != 0 && strcmp(word,"is_file") != 0 && strcmp(word,"is_os") != 0 && + strcmp(word,"extract_setting") != 0 && strcmp(word,"label2type") != 0 && + strcmp(word,"is_typelabel") != 0) return 0; + // process label2type() separately b/c its label arg can have commas in it + + if (strcmp(word,"label2type") == 0 || strcmp(word,"is_typelabel") == 0) { + if (!atom->labelmapflag) + print_var_error(FLERR,fmt::format("Cannot use {}() function without a labelmap",word),ivar); + + std::string contents_copy(contents); + auto pos = contents_copy.find_first_of(','); + if (pos == std::string::npos) { + if (strcmp(word,"label2type") == 0) { + print_var_error(FLERR, fmt::format("Invalid label2type({}) function in variable formula", + contents_copy), ivar); + } else { + print_var_error(FLERR, fmt::format("Invalid is_typelabel({}) function in variable formula", + contents_copy), ivar); + } + } + + std::string typestr = contents_copy.substr(pos+1); + std::string kind = contents_copy.substr(0, pos); + + int value = -1; + if (kind == "atom") { + value = atom->lmap->find(typestr,Atom::ATOM); + } else if (kind == "bond") { + value = atom->lmap->find(typestr,Atom::BOND); + } else if (kind == "angle") { + value = atom->lmap->find(typestr,Atom::ANGLE); + } else if (kind == "dihedral") { + value = atom->lmap->find(typestr,Atom::DIHEDRAL); + } else if (kind == "improper") { + value = atom->lmap->find(typestr,Atom::IMPROPER); + } else { + print_var_error(FLERR, fmt::format("Invalid kind {} in {}() in variable", kind, word),ivar); + } + + if (strcmp(word,"label2type") == 0) { + if (value == -1) + print_var_error(FLERR, fmt::format("Invalid {} type label {} in label2type() in variable", + kind, typestr), ivar); + } else value = (value == -1) ? 0.0 : 1.0; + + // save value in tree or on argstack + + if (tree) { + Tree *newtree = new Tree(); + newtree->type = VALUE; + newtree->value = value; + newtree->first = newtree->second = nullptr; + newtree->nextra = 0; + treestack[ntreestack++] = newtree; + } else argstack[nargstack++] = value; + + return 1; + } + + // process other special functions // parse contents for comma-separated args // narg = number of args, args = strings between commas - std::string contents_copy(contents); // for label2type - char *args[MAXFUNCARG]; int narg = parse_args(contents,args); @@ -4050,10 +4164,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t print_var_error(FLERR,mesg,ivar); } if (index == 0 && compute->vector_flag) { - if (update->whichflag == 0) { - if (compute->invoked_vector != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { compute->compute_vector(); compute->invoked_flag |= Compute::INVOKED_VECTOR; } @@ -4062,10 +4175,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } else if (index && compute->array_flag) { if (index > compute->size_array_cols) print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0); - if (update->whichflag == 0) { - if (compute->invoked_array != update->ntimestep) - print_var_error(FLERR,"Compute used in variable between runs is not current",ivar); - } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { + if (update->first_update == 0) + print_var_error(FLERR,"Variable formula compute cannot be invoked before first run",ivar); + if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) { compute->compute_array(); compute->invoked_flag |= Compute::INVOKED_ARRAY; } @@ -4333,54 +4445,6 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } else print_var_error(FLERR,"Invalid variable style in special function next",ivar); - } else if (strcmp(word,"is_active") == 0) { - if (narg != 2) - print_var_error(FLERR,"Invalid is_active() function in variable formula",ivar); - - Info info(lmp); - value = (info.is_active(args[0],args[1])) ? 1.0 : 0.0; - - // save value in tree or on argstack - - if (tree) { - auto newtree = new Tree(); - newtree->type = VALUE; - newtree->value = value; - treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = value; - - } else if (strcmp(word,"is_available") == 0) { - if (narg != 2) - print_var_error(FLERR,"Invalid is_available() function in variable formula",ivar); - - Info info(lmp); - value = (info.is_available(args[0],args[1])) ? 1.0 : 0.0; - - // save value in tree or on argstack - - if (tree) { - auto newtree = new Tree(); - newtree->type = VALUE; - newtree->value = value; - treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = value; - - } else if (strcmp(word,"is_defined") == 0) { - if (narg != 2) - print_var_error(FLERR,"Invalid is_defined() function in variable formula",ivar); - - Info info(lmp); - value = (info.is_defined(args[0],args[1])) ? 1.0 : 0.0; - - // save value in tree or on argstack - - if (tree) { - auto newtree = new Tree(); - newtree->type = VALUE; - newtree->value = value; - treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = value; - } else if (strcmp(word,"is_file") == 0) { if (narg != 1) print_var_error(FLERR,"Invalid is_file() function in variable formula",ivar); @@ -4412,7 +4476,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t } else argstack[nargstack++] = value; } else if (strcmp(word,"extract_setting") == 0) { - if (narg != 1) print_var_error(FLERR,"Invalid extract_setting() function syntax in variable formula",ivar); + if (narg != 1) print_var_error(FLERR,"Invalid extract_setting() function in variable formula",ivar); value = lammps_extract_setting(lmp, args[0]); if (value < 0) { @@ -4428,45 +4492,87 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t newtree->value = value; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; + } - } else if (strcmp(word,"label2type") == 0) { - if (!atom->labelmapflag) - print_var_error(FLERR,"Cannot use label2type() function without a labelmap",ivar); + // delete stored args - auto pos = contents_copy.find_first_of(','); - if (pos == std::string::npos) - print_var_error(FLERR, fmt::format("Invalid label2type({}) function in variable formula", - contents_copy), ivar); - std::string typestr = contents_copy.substr(pos+1); - std::string kind = contents_copy.substr(0, pos); + for (int i = 0; i < narg; i++) delete[] args[i]; - int value = -1; - if (kind == "atom") { - value = atom->lmap->find(typestr,Atom::ATOM); - } else if (kind == "bond") { - value = atom->lmap->find(typestr,Atom::BOND); - } else if (kind == "angle") { - value = atom->lmap->find(typestr,Atom::ANGLE); - } else if (kind == "dihedral") { - value = atom->lmap->find(typestr,Atom::DIHEDRAL); - } else if (kind == "improper") { - value = atom->lmap->find(typestr,Atom::IMPROPER); - } else { - print_var_error(FLERR, fmt::format("Invalid type kind {} in variable formula",kind), ivar); - } + return 1; +} - if (value == -1) - print_var_error(FLERR, fmt::format("Invalid {} type label {} in variable formula", - kind, typestr), ivar); +/* ---------------------------------------------------------------------- + process a feature function in formula + push result onto tree or arg stack + word = special function + contents = str between parentheses with one or more args + return 0 if not a match, 1 if successfully processed + customize by adding a feature function: + is_available(x,y),is_active(x,y),is_defined(x,y), +------------------------------------------------------------------------- */ + +int Variable::feature_function(char *word, char *contents, Tree **tree, Tree **treestack, + int &ntreestack, double *argstack, int &nargstack, int ivar) +{ + double value; + + // word is not a match to any feature function + + if (strcmp(word,"is_available") && strcmp(word,"is_active") && strcmp(word,"is_defined") != 0) + return 0; + + // process feature functions + // parse contents for comma-separated args + // narg = number of args, args = strings between commas + + char *args[MAXFUNCARG]; + int narg = parse_args(contents,args); + + if (strcmp(word,"is_available") == 0) { + if (narg != 2) + print_var_error(FLERR,"Invalid is_available() function in variable formula",ivar); + + Info info(lmp); + value = (info.is_available(args[0],args[1])) ? 1.0 : 0.0; // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); + newtree->type = VALUE; + newtree->value = value; + treestack[ntreestack++] = newtree; + } else argstack[nargstack++] = value; + + } else if (strcmp(word,"is_active") == 0) { + if (narg != 2) + print_var_error(FLERR,"Invalid is_active() function in variable formula",ivar); + + Info info(lmp); + value = (info.is_active(args[0],args[1])) ? 1.0 : 0.0; + + // save value in tree or on argstack + + if (tree) { + auto newtree = new Tree(); + newtree->type = VALUE; + newtree->value = value; + treestack[ntreestack++] = newtree; + } else argstack[nargstack++] = value; + + } else if (strcmp(word,"is_defined") == 0) { + if (narg != 2) + print_var_error(FLERR,"Invalid is_defined() function in variable formula",ivar); + + Info info(lmp); + value = (info.is_defined(args[0],args[1])) ? 1.0 : 0.0; + + // save value in tree or on argstack + + if (tree) { + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = nullptr; - newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; } @@ -4656,6 +4762,30 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree else if (strcmp(word,"fz") == 0) newtree->array = &atom->f[0][2]; } +/* ---------------------------------------------------------------------- + parse vector string with format [value,value,...] for vector-style variable + store numeric values in vecs[ivar] +------------------------------------------------------------------------- */ + +void Variable::parse_vector(int ivar, char *str) +{ + // check for square brackets, remove them, and split into vector + int nstr = strlen(str)-1; + if ((str[0] != '[') || (str[nstr] != ']')) + error->all(FLERR,"Vector variable formula lacks opening or closing brace: {}", str); + std::vector args = Tokenizer(std::string(str+1, str+nstr), ",").as_vector(); + + int nvec = args.size(); + vecs[ivar].n = nvec; + vecs[ivar].nmax = nvec; + vecs[ivar].currentstep = -1; + memory->destroy(vecs[ivar].values); + memory->create(vecs[ivar].values,vecs[ivar].nmax,"variable:values"); + + for (int i = 0; i < nvec; i++) + vecs[ivar].values[i] = utils::numeric(FLERR, utils::trim(args[i]), false, lmp); +} + /* ---------------------------------------------------------------------- parse string for comma-separated args store copy of each arg in args array @@ -4698,7 +4828,6 @@ char *Variable::find_next_comma(char *str) return nullptr; } - /* ---------------------------------------------------------------------- helper routine for printing variable name with error message ------------------------------------------------------------------------- */ diff --git a/src/variable.h b/src/variable.h index 825a207d78..c0aeaebd37 100644 --- a/src/variable.h +++ b/src/variable.h @@ -90,6 +90,7 @@ class Variable : protected Pointers { struct VecVar { int n, nmax; + int dynamic; bigint currentstep; double *values; }; @@ -141,10 +142,12 @@ class Variable : protected Pointers { int group_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); Region *region_function(char *, int); int special_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); + int feature_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); void peratom2global(int, char *, double *, int, tagint, Tree **, Tree **, int &, double *, int &); int is_atom_vector(char *); void atom_vector(char *, Tree **, Tree **, int &); int parse_args(char *, char **); + void parse_vector(int, char *); char *find_next_comma(char *); void print_var_error(const std::string &, int, const std::string &, int, int global = 1); void print_tree(Tree *, int); diff --git a/src/version.h b/src/version.h index 2d0eb0480e..2a1c8a9a37 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ -#define LAMMPS_VERSION "28 Mar 2023" +#define LAMMPS_VERSION "15 Jun 2023" #define LAMMPS_UPDATE "Development" diff --git a/tools/coding_standard/versiontags.py b/tools/coding_standard/versiontags.py index 0b4597046f..ec512a3fad 100644 --- a/tools/coding_standard/versiontags.py +++ b/tools/coding_standard/versiontags.py @@ -21,7 +21,7 @@ DEFAULT_CONFIG = """ recursive: true include: - doc/src/** - - python + - python/** - src/** exclude: - src/Make.sh diff --git a/tools/phonon/CMakeLists.spglib b/tools/phonon/CMakeLists.spglib new file mode 100644 index 0000000000..566e58a2b6 --- /dev/null +++ b/tools/phonon/CMakeLists.spglib @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.10) +project(spglib C) +set(CMAKE_MACOSX_RPATH 1) +set(CMAKE_C_FLAGS_RELEASE "-Wall -O2") +set(CMAKE_C_FLAGS_DEBUG "-g -DSPGDEBUG -DSPGWARNING") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + +# Version numbers +file(READ ${PROJECT_SOURCE_DIR}/src/version.h version_file) +string(REGEX MATCH "SPGLIB_MAJOR_VERSION ([0-9]+)" spglib_major_version ${version_file}) +set(spglib_major_version ${CMAKE_MATCH_1}) +string(REGEX MATCH "SPGLIB_MINOR_VERSION ([0-9]+)" spglib_minor_version ${version_file}) +set(spglib_minor_version ${CMAKE_MATCH_1}) +string(REGEX MATCH "SPGLIB_MICRO_VERSION ([0-9]+)" spglib_micro_version ${version_file}) +set(spglib_micro_version ${CMAKE_MATCH_1}) +set(serial "${spglib_major_version}.${spglib_minor_version}.${spglib_micro_version}") +set(soserial "1") + +# Source code +include_directories("${PROJECT_SOURCE_DIR}/src") +set(SOURCES ${PROJECT_SOURCE_DIR}/src/arithmetic.c + ${PROJECT_SOURCE_DIR}/src/cell.c + ${PROJECT_SOURCE_DIR}/src/debug.c + ${PROJECT_SOURCE_DIR}/src/delaunay.c + ${PROJECT_SOURCE_DIR}/src/determination.c + ${PROJECT_SOURCE_DIR}/src/hall_symbol.c + ${PROJECT_SOURCE_DIR}/src/kgrid.c + ${PROJECT_SOURCE_DIR}/src/kpoint.c + ${PROJECT_SOURCE_DIR}/src/mathfunc.c + ${PROJECT_SOURCE_DIR}/src/niggli.c + ${PROJECT_SOURCE_DIR}/src/overlap.c + ${PROJECT_SOURCE_DIR}/src/pointgroup.c + ${PROJECT_SOURCE_DIR}/src/primitive.c + ${PROJECT_SOURCE_DIR}/src/refinement.c + ${PROJECT_SOURCE_DIR}/src/site_symmetry.c + ${PROJECT_SOURCE_DIR}/src/sitesym_database.c + ${PROJECT_SOURCE_DIR}/src/spacegroup.c + ${PROJECT_SOURCE_DIR}/src/spg_database.c + ${PROJECT_SOURCE_DIR}/src/spglib.c + ${PROJECT_SOURCE_DIR}/src/spin.c + ${PROJECT_SOURCE_DIR}/src/symmetry.c) + +add_library(symspg STATIC ${SOURCES}) +install(TARGETS symspg ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + +# Header file +install(FILES ${PROJECT_SOURCE_DIR}/src/spglib.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) + diff --git a/tools/phonon/CMakeLists.txt b/tools/phonon/CMakeLists.txt new file mode 100644 index 0000000000..60da1cc79f --- /dev/null +++ b/tools/phonon/CMakeLists.txt @@ -0,0 +1,120 @@ + +# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL), +# macOS, MSVC 2019 (=Version 16) +cmake_minimum_required(VERSION 3.10) + +# set timestamp of downloaded files to that of archive +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() + +# set up project +set(PHANA_MINOR_VERSION 48) +project(phonon VERSION ${PHANA_MINOR_VERSION} + DESCRIPTION "Fix phonon post-processor" + LANGUAGES CXX C) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo) +endif() + +# hacks for MSVC to prevent lots of pointless warnings about "unsafe" functions, +# padding and Spectre mitigation +if(MSVC) + add_compile_options(/wd4244) + add_compile_options(/wd4267) + add_compile_options(/wd4711) + add_compile_options(/wd4820) + add_compile_options(/wd5045) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) +endif() + +set(CMAKE_PROJECT_VERSION ${PHANA_MINOR_VERSION}) +configure_file(version.h.in version.h @ONLY) +add_executable(phana + main.cpp + disp.cpp + dynmat.cpp + green.cpp + input.cpp + interpolate.cpp + kpath.cpp + memory.cpp + phonon.cpp + phonopy.cpp + qnodes.cpp + timer.cpp +) +target_include_directories(phana PUBLIC $) + +if(NOT LAMMPS_DIR) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules) + set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty") +endif() +find_package(FFTW3) +if(FFTW3_FOUND) + target_compile_definitions(phana PRIVATE FFTW3) + target_link_libraries(phana PRIVATE FFTW3::FFTW3) +endif() + +# build bundeled libraries +add_subdirectory(tricubic) + +# standalone build must build our own version of linalg +if(NOT LAMMPS_DIR) + if(NOT USE_INTERNAL_LINALG) + find_package(LAPACK) + find_package(BLAS) + endif() + if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG) + file(GLOB LINALG_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/linalg/[^.]*.cpp) + add_library(linalg STATIC ${LINALG_SOURCES}) + set(BLAS_LIBRARIES "$") + set(LAPACK_LIBRARIES "$") + else() + list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + endif() +endif() + +option(USE_SPGLIB "Download and use spglib for phonon DOS and other optional properties" ON) +if(USE_SPGLIB) + set(SPGLIB_URL "https://github.com/spglib/spglib/archive/refs/tags/v1.11.2.1.tar.gz" CACHE STRING "URL for spglib v1.x tarball") + set(SPGLIB_MD5 "3089782bc85b5034dd4765a18ee70bc7" CACHE STRING "MD5 checksum for spglib tarball") + mark_as_advanced(SPGLIB_URL) + mark_as_advanced(SPGLIB_MD5) + include(LAMMPSUtils) + GetFallbackURL(SPGLIB_URL SPGLIB_FALLBACK) + + include(ExternalProject) + ExternalProject_Add(spglib_build + URL ${SPGLIB_URL} ${SPGLIB_FALLBACK} + URL_MD5 ${SPGLIB_MD5} + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.spglib ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/src/spglib_build/CMakeLists.txt + INSTALL_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/src/spglib_build-build --target install + BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/lib/${CMAKE_STATIC_LIBRARY_PREFIX}symspg${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + + # workaround for older CMake versions + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/lib) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/include) + + add_library(SPGLIB::SYMSPG UNKNOWN IMPORTED) + add_dependencies(SPGLIB::SYMSPG spglib_build) + set_target_properties(SPGLIB::SYMSPG PROPERTIES + IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/lib/${CMAKE_STATIC_LIBRARY_PREFIX}symspg${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/spglib_build_ext/include + ) + + target_compile_definitions(phana PRIVATE UseSPG) + target_link_libraries(phana PRIVATE SPGLIB::SYMSPG) +endif() + +target_link_libraries(phana PRIVATE tricubic ${LAPACK_LIBRARIES}) +install(TARGETS phana EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/tools/phonon/Makefile b/tools/phonon/Makefile deleted file mode 100644 index 6afae5f312..0000000000 --- a/tools/phonon/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -.SUFFIXES : .o .cpp -# compiler and flags -CC = g++ -Wno-unused-result -LINK = $(CC) -static -CFLAGS = -O3 $(DEBUG) $(UFLAG) - -OFLAGS = -O3 $(DEBUG) -INC = $(LPKINC) $(TCINC) $(SPGINC) $(FFTINC) -LIB = $(LPKLIB) $(TCLIB) $(SPGLIB) $(FFTLIB) - -# cLapack library needed -LPKINC = -I/opt/clapack/3.2.1/include -LPKLIB = -L/opt/clapack/3.2.1/lib -lclapack -lblas -lf2c -lm - -# Tricubic library needed -TCINC = -I/opt/tricubic/1.0/include -TCLIB = -L/opt/tricubic/1.0/lib -ltricubic - -# spglib, used to get the irreducible q-points -# if SFLAG is not set, spglib won't be used. -SFLAG = -DUseSPG -SPGINC = -I/opt/spglib/1.9.7/include/spglib -SPGLIB = -L/opt/spglib/1.9.7/lib -lsymspg - -# FFTW 3, used to deduce the force constants in real space -# if FFLAG is not set, fftw won't be used. -FFLAG = -DFFTW3 -FFTINC = -I/opt/fftw/3.3.7/include -FFTLIB = -L/opt/fftw/3.3.7/lib -lfftw3 - -# Debug flags -# DEBUG = -g -DDEBUG -UFLAG = $(SFLAG) $(FFLAG) - -#==================================================================== -ROOT = phana -# executable name -EXE = $(ROOT) -#==================================================================== -# source and rules -SRC = $(wildcard *.cpp) -OBJ = $(SRC:.cpp=.o) - -#==================================================================== -all: ${EXE} - -${EXE}: $(OBJ) - $(LINK) $(OFLAGS) $(OBJ) $(LIB) -o $@ - -clean: - rm -f *.o *~ *.mod ${EXE} - -tar: - rm -f ${ROOT}.tar.gz; tar -czvf ${ROOT}.tar.gz *.cpp *.h Makefile README - -ver: - @echo "#define VERSION `git log|grep '^commit'|wc -l`" > version.h - -#==================================================================== -.f.o: - $(FC) $(FFLAGS) $(FREE) $(MPI) ${INC} -c $< -.f90.o: - $(FC) $(FFLAGS) $(FREE) $(MPI) ${INC} -c $< -.c.o: - $(CC) $(CFLAGS) -c $< -.cpp.o: - $(CC) $(CFLAGS) $(INC) -c $< diff --git a/tools/phonon/README b/tools/phonon/README index db69ac50c8..c1430f5940 100644 --- a/tools/phonon/README +++ b/tools/phonon/README @@ -5,34 +5,38 @@ analyse the phonon related information. #------------------------------------------------------------------------------- 1. Dependencies - The clapack library is needed to solve the eigen problems, - which could be downloaded from: - http://www.netlib.org/clapack/ - - The tricubic library is also needed to do tricubic interpolations, - which could now be obtained from: - https://github.com/nbigaouette/libtricubic/ - + The ZHEEVD LAPACK function is needed to solve the eigen problems. + A C++ compilable version based on CLAPACK is included in the linalg folder + and will be automatically built. + + The tricubic library is also needed to do tricubic interpolations. + A copy is included and will be automatically built. + The spglib is optionally needed, enabling one to evaluate the phonon density of states or vibrational thermal properties using only the irreducible q-points in the first Brillouin zone, as well as to evaluate the phonon dispersion curvers with the - automatic mode. Currently, the 1.8.3 version of spglib is used. - It can be obtained from: - http://spglib.sourceforge.net/ + automatic mode. Currently, version 1.11.2.1 of spglib is used. + It is automatically downloaded and compiled unless the -DUSE_SPGLIB=off + variable is set during CMake configuration. FFTW 3 might also be needed if you would like to interface with phonopy: necessary input files for phonopy will be prepared so that you can make use of the functions provided by phonopy. - FFTW 3 can be downloaded from: - http://www.fftw.org - + It is autodetected and used if available. + + FFTW 3 can be downloaded from: http://www.fftw.org + 2. Compilation - To compile the code, one needs therefore to install the above - libraries and set the paths correctly in the Makefile. - Once this is done, by typing - make - will yield the executable "phana". + To compile the code, one needs to have CMake version 3.16 + or later installed. + + The CMake configuration is done with: + cmake -S . -B build + And compilation then performed with: + cmake --build build + The phana (or phana.exe) executable is then available in + the "build" folder 3. Unit system The units of the output frequencies by this code is THz for @@ -46,6 +50,18 @@ 5. Bug report If any bug found, please drop a line to: konglt(at)sjtu.edu.cn +6. Precompiled executable + The "precompiled" folder contains a precompiled and statically + linked Linux executable for x86_64 CPUs. It should work on *any* + Linux machine with using the x86_64 architecture. It includes + spglib support but not fftw3. + +7. Portability + Build and use of phana has been successfully tested on: + - Fedora Linux 38 using GCC, Clang, and MinGW Linux2Windows cross-compiler + - macOS 12 (Monterey) using Xcode + - Windows 11 using Visual Studio 2022 with MSVC and Clang + #------------------------------------------------------------------------------- Author: Ling-Ti Kong, konglt(at)sjtu.edu.cn -May 2020 +Aug 2021 diff --git a/tools/phonon/disp.cpp b/tools/phonon/disp.cpp index 8a53873383..79a22aeee4 100644 --- a/tools/phonon/disp.cpp +++ b/tools/phonon/disp.cpp @@ -1,10 +1,18 @@ -#include "string.h" -#include "qnodes.h" -#include "global.h" + #include "phonon.h" -#include "green.h" -#include "timer.h" + +#include "dynmat.h" +#include "global.h" +#include "input.h" #include "kpath.h" +#include "qnodes.h" + +#include +#include +#include +#include +#include +#include /*------------------------------------------------------------------------------ * Private method to evaluate the phonon dispersion curves @@ -13,19 +21,22 @@ void Phonon::pdisp() { // ask the output file name and write the header. char str[MAXLINE]; - for (int ii = 0; ii < 80; ++ii) printf("="); printf("\n"); + puts("================================================================================"); + #ifdef UseSPG // ask method to generate q-lines int method = 2; printf("Please select your method to generate the phonon dispersion:\n"); printf(" 1. Manual, should always work;\n"); printf(" 2. Automatic, works only for 3D crystals (CMS49-299).\nYour choice [2]: "); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) method = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) method = atoi(strtok(str," \t\n\r\f")); method = 2 - method%2; printf("Your selection: %d\n", method); #endif printf("\nPlease input the filename to output the dispersion data [pdisp.dat]:"); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str, "pdisp.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str, "pdisp.dat"); char *ptr = strtok(str," \t\n\r\f"); char *fname = new char[strlen(ptr)+1]; strcpy(fname,ptr); @@ -45,9 +56,9 @@ void Phonon::pdisp() while (1){ for (int i = 0; i < 3; ++i) qstr[i] = qend[i]; - int quit = 0; printf("\nPlease input the start q-point in unit of B1->B3, q to exit [%g %g %g]: ", qstr[0], qstr[1], qstr[2]); - int n = count_words(fgets(str, MAXLINE, stdin)); + input->read_stdin(str); + int n = count_words(str); ptr = strtok(str, " \t\n\r\f"); if ((n == 1) && (strcmp(ptr,"q") == 0)) break; else if (n >= 3){ @@ -56,14 +67,18 @@ void Phonon::pdisp() qstr[2] = atof(strtok(NULL, " \t\n\r\f")); } - do printf("Please input the end q-point in unit of B1->B3: "); - while (count_words(fgets(str, MAXLINE, stdin)) < 3); + while ( 1 ){ + printf("Please input the end q-point in unit of B1->B3: "); + input->read_stdin(str); + if (count_words(str) >= 3) break; + } qend[0] = atof(strtok(str, " \t\n\r\f")); qend[1] = atof(strtok(NULL, " \t\n\r\f")); qend[2] = atof(strtok(NULL, " \t\n\r\f")); printf("Please input the # of points along the line [%d]: ", nq); - if (count_words(fgets(str, MAXLINE, stdin)) > 0) nq = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) nq = atoi(strtok(str," \t\n\r\f")); nq = MAX(nq,2); double *qtmp = new double [3]; @@ -147,7 +162,7 @@ void Phonon::pdisp() printf("\nPhonon dispersion data are written to: %s, you can visualize the results\n", fname); printf("by invoking: `gnuplot pdisp.gnuplot; gv pdisp.eps`\n"); } - for (int ii = 0; ii < 80; ++ii) printf("="); printf("\n"); + puts("================================================================================"); delete []fname; delete qnodes; diff --git a/tools/phonon/dynmat.cpp b/tools/phonon/dynmat.cpp index a6c4105547..b7cd4dde63 100644 --- a/tools/phonon/dynmat.cpp +++ b/tools/phonon/dynmat.cpp @@ -1,7 +1,16 @@ + #include "dynmat.h" -#include "math.h" -#include "version.h" + #include "global.h" +#include "input.h" +#include "interpolate.h" +#include "memory.h" +#include "version.h" +#include "zheevd.h" + +#include +#include +#include /* ---------------------------------------------------------------------------- * Class DynMat stores the Dynamic Matrix read from the binary file from @@ -9,6 +18,7 @@ * ---------------------------------------------------------------------------- */ DynMat::DynMat(int narg, char **arg) { + input = NULL; attyp = NULL; memory = NULL; M_inv_sqrt = NULL; @@ -19,6 +29,8 @@ DynMat::DynMat(int narg, char **arg) attyp = NULL; basis = NULL; flag_reset_gamma = flag_skip = 0; + symprec = -1.; + int flag_save = 0; // analyze the command line options int iarg = 1; @@ -29,9 +41,16 @@ DynMat::DynMat(int narg, char **arg) } else if (strcmp(arg[iarg], "-r") == 0){ flag_reset_gamma = 1; + } else if (strcmp(arg[iarg], "-p") == 0){ + if (++iarg >= narg) help(); + else symprec = fabs(atof(arg[iarg])); + } else if (strcmp(arg[iarg], "-h") == 0){ help(); + } else if (strcmp(arg[iarg], "-save") == 0){ + flag_save = 1; + } else { if (binfile) delete []binfile; int n = strlen(arg[iarg]) + 1; @@ -43,6 +62,8 @@ DynMat::DynMat(int narg, char **arg) } ShowVersion(); + input = new UserInput(flag_save); + // get the binary file name from user input if not found in command line char str[MAXLINE]; if (binfile == NULL) { @@ -50,7 +71,7 @@ DynMat::DynMat(int narg, char **arg) printf("\n"); do { printf("Please input the binary file name from fix_phonon: "); - fgets(str,MAXLINE,stdin); + input->read_stdin(str); ptr = strtok(str, " \n\t\r\f"); } while (ptr == NULL); @@ -116,7 +137,7 @@ DynMat::DynMat(int narg, char **arg) memory->create(DM_q, fftdim,fftdim,"DynMat:DM_q"); // read all dynamical matrix info into DM_all - if (fread(DM_all[0], sizeof(doublecomplex), npt*fftdim2, fp) != size_t(npt*fftdim2)){ + if (fread(DM_all[0], sizeof(doublecomplex), npt*size_t(fftdim2), fp) != npt*size_t(fftdim2)) { printf("\nError while reading the DM from file: %s\n", binfile); fclose(fp); exit(1); @@ -137,17 +158,17 @@ DynMat::DynMat(int narg, char **arg) fclose(fp); exit(3); } - if (fread(basis[0], sizeof(double), fftdim, fp) != fftdim){ + if (fread(basis[0], sizeof(double), fftdim, fp) != (size_t)fftdim){ printf("\nError while reading basis info from file: %s\n", binfile); fclose(fp); exit(3); } - if (fread(&attyp[0], sizeof(int), nucell, fp) != nucell){ + if (fread(&attyp[0], sizeof(int), nucell, fp) != (size_t)nucell){ printf("\nError while reading atom types from file: %s\n", binfile); fclose(fp); exit(3); } - if (fread(&M_inv_sqrt[0], sizeof(double), nucell, fp) != nucell){ + if (fread(&M_inv_sqrt[0], sizeof(double), nucell, fp) != (size_t)nucell){ printf("\nError while reading atomic masses from file: %s\n", binfile); fclose(fp); exit(3); @@ -159,6 +180,7 @@ DynMat::DynMat(int narg, char **arg) // initialize interpolation interpolate = new Interpolate(nx,ny,nz,fftdim2,DM_all); + interpolate->input = input; if (flag_reset_gamma) interpolate->reset_gamma(); // Enforcing Austic Sum Rule @@ -217,7 +239,7 @@ void DynMat::writeDMq(double *q) printf("\n"); while ( 1 ){ printf("Please input the filename to output the DM at selected q: "); - fgets(str,MAXLINE,stdin); + input->read_stdin(str); ptr = strtok(str, " \r\t\n\f"); if (ptr) break; } @@ -264,9 +286,9 @@ void DynMat::writeDMq(double *q, const double qr, FILE *fp) int DynMat::geteigen(double *egv, int flag) { char jobz, uplo; - integer n, lda, lwork, lrwork, *iwork, liwork, info; + int n, lda, lwork, lrwork, *iwork, liwork, info; doublecomplex *work; - doublereal *w = &egv[0], *rwork; + double *w = &egv[0], *rwork; n = fftdim; if (flag) jobz = 'V'; @@ -348,7 +370,7 @@ void DynMat::EnforceASR() char str[MAXLINE]; int nasr = 20; if (nucell <= 1) nasr = 1; - printf("\n"); for (int i = 0; i < 80; ++i) printf("="); + printf("\n================================================================================"); // compute and display eigenvalues of Phi at gamma before ASR if (nucell > 100){ @@ -356,7 +378,7 @@ void DynMat::EnforceASR() fflush(stdout); } - double egvs[fftdim]; + double *egvs = new double[fftdim]; for (int i = 0; i < fftdim; ++i) for (int j = 0; j < fftdim; ++j) DM_q[i][j] = DM_all[0][i*fftdim+j]; geteigen(egvs, 0); @@ -370,11 +392,11 @@ void DynMat::EnforceASR() // ask for iterations to enforce ASR printf("Please input the # of iterations to enforce ASR [%d]: ", nasr); - fgets(str,MAXLINE,stdin); + input->read_stdin(str); char *ptr = strtok(str," \t\n\r\f"); if (ptr) nasr = atoi(ptr); if (nasr < 1){ - for (int i=0; i<80; i++) printf("="); printf("\n"); + puts("================================================================================"); return; } @@ -439,9 +461,8 @@ void DynMat::EnforceASR() if (i%10 == 9) printf("\n"); if (i == 99){ printf("...... (%d more skiped)", fftdim-100); break;} } - printf("\n"); - for (int i = 0; i < 80; ++i) printf("="); printf("\n\n"); - + delete[] egvs; + puts("\n================================================================================\n"); return; } @@ -468,7 +489,7 @@ void DynMat::real2rec() for (int i = 0; i < 9; ++i) ibasevec[i] *= vol; - printf("\n"); for (int i = 0; i < 80; ++i) printf("="); + printf("\n================================================================================"); printf("\nBasis vectors of the unit cell in real space:"); for (int i = 0; i < sysdim; ++i){ printf("\n A%d: ", i+1); @@ -479,8 +500,7 @@ void DynMat::real2rec() printf("\n B%d: ", i+1); for (int j = 0; j < sysdim; ++j) printf("%8.4f ", ibasevec[i*3+j]); } - printf("\n"); for (int i = 0; i < 80; ++i) printf("="); printf("\n"); - + puts("\n================================================================================"); return; } @@ -500,16 +520,17 @@ void DynMat::GaussJordan(int n, double *Mat) indxc = new int[n]; indxr = new int[n]; ipiv = new int[n]; - + + irow = icol = -1; for (i = 0; i < n; ++i) ipiv[i] = 0; for (i = 0; i < n; ++i){ - big = 0.; + big = 0.0; for (j = 0; j < n; ++j){ if (ipiv[j] != 1){ for (k = 0; k < n; ++k){ if (ipiv[k] == 0){ idr = j * n + k; - nmjk = abs(Mat[idr]); + nmjk = fabs(Mat[idr]); if (nmjk >= big){ big = nmjk; irow = j; @@ -602,6 +623,9 @@ void DynMat::help() printf(" will also inform the code to skip all q-points that is in the vicinity\n"); printf(" of the gamma point when evaluating phonon DOS and/or phonon dispersion.\n\n"); printf(" By default, this is not set; and not expected for uncharged systems.\n\n"); + printf(" -p prec To define the precision for symmetry identification with spglib.\n"); + printf(" By default, 1.e-3.\n\n"); + printf(" -save To record user input in `script.inp`, facilitating scripting.\n\n"); printf(" -h To print out this help info.\n\n"); printf(" file To define the filename that carries the binary dynamical matrice generated\n"); printf(" by fix-phonon. If not provided, the code will ask for it.\n"); @@ -680,13 +704,13 @@ void DynMat::Define_Conversion_Factor() * ---------------------------------------------------------------------------- */ void DynMat::ShowInfo() { - printf("\n"); for (int i = 0; i < 80; ++i) printf("="); printf("\n"); + puts("\n================================================================================"); printf("Dynamical matrix is read from file: %s\n", binfile); printf("The system size in three dimension: %d x %d x %d\n", nx, ny, nz); printf("Number of atoms per unit cell : %d\n", nucell); printf("System dimension : %d\n", sysdim); printf("Boltzmann constant in used units : %g\n", boltz); - for (int i = 0; i < 80; ++i) printf("="); printf("\n"); + puts("================================================================================"); return; } /* --------------------------------------------------------------------*/ diff --git a/tools/phonon/dynmat.h b/tools/phonon/dynmat.h index 10caa1ce2a..e11badfde6 100644 --- a/tools/phonon/dynmat.h +++ b/tools/phonon/dynmat.h @@ -1,11 +1,9 @@ #ifndef DYNMAT_H #define DYNMAT_H -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "memory.h" -#include "interpolate.h" +#include "zheevd.h" + +#include class DynMat { public: @@ -15,7 +13,7 @@ public: int nx, ny, nz, nucell; int sysdim, fftdim; - double eml2f, eml2fc; + double eml2f, eml2fc, symprec; char *funit; void getDMq(double *); @@ -34,18 +32,18 @@ public: double **basis; int *attyp; + class UserInput *input; + private: int flag_skip, flag_reset_gamma; - Interpolate *interpolate; - - Memory *memory; + class Interpolate *interpolate; + class Memory *memory; - int nasr; void EnforceASR(); char *binfile, *dmfile; - double boltz, q[3]; + double boltz; doublecomplex **DM_all; diff --git a/tools/phonon/global.h b/tools/phonon/global.h index c20a91f317..bd1608ee07 100644 --- a/tools/phonon/global.h +++ b/tools/phonon/global.h @@ -1,7 +1,7 @@ #ifndef GLOBAL_H #define GLOBAL_H -#define ZERO 1.e-8 +#define ZERO 1.0e-8 #define MAXLINE 512 #define MIN(a,b) ((a)>(b)?(b):(a)) diff --git a/tools/phonon/green.cpp b/tools/phonon/green.cpp index 41f5b14886..0f687fd834 100644 --- a/tools/phonon/green.cpp +++ b/tools/phonon/green.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include #include "green.h" + +#include "memory.h" + #include -#include "global.h" +#include +#include /******************************************************************************* * The class of Green is designed to evaluate the LDOS via the Green's Function @@ -59,7 +59,6 @@ Green::Green(const int ntm, const int sdim, const int niter, const double min, c dw = (wmax - wmin)/double(nw-1); memory->create(alpha, sysdim,nit, "Green_Green:alpha"); memory->create(beta, sysdim,nit+1,"Green_Green:beta"); - //memory->create(ldos, nw,sysdim, "Green_Green:ldos"); // use Lanczos algorithm to diagonalize the Hessian Lanczos(); @@ -224,8 +223,6 @@ void Green::recursion() { // local variables std::complex Z, rec_x, rec_x_inv; - std::complex cunit = std::complex(0.,1.); - double w = wmin; for (int i = 0; i < nw; ++i){ diff --git a/tools/phonon/green.h b/tools/phonon/green.h index 1a137e53ba..21e3b091dc 100644 --- a/tools/phonon/green.h +++ b/tools/phonon/green.h @@ -1,8 +1,6 @@ #ifndef GREEN_H #define GREEN_H -#include "memory.h" - class Green{ public: Green(const int, const int, const int, const double, const double, @@ -14,12 +12,11 @@ private: void Recursion(); void recursion(); - int ndos; double **ldos; int natom, iatom, sysdim, nit, nw, ndim; double dw, wmin, wmax, epson; double **alpha, **beta, **H; - Memory *memory; + class Memory *memory; }; #endif diff --git a/tools/phonon/input.cpp b/tools/phonon/input.cpp new file mode 100644 index 0000000000..c2059043c7 --- /dev/null +++ b/tools/phonon/input.cpp @@ -0,0 +1,35 @@ +#include "input.h" + +#include "global.h" + +/* ------------------------------------------------------------------- + * Constructor. If flag = 1, output user inputs as script.inp + * ---------------------------------------------------------------- */ +UserInput::UserInput(int flag) +{ + fp = NULL; + if (flag) fp = fopen("script.inp", "w"); + + return; +} + +/* ------------------------------------------------------------------- + * Deconstructor. Output user inputs as required and clear workspace. + * ---------------------------------------------------------------- */ +UserInput::~UserInput() +{ + if (fp) fclose(fp); + fp = NULL; +} + +/* ------------------------------------------------------------------- + * Read stdin and keep a record of it. + * ---------------------------------------------------------------- */ +void UserInput::read_stdin(char *str) +{ + fgets(str, MAXLINE, stdin); + if (fp) fprintf(fp, "%s", str); + + return; +} +/* ---------------------------------------------------------------- */ diff --git a/tools/phonon/input.h b/tools/phonon/input.h new file mode 100644 index 0000000000..c931895c4d --- /dev/null +++ b/tools/phonon/input.h @@ -0,0 +1,17 @@ +#ifndef INPUT_H +#define INPUT_H + +#include + +class UserInput { +public: + UserInput(int); + ~UserInput(); + + void read_stdin(char *); + +private: + FILE *fp; + +}; +#endif diff --git a/tools/phonon/interpolate.cpp b/tools/phonon/interpolate.cpp index 09e261c763..8ea551d1a8 100644 --- a/tools/phonon/interpolate.cpp +++ b/tools/phonon/interpolate.cpp @@ -1,6 +1,14 @@ + #include "interpolate.h" -#include "math.h" + #include "global.h" +#include "input.h" +#include "memory.h" +#include "tricubic.h" + +#include +#include +#include /* ---------------------------------------------------------------------------- * Constructor used to get info from caller, and prepare other necessary data @@ -19,6 +27,7 @@ Interpolate::Interpolate(int nx, int ny, int nz, int ndm, doublecomplex **DM) data = DM; Dfdx = Dfdy = Dfdz = D2fdxdy = D2fdxdz = D2fdydz = D3fdxdydz = NULL; flag_reset_gamma = flag_allocated_dfs = 0; + input = NULL; return; } @@ -265,17 +274,19 @@ void Interpolate::set_method() { char str[MAXLINE]; int im = 1; - printf("\n");for(int i=0; i<80; i++) printf("="); - printf("\nWhich interpolation method would you like to use?\n"); + if (input == NULL) input = new UserInput(0); + + puts("\n================================================================================"); + printf("Which interpolation method would you like to use?\n"); printf(" 1. Tricubic;\n 2. Trilinear;\n"); printf("Your choice [1]: "); - fgets(str,MAXLINE,stdin); + input->read_stdin(str); char *ptr = strtok(str," \t\n\r\f"); if (ptr) im = atoi(ptr); which =2-im%2; printf("Your selection: %d\n", which); - for(int i=0; i<80; i++) printf("="); printf("\n\n"); + puts("================================================================================\n"); if (which == 1) tricubic_init(); diff --git a/tools/phonon/interpolate.h b/tools/phonon/interpolate.h index c650b30908..b9e0242b96 100644 --- a/tools/phonon/interpolate.h +++ b/tools/phonon/interpolate.h @@ -1,16 +1,7 @@ #ifndef INTERPOLATION_H #define INTERPOLATION_H -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "memory.h" -#include "tricubic.h" - -extern "C"{ -#include "f2c.h" -#include "clapack.h" -} +#include "zheevd.h" class Interpolate{ public: @@ -23,11 +14,13 @@ public: int UseGamma; + class UserInput *input; + private: void tricubic_init(); void tricubic(double *, doublecomplex *); void trilinear(double *, doublecomplex *); - Memory *memory; + class Memory *memory; int which; int Nx, Ny, Nz, Npt, ndim; diff --git a/tools/phonon/kpath.cpp b/tools/phonon/kpath.cpp index 842e680611..49730b42b6 100644 --- a/tools/phonon/kpath.cpp +++ b/tools/phonon/kpath.cpp @@ -1,11 +1,19 @@ -#include "global.h" + #include "kpath.h" +#include "global.h" +#include "dynmat.h" +#include "memory.h" +#include "qnodes.h" + #ifdef UseSPG extern "C"{ #include "spglib.h" } -#include "math.h" +#include +#include +#include +#include /* ---------------------------------------------------------------------------- * Class kPath will help to find the high symmetry k-path for a given lattice. @@ -47,11 +55,15 @@ kPath::kPath(DynMat *dm, QNodes *qn) for (int idim = 0; idim < sysdim; ++idim) atpos[i][idim] = dynmat->basis[i][idim]; // get the space group number - double symprec = 1.e-4, pos[num_atom][3]; + double symprec = 1.0e-3; + double **pos; + memory->create(pos,num_atom,3,"kpath:pos"); + if (dynmat->symprec > 0.0) symprec = dynmat->symprec; + for (int i = 0; i < num_atom; ++i) for (int j = 0; j < 3; ++j) pos[i][j] = atpos[i][j]; - spgnum = spg_get_international(symbol, latvec, pos, attyp, num_atom, symprec); - + spgnum = spg_get_international(symbol, latvec, (double (*)[3])pos, attyp, num_atom, symprec); + memory->destroy(pos); return; } @@ -61,7 +73,7 @@ kPath::kPath(DynMat *dm, QNodes *qn) void kPath::show_info() { // display the unit cell info read - for (int ii = 0; ii < 80; ++ii) printf("-"); printf("\n"); + puts("--------------------------------------------------------------------------------"); printf("The basis vectors of the unit cell:\n"); for (int idim = 0; idim < 3; ++idim){ printf(" A%d =", idim+1); @@ -76,12 +88,10 @@ void kPath::show_info() if (num_atom > NUMATOM) printf(" ... (%d atoms omitted.)\n", num_atom-NUMATOM); printf("The space group number of your unit cell is: %d => %s\n", spgnum, symbol); - for (int ii = 0; ii < 80; ++ii) printf("-"); printf("\n"); - + puts("--------------------------------------------------------------------------------"); return; } - /* ---------------------------------------------------------------------------- * Free the memeory used by kPath. * ---------------------------------------------------------------------------- */ @@ -2765,9 +2775,16 @@ void kPath::show_path() if (q == NULL) return; int nbin = q->ndstr.size(); if (nbin > 0){ - printf("\nk-path for the current lattice will be:\n\t%s", q->ndstr[0].c_str()); + puts("\n--------------------------------------------------------------------------------"); + printf("k-path for the current lattice will be:\n %s", q->ndstr[0].c_str()); for (int is = 1; is < nbin; ++is) printf("-%s", q->ndstr[is].c_str()); - printf("\n"); + + printf("\n\nThe fractional coordinates of these paths are:\n"); + for (int is = 0; is < nbin-1; ++is) + printf(" [%6.4f %6.4f %6.4f] --> [%6.4f %6.4f %6.4f] (%s - %s)\n", q->qs[is][0], + q->qs[is][1], q->qs[is][2], q->qe[is][0], q->qe[is][1], q->qe[is][2], + q->ndstr[is].c_str(), q->ndstr[is+1].c_str() ); + puts("--------------------------------------------------------------------------------"); } return; diff --git a/tools/phonon/kpath.h b/tools/phonon/kpath.h index bbcedf15d4..ade1e3a27c 100644 --- a/tools/phonon/kpath.h +++ b/tools/phonon/kpath.h @@ -4,14 +4,9 @@ #ifndef KPATH_H #define KPATH_H -#include "qnodes.h" -#include "dynmat.h" -#include "memory.h" - class kPath{ public: - - kPath(DynMat *, QNodes *); + kPath(class DynMat *, class QNodes *); ~kPath(); void kpath(); @@ -19,13 +14,11 @@ public: void show_info(); private: - - Memory *memory; - - DynMat *dynmat; - QNodes *q; + class Memory *memory; + class DynMat *dynmat; + class QNodes *q; char symbol[11]; - int spgnum, sysdim, fftdim, num_atom, *attyp; + int spgnum, sysdim, num_atom, *attyp; double latvec[3][3], **atpos; }; diff --git a/tools/phonon/main.cpp b/tools/phonon/main.cpp index d7d5baa1cc..d0193a037c 100644 --- a/tools/phonon/main.cpp +++ b/tools/phonon/main.cpp @@ -1,10 +1,6 @@ -#include "stdio.h" -#include "stdlib.h" #include "dynmat.h" #include "phonon.h" -using namespace std; - int main(int argc, char** argv) { diff --git a/tools/phonon/memory.cpp b/tools/phonon/memory.cpp index 4d65e83ef8..18dfa2fa43 100644 --- a/tools/phonon/memory.cpp +++ b/tools/phonon/memory.cpp @@ -1,8 +1,8 @@ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" #include "memory.h" +#include +#include + /* ---------------------------------------------------------------------- safe malloc ------------------------------------------------------------------------- */ diff --git a/tools/phonon/memory.h b/tools/phonon/memory.h index ae2feceba3..13eeca4b14 100644 --- a/tools/phonon/memory.h +++ b/tools/phonon/memory.h @@ -4,18 +4,16 @@ #define __STDC_LIMIT_MACROS #define __STDC_FORMAT_MACROS -#include "stdio.h" -#include "stdlib.h" -#include "limits.h" -#include "stdint.h" -#include "inttypes.h" +#include +#include +#include typedef int64_t bigint; #define BIGINT_FORMAT "%" PRId64 #define ATOBIGINT atoll class Memory { - public: +public: Memory(){}; void *smalloc(bigint n, const char *); @@ -24,11 +22,11 @@ class Memory { void fail(const char *); /* ---------------------------------------------------------------------- - create a 1d array -------------------------------------------------------------------------- */ + create a 1d array + ------------------------------------------------------------------------- */ template - TYPE *create(TYPE *&array, int n, const char *name) + TYPE *create(TYPE *&array, int n, const char *name) { bigint nbytes = sizeof(TYPE) * n; array = (TYPE *) smalloc(nbytes,name); @@ -36,42 +34,42 @@ class Memory { }; template - TYPE **create(TYPE **&array, int n, const char *name) {fail(name);} + TYPE **create(TYPE **&, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- grow or shrink 1d array -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ template - TYPE *grow(TYPE *&array, int n, const char *name) + TYPE *grow(TYPE *&array, int n, const char *name) { if (array == NULL) return create(array,n,name); - + bigint nbytes = sizeof(TYPE) * n; array = (TYPE *) srealloc(array,nbytes,name); return array; }; template - TYPE **grow(TYPE **&array, int n, const char *name) {fail(name);} + TYPE **grow(TYPE **&, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- - destroy a 1d array -------------------------------------------------------------------------- */ + destroy a 1d array + ------------------------------------------------------------------------- */ template - void destroy(TYPE *array) + void destroy(TYPE *array) { sfree(array); }; /* ---------------------------------------------------------------------- - create a 1d array with index from nlo to nhi inclusive + create a 1d array with index from nlo to nhi inclusive cannot grow it -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ template - TYPE *create1d_offset(TYPE *&array, int nlo, int nhi, const char *name) + TYPE *create1d_offset(TYPE *&array, int nlo, int nhi, const char *name) { bigint nbytes = sizeof(TYPE) * (nhi-nlo+1); array = (TYPE *) smalloc(nbytes,name); @@ -80,76 +78,76 @@ class Memory { } template - TYPE **create1d_offset(TYPE **&array, int nlo, int nhi, const char *name) + TYPE **create1d_offset(TYPE **&, int, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- - destroy a 1d array with index offset -------------------------------------------------------------------------- */ + destroy a 1d array with index offset + ------------------------------------------------------------------------- */ template - void destroy1d_offset(TYPE *array, int offset) + void destroy1d_offset(TYPE *array, int offset) { if (array) sfree(&array[offset]); } /* ---------------------------------------------------------------------- - create a 2d array -------------------------------------------------------------------------- */ + create a 2d array + ------------------------------------------------------------------------- */ template - TYPE **create(TYPE **&array, int n1, int n2, const char *name) + TYPE **create(TYPE **&array, int n1, int n2, const char *name) { bigint nbytes = sizeof(TYPE) * n1*n2; TYPE *data = (TYPE *) smalloc(nbytes,name); nbytes = sizeof(TYPE *) * n1; array = (TYPE **) smalloc(nbytes,name); - + int n = 0; for (int i = 0; i < n1; i++) { - array[i] = &data[n]; - n += n2; + array[i] = &data[n]; + n += n2; } return array; } template - TYPE ***create(TYPE ***&array, int n1, int n2, const char *name) + TYPE ***create(TYPE ***&, int, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array last dim must stay the same -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ template - TYPE **grow(TYPE **&array, int n1, int n2, const char *name) + TYPE **grow(TYPE **&array, int n1, int n2, const char *name) { if (array == NULL) return create(array,n1,n2,name); - + bigint nbytes = sizeof(TYPE) * n1*n2; TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); nbytes = sizeof(TYPE *) * n1; array = (TYPE **) srealloc(array,nbytes,name); - + int n = 0; for (int i = 0; i < n1; i++) { - array[i] = &data[n]; - n += n2; + array[i] = &data[n]; + n += n2; } return array; } template - TYPE ***grow(TYPE ***&array, int n1, int n2, const char *name) + TYPE ***grow(TYPE ***&, int, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- - destroy a 2d array -------------------------------------------------------------------------- */ + destroy a 2d array + ------------------------------------------------------------------------- */ template - void destroy(TYPE **array) + void destroy(TYPE **array) { if (array == NULL) return; sfree(array[0]); @@ -157,42 +155,11 @@ class Memory { } /* ---------------------------------------------------------------------- - create a 2d array with 2nd index from n2lo to n2hi inclusive - cannot grow it -------------------------------------------------------------------------- */ + create a 3d array + ------------------------------------------------------------------------- */ template - TYPE **create2d_offset(TYPE **&array, int n1, int n2lo, int n2hi, - const char *name) - { - int n2 = n2hi - n2lo + 1; - create(array,n1,n2,name); - for (int i = 0; i < n1; i++) array[i] -= n2lo; - return array; - } - - template - TYPE ***create2d_offset(TYPE ***&array, int n1, int n2lo, int n2hi, - const char *name) {fail(name);} - -/* ---------------------------------------------------------------------- - destroy a 2d array with 2nd index offset -------------------------------------------------------------------------- */ - - template - void destroy2d_offset(TYPE **array, int offset) - { - if (array == NULL) return; - sfree(&array[0][offset]); - sfree(array); - } - -/* ---------------------------------------------------------------------- - create a 3d array -------------------------------------------------------------------------- */ - - template - TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name) + TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name) { bigint nbytes = sizeof(TYPE) * n1*n2*n3; TYPE *data = (TYPE *) smalloc(nbytes,name); @@ -200,62 +167,62 @@ class Memory { TYPE **plane = (TYPE **) smalloc(nbytes,name); nbytes = sizeof(TYPE **) * n1; array = (TYPE ***) smalloc(nbytes,name); - + int i,j; int n = 0; for (i = 0; i < n1; i++) { - array[i] = &plane[i*n2]; - for (j = 0; j < n2; j++) { - plane[i*n2+j] = &data[n]; - n += n3; - } + array[i] = &plane[i*n2]; + for (j = 0; j < n2; j++) { + plane[i*n2+j] = &data[n]; + n += n3; + } } return array; } template - TYPE ****create(TYPE ****&array, int n1, int n2, int n3, const char *name) + TYPE ****create(TYPE ****&, int, int, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array last 2 dims must stay the same -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ template - TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) + TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) { if (array == NULL) return create(array,n1,n2,n3,name); - + bigint nbytes = sizeof(TYPE) * n1*n2*n3; TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); nbytes = sizeof(TYPE *) * n1*n2; TYPE **plane = (TYPE **) srealloc(array[0],nbytes,name); nbytes = sizeof(TYPE **) * n1; array = (TYPE ***) srealloc(array,nbytes,name); - + int i,j; int n = 0; for (i = 0; i < n1; i++) { - array[i] = &plane[i*n2]; - for (j = 0; j < n2; j++) { - plane[i*n2+j] = &data[n]; - n += n3; - } + array[i] = &plane[i*n2]; + for (j = 0; j < n2; j++) { + plane[i*n2+j] = &data[n]; + n += n3; + } } return array; } template - TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, const char *name) + TYPE ****grow(TYPE ****&, int, int, int, const char *name) {fail(name);} /* ---------------------------------------------------------------------- - destroy a 3d array -------------------------------------------------------------------------- */ + destroy a 3d array + ------------------------------------------------------------------------- */ template - void destroy(TYPE ***array) + void destroy(TYPE ***array) { if (array == NULL) return; sfree(array[0][0]); @@ -263,168 +230,23 @@ class Memory { sfree(array); } -/* ---------------------------------------------------------------------- - create a 3d array with 1st index from n1lo to n1hi inclusive - cannot grow it -------------------------------------------------------------------------- */ - - template - TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, - int n2, int n3, const char *name) - { - int n1 = n1hi - n1lo + 1; - create(array,n1,n2,n3,name); - array -= n1lo; - return array; - } - - template - TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, - int n2, int n3, const char *name) - {fail(name);} - -/* ---------------------------------------------------------------------- - free a 3d array with 1st index offset -------------------------------------------------------------------------- */ - - template - void destroy3d_offset(TYPE ***array, int offset) - { - if (array) destroy(&array[offset]); - } - -/* ---------------------------------------------------------------------- - create a 3d array with - 1st index from n1lo to n1hi inclusive, - 2nd index from n2lo to n2hi inclusive, - 3rd index from n3lo to n3hi inclusive - cannot grow it -------------------------------------------------------------------------- */ - - template - TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, - int n2lo, int n2hi, int n3lo, int n3hi, - const char *name) - { - int n1 = n1hi - n1lo + 1; - int n2 = n2hi - n2lo + 1; - int n3 = n3hi - n3lo + 1; - create(array,n1,n2,n3,name); - - for (int i = 0; i < n1*n2; i++) array[0][i] -= n3lo; - for (int i = 0; i < n1; i++) array[i] -= n2lo; - array -= n1lo; - return array; - } - - template - TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, - int n2lo, int n2hi, int n3lo, int n3hi, - const char *name) - {fail(name);} - -/* ---------------------------------------------------------------------- - free a 3d array with all 3 indices offset -------------------------------------------------------------------------- */ - - template - void destroy3d_offset(TYPE ***array, - int n1_offset, int n2_offset, int n3_offset) - { - if (array == NULL) return; - sfree(&array[n1_offset][n2_offset][n3_offset]); - sfree(&array[n1_offset][n2_offset]); - sfree(&array[n1_offset]); - } - -/* ---------------------------------------------------------------------- - create a 4d array -------------------------------------------------------------------------- */ - - template - TYPE ****create(TYPE ****&array, int n1, int n2, int n3, int n4, - const char *name) - { - bigint nbytes = sizeof(TYPE) * n1*n2*n3*n4; - TYPE *data = (double *) smalloc(nbytes,name); - nbytes = sizeof(TYPE *) * n1*n2*n3; - TYPE **cube = (double **) smalloc(nbytes,name); - nbytes = sizeof(TYPE **) * n1*n2; - TYPE ***plane = (double ***) smalloc(nbytes,name); - nbytes = sizeof(TYPE ***) * n1; - array = (double ****) smalloc(nbytes,name); - - int i,j,k; - int n = 0; - for (i = 0; i < n1; i++) { - array[i] = &plane[i*n2]; - for (j = 0; j < n2; j++) { - plane[i*n2+j] = &cube[i*n2*n3+j*n3]; - for (k = 0; k < n3; k++) { - cube[i*n2*n3+j*n3+k] = &data[n]; - n += n4; - } - } - } - return array; - } - - template - TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, - const char *name) - {fail(name);} - -/* ---------------------------------------------------------------------- - destroy a 4d array -------------------------------------------------------------------------- */ - - template - void destroy(TYPE ****array) - { - if (array == NULL) return; - sfree(array[0][0][0]); - sfree(array[0][0]); - sfree(array[0]); - sfree(array); - } - /* ---------------------------------------------------------------------- memory usage of arrays, including pointers -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ template - bigint usage(TYPE *array, int n) + bigint usage(TYPE *, int n) { bigint bytes = sizeof(TYPE) * n; return bytes; } template - bigint usage(TYPE **array, int n1, int n2) + bigint usage(TYPE **, int n1, int n2) { bigint bytes = sizeof(TYPE) * n1*n2; bytes += sizeof(TYPE *) * n1; return bytes; } - - template - bigint usage(TYPE ***array, int n1, int n2, int n3) - { - bigint bytes = sizeof(TYPE) * n1*n2*n3; - bytes += sizeof(TYPE *) * n1*n2; - bytes += sizeof(TYPE **) * n1; - return bytes; - } - - template - bigint usage(TYPE ****array, int n1, int n2, int n3, int n4) - { - bigint bytes = sizeof(TYPE) * n1*n2*n3*n4; - bytes += sizeof(TYPE *) * n1*n2*n3; - bytes += sizeof(TYPE **) * n1*n2; - bytes += sizeof(TYPE ***) * n1; - return bytes; - } }; - #endif diff --git a/tools/phonon/phonon.cpp b/tools/phonon/phonon.cpp index 56fa409e06..06372dcd1b 100644 --- a/tools/phonon/phonon.cpp +++ b/tools/phonon/phonon.cpp @@ -1,9 +1,18 @@ -#include -#include "string.h" + #include "phonon.h" -#include "green.h" -#include "timer.h" + #include "global.h" +#include "dynmat.h" +#include "green.h" +#include "input.h" +#include "memory.h" +#include "timer.h" +#include "zheevd.h" + +#include +#include +#include +#include #ifdef UseSPG extern "C"{ @@ -27,6 +36,7 @@ Phonon::Phonon(DynMat *dm) dynmat = dm; sysdim = dynmat->sysdim; ndim = dynmat->fftdim; + input = dm->input; dos = NULL; ldos = NULL; qpts = NULL; @@ -42,10 +52,7 @@ Phonon::Phonon(DynMat *dm) // display the menu char str[MAXLINE]; while ( 1 ){ - printf("\n"); - for (int i = 0; i < 37; ++i) printf("="); - printf(" Menu "); - for (int i = 0; i < 37; ++i) printf("="); printf("\n"); + puts("\n===================================== Menu ====================================="); printf(" 1. Phonon DOS evaluation;\n"); printf(" 2. Phonon dispersion curves;\n"); printf(" 3. Dynamical matrix at arbitrary q;\n"); @@ -64,9 +71,10 @@ Phonon::Phonon(DynMat *dm) // read user choice int job = 0; printf("Your choice [0]: "); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) job = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) job = atoi(strtok(str," \t\n\r\f")); printf("\nYour selection: %d\n", job); - for (int i = 0; i < 80; ++i) printf("=");printf("\n\n"); + puts("================================================================================\n"); // now to do the job according to user's choice if (job == 1) pdos(); @@ -138,7 +146,8 @@ void Phonon::pdos() // Now to ask for the output frequency range printf("\nThe frequency range of all q-points are: [%g %g]\n", fmin, fmax); printf("Please input the desired range to get DOS [%g %g]: ", fmin, fmax); - if (count_words(fgets(str,MAXLINE,stdin)) >= 2){ + input->read_stdin(str); + if (count_words(str) >= 2){ fmin = atof(strtok(str," \t\n\r\f")); fmax = atof(strtok(NULL," \t\n\r\f")); } @@ -147,7 +156,8 @@ void Phonon::pdos() ndos = 201; printf("Please input the number of intervals [%d]: ", ndos); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) ndos = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) ndos = atoi(strtok(str," \t\n\r\f")); ndos += (ndos+1)%2; ndos = MAX(2,ndos); @@ -170,7 +180,8 @@ void Phonon::pdos() // smooth dos ? printf("Would you like to smooth the phonon dos? (y/n)[n]: "); - if (count_words(fgets(str,MAXLINE,stdin)) > 0){ + input->read_stdin(str); + if (count_words(str) > 0){ char *flag = strtok(str," \t\n\r\f"); if (strcmp(flag,"y") == 0 || strcmp(flag,"Y") == 0) smooth(dos, ndos); } @@ -194,7 +205,8 @@ void Phonon::writeDOS() char str[MAXLINE]; // now to output the phonon DOS printf("\nPlease input the filename to write DOS [pdos.dat]: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str, "pdos.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str, "pdos.dat"); char *fname = strtok(str," \t\n\r\f"); printf("The total phonon DOS will be written to file: %s\n", fname); @@ -234,7 +246,7 @@ void Phonon::writeLDOS() const double one3 = 1./double(sysdim); char str[MAXLINE]; for (int ilocal = 0; ilocal < nlocal; ++ilocal){ - sprintf(str,"pldos_%d.dat", locals[ilocal]); + snprintf(str, MAXLINE-1, "pldos_%d.dat", locals[ilocal]); char *fname = strtok(str," \t\n\r\f"); FILE *fp = fopen(fname, "w"); fname = NULL; @@ -281,7 +293,7 @@ void Phonon::ldos_rsgf() fmin = fmax = egvs[0]; for (int i = 1; i < ndim; ++i){fmin = MIN(fmin, egvs[i]); fmax = MAX(fmax, egvs[i]);} - delete []egvs; + delete[] egvs; } else { fmin = 0.; fmax = 20.; @@ -297,7 +309,8 @@ void Phonon::ldos_rsgf() printf("\nThere are %d atoms in each unit cell of your lattice.\n", dynmat->nucell); printf("Please input the index/index range/index range and increment of atom(s)\n"); printf("in the unit cell to evaluate LDOS, q to exit [%d]: ", ik); - int nr = count_words( fgets(str,MAXLINE,stdin) ); + input->read_stdin(str); + int nr = count_words(str); if (nr < 1){ istr = iend = ik; iinc = 1; @@ -327,7 +340,8 @@ void Phonon::ldos_rsgf() } printf("Please input the frequency range to evaluate LDOS [%g %g]: ", fmin, fmax); - if (count_words(fgets(str,MAXLINE,stdin)) >= 2){ + input->read_stdin(str); + if (count_words(str) >= 2){ fmin = atof(strtok(str," \t\n\r\f")); fmax = atof(strtok(NULL," \t\n\r\f")); } @@ -335,16 +349,19 @@ void Phonon::ldos_rsgf() printf("The frequency range for your LDOS is [%g %g].\n", fmin, fmax); printf("Please input the desired number of points in LDOS [%d]: ", ndos); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) ndos = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) ndos = atoi(strtok(str," \t\n\r\f")); if (ndos < 2) break; ndos += (ndos+1)%2; printf("Please input the maximum # of Lanczos iterations [%d]: ", nit); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) nit = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) nit = atoi(strtok(str," \t\n\r\f")); if (nit < 1) break; printf("Please input the value of epsilon for delta-function [%g]: ", eps); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) eps = atof(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) eps = atof(strtok(str," \t\n\r\f")); if (eps <= 0.) break; // prepare array for local pdos @@ -395,8 +412,11 @@ void Phonon::dmanyq() { char str[MAXLINE]; double q[3]; - do printf("Please input the q-point to output the dynamical matrix:"); - while (count_words(fgets(str,MAXLINE,stdin)) < 3); + while ( 1 ){ + printf("Please input the q-point to output the dynamical matrix: "); + input->read_stdin(str); + if (count_words(str) >= 3) break; + } q[0] = atof(strtok(str," \t\n\r\f")); q[1] = atof(strtok(NULL," \t\n\r\f")); q[2] = atof(strtok(NULL," \t\n\r\f")); @@ -413,11 +433,13 @@ void Phonon::dmanyq() void Phonon::vfanyq() { char str[MAXLINE]; - double q[3], egvs[ndim]; + double q[3]; + double *egvs = new double[ndim]; while ( 1 ){ printf("Please input the q-point to compute the frequencies, q to exit: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 3) break; + input->read_stdin(str); + if (count_words(str) < 3) break; q[0] = atof(strtok(str, " \t\n\r\f")); q[1] = atof(strtok(NULL," \t\n\r\f")); @@ -427,9 +449,11 @@ void Phonon::vfanyq() dynmat->geteigen(egvs, 0); printf("q-point: [%lg %lg %lg], ", q[0], q[1], q[2]); printf("vibrational frequencies at this q-point:\n"); - for (int i = 0; i < ndim; ++i) printf("%lg ", egvs[i]); printf("\n\n"); + for (int i = 0; i < ndim; ++i) printf("%lg ", egvs[i]); + printf("\n\n"); } - + + delete[] egvs; return; } @@ -439,15 +463,18 @@ void Phonon::vfanyq() void Phonon::vecanyq() { char str[MAXLINE]; - double q[3], egvs[ndim]; + double q[3]; + double *egvs = new double[ndim]; doublecomplex **eigvec = dynmat->DM_q; printf("Please input the filename to output the result [eigvec.dat]: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str,"eigvec.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str,"eigvec.dat"); FILE *fp = fopen(strtok(str," \t\n\r\f"), "w"); while ( 1 ){ printf("Please input the q-point to compute the frequencies, q to exit: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 3) break; + input->read_stdin(str); + if (count_words(str) < 3) break; q[0] = atof(strtok(str, " \t\n\r\f")); q[1] = atof(strtok(NULL," \t\n\r\f")); @@ -475,6 +502,7 @@ void Phonon::vecanyq() fprintf(fp,"\n"); } fclose(fp); + delete[] egvs; eigvec = NULL; return; } @@ -488,7 +516,8 @@ void Phonon::DMdisp() char str[MAXLINE]; printf("Please input the filename to output the DM data [DMDisp.dat]: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str, "DMDisp.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str, "DMDisp.dat"); char *fname = strtok(str," \t\n\r\f"); FILE *fp = fopen(fname, "w"); fname = NULL; @@ -503,7 +532,8 @@ void Phonon::DMdisp() for (int i = 0; i < 3; ++i) qstr[i] = qend[i]; printf("\nPlease input the start q-point in unit of B1->B3, q to exit [%g %g %g]: ", qstr[0], qstr[1], qstr[2]); - int n = count_words(fgets(str,MAXLINE,stdin)); + input->read_stdin(str); + int n = count_words(str); char *ptr = strtok(str," \t\n\r\f"); if ((n == 1) && (strcmp(ptr,"q") == 0)) break; else if (n >= 3){ @@ -512,14 +542,18 @@ void Phonon::DMdisp() qstr[2] = atof(strtok(NULL," \t\n\r\f")); } - do printf("Please input the end q-point in unit of B1->B3: "); - while (count_words(fgets(str,MAXLINE,stdin)) < 3); + while ( 1 ){ + printf("Please input the end q-point in unit of B1->B3: "); + input->read_stdin(str); + if (count_words(str) >= 3) break; + } qend[0] = atof(strtok(str," \t\n\r\f")); qend[1] = atof(strtok(NULL," \t\n\r\f")); qend[2] = atof(strtok(NULL," \t\n\r\f")); printf("Please input the # of points along the line [%d]: ", nq); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) nq = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) nq = atoi(strtok(str," \t\n\r\f")); nq = MAX(nq,2); for (int i=0; i<3; i++) qinc[i] = (qend[i]-qstr[i])/double(nq-1); @@ -588,7 +622,8 @@ void Phonon::therm() char str[MAXLINE]; printf("\nPlease input the filename to output thermal properties [therm.dat]:"); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str, "therm.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str, "therm.dat"); char *fname = strtok(str," \t\n\r\f"); FILE *fp = fopen(fname, "a"); fname = NULL; // header line @@ -630,7 +665,8 @@ void Phonon::therm() fprintf(fp,"%lg %lg %lg %lg %lg %lg\n", T, Uvib, Svib, Fvib, ZPE, Cvib); printf("Please input the desired temperature (K), enter to exit: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) break; + input->read_stdin(str); + if (count_words(str) < 1) break; T = atof(strtok(str," \t\n\r\f")); } while (T > 0.); @@ -646,12 +682,14 @@ void Phonon::local_therm() { char str[MAXLINE]; printf("\nWould you like to compute the local thermal properties (y/n)[n]: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) return; + input->read_stdin(str); + if (count_words(str) < 1) return; char *ptr = strtok(str," \t\n\r\f"); if (strcmp(ptr,"y") != 0 && strcmp(ptr, "Y") != 0 && strcmp(ptr, "yes") != 0) return; printf("Please input the filename to output vibrational thermal info [localtherm.dat]: "); - if (count_words(fgets(str,MAXLINE,stdin)) < 1) strcpy(str, "localtherm.dat"); + input->read_stdin(str); + if (count_words(str) < 1) strcpy(str, "localtherm.dat"); FILE *fp = fopen(strtok(str," \t\n\r\f"), "w"); fprintf(fp,"# atom Temp U_vib (eV) S_vib (kB) F_vib (eV) C_vib (kB) ZPE (eV)\n"); @@ -672,7 +710,8 @@ void Phonon::local_therm() while ( 1 ){ printf("\nPlease input the temperature at which to evaluate the local vibrational\n"); printf("thermal properties, non-positive number to exit [%g]: ", T); - if (count_words(fgets(str,MAXLINE,stdin)) > 0){ + input->read_stdin(str); + if (count_words(str) > 0){ T = atoi(strtok(str," \t\n\r\f")); if (T <= 0.) break; } @@ -765,7 +804,8 @@ void Phonon::QMesh() printf("\nThe q-mesh size from the read dynamical matrix is: %d x %d x %d\n", nx, ny, nz); printf("A denser mesh can be interpolated, but NOTE a too dense mesh can cause segmentation fault.\n"); printf("Please input your desired q-mesh size [%d %d %d]: ", nx, ny, nz); - if (count_words(fgets(str,MAXLINE,stdin)) >= 3){ + input->read_stdin(str); + if (count_words(str) >= 3){ nx = atoi(strtok(str," \t\n\r\f")); ny = atoi(strtok(NULL," \t\n\r\f")); nz = atoi(strtok(NULL," \t\n\r\f")); @@ -780,7 +820,8 @@ void Phonon::QMesh() int method = 2; printf("Please select your method to generate the q-points:\n"); printf(" 1. uniform;\n 2. Monkhost-Pack mesh;\nYour choice [2]: "); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) method = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) method = atoi(strtok(str," \t\n\r\f")); method = 2 - method%2; printf("Your selection: %d\n", method); #endif @@ -831,7 +872,7 @@ void Phonon::QMesh() for (int idim = 0; idim < sysdim; ++idim) atpos[i][idim] = dynmat->basis[i][idim]; // display the unit cell info read - printf("\n");for (int ii = 0; ii < 80; ++ii) printf("="); printf("\n"); + puts("\n================================================================================"); printf("The basis vectors of the unit cell:\n"); for (int idim = 0; idim < 3; ++idim) printf(" A%d = %lg %lg %lg\n", idim+1, latvec[0][idim], latvec[1][idim], latvec[2][idim]); @@ -845,14 +886,21 @@ void Phonon::QMesh() mesh[0] = nx; mesh[1] = ny; mesh[2] = nz; shift[0] = shift[1] = shift[2] = 0; int num_grid = mesh[0]*mesh[1]*mesh[2]; - int grid_point[num_grid][3], map[num_grid]; - double symprec = 1.e-4, pos[num_atom][3]; + int **grid_point; + memory->create(grid_point, num_grid, 3, "phonon:grid_point"); + int *map = new int[num_grid]; + double symprec = 1.0e-3; + double **pos; + memory->create(pos, num_atom, 3, "phonon:pos"); + if (dynmat->symprec > 0.) symprec = dynmat->symprec; for (int i = 0; i < num_atom; ++i) - for (int j = 0; j < 3; ++j) pos[i][j] = atpos[i][j]; + for (int j = 0; j < 3; ++j) + pos[i][j] = atpos[i][j]; // if spglib >= 1.0.3 is used - nq = spg_get_ir_reciprocal_mesh(grid_point, map, mesh, shift, is_time_reversal, latvec, pos, attyp, num_atom, symprec); + nq = spg_get_ir_reciprocal_mesh((int (*)[3])grid_point, map, mesh, shift, is_time_reversal, + latvec, (double (*)[3])pos, attyp, num_atom, symprec); memory->create(wt, nq, "QMesh:wt"); memory->create(qpts, nq,3,"QMesh:qpts"); @@ -873,11 +921,14 @@ void Phonon::QMesh() qpts[numq][2] = double(grid_point[i][2])/double(mesh[2]); numq++; } - wt[iq2idx[iq]] += 1.; + wt[iq2idx[iq]] += 1.0; } - delete []iq2idx; - - double wsum = 0.; + delete[] iq2idx; + delete[] map; + memory->destroy(grid_point); + memory->destroy(pos); + + double wsum = 0.0; for (int iq = 0; iq < nq; ++iq) wsum += wt[iq]; for (int iq = 0; iq < nq; ++iq) wt[iq] /= wsum; @@ -898,7 +949,8 @@ void Phonon::ldos_egv() char str[MAXLINE], *ptr; printf("\nThe # of atoms per cell is: %d, please input the atom IDs to compute\n", dynmat->nucell); printf("local PDOS, IDs begin with 0: "); - int nmax = count_words(fgets(str,MAXLINE,stdin)); + input->read_stdin(str); + int nmax = count_words(str); if (nmax < 1) return; memory->destroy(locals); @@ -920,7 +972,8 @@ void Phonon::ldos_egv() fmin = 0.; fmax = 10.; printf("Please input the freqency (nv, THz) range to compute PDOS [%g %g]: ", fmin, fmax); - if (count_words(fgets(str,MAXLINE,stdin)) >= 2) { + input->read_stdin(str); + if (count_words(str) >= 2) { fmin = atof(strtok(str," \t\n\r\f")); fmax = atof(strtok(NULL," \t\n\r\f")); } @@ -928,7 +981,8 @@ void Phonon::ldos_egv() ndos = 201; printf("Please input your desired # of points in PDOS [%d]: ", ndos); - if (count_words(fgets(str,MAXLINE,stdin)) > 0) ndos = atoi(strtok(str," \t\n\r\f")); + input->read_stdin(str); + if (count_words(str) > 0) ndos = atoi(strtok(str," \t\n\r\f")); if (ndos < 2) return; ndos += (ndos+1)%2; @@ -957,7 +1011,8 @@ void Phonon::ldos_egv() Timer *time = new Timer(); // memory and pointer for eigenvalues and eigenvectors - double egval[ndim], offset=fmin-0.5*df; + double offset=fmin-0.5*df; + double *egval = new double[ndim]; doublecomplex **egvec = dynmat->DM_q; printf("\nNow to compute the phonons and DOSs "); fflush(stdout); @@ -985,6 +1040,7 @@ void Phonon::ldos_egv() } } } + delete[] egval; egvec = NULL; printf("Done!\nNow to normalize the DOSs ..."); fflush(stdout); @@ -1008,10 +1064,7 @@ void Phonon::ldos_egv() * ---------------------------------------------------------------------------- */ void Phonon::ShowCell() { - printf("\n"); - for (int i = 0; i < 30; ++i) printf("="); - printf(" Unit Cell Info "); - for (int i = 0; i < 30; ++i) printf("="); printf("\n"); + puts("============================== Unit Cell Info =============================="); printf("Number of atoms in the unit cell: %d\n", dynmat->nucell); printf("Basis vectors of the unit cell:\n"); printf(" %15.8f %15.8f %15.8f\n", dynmat->basevec[0], dynmat->basevec[1], dynmat->basevec[2]); @@ -1024,8 +1077,7 @@ void Phonon::ShowCell() printf("Atomic type and fractional coordinates:\n"); for (int i = 0; i < dynmat->nucell; ++i) printf("%4d %12.8f %12.8f %12.8f\n", dynmat->attyp[i], dynmat->basis[i][0], dynmat->basis[i][1], dynmat->basis[i][2]); - for (int i = 0; i < 80; ++i) printf("="); - printf("\n"); + puts("================================================================================"); return; } @@ -1101,7 +1153,7 @@ int Phonon::count_words(const char *line) strcpy(copy,line); char *ptr; - if (ptr = strchr(copy,'#')) *ptr = '\0'; + if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); diff --git a/tools/phonon/phonon.h b/tools/phonon/phonon.h index 69a1fe5d50..46ce17f268 100644 --- a/tools/phonon/phonon.h +++ b/tools/phonon/phonon.h @@ -1,22 +1,16 @@ #ifndef PHONON_H #define PHONON_H -#include "stdio.h" -#include "stdlib.h" -#include -#include "dynmat.h" -#include "memory.h" - -using namespace std; - class Phonon{ public: - Phonon(DynMat *); + Phonon(class DynMat *); ~Phonon(); - DynMat *dynmat; + class DynMat *dynmat; private: + class UserInput *input; + int nq, ndim, sysdim; double **qpts, *wt; double **eigs; @@ -25,7 +19,7 @@ private: double *dos, fmin, fmax, df, rdf; double ***ldos; - Memory *memory; + class Memory *memory; void QMesh(); void ComputeAll(); diff --git a/tools/phonon/phonopy.cpp b/tools/phonon/phonopy.cpp index cfe32ab61a..2cee319aa7 100644 --- a/tools/phonon/phonopy.cpp +++ b/tools/phonon/phonopy.cpp @@ -1,9 +1,20 @@ + #ifdef FFTW3 -#include + #include "phonopy.h" -#include "math.h" -#include "kpath.h" -#include "fftw3.h" + +#include "global.h" +#include "dynmat.h" +#include "input.h" +#include "memory.h" + +#include + +#include +#include +#include +#include +#include /* ---------------------------------------------------------------------------- * Class Phonopy is designed to interface with phonopy. @@ -14,13 +25,16 @@ Phonopy::Phonopy(DynMat *dynmat) memory = new Memory(); sysdim = dm->sysdim; fftdim = dm->fftdim; + input = dm->input; fftdim2 = fftdim * fftdim; nucell = dm->nucell; nx = ny = nz = 5; write(1); char str[MAXLINE]; - if (count_words(fgets(str,MAXLINE,stdin)) >= 3){ + if (input == NULL) input = new UserInput(0); + input->read_stdin(str); + if (count_words(str) >= 3){ nx = atoi(strtok(str," \t\n\r\f")); ny = atoi(strtok(NULL," \t\n\r\f")); nz = atoi(strtok(NULL," \t\n\r\f")); @@ -36,7 +50,7 @@ Phonopy::Phonopy(DynMat *dynmat) memory->create(mass, nucell, "Phonopy:mass"); for (int i = 0; i < nucell; ++i){ - double m = 1./dm->M_inv_sqrt[i]; + double m = 1.0/dm->M_inv_sqrt[i]; mass[i] = m * m; } @@ -68,7 +82,7 @@ return; void Phonopy::write(int flag) { if (flag == 1){ // basic information - for (int ii = 0; ii < 80; ++ii) printf("="); printf("\n"); + puts("================================================================================"); printf("Now to prepare the input files for phonopy.\n"); printf("The dimension of your present supercell is : %d x %d x %d.\n", dm->nx, dm->ny, dm->nz); printf("The size of the force constant matrix will be: %d x %d.\n", dm->npt*3, dm->npt*3); @@ -84,19 +98,18 @@ void Phonopy::write(int flag) } else if (flag == 4){ printf("Done!\nThe force constants information is extracted and written to FORCE_CONSTANTS,\n"); printf("the primitive cell is written to POSCAR.primitive, and the input file for\n"); - printf("phonopy band evaluation is written to band.conf.\n"); - printf("One should be able to obtain the phonon band structure after correcting\n"); - printf("the element names in POSCAR.primitive and band.conf by running\n"); - printf("`phonopy --readfc -c POSCAR.primitive -p band.conf`.\n"); - for (int ii = 0; ii < 80; ++ii) printf("-"); - printf("\n*** Remember to change the element names. ***\n"); -#ifdef UseSPG - for (int ii = 0; ii < 80; ++ii) printf("-"); -#endif + printf("phonopy band evaluation is written to band.conf.\n\n"); + printf("One should be able to obtain the phonon band structure after\n"); + printf(" 1) Correcting the `element names` in POSCAR.primitive and band.conf;\n"); + printf(" 2) Running `phonopy --readfc -c POSCAR.primitive -p band.conf`.\n\n"); + printf("Or the phonon density of states after\n"); + printf(" 1) Correcting the `element names` in POSCAR.primitive and mesh.conf;\n"); + printf(" 2) Running `phonopy --readfc -c POSCAR.primitive -p mesh.conf`.\n"); + puts("--------------------------------------------------------------------------------"); + printf("*** Remember to modify the `element names`. ***\n"); } else if (flag == 5){ - for (int ii = 0; ii < 80; ++ii) printf("="); printf("\n"); - + puts("================================================================================"); } return; } @@ -162,7 +175,9 @@ void Phonopy::phonopy() memory->destroy(out); // in POSCAR, atoms are sorted/aggregated by type, while for LAMMPS there is no such requirment - int type_id[nucell], num_type[nucell], ntype = 0; + int *type_id = new int[nucell]; + int *num_type = new int[nucell]; + int ntype = 0; for (int i = 0; i < nucell; ++i) num_type[i] = 0; for (int i = 0; i < nucell; ++i){ int ip = ntype; @@ -221,14 +236,22 @@ void Phonopy::phonopy() // write the primitive cell in POSCAR format fp = fopen("POSCAR.primitive", "w"); fprintf(fp, "Fix-phonon unit cell"); - for (int ip = 0; ip < ntype; ++ip) fprintf(fp, ", Elem-%d: %lg", type_id[ip], mass[ip]); + for (int ip = 0; ip < ntype; ++ip){ + for (int i = 0; i < nucell; ++i){ + if (dm->attyp[i] == type_id[ip]){ + fprintf(fp, ", Elem-%d: %lg", type_id[ip], mass[i]); + break; + } + } + } fprintf(fp, "\n1.\n"); int ndim = 0; for (int idim = 0; idim < 3; ++idim){ for (int jdim = 0; jdim < 3; ++jdim) fprintf(fp, "%lg ", dm->basevec[ndim++]); fprintf(fp, "\n"); } - for (int ip = 0; ip < ntype; ++ip) fprintf(fp, "Elem-%d ", type_id[ip]); fprintf(fp, "\n"); + for (int ip = 0; ip < ntype; ++ip) fprintf(fp, "Elem-%d ", type_id[ip]); + fprintf(fp, "\n"); for (int ip = 0; ip < ntype; ++ip) fprintf(fp, "%d ", num_type[ip]); fprintf(fp, "\nDirect\n"); for (int ip = 0; ip < ntype; ++ip){ @@ -240,57 +263,48 @@ void Phonopy::phonopy() } fclose(fp); -#ifdef UseSPG - // Get high symmetry k-path - QNodes *q = new QNodes(); - kPath *kp = new kPath(dm, q); - kp->kpath(); -#endif - + // mesh.conf + fp = fopen("mesh.conf", "w"); + fprintf(fp, "# From Fix-phonon"); + for (int ip = 0; ip < ntype; ++ip){ + for (int i = 0; i < nucell; ++i){ + if (dm->attyp[i] == type_id[ip]){ + fprintf(fp, ", Elem-%d: %lg", type_id[ip], mass[i]); + break; + } + } + } + fprintf(fp, "\n\nATOM_NAME = "); + for (int ip = 0; ip < ntype; ++ip) fprintf(fp, "Elem-%d ", type_id[ip]); + fprintf(fp, "\nDIM = %d %d %d\n", nx, ny, nz); + fprintf(fp, "MP = 31 31 31\nFORCE_CONSTANTS = READ\n"); + fprintf(fp, "#FC_SYMMETRY = .TRUE.\n#SYMMETRY_TOLERANCE = 0.01\n"); + fclose(fp); + + // band.conf fp = fopen("band.conf", "w"); fprintf(fp, "# From Fix-phonon"); - for (int ip = 0; ip < ntype; ++ip) fprintf(fp, ", Elem-%d: %lg", type_id[ip], mass[ip]); + for (int ip = 0; ip < ntype; ++ip){ + for (int i = 0; i < nucell; ++i){ + if (dm->attyp[i] == type_id[ip]){ + fprintf(fp, ", Elem-%d: %lg", type_id[ip], mass[i]); + break; + } + } + } fprintf(fp, "\n\nATOM_NAME = "); for (int ip = 0; ip < ntype; ++ip) fprintf(fp, "Elem-%d ", type_id[ip]); - fprintf(fp, "\nDIM = %d %d %d\nBAND = ", nx, ny, nz); -#ifdef UseSPG - int nsect = q->qs.size(); - for (int i = 0; i < nsect; ++i){ - fprintf(fp, " %lg %lg %lg", q->qs[i][0], q->qs[i][1], q->qs[i][2]); - if (i+1 < nsect){ - double dq = 0.; - for (int j = 0; j < 3; ++j) dq += (q->qe[i][j] - q->qs[i+1][j]) * (q->qe[i][j] - q->qs[i+1][j]); - if (dq > ZERO) { - fprintf(fp, " %lg %lg %lg,", q->qe[i][0], q->qe[i][1], q->qe[i][2]); - } - } else if (i+1 == nsect){ - fprintf(fp, " %lg %lg %lg\n", q->qe[i][0], q->qe[i][1], q->qe[i][2]); - } - } -#endif - fprintf(fp, "\nBAND_POINTS = 21\nBAND_LABELS ="); -#ifdef UseSPG - for (int i = 0; i < q->ndstr.size(); ++i){ - std::size_t found = q->ndstr[i].find("{/Symbol G}"); - if (found != std::string::npos) q->ndstr[i].replace(found, found+11, "$\\Gamma$"); - found = q->ndstr[i].find("/"); - if (found != std::string::npos) q->ndstr[i].replace(found, found, " "); - fprintf(fp, " %s", q->ndstr[i].c_str()); - } -#endif - fprintf(fp, "\nFORCE_CONSTANTS = READ\nBAND_CONNECTION = .TRUE.\n"); + fprintf(fp, "\nDIM = %d %d %d\nBAND = AUTO\n", nx, ny, nz); + fprintf(fp, "BAND_POINTS = 21\nFORCE_CONSTANTS = READ\nBAND_CONNECTION = .TRUE.\n"); + fprintf(fp, "#FC_SYMMETRY = .TRUE.\n#SYMMETRY_TOLERANCE = 0.01\n"); // output info write(4); -#ifdef UseSPG - kp->show_path(); - delete kp; - delete q; -#endif write(5); - -return; + delete[] type_id; + delete[] num_type; + return; } /*------------------------------------------------------------------------------ @@ -304,7 +318,7 @@ int Phonopy::count_words(const char *line) strcpy(copy,line); char *ptr; - if (ptr = strchr(copy,'#')) *ptr = '\0'; + if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); @@ -314,7 +328,7 @@ int Phonopy::count_words(const char *line) while (strtok(NULL," \t\n\r\f")) n++; memory->destroy(copy); -return n; + return n; } /*----------------------------------------------------------------------------*/ #endif diff --git a/tools/phonon/phonopy.h b/tools/phonon/phonopy.h index 2f3006e791..e1200b8242 100644 --- a/tools/phonon/phonopy.h +++ b/tools/phonon/phonopy.h @@ -4,22 +4,16 @@ #ifndef PHONOPY_H #define PHONOPY_H -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "memory.h" -#include "qnodes.h" -#include "dynmat.h" -#include "global.h" +#include "zheevd.h" class Phonopy { public: - Phonopy(DynMat *); + Phonopy(class DynMat *); ~Phonopy(); private: - Memory *memory; - char str[MAXLINE]; + class UserInput *input; + class Memory *memory; int npt, fftdim2; // local variables int nx, ny, nz, nucell; // local variables int sysdim, fftdim; // local variables @@ -27,7 +21,7 @@ private: doublecomplex **FC_all; - DynMat *dm; + class DynMat *dm; void write(int); void get_my_FC(); void phonopy(); diff --git a/tools/phonon/timer.cpp b/tools/phonon/timer.cpp index 953257340d..b94bed40b1 100644 --- a/tools/phonon/timer.cpp +++ b/tools/phonon/timer.cpp @@ -1,4 +1,7 @@ #include "timer.h" + +#include + /* ----------------------------------------------------------------------------- * Initialization of time * -------------------------------------------------------------------------- */ diff --git a/tools/phonon/timer.h b/tools/phonon/timer.h index cd04dea56d..993a33f9f3 100644 --- a/tools/phonon/timer.h +++ b/tools/phonon/timer.h @@ -1,9 +1,7 @@ #ifndef TIMER_H #define TIMER_H -#include "stdio.h" -#include "stdlib.h" -#include "time.h" +#include class Timer { public: diff --git a/tools/phonon/tricubic/CMakeLists.txt b/tools/phonon/tricubic/CMakeLists.txt new file mode 100644 index 0000000000..190c6ceb80 --- /dev/null +++ b/tools/phonon/tricubic/CMakeLists.txt @@ -0,0 +1,18 @@ + +# Support Linux from Ubuntu 20.04LTS onward, CentOS 7.x (with EPEL), +# macOS, MSVC 2019 (=Version 16) +cmake_minimum_required(VERSION 3.10) + +# set up project +project(tricubic VERSION 1.1 DESCRIPTION "Tricubic library" LANGUAGES CXX) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# hacks for MSVC to prevent lots of pointless warnings about "unsafe" functions +if(MSVC) + add_compile_options(/wd4244) + add_compile_options(/wd4267) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) +endif() + +add_library(tricubic STATIC tricubic.cpp) +target_include_directories(tricubic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/tools/phonon/tricubic/LICENSE b/tools/phonon/tricubic/LICENSE new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/tools/phonon/tricubic/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tools/phonon/tricubic/README.md b/tools/phonon/tricubic/README.md new file mode 100644 index 0000000000..0e8058339e --- /dev/null +++ b/tools/phonon/tricubic/README.md @@ -0,0 +1,28 @@ +# libtricubic + +This folder contains a slightly refactored version of version 1.0 of +the _libtricubic_ library, developed by François Lekien in 2004. + +The following paper explaining the method was published in 2005: + +> Lekien, F., & Marsden, J. (2005). _Tricubic interpolation in three +> dimensions._ International Journal for Numerical Methods in Engineering, +> 63(3), 455–471. doi:10.1002/nme.1296 + +Some additional notes and the full matrix can be found in the technical notes: + +> Lekien, F., Coulliette, C., & Marsden, J. (2004). _Tricubic Engine - Technical +> Notes and Full Matrix. + +The main article refers to the author's website +(http://gyre.cds.caltech.edu/pub/software/tricubic/) to download the code and +documentation. Unfortunately, this website no longer exists. Even the +archive.org snapshot is useless; [A single snapshot from December 3rd 2009 is +available](https://web.archive.org/web/20091203115835/http://gyre.cds.caltech.edu/pub/software/tricubic) +which seems like an FTP listing. No files are accessible. + +The source code was obtained from https://github.com/nbigaouette/libtricubic/ +Only the sources for the library were retained. No functional changes were +made, but some common programming conventions were applied, source files +merged, and build support for CMake added. + diff --git a/tools/phonon/tricubic/tricubic.cpp b/tools/phonon/tricubic/tricubic.cpp new file mode 100644 index 0000000000..974ed6aa52 --- /dev/null +++ b/tools/phonon/tricubic/tricubic.cpp @@ -0,0 +1,185 @@ + +#include "tricubic.h" + +#include + +static const int A[64][64] = { + { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-3, 3, 0, 0, 0, 0, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 2,-2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 9,-9,-9, 9, 0, 0, 0, 0, 6, 3,-6,-3, 0, 0, 0, 0, 6,-6, 3,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-6, 6, 6,-6, 0, 0, 0, 0,-3,-3, 3, 3, 0, 0, 0, 0,-4, 4,-2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-2,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-6, 6, 6,-6, 0, 0, 0, 0,-4,-2, 4, 2, 0, 0, 0, 0,-3, 3,-3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-1,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 4,-4,-4, 4, 0, 0, 0, 0, 2, 2,-2,-2, 0, 0, 0, 0, 2,-2, 2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0, 0, 0, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,-9,-9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3,-6,-3, 0, 0, 0, 0, 6,-6, 3,-3, 0, 0, 0, 0, 4, 2, 2, 1, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-6, 6, 6,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3,-3, 3, 3, 0, 0, 0, 0,-4, 4,-2, 2, 0, 0, 0, 0,-2,-2,-1,-1, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-6, 6, 6,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4,-2, 4, 2, 0, 0, 0, 0,-3, 3,-3, 3, 0, 0, 0, 0,-2,-1,-2,-1, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,-4,-4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,-2,-2, 0, 0, 0, 0, 2,-2, 2,-2, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, + {-3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 9,-9, 0, 0,-9, 9, 0, 0, 6, 3, 0, 0,-6,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,-6, 0, 0, 3,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-6, 6, 0, 0, 6,-6, 0, 0,-3,-3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4, 4, 0, 0,-2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-2, 0, 0,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 0, 0,-1, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,-9, 0, 0,-9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0, 0,-6,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,-6, 0, 0, 3,-3, 0, 0, 4, 2, 0, 0, 2, 1, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-6, 6, 0, 0, 6,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3,-3, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4, 4, 0, 0,-2, 2, 0, 0,-2,-2, 0, 0,-1,-1, 0, 0}, + { 9, 0,-9, 0,-9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 0,-6, 0,-3, 0, 6, 0,-6, 0, 3, 0,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,-9, 0,-9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 0,-6, 0,-3, 0, 6, 0,-6, 0, 3, 0,-3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 2, 0, 2, 0, 1, 0}, + {-27,27,27,-27,27,-27,-27,27,-18,-9,18, 9,18, 9,-18,-9,-18,18,-9, 9,18,-18, 9,-9,-18,18,18,-18,-9, 9, 9,-9,-12,-6,-6,-3,12, 6, 6, 3,-12,-6,12, 6,-6,-3, 6, 3,-12,12,-6, 6,-6, 6,-3, 3,-8,-4,-4,-2,-4,-2,-2,-1}, + {18,-18,-18,18,-18,18,18,-18, 9, 9,-9,-9,-9,-9, 9, 9,12,-12, 6,-6,-12,12,-6, 6,12,-12,-12,12, 6,-6,-6, 6, 6, 6, 3, 3,-6,-6,-3,-3, 6, 6,-6,-6, 3, 3,-3,-3, 8,-8, 4,-4, 4,-4, 2,-2, 4, 4, 2, 2, 2, 2, 1, 1}, + {-6, 0, 6, 0, 6, 0,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0,-3, 0, 3, 0, 3, 0,-4, 0, 4, 0,-2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-2, 0,-1, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0,-6, 0, 6, 0, 6, 0,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 0,-3, 0, 3, 0, 3, 0,-4, 0, 4, 0,-2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-2, 0,-1, 0,-1, 0}, + {18,-18,-18,18,-18,18,18,-18,12, 6,-12,-6,-12,-6,12, 6, 9,-9, 9,-9,-9, 9,-9, 9,12,-12,-12,12, 6,-6,-6, 6, 6, 3, 6, 3,-6,-3,-6,-3, 8, 4,-8,-4, 4, 2,-4,-2, 6,-6, 6,-6, 3,-3, 3,-3, 4, 2, 4, 2, 2, 1, 2, 1}, + {-12,12,12,-12,12,-12,-12,12,-6,-6, 6, 6, 6, 6,-6,-6,-6, 6,-6, 6, 6,-6, 6,-6,-8, 8, 8,-8,-4, 4, 4,-4,-3,-3,-3,-3, 3, 3, 3, 3,-4,-4, 4, 4,-2,-2, 2, 2,-4, 4,-4, 4,-2, 2,-2, 2,-2,-2,-2,-2,-1,-1,-1,-1}, + { 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {-6, 6, 0, 0, 6,-6, 0, 0,-4,-2, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0,-3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2,-1, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 4,-4, 0, 0,-4, 4, 0, 0, 2, 2, 0, 0,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-6, 6, 0, 0, 6,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4,-2, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0,-3, 3, 0, 0,-2,-1, 0, 0,-2,-1, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,-4, 0, 0,-4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0,-2,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 2,-2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}, + {-6, 0, 6, 0, 6, 0,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4, 0,-2, 0, 4, 0, 2, 0,-3, 0, 3, 0,-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0,-6, 0, 6, 0, 6, 0,-6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-4, 0,-2, 0, 4, 0, 2, 0,-3, 0, 3, 0,-3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 0,-1, 0,-2, 0,-1, 0}, + {18,-18,-18,18,-18,18,18,-18,12, 6,-12,-6,-12,-6,12, 6,12,-12, 6,-6,-12,12,-6, 6, 9,-9,-9, 9, 9,-9,-9, 9, 8, 4, 4, 2,-8,-4,-4,-2, 6, 3,-6,-3, 6, 3,-6,-3, 6,-6, 3,-3, 6,-6, 3,-3, 4, 2, 2, 1, 4, 2, 2, 1}, + {-12,12,12,-12,12,-12,-12,12,-6,-6, 6, 6, 6, 6,-6,-6,-8, 8,-4, 4, 8,-8, 4,-4,-6, 6, 6,-6,-6, 6, 6,-6,-4,-4,-2,-2, 4, 4, 2, 2,-3,-3, 3, 3,-3,-3, 3, 3,-4, 4,-2, 2,-4, 4,-2, 2,-2,-2,-1,-1,-2,-2,-1,-1}, + { 4, 0,-4, 0,-4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0,-2, 0,-2, 0, 2, 0,-2, 0, 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,-4, 0,-4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0,-2, 0,-2, 0, 2, 0,-2, 0, 2, 0,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0}, + {-12,12,12,-12,12,-12,-12,12,-8,-4, 8, 4, 8, 4,-8,-4,-6, 6,-6, 6, 6,-6, 6,-6,-6, 6, 6,-6,-6, 6, 6,-6,-4,-2,-4,-2, 4, 2, 4, 2,-4,-2, 4, 2,-4,-2, 4, 2,-3, 3,-3, 3,-3, 3,-3, 3,-2,-1,-2,-1,-2,-1,-2,-1}, + { 8,-8,-8, 8,-8, 8, 8,-8, 4, 4,-4,-4,-4,-4, 4, 4, 4,-4, 4,-4,-4, 4,-4, 4, 4,-4,-4, 4, 4,-4,-4, 4, 2, 2, 2, 2,-2,-2,-2,-2, 2, 2,-2,-2, 2, 2,-2,-2, 2,-2, 2,-2, 2,-2, 2,-2, 1, 1, 1, 1, 1, 1, 1, 1} +}; + +static const char tricubic_version_stored[] = "1.1"; + +static int ijk2n(int i, int j, int k) { + return(i+4*j+16*k); +} + +static void point2xyz(int p, int *x, int *y, int *z) { + switch (p) { + case 0: *x=0; *y=0; *z=0; break; + case 1: *x=1; *y=0; *z=0; break; + case 2: *x=0; *y=1; *z=0; break; + case 3: *x=1; *y=1; *z=0; break; + case 4: *x=0; *y=0; *z=1; break; + case 5: *x=1; *y=0; *z=1; break; + case 6: *x=0; *y=1; *z=1; break; + case 7: *x=1; *y=1; *z=1; break; + default:*x=0; *y=0; *z=0; + } +} + +const char *tricubic_version(void) { + return(tricubic_version_stored); +} + +void tricubic_pointID2xyz(int id, int *x, int *y, int *z) { + point2xyz(id,x,y,z); +} + +void tricubic_pointID2xyz(int id, double *x, double *y, double *z) { + int x2,y2,z2; + point2xyz(id,&x2,&y2,&z2); + *x=(double)(x2); + *y=(double)(y2); + *z=(double)(z2); +} + +void tricubic_get_coeff_stacked(double a[64], double x[64]) { + int i,j; + for (i=0;i<64;i++) { + a[i]=(double)(0.0); + for (j=0;j<64;j++) { + a[i]+=A[i][j]*x[j]; + } + } +} + +void tricubic_get_coeff(double a[64], double f[8], double dfdx[8], double dfdy[8], double dfdz[8], double d2fdxdy[8], double d2fdxdz[8], double d2fdydz[8], double d3fdxdydz[8]) { + int i; + double x[64]; + for (i=0;i<8;i++) { + x[0+i]=f[i]; + x[8+i]=dfdx[i]; + x[16+i]=dfdy[i]; + x[24+i]=dfdz[i]; + x[32+i]=d2fdxdy[i]; + x[40+i]=d2fdxdz[i]; + x[48+i]=d2fdydz[i]; + x[56+i]=d3fdxdydz[i]; + } + tricubic_get_coeff_stacked(a,x); +} + +double tricubic_eval(double a[64], double x, double y, double z) { + int i,j,k; + double ret=(double)(0.0); + /* TRICUBIC EVAL + This is the short version of tricubic_eval. It is used to compute + the value of the function at a given point (x,y,z). To compute + partial derivatives of f, use the full version with the extra args. + */ + for (i=0;i<4;i++) { + for (j=0;j<4;j++) { + for (k=0;k<4;k++) { + ret+=a[ijk2n(i,j,k)]*pow(x,i)*pow(y,j)*pow(z,k); + } + } + } + return(ret); +} + +double tricubic_eval(double a[64], double x, double y, double z, int derx, int dery, int derz) { + int i,j,k; + double ret=(double)(0.0); + double cont; + int w; + /* TRICUBIC_EVAL + The full version takes 3 extra integers args that allows to evaluate + any partial derivative of f at the point + derx=dery=derz=0 => f + derx=2 dery=derz=0 => d2f/dx2 + derx=dery=derz=1 =? d3f/dxdydz + NOTICE that (derx>3)||(dery>3)||(derz>3) => returns 0.0 + this computes \frac{\partial ^{derx+dery+derz} d}{\partial x ^{derx} \partial y ^{dery} \partial z ^{derz}} + */ + for (i=derx;i<4;i++) { + for (j=dery;j<4;j++) { + for (k=derz;k<4;k++) { + cont=a[ijk2n(i,j,k)]*pow(x,i-derx)*pow(y,j-dery)*pow(z,k-derz); + for (w=0;w -log none -echo none -in in.empty) set_tests_properties(RunLammps PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") # check if the compiled executable will print the help message add_test(NAME HelpMessage diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 06bae7a2ef..e55e94f709 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -73,7 +73,7 @@ if(BUILD_MPI) COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/plugin/in.lj $) set_tests_properties(RunCoupleSimplePlugin PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() add_subdirectory(${LAMMPS_DIR}/examples/COUPLE/simple ${CMAKE_BINARY_DIR}/build-simple) add_test(NAME RunCoupleSimpleC @@ -81,15 +81,15 @@ if(BUILD_MPI) add_test(NAME RunCoupleSimpleCC COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) - if($) + if(TARGET simpleF90) add_test(NAME RunCoupleSimpleF90 COMMAND $ 1 ${LAMMPS_DIR}/examples/COUPLE/simple/in.lj) set_tests_properties(RunCoupleSimpleF90 PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() set_tests_properties(RunCoupleSimpleC RunCoupleSimpleCC PROPERTIES ENVIRONMENT "TSAN_OPTIONS=ignore_noninstrumented_modules=1;HWLOC_HIDE_ERRORS=2" - PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development)?( - Maintenance)?\\)") + PASS_REGULAR_EXPRESSION "LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]( - Update [0-9]+)?( - Development.*)?( - Maintenance.*)?\\)") endif() diff --git a/unittest/c-library/test_library_properties.cpp b/unittest/c-library/test_library_properties.cpp index a684ce8c27..0c5ad2c809 100644 --- a/unittest/c-library/test_library_properties.cpp +++ b/unittest/c-library/test_library_properties.cpp @@ -14,6 +14,7 @@ #define STRINGIFY(val) XSTR(val) #define XSTR(val) #val +using ::LAMMPS_NS::bigint; using ::LAMMPS_NS::tagint; using ::LAMMPS_NS::platform::path_join; using ::testing::HasSubstr; @@ -93,6 +94,9 @@ TEST_F(LibraryProperties, natoms) TEST_F(LibraryProperties, thermo) { + bigint bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, -1); + if (!lammps_has_style(lmp, "atom", "full")) GTEST_SKIP(); std::string input = path_join(INPUT_DIR, "in.fourmol"); ::testing::internal::CaptureStdout(); @@ -105,6 +109,59 @@ TEST_F(LibraryProperties, thermo) EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "vol"), 3375.0); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "density"), 0.12211250945013695); EXPECT_DOUBLE_EQ(lammps_get_thermo(lmp, "cellalpha"), 90.0); + + bval = *(bigint *)lammps_last_thermo(lmp, "step", 0); + EXPECT_EQ(bval, 2); + int ival = *(int *)lammps_last_thermo(lmp, "num", 0); + EXPECT_EQ(ival, 6); + + const char *key = (const char *)lammps_last_thermo(lmp, "keyword", 0); + EXPECT_THAT(key, StrEq("Step")); + ival = *(int *)lammps_last_thermo(lmp, "type", 0); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(ival, LAMMPS_INT); + ival = *(int *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(ival, 2); +#else + EXPECT_EQ(ival, LAMMPS_INT64); + bval = *(bigint *)lammps_last_thermo(lmp, "data", 0); + EXPECT_EQ(bval, 2); +#endif + + key = (const char *)lammps_last_thermo(lmp, "keyword", 1); + EXPECT_THAT(key, StrEq("Temp")); + ival = *(int *)lammps_last_thermo(lmp, "type", 1); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + double dval = *(double *)lammps_last_thermo(lmp, "data", 1); + EXPECT_DOUBLE_EQ(dval, 28.042780385852982); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 2); + EXPECT_THAT(key, StrEq("E_pair")); + ival = *(int *)lammps_last_thermo(lmp, "type", 2); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 2); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 3); + EXPECT_THAT(key, StrEq("E_mol")); + ival = *(int *)lammps_last_thermo(lmp, "type", 3); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 3); + EXPECT_DOUBLE_EQ(dval, 0.0); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 4); + EXPECT_THAT(key, StrEq("TotEng")); + ival = *(int *)lammps_last_thermo(lmp, "type", 4); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 4); + EXPECT_DOUBLE_EQ(dval, 2.3405256449146163); + + key = (const char *)lammps_last_thermo(lmp, "keyword", 5); + EXPECT_THAT(key, StrEq("Press")); + ival = *(int *)lammps_last_thermo(lmp, "type", 5); + EXPECT_EQ(ival, LAMMPS_DOUBLE); + dval = *(double *)lammps_last_thermo(lmp, "data", 5); + EXPECT_DOUBLE_EQ(dval, 31.700964689115658); }; TEST_F(LibraryProperties, box) @@ -325,8 +382,8 @@ TEST_F(LibraryProperties, global) EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_lj"), LAMMPS_DOUBLE); EXPECT_EQ(lammps_extract_global_datatype(lmp, "special_coul"), LAMMPS_DOUBLE); - double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); - double *special_coul= (double *)lammps_extract_global(lmp, "special_coul"); + double *special_lj = (double *)lammps_extract_global(lmp, "special_lj"); + double *special_coul = (double *)lammps_extract_global(lmp, "special_coul"); EXPECT_DOUBLE_EQ(special_lj[0], 1.0); EXPECT_DOUBLE_EQ(special_lj[1], 0.0); EXPECT_DOUBLE_EQ(special_lj[2], 0.5); diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index 9f5dc5581d..d3d883a73e 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -169,7 +169,7 @@ TEST_F(ComputeGlobalTest, Geometry) command("compute mom1 all momentum"); command("compute mom2 allwater momentum"); command("compute mop1 all stress/mop x 0.0 total"); - command("compute mop2 all stress/mop/profile z lower 0.5 kin conf"); + command("compute mop2 all stress/mop/profile z lower 0.5 kin pair"); thermo_style += " c_mu1 c_mu2 c_mop1[*] c_mop2[1][1]"; } @@ -225,9 +225,9 @@ TEST_F(ComputeGlobalTest, Geometry) EXPECT_DOUBLE_EQ(mom2[0], -0.022332069630161717); EXPECT_DOUBLE_EQ(mom2[1], -0.056896553865696115); EXPECT_DOUBLE_EQ(mom2[2], 0.069179891052881484); - EXPECT_DOUBLE_EQ(mop1[0], 3522311.3572200728); - EXPECT_DOUBLE_EQ(mop1[1], 2871104.9055934539); - EXPECT_DOUBLE_EQ(mop1[2], -4136077.5224247416); + EXPECT_DOUBLE_EQ(mop1[0], 3536584.0880458541); + EXPECT_DOUBLE_EQ(mop1[1], 2887485.033995091); + EXPECT_DOUBLE_EQ(mop1[2], -4154145.8952306858); EXPECT_DOUBLE_EQ(mop2[0][0], -8.0869239999999998); EXPECT_DOUBLE_EQ(mop2[0][1], 0.0); EXPECT_DOUBLE_EQ(mop2[0][2], 0.0); @@ -294,6 +294,98 @@ TEST_F(ComputeGlobalTest, Reduction) EXPECT_DOUBLE_EQ(rep[2], 26); EXPECT_DOUBLE_EQ(rep[3], max[0]); } + +TEST_F(ComputeGlobalTest, Counts) +{ + if (lammps_get_natoms(lmp) == 0.0) GTEST_SKIP(); + + BEGIN_HIDE_OUTPUT(); + command("pair_style zero 10.0"); + command("pair_coeff * *"); + + command("variable t1 atom type==1"); + command("variable t2 atom type==2"); + command("variable t3 atom type==3"); + command("variable t4 atom type==4"); + command("variable t5 atom type==5"); + command("compute tsum all reduce sum v_t1 v_t2 v_t3 v_t4 v_t5"); + command("compute tcnt all count/type atom"); + command("compute bcnt all count/type bond"); + command("compute acnt all count/type angle"); + command("compute dcnt all count/type dihedral"); + command("compute icnt all count/type improper"); + command("thermo_style custom c_tsum[*] c_tcnt[*] c_bcnt[*] c_acnt[*] c_dcnt[*] c_icnt[*]"); + command("run 0 post no"); + END_HIDE_OUTPUT(); + + auto tsum = get_vector("tsum"); + auto tcnt = get_vector("tcnt"); + auto bcnt = get_vector("bcnt"); + auto bbrk = get_scalar("bcnt"); + auto acnt = get_vector("acnt"); + auto dcnt = get_vector("dcnt"); + auto icnt = get_vector("icnt"); + + EXPECT_DOUBLE_EQ(tsum[0], tcnt[0]); + EXPECT_DOUBLE_EQ(tsum[1], tcnt[1]); + EXPECT_DOUBLE_EQ(tsum[2], tcnt[2]); + EXPECT_DOUBLE_EQ(tsum[3], tcnt[3]); + EXPECT_DOUBLE_EQ(tsum[4], tcnt[4]); + + EXPECT_DOUBLE_EQ(bbrk, 0.0); + + EXPECT_DOUBLE_EQ(bcnt[0], 3.0); + EXPECT_DOUBLE_EQ(bcnt[1], 6.0); + EXPECT_DOUBLE_EQ(bcnt[2], 3.0); + EXPECT_DOUBLE_EQ(bcnt[3], 2.0); + EXPECT_DOUBLE_EQ(bcnt[4], 10.0); + + EXPECT_DOUBLE_EQ(acnt[0], 6.0); + EXPECT_DOUBLE_EQ(acnt[1], 10.0); + EXPECT_DOUBLE_EQ(acnt[2], 5.0); + EXPECT_DOUBLE_EQ(acnt[3], 9.0); + + EXPECT_DOUBLE_EQ(dcnt[0], 3.0); + EXPECT_DOUBLE_EQ(dcnt[1], 8.0); + EXPECT_DOUBLE_EQ(dcnt[2], 3.0); + EXPECT_DOUBLE_EQ(dcnt[3], 4.0); + EXPECT_DOUBLE_EQ(dcnt[4], 13.0); + + EXPECT_DOUBLE_EQ(icnt[0], 1.0); + EXPECT_DOUBLE_EQ(icnt[1], 1.0); + + BEGIN_HIDE_OUTPUT(); + command("delete_bonds all bond 3 remove"); + command("run 0 post no"); + END_HIDE_OUTPUT(); + + bcnt = get_vector("bcnt"); + bbrk = get_scalar("bcnt"); + acnt = get_vector("acnt"); + dcnt = get_vector("dcnt"); + icnt = get_vector("icnt"); + + EXPECT_DOUBLE_EQ(bbrk, 0.0); + EXPECT_DOUBLE_EQ(bcnt[0], 3.0); + EXPECT_DOUBLE_EQ(bcnt[1], 6.0); + EXPECT_DOUBLE_EQ(bcnt[2], 0.0); + EXPECT_DOUBLE_EQ(bcnt[3], 2.0); + EXPECT_DOUBLE_EQ(bcnt[4], 10.0); + + EXPECT_DOUBLE_EQ(acnt[0], 6.0); + EXPECT_DOUBLE_EQ(acnt[1], 10.0); + EXPECT_DOUBLE_EQ(acnt[2], 5.0); + EXPECT_DOUBLE_EQ(acnt[3], 9.0); + + EXPECT_DOUBLE_EQ(dcnt[0], 3.0); + EXPECT_DOUBLE_EQ(dcnt[1], 8.0); + EXPECT_DOUBLE_EQ(dcnt[2], 3.0); + EXPECT_DOUBLE_EQ(dcnt[3], 4.0); + EXPECT_DOUBLE_EQ(dcnt[4], 13.0); + + EXPECT_DOUBLE_EQ(icnt[0], 1.0); + EXPECT_DOUBLE_EQ(icnt[1], 1.0); +} } // namespace LAMMPS_NS int main(int argc, char **argv) diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 530c33fcfe..90a8d013a3 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -140,16 +140,18 @@ TEST_F(VariableTest, CreateDelete) command("variable ten1 universe 1 2 3 4"); command("variable ten2 uloop 4"); command("variable ten3 uloop 4 pad"); + command("variable ten4 vector [0,1,2,3,5,7,11]"); + command("variable ten5 vector [0.5,1.25]"); command("variable dummy index 0"); command("variable file equal is_file(MYFILE)"); command("variable iswin equal is_os(^Windows)"); command("variable islin equal is_os(^Linux)"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 20); + ASSERT_EQ(variable->nvar, 22); BEGIN_HIDE_OUTPUT(); command("variable dummy delete"); END_HIDE_OUTPUT(); - ASSERT_EQ(variable->nvar, 19); + ASSERT_EQ(variable->nvar, 21); ASSERT_THAT(variable->retrieve("three"), StrEq("three")); variable->set_string("three", "four"); ASSERT_THAT(variable->retrieve("three"), StrEq("four")); @@ -160,6 +162,8 @@ TEST_F(VariableTest, CreateDelete) ASSERT_THAT(variable->retrieve("eight"), StrEq("")); variable->internal_set(variable->find("ten"), 2.5); ASSERT_THAT(variable->retrieve("ten"), StrEq("2.5")); + EXPECT_THAT(variable->retrieve("ten4"), StrEq("[0,1,2,3,5,7,11]")); + EXPECT_THAT(variable->retrieve("ten5"), StrEq("[0.5,1.25]")); ASSERT_THAT(variable->retrieve("file"), StrEq("0")); FILE *fp = fopen("MYFILE", "w"); fputs(" ", fp); @@ -217,7 +221,7 @@ TEST_F(VariableTest, CreateDelete) TEST_FAILURE(".*ERROR: World variable count doesn't match # of partitions.*", command("variable ten10 world xxx xxx");); TEST_FAILURE(".*ERROR: All universe/uloop variables must have same # of values.*", - command("variable ten4 uloop 2");); + command("variable ten6 uloop 2");); TEST_FAILURE(".*ERROR: Incorrect conversion in format string.*", command("variable ten11 format two \"%08x\"");); TEST_FAILURE(".*ERROR: Variable name 'ten@12' must have only letters, numbers, or undersc.*", @@ -321,6 +325,9 @@ TEST_F(VariableTest, Expressions) command("variable err1 equal v_one/v_ten7"); command("variable err2 equal v_one%v_ten7"); command("variable err3 equal v_ten7^-v_one"); + command("variable vec1 vector \"[-2, 0, 1,2 ,3, 5 , 7\n]\""); + command("variable vec2 vector v_vec1*0.5"); + command("variable vec3 equal v_vec2[3]"); variable->set("dummy index 1 2"); END_HIDE_OUTPUT(); @@ -347,6 +354,9 @@ TEST_F(VariableTest, Expressions) ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten10"), 100); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten11"), 1); ASSERT_DOUBLE_EQ(variable->compute_equal("v_ten12"), 3); + EXPECT_THAT(variable->retrieve("vec1"), StrEq("[-2,0,1,2,3,5,7]")); + EXPECT_THAT(variable->retrieve("vec2"), StrEq("[-1,0,0.5,1,1.5,2.5,3.5]")); + ASSERT_DOUBLE_EQ(variable->compute_equal("v_vec3"), 0.5); TEST_FAILURE(".*ERROR: Variable six: Invalid thermo keyword 'XXX' in variable formula.*", command("print \"${six}\"");); @@ -402,7 +412,7 @@ TEST_F(VariableTest, Functions) command("print \"$(extract_setting()\"");); TEST_FAILURE(".*ERROR on proc 0: Invalid immediate variable.*", command("print \"$(extract_setting()\"");); - TEST_FAILURE(".*ERROR: Invalid extract_setting.. function syntax in variable formula.*", + TEST_FAILURE(".*ERROR: Invalid extract_setting.. function in variable formula.*", command("print \"$(extract_setting(one,two))\"");); TEST_FAILURE( ".*ERROR: Unknown setting nprocs for extract_setting.. function in variable formula.*", @@ -580,7 +590,7 @@ TEST_F(VariableTest, NextCommand) command("next five four");); } -TEST_F(VariableTest, Label2TypeAtomic) +TEST_F(VariableTest, LabelMapAtomic) { BEGIN_HIDE_OUTPUT(); command("region box block 0 2 0 2 0 2"); @@ -598,14 +608,20 @@ TEST_F(VariableTest, Label2TypeAtomic) ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,N1)"), 2.0); ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,O1)"), 3.0); ASSERT_DOUBLE_EQ(variable->compute_equal("label2type(atom,H1)"), 4.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N1)"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N2)"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,O)"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,H1)"), 1.0); - TEST_FAILURE(".*ERROR: Variable t1: Invalid atom type label C1 in variable formula.*", + TEST_FAILURE(".*ERROR: Variable t1: Invalid atom type label C1 in label2type.. in variable.*", command("print \"${t1}\"");); - TEST_FAILURE(".*ERROR: Invalid bond type label H1 in variable formula.*", - variable->compute_equal("label2type(bond,H1)");); + TEST_FAILURE(".*ERROR: Invalid kind xxx in label2type.. in variable.*", + variable->compute_equal("label2type(xxx,H1)");); + TEST_FAILURE(".*ERROR: Invalid kind xxx in is_typelabel.. in variable.*", + variable->compute_equal("is_typelabel(xxx,H1)");); } -TEST_F(VariableTest, Label2TypeMolecular) +TEST_F(VariableTest, LabelMapMolecular) { if (!info->has_style("atom", "full")) GTEST_SKIP(); @@ -627,6 +643,14 @@ TEST_F(VariableTest, Label2TypeMolecular) command("variable a2 equal \"\"\"label2type(angle,N2'-C1\"-N2')\"\"\""); command("variable d1 equal label2type(dihedral,C1-N2-C1-N2)"); command("variable i1 equal label2type(improper,C1-N2-C1-N2)"); + + command("variable l1 equal is_typelabel(atom,C2)+is_typelabel(bond,C2-N1)" + "+is_typelabel(bond,[X1][Y1])+is_typelabel(angle,C1-C2-N1)" + "+is_typelabel(dihedral,N2-C1-C1-N2)+is_typelabel(improper,N2-C1-C1-N2)"); + command("variable l2 equal is_typelabel(atom,C1)+is_typelabel(bond,C1-N2)" + "+is_typelabel(bond,[C1][C1])+is_typelabel(angle,C1-N2-C1)" + "+is_typelabel(dihedral,C1-N2-C1-N2)+is_typelabel(improper,C1-N2-C1-N2)"); + END_HIDE_OUTPUT(); ASSERT_THAT(variable->retrieve("t1"), StrEq("1")); @@ -637,6 +661,30 @@ TEST_F(VariableTest, Label2TypeMolecular) ASSERT_THAT(variable->retrieve("a2"), StrEq("2")); ASSERT_THAT(variable->retrieve("d1"), StrEq("1")); ASSERT_THAT(variable->retrieve("i1"), StrEq("1")); + ASSERT_THAT(variable->retrieve("l1"), StrEq("0")); + ASSERT_THAT(variable->retrieve("l2"), StrEq("6")); + + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,N2')"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(atom,\"N2'\")"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,C1-N2)"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,C2-N1)"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,[C1][C1])"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(bond,[X1][Y1])"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(angle,C1-C2-N1)"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(angle,C1-N2-C1)"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(dihedral,C1-N2-C1-N2)"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(dihedral,N2-C1-C1-N2)"), 0.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(improper,C1-N2-C1-N2)"), 1.0); + ASSERT_DOUBLE_EQ(variable->compute_equal("is_typelabel(improper,N2-C1-C1-N2)"), 0.0); + + TEST_FAILURE(".*ERROR: Invalid bond type label H1 in label2type.. in variable.*", + variable->compute_equal("label2type(bond,H1)");); + TEST_FAILURE(".*ERROR: Invalid angle type label H1 in label2type.. in variable.*", + variable->compute_equal("label2type(angle,H1)");); + TEST_FAILURE(".*ERROR: Invalid dihedral type label H1 in label2type.. in variable.*", + variable->compute_equal("label2type(dihedral,H1)");); + TEST_FAILURE(".*ERROR: Invalid improper type label H1 in label2type.. in variable.*", + variable->compute_equal("label2type(improper,H1)");); } TEST_F(VariableTest, Format) diff --git a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml index 5663efccbf..5475004348 100644 --- a/unittest/force-styles/tests/atomic-pair-kim_lj.yaml +++ b/unittest/force-styles/tests/atomic-pair-kim_lj.yaml @@ -14,7 +14,8 @@ input_file: in.metal pair_style: kim ex_model_Ar_P_LJ pair_coeff: ! | * * Ar Ar -extract: ! "" +extract: ! | + scale 0 natoms: 32 init_vdwl: 9544.77366960673 init_coul: 0 diff --git a/unittest/fortran/test_fortran_gather_scatter.f90 b/unittest/fortran/test_fortran_gather_scatter.f90 index 1f8d4f0905..8741bba485 100644 --- a/unittest/fortran/test_fortran_gather_scatter.f90 +++ b/unittest/fortran/test_fortran_gather_scatter.f90 @@ -207,7 +207,7 @@ END SUBROUTINE f_lammps_scatter_atoms_subset_mask SUBROUTINE f_lammps_setup_gather_topology() BIND(C) USE LIBLAMMPS - USE keepstuff, ONLY : lmp, cont_input, more_input, pair_input + USE keepstuff, ONLY : lmp IMPLICIT NONE CALL lmp%command('include ${input_dir}/in.fourmol') @@ -232,7 +232,7 @@ FUNCTION f_lammps_test_gather_bonds_small() BIND(C) RESULT(count) nbonds = nbonds_small ELSE nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) END IF CALL lmp%gather_bonds(bonds) @@ -280,7 +280,7 @@ FUNCTION f_lammps_test_gather_bonds_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nbonds_big nbonds_big = lmp%extract_global('nbonds') - nbonds = nbonds_big + nbonds = INT(nbonds_big) CALL lmp%gather_bonds(bonds) bonds_array(1:3,1:SIZE(bonds)/3) => bonds count = 0 @@ -332,7 +332,7 @@ FUNCTION f_lammps_test_gather_angles_small() BIND(C) RESULT(count) nangles = nangles_small ELSE nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) END IF CALL lmp%gather_angles(angles) @@ -380,7 +380,7 @@ FUNCTION f_lammps_test_gather_angles_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nangles_big nangles_big = lmp%extract_global('nangles') - nangles = nangles_big + nangles = INT(nangles_big) CALL lmp%gather_angles(angles) angles_array(1:4,1:SIZE(angles)/4) => angles count = 0 @@ -432,7 +432,7 @@ FUNCTION f_lammps_test_gather_dihedrals_small() BIND(C) RESULT(count) ndihedrals = ndihedrals_small ELSE ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) END IF CALL lmp%gather_dihedrals(dihedrals) @@ -478,7 +478,7 @@ FUNCTION f_lammps_test_gather_dihedrals_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: ndihedrals_big ndihedrals_big = lmp%extract_global('ndihedrals') - ndihedrals = ndihedrals_big + ndihedrals = INT(ndihedrals_big) CALL lmp%gather_dihedrals(dihedrals) dihedrals_array(1:5,1:SIZE(dihedrals)/5) => dihedrals count = 0 @@ -528,7 +528,7 @@ FUNCTION f_lammps_test_gather_impropers_small() BIND(C) RESULT(count) nimpropers = nimpropers_small ELSE nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) END IF CALL lmp%gather_impropers(impropers) @@ -566,7 +566,7 @@ FUNCTION f_lammps_test_gather_impropers_big() BIND(C) RESULT(count) INTEGER(c_int64_t), POINTER :: nimpropers_big nimpropers_big = lmp%extract_global('nimpropers') - nimpropers = nimpropers_big + nimpropers = INT(nimpropers_big) CALL lmp%gather_impropers(impropers) impropers_array(1:5,1:SIZE(impropers)/5) => impropers count = 0 diff --git a/unittest/fortran/test_fortran_get_thermo.f90 b/unittest/fortran/test_fortran_get_thermo.f90 index 7911ab07d5..965e6d58f7 100644 --- a/unittest/fortran/test_fortran_get_thermo.f90 +++ b/unittest/fortran/test_fortran_get_thermo.f90 @@ -152,3 +152,111 @@ FUNCTION f_lammps_get_thermo_zhi() BIND(C) f_lammps_get_thermo_zhi = lmp%get_thermo('zhi') END FUNCTION f_lammps_get_thermo_zhi + +SUBROUTINE f_lammps_last_thermo_setup() BIND(C) + USE liblammps + USE keepstuff, ONLY : lmp, big_input, cont_input, pair_input + IMPLICIT NONE + + CALL lmp%commands_list(big_input) + CALL lmp%commands_list(cont_input) + CALL lmp%commands_list(pair_input) + CALL lmp%command('thermo 10') + CALL lmp%command('run 15 post no') +END SUBROUTINE f_lammps_last_thermo_setup + +FUNCTION f_lammps_last_thermo_step() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_step + INTEGER :: size_bigint + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(ival) + ELSE + bval = lmp%last_thermo('step',1) + f_lammps_last_thermo_step = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_step + +FUNCTION f_lammps_last_thermo_num() BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int) :: f_lammps_last_thermo_num + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('num',1) + f_lammps_last_thermo_num = ival +END FUNCTION f_lammps_last_thermo_num + +FUNCTION f_lammps_last_thermo_type(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int) :: f_lammps_last_thermo_type + INTEGER(c_int), POINTER :: ival + + ival = lmp%last_thermo('type',idx) + f_lammps_last_thermo_type = ival +END FUNCTION f_lammps_last_thermo_type + +FUNCTION f_lammps_last_thermo_string(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_ptr, c_null_ptr + USE liblammps + USE keepstuff, ONLY : lmp, f2c_string + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + TYPE(c_ptr) :: f_lammps_last_thermo_string + CHARACTER(LEN=12) :: buffer + + buffer = lmp%last_thermo('keyword',idx) + IF (LEN_TRIM(buffer) > 0) THEN + f_lammps_last_thermo_string = f2c_string(buffer) + ELSE + f_lammps_last_thermo_string = c_null_ptr + END IF +END FUNCTION f_lammps_last_thermo_string + +FUNCTION f_lammps_last_thermo_int(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_int64_t + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + INTEGER(c_int), POINTER :: ival + INTEGER(c_int64_t), POINTER :: bval + INTEGER(c_int) :: f_lammps_last_thermo_int + INTEGER :: size_bigint + + size_bigint = lmp%extract_setting('bigint') + IF (size_bigint == 4) THEN + ival = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(ival) + ELSE + bval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_int = INT(bval) + END IF +END FUNCTION f_lammps_last_thermo_int + +FUNCTION f_lammps_last_thermo_double(idx) BIND(C) + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_int, c_double + USE liblammps + USE keepstuff, ONLY : lmp + IMPLICIT NONE + INTEGER(c_int), VALUE :: idx + REAL(c_double), POINTER :: dval + REAL(c_double) :: f_lammps_last_thermo_double + + dval = lmp%last_thermo('data',idx) + f_lammps_last_thermo_double = dval +END FUNCTION f_lammps_last_thermo_double diff --git a/unittest/fortran/wrap_get_thermo.cpp b/unittest/fortran/wrap_get_thermo.cpp index 71b51609eb..e18697ba9b 100644 --- a/unittest/fortran/wrap_get_thermo.cpp +++ b/unittest/fortran/wrap_get_thermo.cpp @@ -1,6 +1,7 @@ // unit tests for getting thermodynamic output from a LAMMPS instance through the Fortran wrapper #include "lammps.h" +#include "lmptype.h" #include #include @@ -23,8 +24,18 @@ double f_lammps_get_thermo_ylo(); double f_lammps_get_thermo_yhi(); double f_lammps_get_thermo_zlo(); double f_lammps_get_thermo_zhi(); + +void f_lammps_last_thermo_setup(); +int f_lammps_last_thermo_step(); +int f_lammps_last_thermo_num(); +int f_lammps_last_thermo_type(int); +const char *f_lammps_last_thermo_string(int); +int f_lammps_last_thermo_int(int); +double f_lammps_last_thermo_double(int); } +using LAMMPS_NS::multitype; + class LAMMPS_thermo : public ::testing::Test { protected: LAMMPS_NS::LAMMPS *lmp; @@ -65,3 +76,33 @@ TEST_F(LAMMPS_thermo, get_thermo) EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zlo(), 0.0); EXPECT_DOUBLE_EQ(f_lammps_get_thermo_zhi(), 4.0); }; + +TEST_F(LAMMPS_thermo, last_thermo) +{ + EXPECT_EQ(f_lammps_last_thermo_step(), -1); + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_NONE); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_NONE); + f_lammps_last_thermo_setup(); + EXPECT_EQ(f_lammps_last_thermo_step(), 15); + EXPECT_EQ(f_lammps_last_thermo_num(), 6); + EXPECT_STREQ(f_lammps_last_thermo_string(1), "Step"); + EXPECT_STREQ(f_lammps_last_thermo_string(2), "Temp"); + EXPECT_STREQ(f_lammps_last_thermo_string(3), "E_pair"); + EXPECT_STREQ(f_lammps_last_thermo_string(6), "Press"); +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT); +#else + EXPECT_EQ(f_lammps_last_thermo_type(1), multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(f_lammps_last_thermo_int(1), 15); + EXPECT_EQ(f_lammps_last_thermo_type(2), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(3), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(4), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(5), multitype::LAMMPS_DOUBLE); + EXPECT_EQ(f_lammps_last_thermo_type(6), multitype::LAMMPS_DOUBLE); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(2), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(3), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(4), 0.0); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(5), -0.13713425198078993); + EXPECT_DOUBLE_EQ(f_lammps_last_thermo_double(6), -0.022421073321023492); +}; diff --git a/unittest/python/python-commands.py b/unittest/python/python-commands.py index 33b19ba4f0..1c25751191 100644 --- a/unittest/python/python-commands.py +++ b/unittest/python/python-commands.py @@ -533,6 +533,33 @@ create_atoms 1 single & result = self.lmp.get_thermo(key) self.assertEqual(value, result, key) + + def test_last_thermo(self): + self.lmp.command("units lj") + self.lmp.command("atom_style atomic") + self.lmp.command("atom_modify map array") + self.lmp.command("boundary f f f") + self.lmp.command("region box block 0 2 0 2 0 2") + self.lmp.command("create_box 1 box") + self.lmp.command("mass * 1") + + x = [ + 0.5, 0.5, 0.5, + 1.5, 1.5, 1.5 + ] + types = [1, 1] + self.lmp.create_atoms(2, id=None, type=types, x=x) + + self.assertEqual(self.lmp.last_thermo(), None) + self.lmp.command("run 2 post no") + ref = { "Step" : 2, + "Temp" : 0.0, + "E_pair" : 0.0, + "E_mol" : 0.0, + "TotEng" : 0.0, + "Press" : 0.0} + self.assertDictEqual(self.lmp.last_thermo(), ref) + def test_extract_global(self): self.lmp.command("region box block -1 1 -2 2 -3 3") self.lmp.command("create_box 1 box") diff --git a/unittest/python/python-pylammps.py b/unittest/python/python-pylammps.py index 2b92f82248..9e691b1b8c 100644 --- a/unittest/python/python-pylammps.py +++ b/unittest/python/python-pylammps.py @@ -82,14 +82,26 @@ class PythonPyLammps(unittest.TestCase): self.pylmp.variable("fx atom fx") self.pylmp.run(10) - self.assertEqual(len(self.pylmp.runs), 1) - self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) - self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) - self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + # thermo data is only captured during a run if PYTHON package is enabled + # without it, it will only capture the final thermo at completion + if self.pylmp.lmp.has_package("PYTHON"): + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 2) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 2) + else: + self.assertEqual(len(self.pylmp.runs), 1) + self.assertEqual(self.pylmp.last_run, self.pylmp.runs[0]) + self.assertEqual(len(self.pylmp.last_run.thermo.Step), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Temp), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_pair), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.E_mol), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.TotEng), 1) + self.assertEqual(len(self.pylmp.last_run.thermo.Press), 1) def test_info_queries(self): self.pylmp.lattice("fcc", 0.8442), diff --git a/unittest/utils/CMakeLists.txt b/unittest/utils/CMakeLists.txt index a6d5545873..8c1a5a3f6a 100644 --- a/unittest/utils/CMakeLists.txt +++ b/unittest/utils/CMakeLists.txt @@ -7,6 +7,10 @@ add_executable(test_mempool test_mempool.cpp) target_link_libraries(test_mempool PRIVATE lammps GTest::GMockMain) add_test(NAME MemPool COMMAND test_mempool) +add_executable(test_lmptype test_lmptype.cpp) +target_link_libraries(test_lmptype PRIVATE lammps GTest::GMockMain) +add_test(NAME LmpType COMMAND test_lmptype) + add_executable(test_argutils test_argutils.cpp) target_link_libraries(test_argutils PRIVATE lammps GTest::GMockMain) add_test(NAME ArgUtils COMMAND test_argutils) diff --git a/unittest/utils/test_lmptype.cpp b/unittest/utils/test_lmptype.cpp new file mode 100644 index 0000000000..383c9d4b2c --- /dev/null +++ b/unittest/utils/test_lmptype.cpp @@ -0,0 +1,79 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS Development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "lmptype.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + +using namespace LAMMPS_NS; + +TEST(Types, ubuf) +{ + double buf[3]; + double d1 = 0.1; + int i1 = -10; +#if defined(LAMMPS_SMALLSMALL) + bigint b1 = 2048; +#else + bigint b1 = (1L << 58) + (1L << 50); +#endif + buf[0] = d1; + buf[1] = ubuf(i1).d; + buf[2] = ubuf(b1).d; + + EXPECT_EQ(d1, buf[0]); + EXPECT_EQ(i1, (int)ubuf(buf[1]).i); + EXPECT_EQ(b1, (bigint)ubuf(buf[2]).i); +} + +TEST(Types, multitype) +{ + multitype m[7]; + int64_t b1 = (3L << 48) - 1; + int i1 = 20; + double d1 = 0.1; + + m[0] = b1; + m[1] = i1; + m[2] = d1; + + m[3] = (bigint) -((1L << 40) + (1L << 50)); + m[4] = -1023; + m[5] = -2.225; + + EXPECT_EQ(m[0].type, multitype::LAMMPS_INT64); + EXPECT_EQ(m[1].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[2].type, multitype::LAMMPS_DOUBLE); + +#if defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT); +#else + EXPECT_EQ(m[3].type, multitype::LAMMPS_INT64); +#endif + EXPECT_EQ(m[4].type, multitype::LAMMPS_INT); + EXPECT_EQ(m[5].type, multitype::LAMMPS_DOUBLE); + EXPECT_EQ(m[6].type, multitype::LAMMPS_NONE); + + EXPECT_EQ(m[0].data.b, b1); + EXPECT_EQ(m[1].data.i, i1); + EXPECT_EQ(m[2].data.d, d1); + +#if !defined(LAMMPS_SMALLSMALL) + EXPECT_EQ(m[3].data.b, -((1L << 40) + (1L << 50))); +#endif + EXPECT_EQ(m[4].data.i, -1023); + EXPECT_EQ(m[5].data.d, -2.225); +}