diff --git a/cmake/Modules/Tools.cmake b/cmake/Modules/Tools.cmake index 29b21dc390..146764dbd5 100644 --- a/cmake/Modules/Tools.cmake +++ b/cmake/Modules/Tools.cmake @@ -9,14 +9,16 @@ if(BUILD_TOOLS) check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) - add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) + add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f90) target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) - install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) + add_executable(micelle2d.x ${LAMMPS_TOOLS_DIR}/micelle2d.f90) + target_link_libraries(micelle2d.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) + install(TARGETS chain.x micelle2d.x DESTINATION ${CMAKE_INSTALL_BINDIR}) else() - message(WARNING "No suitable Fortran compiler found, skipping build of 'chain.x'") + message(WARNING "No suitable Fortran compiler found, skipping build of 'chain.x' and 'micelle2d.x'") endif() else() - message(WARNING "CMake build doesn't support fortran, skipping build of 'chain.x'") + message(WARNING "CMake build doesn't support Fortran, skipping build of 'chain.x' and 'micelle2d.x'") endif() enable_language(C) diff --git a/cmake/presets/clang.cmake b/cmake/presets/clang.cmake index 073bcec3f2..a0d654ad35 100644 --- a/cmake/presets/clang.cmake +++ b/cmake/presets/clang.cmake @@ -10,9 +10,9 @@ set(CMAKE_Fortran_COMPILER ${CLANG_FORTRAN} CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f95" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f95" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f95" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -Wextra -g -std=f2003" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_DEBUG "-Wall -Wextra -g" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Wall -Wextra -g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) diff --git a/cmake/presets/gcc.cmake b/cmake/presets/gcc.cmake index 7942b2a4ce..c2dbacf674 100644 --- a/cmake/presets/gcc.cmake +++ b/cmake/presets/gcc.cmake @@ -1,4 +1,4 @@ -# preset that will restore gcc/g++ with support for MPI and OpenMP (on Linux boxes) +# preset that will explicitly request gcc/g++ compilers with support for MPI and OpenMP set(CMAKE_CXX_COMPILER "g++" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "gcc" CACHE STRING "" FORCE) @@ -15,9 +15,9 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) set(MPI_Fortran "gfortran" CACHE STRING "" FORCE) set(MPI_Fortran_COMPILER "mpifort" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -g" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG" CACHE STRING "" FORCE) -set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -g -std=f2003" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) +set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -std=f2003" CACHE STRING "" FORCE) unset(HAVE_OMP_H_INCLUDE CACHE) set(OpenMP_C "gcc" CACHE STRING "" FORCE) diff --git a/doc/src/Build.rst b/doc/src/Build.rst index 6dee21206b..7e4f749743 100644 --- a/doc/src/Build.rst +++ b/doc/src/Build.rst @@ -22,4 +22,5 @@ page. Build_extras Build_manual Build_windows + Build_diskspace Build_development diff --git a/doc/src/Build_diskspace.rst b/doc/src/Build_diskspace.rst new file mode 100644 index 0000000000..48ab21fd70 --- /dev/null +++ b/doc/src/Build_diskspace.rst @@ -0,0 +1,45 @@ +Notes for saving disk space when building LAMMPS from source +------------------------------------------------------------ + +LAMMPS is a large software project with a large number of source files, +extensive documentation, and a large collection of example files. +When downloading LAMMPS by cloning the +`git repository from GitHub `_ this +will by default also download the entire commit history since September 2006. +Compiling LAMMPS will add the storage requirements of the compiled object +files and libraries to the tally. + +In a user account on an HPC cluster with filesystem quotas or in other +environments with restricted disk space capacity it may be needed to +reduce the storage requirements. Here are some suggestions: + +- Create a so-called shallow repository by cloning only the last commit + instead of the full project history by using ``git clone git@github.com:lammps/lammps --depth=1 --branch=master``. + This reduces the downloaded size to about half. With ``--depth=1`` it is not possible to check out different + versions/branches of LAMMPS, using ``--depth=1000`` will make multiple recent versions available at little + extra storage needs (the entire git history had nearly 30,000 commits in fall 2021). + +- Download a tar archive from either the `download section on the LAMMPS homepage `_ + or from the `LAMMPS releases page on GitHub `_ these will not + contain the git history at all. + +- Build LAMMPS without the debug flag (remove ``-g`` from the machine makefile or use ``-DCMAKE_BUILD_TYPE=Release``) + or use the ``strip`` command on the LAMMPS executable when no more debugging would be needed. The strip command + may also be applied to the LAMMPS shared library. The static library may be deleted entirely. + +- Delete compiled object files and libraries after copying the LAMMPS executable to a permanent location. + When using the traditional build process, one may use ``make clean-`` or ``make clean-all`` + to delete object files in the src folder. For CMake based builds, one may use ``make clean`` or just + delete the entire build folder. + +- The folders containing the documentation tree (doc), the examples (examples) are not needed to build and + run LAMMPS and can be safely deleted. Some files in the potentials folder are large and may be deleted, + if not needed. The largest of those files (occupying about 120 MBytes combined) will only be downloaded on + demand, when the corresponding package is installed. + +- When using the CMake build procedure, the compilation can be done on a (local) scratch storage that will not + count toward the quota. A local scratch file system may offer the additional benefit of speeding up creating + object files and linking with libraries compared to a networked file system. Also with CMake (and unlike with + the traditional make) it is possible to compile LAMMPS executables with different settings and packages included + from the same source tree since all the configuration information is stored in the build folder. So it is + not necessary to have multiple copies of LAMMPS. diff --git a/doc/src/Intro_authors.rst b/doc/src/Intro_authors.rst index 720221d4b7..fc609e12cf 100644 --- a/doc/src/Intro_authors.rst +++ b/doc/src/Intro_authors.rst @@ -29,7 +29,7 @@ The following folks deserve special recognition. Many of the packages they have written are unique for an MD code and LAMMPS would not be as general-purpose as it is without their expertise and efforts. -* Metin Aktulga (MSU), REAXFF package for C version of ReaxFF +* Metin Aktulga (MSU), REAXFF package for C/C++ version of ReaxFF * Mike Brown (Intel), GPU and INTEL packages * Colin Denniston (U Western Ontario), LATBOLTZ package * Georg Ganzenmuller (EMI), MACHDYN and SPH packages @@ -37,9 +37,10 @@ general-purpose as it is without their expertise and efforts. * Reese Jones (Sandia) and colleagues, ATC package for atom/continuum coupling * Christoph Kloss (DCS Computing), LIGGGHTS code for granular materials, built on top of LAMMPS * Rudra Mukherjee (JPL), POEMS package for articulated rigid body motion -* Trung Ngyuen (Northwestern U), GPU and RIGID and BODY packages +* Trung Ngyuen (Northwestern U), GPU, RIGID, BODY, and DIELECTRIC packages * Mike Parks (Sandia), PERI package for Peridynamics * Roy Pollock (LLNL), Ewald and PPPM solvers +* Julien Tranchida (Sandia), SPIN package * Christian Trott (Sandia), CUDA and KOKKOS packages * Ilya Valuev (JIHT), AWPMD package for wave packet MD * Greg Wagner (Northwestern U), MEAM package for MEAM potential diff --git a/doc/src/Intro_features.rst b/doc/src/Intro_features.rst index f1c04bdb23..2b0409b007 100644 --- a/doc/src/Intro_features.rst +++ b/doc/src/Intro_features.rst @@ -27,19 +27,19 @@ General features * distributed memory message-passing parallelism (MPI) * shared memory multi-threading parallelism (OpenMP) * spatial decomposition of simulation domain for MPI parallelism -* particle decomposition inside of spatial decomposition for OpenMP parallelism +* particle decomposition inside of spatial decomposition for OpenMP and GPU parallelism * GPLv2 licensed open-source distribution * highly portable C++-11 * modular code with most functionality in optional packages -* only depends on MPI library for basic parallel functionality +* only depends on MPI library for basic parallel functionality, MPI stub for serial compilation * other libraries are optional and only required for specific packages -* GPU (CUDA and OpenCL), Intel Xeon Phi, and OpenMP support for many code features +* GPU (CUDA, OpenCL, HIP, SYCL), Intel Xeon Phi, and OpenMP support for many code features * easy to extend with new features and functionality * runs from an input script * syntax for defining and using variables and formulas * syntax for looping over runs and breaking out of loops * run one or multiple simulations simultaneously (in parallel) from one script -* build as library, invoke LAMMPS through library interface or provided Python wrapper +* build as library, invoke LAMMPS through library interface or provided Python wrapper or SWIG based wrappers * couple with other codes: LAMMPS calls other code, other code calls LAMMPS, umbrella code calls both .. _particle: @@ -57,9 +57,11 @@ Particle and model types * granular materials * coarse-grained mesoscale models * finite-size spherical and ellipsoidal particles -* finite-size line segment (2d) and triangle (3d) particles +* finite-size line segment (2d) and triangle (3d) particles +* finite-size rounded polygons (2d) and polyhedra (3d) particles * point dipole particles -* rigid collections of particles +* particles with magnetic spin +* rigid collections of n particles * hybrid combinations of these .. _ff: @@ -74,24 +76,28 @@ commands) * pairwise potentials: Lennard-Jones, Buckingham, Morse, Born-Mayer-Huggins, Yukawa, soft, class 2 (COMPASS), hydrogen bond, tabulated * charged pairwise potentials: Coulombic, point-dipole -* many-body potentials: EAM, Finnis/Sinclair EAM, modified EAM (MEAM), embedded ion method (EIM), EDIP, ADP, Stillinger-Weber, Tersoff, REBO, AIREBO, ReaxFF, COMB, SNAP, Streitz-Mintmire, 3-body polymorphic -* long-range interactions for charge, point-dipoles, and LJ dispersion: Ewald, Wolf, PPPM (similar to particle-mesh Ewald) +* many-body potentials: EAM, Finnis/Sinclair EAM, modified EAM (MEAM), embedded ion method (EIM), EDIP, ADP, Stillinger-Weber, Tersoff, REBO, AIREBO, ReaxFF, COMB, Streitz-Mintmire, 3-body polymorphic, BOP, Vashishta +* machine learning potentials: SNAP, GAP, ACE, N2P2, RANN, AGNI +* long-range interactions for charge, point-dipoles, and LJ dispersion: Ewald, Wolf, PPPM (similar to particle-mesh Ewald), MSM * polarization models: :doc:`QEq `, :doc:`core/shell model `, :doc:`Drude dipole model ` * charge equilibration (QEq via dynamic, point, shielded, Slater methods) * coarse-grained potentials: DPD, GayBerne, REsquared, colloidal, DLVO -* mesoscopic potentials: granular, Peridynamics, SPH +* mesoscopic potentials: granular, Peridynamics, SPH, mesoscopic tubular potential (MESONT) +* semi-empirical potentials: multi-ion generalized pseudopotential theory (MGPT), second moment tight binding + QEq (SMTB-Q), density functional tight-binding (LATTE) * electron force field (eFF, AWPMD) -* bond potentials: harmonic, FENE, Morse, nonlinear, class 2, quartic (breakable) -* angle potentials: harmonic, CHARMM, cosine, cosine/squared, cosine/periodic, class 2 (COMPASS) -* dihedral potentials: harmonic, CHARMM, multi-harmonic, helix, class 2 (COMPASS), OPLS -* improper potentials: harmonic, cvff, umbrella, class 2 (COMPASS) +* bond potentials: harmonic, FENE, Morse, nonlinear, class 2, quartic (breakable), tabulated +* angle potentials: harmonic, CHARMM, cosine, cosine/squared, cosine/periodic, class 2 (COMPASS), tabulated +* dihedral potentials: harmonic, CHARMM, multi-harmonic, helix, class 2 (COMPASS), OPLS, tabulated +* improper potentials: harmonic, cvff, umbrella, class 2 (COMPASS), tabulated * polymer potentials: all-atom, united-atom, bead-spring, breakable -* water potentials: TIP3P, TIP4P, SPC +* water potentials: TIP3P, TIP4P, SPC, SPC/E and variants +* interlayer potentials for graphene and analogues +* metal-organic framework potentials (QuickFF, MO-FF) * implicit solvent potentials: hydrodynamic lubrication, Debye -* force-field compatibility with common CHARMM, AMBER, DREIDING, OPLS, GROMACS, COMPASS options +* force-field compatibility with common CHARMM, AMBER, DREIDING, OPLS, GROMACS, COMPASS options * access to the `OpenKIM Repository `_ of potentials via :doc:`kim command ` -* hybrid potentials: multiple pair, bond, angle, dihedral, improper potentials can be used in one simulation -* overlaid potentials: superposition of multiple pair potentials +* hybrid potentials: multiple pair, bond, angle, dihedral, improper potentials can be used in one simulation +* overlaid potentials: superposition of multiple pair potentials (including many-body) with optional scale factor .. _create: @@ -124,9 +130,10 @@ Ensembles, constraints, and boundary conditions * harmonic (umbrella) constraint forces * rigid body constraints * SHAKE bond and angle constraints -* Monte Carlo bond breaking, formation, swapping +* motion constraints to manifold surfaces +* Monte Carlo bond breaking, formation, swapping, template based reaction modeling * atom/molecule insertion and deletion -* walls of various kinds +* walls of various kinds, static and moving * non-equilibrium molecular dynamics (NEMD) * variety of additional boundary conditions and constraints @@ -150,6 +157,7 @@ Diagnostics ^^^^^^^^^^^ * see various flavors of the :doc:`fix ` and :doc:`compute ` commands +* introspection command for system, simulation, and compile time settings and configurations .. _output: @@ -164,8 +172,9 @@ Output * parallel I/O of dump and restart files * per-atom quantities (energy, stress, centro-symmetry parameter, CNA, etc) * user-defined system-wide (log file) or per-atom (dump file) calculations -* spatial and time averaging of per-atom quantities -* time averaging of system-wide quantities +* custom partitioning (chunks) for binning, and static or dynamic grouping of atoms for analysis +* spatial, time, and per-chunk averaging of per-atom quantities +* time averaging and histogramming of system-wide quantities * atom snapshots in native, XYZ, XTC, DCD, CFG formats .. _replica1: @@ -178,7 +187,7 @@ Multi-replica models * :doc:`parallel replica dynamics ` * :doc:`temperature accelerated dynamics ` * :doc:`parallel tempering ` -* :doc:`path-integral MD ` +* path-integral MD: `first variant `, `second variant ` * multi-walker collective variables with :doc:`Colvars ` and :doc:`Plumed ` .. _prepost: @@ -210,11 +219,12 @@ page for details. These are LAMMPS capabilities which you may not think of as typical classical MD options: -* :doc:`static ` and :doc:`dynamic load-balancing ` +* :doc:`static ` and :doc:`dynamic load-balancing `, optional with recursive bisectioning decomposition * :doc:`generalized aspherical particles ` * :doc:`stochastic rotation dynamics (SRD) ` -* :doc:`real-time visualization and interactive MD ` +* :doc:`real-time visualization and interactive MD `, :doc:`built-in renderer for images and movies ` * calculate :doc:`virtual diffraction patterns ` +* calculate :doc:`finite temperature phonon dispersion ` and the :doc:`dynamical matrix of minimized structures ` * :doc:`atom-to-continuum coupling ` with finite elements * coupled rigid body integration via the :doc:`POEMS ` library * :doc:`QM/MM coupling ` diff --git a/doc/src/Intro_opensource.rst b/doc/src/Intro_opensource.rst index 635982fd18..fa857e5014 100644 --- a/doc/src/Intro_opensource.rst +++ b/doc/src/Intro_opensource.rst @@ -1,40 +1,61 @@ LAMMPS open-source license -------------------------- -LAMMPS is a freely-available open-source code, distributed under the -terms of the `GNU Public License Version 2 `_, which means you can -use or modify the code however you wish for your own purposes, but have -to adhere to certain rules when redistributing it or software derived +GPL version of LAMMPS +^^^^^^^^^^^^^^^^^^^^^ + +LAMMPS is an open-source code, available free-of-charge, and distributed +under the terms of the `GNU Public License Version 2 `_ (GPLv2), +which means you can use or modify the code however you wish for your own +purposes, but have to adhere to certain rules when redistributing it - +specifically in binary form - or are distributing software derived from it or that includes parts of it. -LAMMPS comes with no warranty of any kind. As each source file states -in its header, it is a copyrighted code that is distributed free-of- -charge, under the terms of the `GNU Public License Version 2 `_ -(GPLv2). This is often referred to as open-source distribution - see -`www.gnu.org `_ or `www.opensource.org `_. The -legal text of the GPL is in the LICENSE file included in the LAMMPS -distribution. +LAMMPS comes with no warranty of any kind. + +As each source file states in its header, it is a copyrighted code, and +thus not in the public domain. For more information about open-source +software and open-source distribution, see `www.gnu.org `_ +or `www.opensource.org `_. The legal text of the GPL as it +applies to LAMMPS is in the LICENSE file included in the LAMMPS distribution. .. _gpl: https://github.com/lammps/lammps/blob/master/LICENSE +.. _lgpl: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + .. _gnuorg: http://www.gnu.org .. _opensource: http://www.opensource.org -Here is a summary of what the GPL means for LAMMPS users: +Here is a more specific summary of what the GPL means for LAMMPS users: -(1) Anyone is free to use, modify, or extend LAMMPS in any way they +(1) Anyone is free to use, copy, modify, or extend LAMMPS in any way they choose, including for commercial purposes. (2) If you **distribute** a modified version of LAMMPS, it must remain -open-source, meaning you distribute **all** of it under the terms of -the GPL. You should clearly annotate such a code as a derivative version -of LAMMPS. +open-source, meaning you are required to distribute **all** of it under +the terms of the GPL. You should clearly annotate such a modified code +as a derivative version of LAMMPS. (3) If you release any code that includes or uses LAMMPS source code, then it must also be open-sourced, meaning you distribute it under -the terms of the GPL. +the terms of the GPL. You may write code that interfaces LAMMPS to +a differently licensed library. In that case the code that provides +the interface must be licensed GPL, but not necessarily that library +unless you are distributing binaries that require the library to run. (4) If you give LAMMPS files to someone else, the GPL LICENSE file and source file headers (including the copyright and GPL notices) should remain part of the code. + + +LGPL version of LAMMPS +^^^^^^^^^^^^^^^^^^^^^^ + +We occasionally make stable LAMMPS releases available under the `GNU +Lesser Public License v2.1 `_. This is on request only and with +non-LGPL compliant files removed. This allows uses linking non-GPL +compatible software with the (otherwise unmodified) LAMMPS library +or loading it dynamically at runtime. Any **modifications** to +the LAMMPS code however, even with the LGPL licensed version, must still +be made available under the same open source terms as LAMMPS itself. diff --git a/doc/src/Intro_overview.rst b/doc/src/Intro_overview.rst index a25f91bc48..11a331015b 100644 --- a/doc/src/Intro_overview.rst +++ b/doc/src/Intro_overview.rst @@ -10,24 +10,26 @@ conditions. It can model 2d or 3d systems with only a few particles up to millions or billions. LAMMPS can be built and run on a laptop or desktop machine, but is -designed for parallel computers. It will run on any parallel machine -that supports the `MPI `_ message-passing library. This includes -shared-memory boxes and distributed-memory clusters and -supercomputers. +designed for parallel computers. It will run in serial and on any +parallel machine that supports the `MPI `_ message-passing +library. This includes shared-memory boxes and distributed-memory +clusters and supercomputers. Parts of LAMMPS also support +`OpenMP multi-threading `_, vectorization and GPU acceleration. .. _mpi: https://en.wikipedia.org/wiki/Message_Passing_Interface .. _lws: https://www.lammps.org +.. _omp: https://www.openmp.org LAMMPS is written in C++ and requires a compiler that is at least -compatible with the C++-11 standard. -Earlier versions were written in F77 and F90. See the `History page +compatible with the C++-11 standard. Earlier versions were written in +F77, F90, and C++-98. See the `History page `_ of the website for details. All -versions can be downloaded from the `LAMMPS website `_. +versions can be downloaded as source code from the `LAMMPS website +`_. -LAMMPS is designed to be easy to modify or extend with new -capabilities, such as new force fields, atom types, boundary -conditions, or diagnostics. See the :doc:`Modify ` page for -more details. +LAMMPS is designed to be easy to modify or extend with new capabilities, +such as new force fields, atom types, boundary conditions, or +diagnostics. See the :doc:`Modify ` page for more details. In the most general sense, LAMMPS integrates Newton's equations of motion for a collection of interacting particles. A single particle @@ -47,4 +49,5 @@ MPI parallelization to partition the simulation domain into small sub-domains of equal computational cost, one of which is assigned to each processor. Processors communicate and store "ghost" atom information for atoms that border their sub-domain. Multi-threading -parallelization with with particle-decomposition can be used in addition. +parallelization and GPU acceleration with with particle-decomposition +can be used in addition. diff --git a/doc/src/Manual_version.rst b/doc/src/Manual_version.rst index a57c8512a6..ae9bd556c4 100644 --- a/doc/src/Manual_version.rst +++ b/doc/src/Manual_version.rst @@ -2,12 +2,21 @@ What does a LAMMPS version mean ------------------------------- The LAMMPS "version" is the date when it was released, such as 1 May -2014. LAMMPS is updated continuously. Whenever we fix a bug or add a -feature, we release it in the next *patch* release, which are -typically made every couple of weeks. Info on patch releases are on -`this website page `_. Every few -months, the latest patch release is subjected to more thorough testing -and labeled as a *stable* version. +2014. LAMMPS is updated continuously and we aim to keep it working +correctly and reliably at all times. You can follow its development +in a public `git repository on GitHub `_. + +Whenever we fix a bug or update or add a feature, it will be merged into +the `master` branch of the git repository. When a sufficient number of +changes have accumulated *and* the software passes a set of automated +tests, we release it in the next *patch* release, which are made every +few weeks. Info on patch releases are on `this website page +`_. + +Once or twice a year, only bug fixes and small, non-intrusive changes are +included for a period of time, and the code is subjected to more detailed +and thorough testing than the default automated testing. The latest +patch release after such a period is then labeled as a *stable* version. Each version of LAMMPS contains all the features and bug-fixes up to and including its version date. diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 72cfc7db9e..5822286e5f 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -172,7 +172,7 @@ Chris Lorenz (chris.lorenz at kcl.ac.uk), King's College London. chain tool ---------------------- -The file chain.f creates a LAMMPS data file containing bead-spring +The file chain.f90 creates a LAMMPS data file containing bead-spring polymer chains and/or monomer solvent atoms. It uses a text file containing chain definition parameters as an input. The created chains and solvent atoms can strongly overlap, so LAMMPS needs to run diff --git a/doc/src/fix_halt.rst b/doc/src/fix_halt.rst index d7f7f75515..46d5cd89bb 100644 --- a/doc/src/fix_halt.rst +++ b/doc/src/fix_halt.rst @@ -19,7 +19,7 @@ Syntax bondmax = length of longest bond in the system (in length units) tlimit = elapsed CPU time (in seconds) - diskfree = free disk space (in megabytes) + diskfree = free disk space (in MBytes) v_name = name of :doc:`equal-style variable ` * operator = "<" or "<=" or ">" or ">=" or "==" or "!=" or "\|\^" @@ -81,7 +81,7 @@ the timer frequently across a large number of processors may be non-negligible. The *diskfree* attribute will check for available disk space (in -megabytes) on supported operating systems. By default it will +MBytes) on supported operating systems. By default it will check the file system of the current working directory. This can be changed with the optional *path* keyword, which will take the path to a file or folder on the file system to be checked diff --git a/doc/src/fix_qtb.rst b/doc/src/fix_qtb.rst index e6975748c4..c41a58a8f4 100644 --- a/doc/src/fix_qtb.rst +++ b/doc/src/fix_qtb.rst @@ -128,7 +128,7 @@ spectrum while consumes more memory. With fixed *f_max* and :math:`\gamma`, *N_f* should be big enough to converge the classical temperature :math:`T^{cl}` as a function of target quantum bath temperature. Memory usage per processor could be from 10 to 100 -Mbytes. +MBytes. .. note:: diff --git a/doc/src/pair_airebo.rst b/doc/src/pair_airebo.rst index 28d7811f06..b250064476 100644 --- a/doc/src/pair_airebo.rst +++ b/doc/src/pair_airebo.rst @@ -229,6 +229,11 @@ but you would need to create your own AIREBO or AIREBO-M potential file with coefficients listed in the appropriate units, if your simulation does not use "metal" units. +The pair styles provided here **only** support potential files parameterized +for the elements carbon and hydrogen (designated with "C" and "H" in the +*pair_coeff* command. Using potential files for other elements will trigger +an error. + Related commands """""""""""""""" diff --git a/doc/src/pair_snap.rst b/doc/src/pair_snap.rst index 381250f57b..e00169b306 100644 --- a/doc/src/pair_snap.rst +++ b/doc/src/pair_snap.rst @@ -135,7 +135,7 @@ with #) anywhere. Each non-blank non-comment line must contain one keyword/value pair. The required keywords are *rcutfac* and *twojmax*\ . Optional keywords are *rfac0*, *rmin0*, *switchflag*, *bzeroflag*, *quadraticflag*, *chemflag*, -*bnormflag*, *wselfallflag*, and *chunksize*\ . +*bnormflag*, *wselfallflag*, *chunksize*, and *parallelthresh*\ . The default values for these keywords are @@ -147,7 +147,8 @@ The default values for these keywords are * *chemflag* = 0 * *bnormflag* = 0 * *wselfallflag* = 0 -* *chunksize* = 4096 +* *chunksize* = 32768 +* *parallelthresh* = 8192 If *quadraticflag* is set to 1, then the SNAP energy expression includes additional quadratic terms that have been shown to increase the overall @@ -188,14 +189,24 @@ corresponding *K*-vector of linear coefficients for element which must equal the number of unique elements appearing in the LAMMPS pair_coeff command, to avoid ambiguity in the number of coefficients. -The keyword *chunksize* is only applicable when using the -pair style *snap* with the KOKKOS package and is ignored otherwise. -This keyword controls +The keywords *chunksize* and *parallelthresh* are only applicable when +using the pair style *snap* with the KOKKOS package on GPUs and are +ignored otherwise. +The *chunksize* keyword controls the number of atoms in each pass used to compute the bispectrum components and is used to avoid running out of memory. For example if there are 8192 atoms in the simulation and the *chunksize* is set to 4096, the bispectrum calculation will be broken up -into two passes. +into two passes (running on a single GPU). +The *parallelthresh* keyword controls +a crossover threshold for performing extra parallelism. For +small systems, exposing additional parallism can be beneficial when +there is not enough work to fully saturate the GPU threads otherwise. +However, the extra parallelism also leads to more divergence +and can hurt performance when the system is already large enough to +saturate the GPU threads. Extra parallelism will be performed if the +*chunksize* (or total number of atoms per GPU) is smaller than +*parallelthresh*. Detailed definitions for all the other keywords are given on the :doc:`compute sna/atom ` doc page. diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 6b40fcde71..7e3886e2fd 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1174,6 +1174,7 @@ googletest Gordan Goudeau GPa +GPL gpu gpuID gpus @@ -1689,6 +1690,7 @@ Lett Leuven Leven Lewy +LGPL lgvdw Liang libatc @@ -1889,7 +1891,6 @@ maxX Mayergoyz Mayoral mbt -Mbytes MBytes mc McLachlan diff --git a/lib/gpu/geryon/ocl_timer.h b/lib/gpu/geryon/ocl_timer.h index ca74312d51..71efe2d2c0 100644 --- a/lib/gpu/geryon/ocl_timer.h +++ b/lib/gpu/geryon/ocl_timer.h @@ -139,7 +139,6 @@ class UCL_Timer { cl_event start_event, stop_event; cl_command_queue _cq; double _total_time; - double t_factor; bool _initialized; bool has_measured_time; }; diff --git a/lib/gpu/geryon/ucl_d_vec.h b/lib/gpu/geryon/ucl_d_vec.h index e791f18f29..6c10568f86 100644 --- a/lib/gpu/geryon/ucl_d_vec.h +++ b/lib/gpu/geryon/ucl_d_vec.h @@ -39,7 +39,7 @@ class UCL_D_Vec : public UCL_BaseMat { }; typedef numtyp data_type; - UCL_D_Vec() : _cols(0), _row_bytes(0) {} + UCL_D_Vec() : _row_bytes(0), _cols(0) {} ~UCL_D_Vec() { _device_free(*this); } /// Construct with n columns diff --git a/lib/gpu/lal_lj_tip4p_long.cu b/lib/gpu/lal_lj_tip4p_long.cu index fd254f0a03..8b52f09d68 100644 --- a/lib/gpu/lal_lj_tip4p_long.cu +++ b/lib/gpu/lal_lj_tip4p_long.cu @@ -20,9 +20,13 @@ #define tagint int #endif #ifdef LAMMPS_BIGBIG -#include "inttypes.h" +#ifdef USE_OPENCL +#define tagint long +#else +#include "stdint.h" #define tagint int64_t #endif +#endif #ifdef LAMMPS_SMALLSMALL #define tagint int #endif @@ -39,9 +43,13 @@ _texture( q_tex,int2); #define tagint int #endif #ifdef LAMMPS_BIGBIG -#include "inttypes.h" +#ifdef USE_OPENCL +#define tagint long +#else +#include "stdint.h" #define tagint int64_t #endif +#endif #ifdef LAMMPS_SMALLSMALL #define tagint int #endif diff --git a/lib/gpu/lal_neighbor_gpu.cu b/lib/gpu/lal_neighbor_gpu.cu index 6fd724b494..352f1d6138 100644 --- a/lib/gpu/lal_neighbor_gpu.cu +++ b/lib/gpu/lal_neighbor_gpu.cu @@ -21,9 +21,13 @@ #define tagint int #endif #ifdef LAMMPS_BIGBIG -#include "inttypes.h" +#ifdef USE_OPENCL +#define tagint long +#else +#include "stdint.h" #define tagint int64_t #endif +#endif #ifdef LAMMPS_SMALLSMALL #define tagint int #endif diff --git a/lib/gpu/lal_precision.h b/lib/gpu/lal_precision.h index bb2423198f..ee1ab7b3e2 100644 --- a/lib/gpu/lal_precision.h +++ b/lib/gpu/lal_precision.h @@ -136,7 +136,7 @@ typedef int tagint; #define OCL_INT_TYPE "-DLAMMPS_SMALLBIG" #endif #ifdef LAMMPS_BIGBIG -#include "inttypes.h" +#include "stdint.h" typedef int64_t tagint; #define OCL_INT_TYPE "-DLAMMPS_BIGBIG" #endif diff --git a/lib/mesont/CNTPot.f90 b/lib/mesont/CNTPot.f90 index 4a130074fd..5c83ce63e5 100644 --- a/lib/mesont/CNTPot.f90 +++ b/lib/mesont/CNTPot.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module CNTPot !************************************************************************************* ! @@ -21,34 +21,34 @@ module CNTPot !***************************************************************** ! ! Carbon nanotubes internal potentials: ! CNTSTRH0, harmonic stretching potential of type 0 with constant Young's modulus -! CNTSTRH1, harmonic stretching potential of type 1 with variable Young's modulus +! CNTSTRH1, harmonic stretching potential of type 1 with variable Young's modulus ! CNTSTRNH0, non-harmonic stretching with fracture potential of type 0 ! CNTSTRNH1, non-harmonic stretching with fracture potential of type 1 ! CNTBNDH, harmonic bending potential ! CNTBNDHB, harmonic bending-buckling potential -! CNTBNDHBF, harmonic bending-buckling potential with fracture +! CNTBNDHBF, harmonic bending-buckling potential with fracture ! CNTTRS, torsion potential ! CNTBRT, breathing potential ! ! The functional form and force constants of harmonic stretching, bending and -! torsion potentials are taken from: +! torsion potentials are taken from: ! L.V. Zhigilei, Ch. Wei, D. Srivastava, Phys. Rev. B 71, 165417 (2005) ! -! The model of stress-strain curve for the non-harmonic potential with fracture +! The model of stress-strain curve for the non-harmonic potential with fracture ! is developed and parameterized using the following constants -! -- Young's modulus +! -- Young's modulus ! -- maximum linear strain (only for the NH potential of type 1) ! -- tensile strength (or fracture strain) ! -- strain at failure (or fracture strain) ! -- maximum strain. ! All these parameters are assumed to be independent of CNT radius or chriality type. -! In this model, the true strain at failure CNTSTREft and true tensile strength +! In this model, the true strain at failure CNTSTREft and true tensile strength ! CNTSTRSft are slightly different from the imposed values CNTSTREf and CNTSTRSf. ! -! The non-harmonic stretching potentials of types 0 and 1 are different from +! The non-harmonic stretching potentials of types 0 and 1 are different from ! each other by the functional form of the stress-strain curve ! -! Different parameterizations of CNTSTRH0, CNTSTRNH0 and CNTSTRNH1 potentials can be chosen, +! Different parameterizations of CNTSTRH0, CNTSTRNH0 and CNTSTRNH1 potentials can be chosen, ! see subroutine CNTSTRSetParameterization ! !--------------------------------------------------------------------------------------------------- @@ -75,47 +75,47 @@ implicit none integer(c_int), parameter :: CNTPOT_BFRACTURE = 5 ! Harmonic stretching model (constant Young's modulus) - integer(c_int), parameter :: CNTSTRMODEL_H0 = 0 + integer(c_int), parameter :: CNTSTRMODEL_H0 = 0 ! Harmonic stretching model (Young's modulus depends on radius) - integer(c_int), parameter :: CNTSTRMODEL_H1 = 1 + integer(c_int), parameter :: CNTSTRMODEL_H1 = 1 ! Non-harmonic stretching with fracture, potential of type 0 - integer(c_int), parameter :: CNTSTRMODEL_NH0F = 2 + integer(c_int), parameter :: CNTSTRMODEL_NH0F = 2 ! Non-harmonic stretching without fracture, potential of type 1 - integer(c_int), parameter :: CNTSTRMODEL_NH1 = 3 + integer(c_int), parameter :: CNTSTRMODEL_NH1 = 3 ! Non-harmonic stretching with fracture, potential of type 1 - integer(c_int), parameter :: CNTSTRMODEL_NH1F = 4 - ! Harmonic stretching model + axial buckling - integer(c_int), parameter :: CNTSTRMODEL_H1B = 5 + integer(c_int), parameter :: CNTSTRMODEL_NH1F = 4 + ! Harmonic stretching model + axial buckling + integer(c_int), parameter :: CNTSTRMODEL_H1B = 5 ! Harmonic stretching model + axial buckling + hysteresis - integer(c_int), parameter :: CNTSTRMODEL_H1BH = 6 + integer(c_int), parameter :: CNTSTRMODEL_H1BH = 6 integer(c_int), parameter :: CNTBNDMODEL_H = 0 ! Harmonic bending model integer(c_int), parameter :: CNTBNDMODEL_HB = 1 ! Harmonic bending - buckling model integer(c_int), parameter :: CNTBNDMODEL_HBF = 2 ! Harmonic bending - buckling - fracture model integer(c_int), parameter :: CNTBNDMODEL_HBH = 3 ! Harmonic bending - buckling + Hysteresis - + integer(c_int), parameter :: CNTPOTNMAX = 4000 ! Maximum number of points in the interpolation tables - + !--------------------------------------------------------------------------------------------------- ! Parameters of potentials !--------------------------------------------------------------------------------------------------- ! Stretching potential - + ! Type of the bending model integer(c_int) :: CNTSTRModel = CNTSTRMODEL_H1 ! Type of parameterization - integer(c_int) :: CNTSTRParams = 0 + integer(c_int) :: CNTSTRParams = 0 ! Type of dependence of the Young's modulus on tube radius - integer(c_int) :: CNTSTRYMT = 0 - + integer(c_int) :: CNTSTRYMT = 0 + ! Parameters of non-harmonic potential and fracture model - real(c_double) :: CNTSTRR0 = 6.8d+00 ! Reference radius of nanotubes (A) - ! (this parameter is not used for the model - ! parametrization, but only for calculation of the + real(c_double) :: CNTSTRR0 = 6.8d+00 ! Reference radius of nanotubes (A) + ! (this parameter is not used for the model + ! parametrization, but only for calculation of the ! force constant in eV/A) - real(c_double) :: CNTSTRD0 = 3.4d+00 ! CNT wall thickness (A) - real(c_double) :: CNTSTREmin = -0.4d+00 ! Minimum strain in tabulated potential + real(c_double) :: CNTSTRD0 = 3.4d+00 ! CNT wall thickness (A) + real(c_double) :: CNTSTREmin = -0.4d+00 ! Minimum strain in tabulated potential real(c_double) :: CNTSTREmax = 0.13d+00 ! Maximum strain in tabulated potential. ! Simultaneously, U=0 if E> CNTSTREmax real(c_double) :: CNTSTREl = 5.0d-02 ! Maximum linear strain @@ -129,17 +129,17 @@ implicit none real(c_double) :: CNTSTRSi ! Maximum stress (not used in the model) (Pa) real(c_double) :: CNTSTRDf ! dF/dE at failure - real(c_double) :: CNTSTRAA, CNTSTRBB ! + real(c_double) :: CNTSTRAA, CNTSTRBB ! real(c_double) :: CNTSTRAAA, CNTSTRBBB ! Auxiliary constants - real(c_double) :: CNTSTRUl, CNTSTRUf ! - + real(c_double) :: CNTSTRUl, CNTSTRUf ! + ! Axial buckling - hysteresis approach - real(c_double) :: CNTSTREc = -0.0142d+00 ! The minimum buckling strain - real(c_double) :: CNTSTREc1 = -0.04d+00 ! Critical axial buckling strain + real(c_double) :: CNTSTREc = -0.0142d+00 ! The minimum buckling strain + real(c_double) :: CNTSTREc1 = -0.04d+00 ! Critical axial buckling strain real(c_double) :: CNTSTREc2 = -0.45d+00 ! Maximum buckling strain - + ! Bending potential - + integer(c_int) :: CNTBNDModel = CNTBNDMODEL_H ! Type of the bending model ! Buckling model parameters real(c_double) :: CNTBNDN = 1.0d+00 ! Buckling exponent @@ -149,9 +149,9 @@ implicit none real(c_double) :: CNTBNDTF = M_PI * 120.0d+00 / 180.0d+00 ! Fracture buckling angle (rad) real(c_double) :: CNTBNDN1 real(c_double) :: CNTBNDC2 - + contains !****************************************************************************************** - + !--------------------------------------------------------------------------------------------------- ! Stretching potential !--------------------------------------------------------------------------------------------------- @@ -167,7 +167,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- integer(c_int), intent(in) :: PType !------------------------------------------------------------------------------------------- - select case ( PType ) + select case ( PType ) case ( 0 ) ! This parametrization is based on averaged exp. data of Ref. [1] CNTSTRR0 = 6.8d+00 ! Ref. [1] CNTSTRD0 = 3.4d+00 ! Ref. [1] @@ -180,7 +180,7 @@ contains !********************************************************************** case ( 1 ) ! This parameterization is taken from Ref. [2] for (10,10) CNTs. ! These values are obtained in MD simulations with REBO potential. ! Values of Young's modulus, tensile strength and stress here - ! are close to those obtained in Ref. [3] for pristine (defectless) + ! are close to those obtained in Ref. [3] for pristine (defectless) ! (5,5) CNT in semi-empirical QM calculations based on PM3 model CNTSTRR0 = 6.785d+00 ! Calculated with the usual formula for (10,10) CNT CNTSTRD0 = 3.35d+00 ! Ref. [2] @@ -190,7 +190,7 @@ contains !********************************************************************** CNTSTREf = 27.9d-02 ! Corresponds to maximum strain in Ref. [2] CNTSTRS0 = 1.031e+12 ! Ref. [2] CNTSTRSf = 148.5d+09 ! Corresponds to tensile strength in Ref. [2] - case ( 2 ) ! This parametrization is taken from Ref. [3] for (5,5) CNTs + case ( 2 ) ! This parametrization is taken from Ref. [3] for (5,5) CNTs ! with one atom vacancy defect obtained with the semi-empirical QM PM3 model CNTSTRR0 = 3.43d+00 ! Ref. [3] CNTSTRD0 = 3.4d+00 ! Ref. [3] @@ -246,14 +246,14 @@ contains !********************************************************************** ! ! Stretching without fracture, harmonic potential, with axial buckling without hysteresis ! - - integer(c_int) function CNTSTRH1BCalc ( U, dUdL, L, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + integer(c_int) function CNTSTRH1BCalc ( U, dUdL, L, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Young's modulus depends on R, see [4]. ! Axial buckling without hysteresis. - !------------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: U, dUdL real(c_double), intent(in) :: L, R0, L0 - real(c_double) :: E, K, Kbcl, dUbcl, d, ud + real(c_double) :: E, K, Kbcl, dUbcl, d, ud !------------------------------------------------------------------------------------------- E = ( L - L0 ) / L0 K = 86.64d+00 + 100.56d+00 * R0 @@ -266,7 +266,7 @@ contains !********************************************************************** dUbcl = 0.5d+00 * L0 * K * CNTSTREc * CNTSTREc - Kbcl * CNTSTREc U = Kbcl * E + dUbcl dUdL = Kbcl / L0 - CNTSTRH1BCalc = CNTPOT_STRETCHING + CNTSTRH1BCalc = CNTPOT_STRETCHING else ! Return to harmonic potential d = -0.0142794 dUdL = K * ( d + E - CNTSTREc2 ) @@ -274,7 +274,7 @@ contains !********************************************************************** Ud = 0.5d+00 * L0 * K * d * d U = 0.5d+00 * L0 * (d+E-CNTSTREc2) * dUdL + dUbcl - Ud CNTSTRH1BCalc = CNTPOT_STRETCHING - end if + end if end function CNTSTRH1BCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! @@ -290,7 +290,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- real(c_double) :: E, K, dUbcl, Ebcl, Kbcl, Edu real(c_double) :: C, DE, t - !------------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------------- E = ( L - L0 ) / L0 K = 86.64d+00 + 100.56d+00 * R0 Kbcl = -10.98d+00 * L0 @@ -319,7 +319,7 @@ contains !********************************************************************** dUdL = Kbcl / L0 CNTSTRH1BHCalc = CNTPOT_SBUCKLING Ebuc = 0.5d+00 * L0 * K * CNTSTREc1 * CNTSTREc1 - Kbcl * CNTSTREc1 - dUbcl - else ! Already buckled + else ! Already buckled dUbcl = 0.5d+00 * L0 * K * CNTSTREc * CNTSTREc - Kbcl * CNTSTREc U = Kbcl * E + dUbcl dUdL = Kbcl / L0 @@ -331,7 +331,7 @@ contains !********************************************************************** U = 0.5d+00 * L0 * E * dUdL CNTSTRH1BHCalc = CNTPOT_STRETCHING Ebuc = 0.0d+00 - end if + end if end function CNTSTRH1BHCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! @@ -345,26 +345,26 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- E = ( L - L0 ) / L0 if ( E < CNTSTREf ) then - dUdL = ( CNTSTRAA - CNTSTRBB * E ) * E + dUdL = ( CNTSTRAA - CNTSTRBB * E ) * E U = ( CNTSTRAAA - CNTSTRBBB * E ) * E * E CNTSTRNH0FCalc = CNTPOT_STRETCHING - else + else dUdL = 0.0d+00 U = 0.0d+00 CNTSTRNH0FCalc = CNTPOT_SFRACTURE end if U = L0 * R0 * U - dUdL = R0 * dUdL + dUdL = R0 * dUdL end function CNTSTRNH0FCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CNTSTRNH0Init () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) :: S !------------------------------------------------------------------------------------------- S = M_2PI * CNTSTRD0 * 1.0e-20 / K_MDFU CNTSTRSl = CNTSTRS0 * CNTSTREl - CNTSTRF0 = CNTSTRS0 * S - CNTSTRFl = CNTSTRSl * S - CNTSTRFf = CNTSTRSf * S + CNTSTRF0 = CNTSTRS0 * S + CNTSTRFl = CNTSTRSl * S + CNTSTRFf = CNTSTRSf * S CNTSTRAA = CNTSTRF0 CNTSTRBB = ( CNTSTRF0 * CNTSTREf - CNTSTRFf ) / ( CNTSTREf * CNTSTREf ) CNTSTRAAA= CNTSTRAA / 2.0d+00 @@ -375,11 +375,11 @@ contains !********************************************************************** CNTSTRSi = 0.0d+00 CNTSTRDf = 0.0d+00 end subroutine CNTSTRNH0Init !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + ! ! Stretching without fracture, non-harmonic potential of type 1 ! - + integer(c_int) function CNTSTRNH1Calc ( U, dUdL, L, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: U, dUdL real(c_double), intent(in) :: L, R0, L0 @@ -390,7 +390,7 @@ contains !********************************************************************** dUdL = CNTSTRF0 * E U = 0.5d+00 * E * dUdL CNTSTRNH1Calc = CNTPOT_STRETCHING - else + else DE = E - CNTSTREl C = 1.0 + CNTSTRBB * DE dUdL = CNTSTRFl + CNTSTRAA * ( 1.0d+00 - 1.0d+00 / C ) @@ -398,13 +398,13 @@ contains !********************************************************************** end if CNTSTRNH1Calc = CNTPOT_STRETCHING U = L0 * R0 * U - dUdL = R0 * dUdL + dUdL = R0 * dUdL end function CNTSTRNH1Calc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Stretching with fracture, non-harmonic potential of type 1 ! - + integer(c_int) function CNTSTRNH1FCalc ( U, dUdL, L, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: U, dUdL real(c_double), intent(in) :: L, R0, L0 @@ -421,24 +421,24 @@ contains !********************************************************************** dUdL = CNTSTRFl + CNTSTRAA * ( 1.0d+00 - 1.0d+00 / C ) U = CNTSTRUl + CNTSTRAAA * DE - CNTSTRBBB * dlog ( C ) CNTSTRNH1FCalc = CNTPOT_STRETCHING - else + else dUdL = 0.0d+00 U = 0.0d+00 CNTSTRNH1FCalc = CNTPOT_SFRACTURE end if U = L0 * R0 * U - dUdL = R0 * dUdL + dUdL = R0 * dUdL end function CNTSTRNH1FCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CNTSTRNH1Init () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) :: S, C, E, t integer(c_int) :: i, CaseID !------------------------------------------------------------------------------------------- S = M_2PI * CNTSTRD0 * 1.0e-20 / K_MDFU CNTSTRSl = CNTSTRS0 * CNTSTREl - CNTSTRF0 = CNTSTRS0 * S - CNTSTRFl = CNTSTRSl * S - CNTSTRFf = CNTSTRSf * S + CNTSTRF0 = CNTSTRS0 * S + CNTSTRFl = CNTSTRSl * S + CNTSTRFf = CNTSTRSf * S CNTSTRAA = ( CNTSTRFf - CNTSTRFl ) * ( CNTSTREf * CNTSTRF0 - CNTSTRFl ) / ( CNTSTREf * CNTSTRF0 - CNTSTRFf ) CNTSTRBB = CNTSTRF0 / CNTSTRAA CNTSTRAAA= CNTSTRFl + CNTSTRAA @@ -449,7 +449,7 @@ contains !********************************************************************** CNTSTRUl = 0.5d+00 * CNTSTRFl * CNTSTREl CNTSTRUf = CNTSTRUl + ( CNTSTRFl + CNTSTRAA ) * ( CNTSTREf - CNTSTREl ) - CNTSTRAA * dlog ( C ) / CNTSTRBB end subroutine CNTSTRNH1Init !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + ! ! General ! @@ -477,7 +477,7 @@ contains !********************************************************************** CNTSTRCalc = CNTSTRH1BHCalc ( U, dUdL, L, R0, L0, ABF, Ebuc ) end select end function CNTSTRCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CNTSTRInit ( STRModel, STRParams, YMType, Rref ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int), intent(in) :: STRModel, STRParams, YMType real(c_double), intent(in) :: Rref @@ -498,13 +498,13 @@ contains !********************************************************************** else call CNTSTRNH1Init () end if - end if + end if end subroutine CNTSTRInit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Bending potentials !--------------------------------------------------------------------------------------------------- - + subroutine BendingGradients ( K, G0, G1, G2, R0, R1, R2 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(inout) :: K real(c_double), dimension(0:2), intent(inout) :: G0, G1, G2 @@ -525,7 +525,7 @@ contains !********************************************************************** G2 = G2 / L2 G1 = - ( G0 + G2 ) end subroutine BendingGradients !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function CNTBNDHCalc ( U, dUdC, C, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Bending model of type 0:Harmonic bending potential. !------------------------------------------------------------------------------------------- @@ -554,10 +554,10 @@ contains !********************************************************************** ! Check the condition for buckling if ( C2 .ge. CNTBNDC2 ) then ! Buckling takes place Theta= M_PI - acos ( C ) - Kbnd = 63.8d+00 * R0**2.93d+00 + Kbnd = 63.8d+00 * R0**2.93d+00 Kbcl = CNTBNDB * Kbnd / CNTBNDR - DUbcl= Kbnd * ( CNTBNDB * ( M_PI - 2.0d+00 * atan ( 2.0 * CNTBNDR / L0 ) ) - 0.5d+00 * L0 / CNTBNDR ) & - / CNTBNDR + DUbcl= Kbnd * ( CNTBNDB * ( M_PI - 2.0d+00 * atan ( 2.0 * CNTBNDR / L0 ) ) - 0.5d+00 * L0 / CNTBNDR ) & + / CNTBNDR U = Kbcl * abs( Theta )**CNTBNDN - DUbcl dUdC = Kbcl * CNTBNDN * abs( Theta )**CNTBNDN1 / sqrt ( 1.0d+00 - C * C ) CNTBNDHBCalc = CNTPOT_BBUCKLING @@ -568,7 +568,7 @@ contains !********************************************************************** CNTBNDHBCalc = CNTPOT_BENDING end if end function CNTBNDHBCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function CNTBNDHBFCalc ( U, dUdC, C, R0, L0 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: U, dUdC real(c_double), intent(in) :: C, R0, L0 @@ -586,10 +586,10 @@ contains !********************************************************************** dUdC = 0.0d+00 CNTBNDHBFCalc = CNTPOT_BFRACTURE else - Kbnd = 63.8d+00 * R0**2.93d+00 + Kbnd = 63.8d+00 * R0**2.93d+00 Kbcl = CNTBNDB * Kbnd / CNTBNDR DUbcl= Kbnd * ( CNTBNDB * ( M_PI - 2.0d+00 * atan ( 2.0 * CNTBNDR / L0 ) ) - & - 0.5d+00 * L0 / CNTBNDR ) / CNTBNDR + 0.5d+00 * L0 / CNTBNDR ) / CNTBNDR U = Kbcl * abs ( Theta )**CNTBNDN - DUbcl dUdC = Kbcl * CNTBNDN * abs ( Theta )**CNTBNDN1 / sqrt ( 1.0d+00 - C * C ) CNTBNDHBFCalc = CNTPOT_BBUCKLING @@ -601,7 +601,7 @@ contains !********************************************************************** CNTBNDHBFCalc = CNTPOT_BENDING end if end function CNTBNDHBFCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function CNTBNDHBHCalc ( U, dUdC, C, R0, L0, BBF, Ebuc ) !!!!!!!!!!!!!!!!!!!! ! Bending model of type 1: Harmonic bending potential with buckling with hysteresis approach. !------------------------------------------------------------------------------------------- @@ -611,16 +611,16 @@ contains !********************************************************************** real(c_double) :: E1, E2, C2, Kbnd, Kbcl,Theta,DUbcl, Ubcl, Cmin,Rmax !------------------------------------------------------------------------------------------- Rmax = 340.0d+00 - Cmin = 1.0/(Rmax*Rmax) + Cmin = 1.0/(Rmax*Rmax) E1 = 1.0d+00 - C - E2 = 1.0d+00 + C + E2 = 1.0d+00 + C ! Calculate the square of curvature C2 = 4.0d+00 * E2 / ( L0 * L0 * E1 ) Theta = M_PI - acos ( C ) - if ( C2 .lt. Cmin ) then ! Harmonic bending + if ( C2 .lt. Cmin ) then ! Harmonic bending Kbnd = 2.0d+00 * ( 63.8d+00 * R0**2.93d+00 ) / L0 U = Kbnd * E2 / E1 - dUdC = 2.0d+00 * Kbnd / ( E1 * E1 ) + dUdC = 2.0d+00 * Kbnd / ( E1 * E1 ) CNTBNDHBHCalc = CNTPOT_BENDING Ebuc = 0.0 else if ( C2 .ge. Cmin .and. C2 .lt. CNTBNDC2 ) then ! Potential depends on buckling flag of a node @@ -640,7 +640,7 @@ contains !********************************************************************** dUdC = Kbcl * CNTBNDN * abs( Theta )**CNTBNDN1 / sqrt ( 1.0d+00 - C * C ) Ebuc = 0.0d+00 CNTBNDHBHCalc = CNTPOT_BBUCKLING - end if + end if else ! Greater than buckling critical point if ( BBF .eq. 1 ) then ! Already buckled Theta= M_PI - acos ( C ) @@ -653,7 +653,7 @@ contains !********************************************************************** Ebuc = 0.0d00 CNTBNDHBHCalc = CNTPOT_BBUCKLING else ! Newly buckled - Theta= M_PI - acos ( C ) + Theta= M_PI - acos ( C ) Kbnd = 63.8d+00 * R0**2.93d+00 Kbcl = CNTBNDB * Kbnd / CNTBNDR DUbcl= 2.0d+00*Kbnd * & @@ -666,11 +666,11 @@ contains !********************************************************************** end if end if end function CNTBNDHBHCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + ! ! General ! - + integer(c_int) function CNTBNDCalc ( U, dUdC, C, R0, L0, BBF, Ebuc ) !!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: U, dUdC, Ebuc real(c_double), intent(in) :: C, R0, L0 @@ -688,7 +688,7 @@ contains !********************************************************************** CNTBNDCalc = CNTBNDHBHCalc ( U, dUdC, C, R0, L0, BBF, Ebuc ) end select end function CNTBNDCalc !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CNTBNDInit ( BNDModel ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int), intent(in) :: BNDModel real(c_double) :: A, E @@ -710,5 +710,5 @@ contains !********************************************************************** call CNTSTRInit ( STRModel, STRParams, YMType, Rref ) call CNTBNDInit ( BNDModel ) end subroutine InitCNTPotModule !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module CNTPot !********************************************************************************* diff --git a/lib/mesont/ExportCNT.f90 b/lib/mesont/ExportCNT.f90 index 20166a956e..039503d51e 100644 --- a/lib/mesont/ExportCNT.f90 +++ b/lib/mesont/ExportCNT.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Maxim Shugaev (UVA), mvs9t@virginia.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module ExportCNT !********************************************************************************** @@ -28,122 +28,122 @@ contains bind(c, name = "mesont_lib_InitCNTPotModule") integer(c_int), intent(in) :: STRModel, STRParams, YMType, BNDModel real(c_double), intent(in) :: Rref - + call InitCNTPotModule(STRModel, STRParams, YMType, BNDModel, Rref) endsubroutine - + subroutine TPBInit_() & bind(c, name = "mesont_lib_TPBInit") - + call TPBInit() endsubroutine subroutine TPMInit_(M, N) & bind(c, name = "mesont_lib_TPMInit") integer(c_int), intent(in) :: M, N - + call TPMInit(M, N) endsubroutine - + subroutine SetTablePath_(TPMFile_, N) & bind(c, name = "mesont_lib_SetTablePath") integer(c_int), intent(in) :: N character(c_char), intent(in), dimension(N) :: TPMFile_ integer :: i - + do i = 1, len(TPMFile) if (i <= N) then TPMFile(i:i) = TPMFile_(i) - else + else TPMFile(i:i) = ' ' endif enddo endsubroutine - + function get_R_ () & bind(c, name = "mesont_lib_get_R") real(c_double) :: get_R_ get_R_ = TPMR1 return endfunction - + subroutine TubeStretchingForceField_(U1, U2, F1, F2, S1, S2, X1, X2, R12, L12) & bind(c, name = "mesont_lib_TubeStretchingForceField") - ! Interaction energies associated with nodes X1 and X2 - real(c_double), intent(inout) :: U1, U2 + ! Interaction energies associated with nodes X1 and X2 + real(c_double), intent(inout) :: U1, U2 ! Forces exerted on nodes X1 and X2 - real(c_double), intent(inout), dimension(0:2) :: F1, F2 + real(c_double), intent(inout), dimension(0:2) :: F1, F2 ! Contributions of nodes X1 and X2 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 - ! Coordinates of the segment nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 + ! Coordinates of the segment nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2 ! Radius of a nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R12 + real(c_double), intent(in) :: R12 ! Equilibrium length of segment (X1,X2) - real(c_double), intent(in) :: L12 - + real(c_double), intent(in) :: L12 + call TubeStretchingForceField(U1, U2, F1, F2, S1, S2, X1, X2, R12, L12) endsubroutine subroutine TubeBendingForceField_(U1, U2, U3, F1, F2, F3, S1, S2, S3, X1, X2, X3, R123, L123, BBF2) & bind(c, name = "mesont_lib_TubeBendingForceField") ! Interaction energies associated with nodes X1, X2, and X3 - real(c_double), intent(inout) :: U1, U2, U3 + real(c_double), intent(inout) :: U1, U2, U3 ! Forces exerted on nodes X1, X2, and X3 - real(c_double), intent(inout), dimension(0:2) :: F1, F2, F3 + real(c_double), intent(inout), dimension(0:2) :: F1, F2, F3 ! Contributions of nodes X1, X2, and X3 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2, S3 - ! Coordinates of nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2, X3 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2, S3 + ! Coordinates of nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2, X3 ! Radius of nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R123 + real(c_double), intent(in) :: R123 ! Equilibrium length of segment (X1,X2) and (X2,X3) (It is assumed to be the same for both segments) - real(c_double), intent(in) :: L123 + real(c_double), intent(in) :: L123 integer(c_int), intent(inout) :: BBF2 - + call TubeBendingForceField(U1, U2, U3, F1, F2, F3, S1, S2, S3, X1, X2, X3, R123, L123, BBF2 ) endsubroutine subroutine SegmentTubeForceField_(U1,U2,U,F1,F2,F,Fe,S1,S2,S,Se,X1,X2,R12,N,X,Xe,BBF,R,E1,E2,Ee,TPMType)& bind(c, name = "mesont_lib_SegmentTubeForceField") ! Number of nodes in array X - integer(c_int), intent(in) :: N + integer(c_int), intent(in) :: N ! Interaction energies associated with nodes X1 and X2 - real(c_double), intent(inout) :: U1, U2 + real(c_double), intent(inout) :: U1, U2 ! Interaction energies associated with nodes X - real(c_double), intent(inout), dimension(0:N-1) :: U + real(c_double), intent(inout), dimension(0:N-1) :: U ! Forces exerted on nodes X1 and X2 - real(c_double), intent(inout), dimension(0:2) :: F1, F2 + real(c_double), intent(inout), dimension(0:2) :: F1, F2 ! Forces exerted on nodes X - real(c_double), intent(inout), dimension(0:2,0:N-1) :: F + real(c_double), intent(inout), dimension(0:2,0:N-1) :: F ! Force exerted on node Xe (can be updated only if Ee > 0) - real(c_double), intent(inout), dimension(0:2) :: Fe + real(c_double), intent(inout), dimension(0:2) :: Fe ! Contributions of nodes X1 and X2 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 ! Contributions of nodes X to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2,0:N-1) :: S + real(c_double), intent(inout), dimension(0:2,0:2,0:N-1) :: S ! Contributions of node Xe to the virial stress tensor (can be updated only if Ee > 0) - real(c_double), intent(inout), dimension(0:2,0:2) :: Se - ! Coordinates of the segment nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2 + real(c_double), intent(inout), dimension(0:2,0:2) :: Se + ! Coordinates of the segment nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2 ! Radius of nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R12 + real(c_double), intent(in) :: R12 ! Coordinates of the nanotube nodes - real(c_double), intent(in), dimension(0:2,0:N-1) :: X + real(c_double), intent(in), dimension(0:2,0:N-1) :: X ! Additional node of the extended chain if Ee > 0 - real(c_double), intent(in), dimension(0:2) :: Xe - ! Bending buckling flags (BBF(i) = 1 in a case of buckling in node i) - integer(c_int), intent(in), dimension(0:N-1) :: BBF + real(c_double), intent(in), dimension(0:2) :: Xe + ! Bending buckling flags (BBF(i) = 1 in a case of buckling in node i) + integer(c_int), intent(in), dimension(0:N-1) :: BBF ! Radius of nanotube X - real(c_double), intent(in) :: R - ! E1 = 1 if the chain node 0 is a CNT end; E2 = 1 if the chain node N-1 is a CNT end; - integer(c_int), intent(in) :: E1, E2 + real(c_double), intent(in) :: R + ! E1 = 1 if the chain node 0 is a CNT end; E2 = 1 if the chain node N-1 is a CNT end; + integer(c_int), intent(in) :: E1, E2 ! Parameter defining the type of the extended chain (0,1,2) - integer(c_int), intent(in) :: Ee + integer(c_int), intent(in) :: Ee ! Type of the tubular potential (0 or 1) - integer(c_int), intent(in) :: TPMType - + integer(c_int), intent(in) :: TPMType + call SegmentTubeForceField(U1, U2, U, F1, F2, F, Fe, S1, S2, S, Se, X1, X2, R12, N, X, Xe, BBF, R, E1, E2, Ee, TPMType) endsubroutine diff --git a/lib/mesont/LinFun2.f90 b/lib/mesont/LinFun2.f90 index 8d01a25eda..d0c10088e9 100644 --- a/lib/mesont/LinFun2.f90 +++ b/lib/mesont/LinFun2.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module LinFun2 !************************************************************************************ ! @@ -26,7 +26,7 @@ module LinFun2 !**************************************************************** !*************************************************************************************************** use iso_c_binding, only : c_int, c_double, c_char implicit none - + contains !****************************************************************************************** real(c_double) function CalcLinFun1_0 ( i, X, N, P, F ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -42,7 +42,7 @@ contains !********************************************************************** A = 1.0d+00 - A0 CalcLinFun1_0 = A0 * F(i1) + A * F(i) end function CalcLinFun1_0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CalcLinFun1_1 ( S, Sx1, i, X, N, P, F, Fx ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: S, Sx1 integer(c_int), intent(in) :: i, N @@ -78,7 +78,7 @@ contains !********************************************************************** G0 = B0 * F(i1,j1) + B * F(i1,j) CalcLinFun2_0 = A0 * G0 + A * G end function CalcLinFun2_0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine CalcLinFun2_1 ( S, Sx1, Sy1, i, j, X, Y, N1, N2, P1, P2, F, Fx, Fy ) !!!!!!!!!!!! real(c_double), intent(out) :: S, Sx1, Sy1 integer(c_int), intent(in) :: i, j, N1, N2 @@ -95,19 +95,19 @@ contains !********************************************************************** A = 1.0d+00 - A0 B0 = ( P2(j) - Y ) / ( P2(j) - P2(j1) ) B = 1.0d+00 - B0 - + G = B0 * F(i,j1) + B * F(i,j) G0 = B0 * F(i1,j1) + B * F(i1,j) S = A0 * G0 + A * G - + G = B0 * Fx(i,j1) + B * Fx(i,j) G0 = B0 * Fx(i1,j1) + B * Fx(i1,j) Sx1 = A0 * G0 + A * G - + G = B0 * Fy(i,j1) + B * Fy(i,j) G0 = B0 * Fy(i1,j1) + B * Fy(i1,j) Sy1 = A0 * G0 + A * G - + end subroutine CalcLinFun2_1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module LinFun2 !******************************************************************************** diff --git a/lib/mesont/Spline1.f90 b/lib/mesont/Spline1.f90 index bd796e35cc..95d7317049 100644 --- a/lib/mesont/Spline1.f90 +++ b/lib/mesont/Spline1.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module Spline1 !************************************************************************************ ! @@ -64,7 +64,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- X(0) = F(0) / K1(0) F(0) = - K2(0) / K1(0) - do i = 1, N - 1 + do i = 1, N - 1 D = - ( K1(i) + F(i-1) * K0(i) ) X(i) = ( K0(i) * X(i-1) - F(i) ) / D F(i) = K2(i) / D @@ -85,8 +85,8 @@ contains !********************************************************************** K0(i) = P(i) - P(i-1) K1(i) = ( F(i) - F(i-1) ) / K0(i) end do - select case ( CL ) - case (1) + select case ( CL ) + case (1) K1(0) = 2.0d+00 / 3.0d+00 K2(0) = 1.0d+00 / 3.0d+00 D (0) = 2 * ( K1(1) - M(0) ) / K0(1) @@ -98,14 +98,14 @@ contains !********************************************************************** K1(0) = 1.0d+00 K2(0) = 0.0d+00 D(0) = 0.0d+00 - end select + end select Z = K1(N-1) - do i = 1, N - 2 + do i = 1, N - 2 D(i) = 6.0d+00 * ( K1(i+1) - K1(i) ) K2(i) = K0(i+1) K1(i) = 2.0d+00 * ( K2(i) + K0(i) ) end do - select case ( CR ) + select case ( CR ) case (1) D(N-1) = 2.0d+00 * ( M(N-1) - Z ) / K0(N-1) K1(N-1) = 2.0d+00 / 3.0d+00 @@ -118,14 +118,14 @@ contains !********************************************************************** K1(N-1) = 1.0d+00 K0(N-1) = 0.0d+00 D(N-1) = 0.0d+00 - end select + end select call sprogonka3 ( N, K0, K1, K2, D, M ) end subroutine CreateSpline1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + real(c_double) function CalcSpline1_0 ( i, X, N, P, F, M ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int), intent(in) :: i, N real(c_double), intent(in) :: X - real(c_double), dimension(0:N-1), intent(in) :: P, F, M + real(c_double), dimension(0:N-1), intent(in) :: P, F, M integer(c_int) :: j real(c_double) :: HL, HR, H, H6, H26, HR2, HL2, HRH, HLH !------------------------------------------------------------------------------------------- @@ -147,7 +147,7 @@ contains !********************************************************************** real(c_double), intent(out) :: S, S1 integer(c_int), intent(in) :: i, N real(c_double), intent(in) :: X - real(c_double), dimension(0:N-1), intent(in) :: P, F, M + real(c_double), dimension(0:N-1), intent(in) :: P, F, M integer(c_int) :: j real(c_double) :: HL, HR, H, H6, H26, HR2, HL2, HRH, HLH !------------------------------------------------------------------------------------------- @@ -169,7 +169,7 @@ contains !********************************************************************** real(c_double), intent(out) :: S, S1, S2 integer(c_int), intent(in) :: i, N real(c_double), intent(in) :: X - real(c_double), dimension(0:N-1), intent(in) :: P, F, M + real(c_double), dimension(0:N-1), intent(in) :: P, F, M integer(c_int) :: j real(c_double) :: HL, HR, H, H6, H26, HR2, HL2, HRH, HLH !------------------------------------------------------------------------------------------- @@ -185,7 +185,7 @@ contains !********************************************************************** HRH = HR / H S = ( M(j) * HR2 * HRH + M(i) * HL2 * HLH ) / 6.0d+00 + ( F(j) - M(j) * H26 ) * HRH + ( F(i) - M(i) * H26 ) * HLH S1 = ( ( M(i) * HL2 - M(j) * HR2 ) / 2.0d+00 + F(i) - F(j) ) / H - H6 * ( M(i) - M(j) ) - S2 = M(j) * HRH + M(i) * HLH + S2 = M(j) * HRH + M(i) * HLH end subroutine CalcSpline1_2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module Spline1 !******************************************************************************** diff --git a/lib/mesont/Spline2.f90 b/lib/mesont/Spline2.f90 index b449f25c07..2dd7fb131b 100644 --- a/lib/mesont/Spline2.f90 +++ b/lib/mesont/Spline2.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module Spline2 !************************************************************************************ ! @@ -79,7 +79,7 @@ contains !********************************************************************** Fxx = 0.0d+00 Fyy = 0.0d+00 Fxxyy = 0.0d+00 - + do II = 0, N2A FF(0:N1-1) = F(0:N1-1,II) MM(0) = Fxx(0,II) @@ -87,7 +87,7 @@ contains !********************************************************************** call CreateSpline1 ( CL, CR, N1, P1, FF, MM, DD, K0, K1, K2 ) Fxx(0:N1-1,II) = MM(0:N1-1) end do - + do II = N2A + 1, N2 - 1 FF(0:N1-N1A-1) = F(N1A:N1-1,II) MM(0) = Fxx(N1A,II) @@ -103,7 +103,7 @@ contains !********************************************************************** call CreateSpline1 ( CD, CU, N2A + 1, P2, FF, MM, DD, K0, K1, K2 ) Fyy(II,0:N2A) = MM(0:N2A) end do - + do II = N1A, N1 - 1 MM(0) = Fyy(II,0) MM(N-1) = Fyy(II,N2-1) @@ -111,19 +111,19 @@ contains !********************************************************************** call CreateSpline1 ( CD, CU, N2, P2, FF, MM, DD, K0, K1, K2 ) Fyy(II,0:N2-1) = MM(0:N2-1) end do - + FF(0:N1-1) = Fyy(0:N1-1,0) call CreateSpline1 ( 3, 3, N1, P1, FF, MM, DD, K0, K1, K2 ) Fxxyy(0:N1-1,0) = MM(0:N1-1) - + FF(0:N1A) = Fyy(0:N1A,N2A) call CreateSpline1 ( 3, 3, N1A + 1, P1, FF, MM, DD, K0, K1, K2 ) Fxxyy(0:N1A,N2A) = MM(0:N1A) - + FF(0:N1-N1A-1) = Fyy(N1A:N1-1,N2-1 ) call CreateSpline1 ( 3, 3, N1-N1A, P1, FF, MM, DD, K0, K1, K2 ) Fxxyy(N1A:N1-1,N2-1) = MM(0:N1-N1A-1) - + do II = 1, N1A MM(0) = Fxxyy(II,0) MM(N2A) = Fxxyy(II,N2A) @@ -131,7 +131,7 @@ contains !********************************************************************** call CreateSpline1 ( 2 , 2, N2A + 1, P2, FF, MM, DD, K0, K1, K2 ) Fxxyy(II,0:N2A) = MM(0:N2A) end do - + do II = N1A + 1, N1 - 2 MM(0) = Fxxyy(II,0) MM(N-1) = Fxxyy(II,N2-1) @@ -139,9 +139,9 @@ contains !********************************************************************** call CreateSpline1 ( 2 , 2, N2, P2, FF, MM, DD, K0, K1, K2 ) Fxxyy(II,0:N2-1) = MM(0:N2-1) end do - + end subroutine CreateSpline2Ext !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + real(c_double) function CalcSpline2_0 ( i, j, X, Y, N1, N2, P1, P2, F, Fxx, Fyy, Fxxyy ) !!! integer(c_int), intent(in) :: i, j, N1, N2 real(c_double), intent(in) :: X, Y @@ -182,5 +182,5 @@ contains !********************************************************************** call ValueSpline1_1 ( S, Sx1, X, P1(i), P1(i1), Gy_0, Gy_1,Gxxy_0, Gxxy_1, P1(i) - P1(i1) ) Sy1 = ValueSpline1_0 ( X, P1(i), P1(i1), Gyy_0, Gyy_1,Gxxyy_0, Gxxyy_1, P1(i) - P1(i1) ) end subroutine CalcSpline2_1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module Spline2 !******************************************************************************** diff --git a/lib/mesont/TPMForceField.f90 b/lib/mesont/TPMForceField.f90 index a7312e09f8..5fa0514eea 100644 --- a/lib/mesont/TPMForceField.f90 +++ b/lib/mesont/TPMForceField.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TPMForceField !****************************************************************************** ! @@ -32,32 +32,32 @@ use iso_c_binding, only : c_int, c_double, c_char implicit none contains !****************************************************************************************** - + subroutine TubeStretchingForceField ( U1, U2, F1, F2, S1, S2, X1, X2, R12, L12 ) !!!!!!!!!!! ! Interaction energies associated with nodes X1 and X2 - real(c_double), intent(inout) :: U1, U2 + real(c_double), intent(inout) :: U1, U2 ! Forces exerted on nodes X1 and X2 - real(c_double), intent(inout), dimension(0:2) :: F1, F2 + real(c_double), intent(inout), dimension(0:2) :: F1, F2 ! Contributions of nodes X1 and X2 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 - ! Coordinates of the segment nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 + ! Coordinates of the segment nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2 ! Radius of a nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R12 + real(c_double), intent(in) :: R12 ! Equilibrium length of segment (X1,X2) - real(c_double), intent(in) :: L12 + real(c_double), intent(in) :: L12 !------------------------------------------------------------------------------------------- integer(c_int) :: ii, jj, Event real(c_double) :: U, F, LL, S, Ubcl real(c_double), dimension(0:2) :: DX, FF !------------------------------------------------------------------------------------------- - DX = X2 - X1 + DX = X2 - X1 LL = S_V3norm3 ( DX ) Event = CNTSTRCalc ( U, F, LL, R12, L12, 0, Ubcl ) U = U / 2.0d+00 FF = DX * F / LL - + F1 = F1 + FF U1 = U1 + U @@ -68,25 +68,25 @@ contains !********************************************************************** do ii = 0, 2 do jj = 0, 2 S = - 0.5d+00 * DX(ii) * FF(jj) - S1(ii,jj) = S1(ii,jj) + S - S2(ii,jj) = S2(ii,jj) + S + S1(ii,jj) = S1(ii,jj) + S + S2(ii,jj) = S2(ii,jj) + S end do end do end subroutine TubeStretchingForceField !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - subroutine TubeBendingForceField ( U1, U2, U3, F1, F2, F3, S1, S2, S3, X1, X2, X3, R123, L123, BBF2 ) + subroutine TubeBendingForceField ( U1, U2, U3, F1, F2, F3, S1, S2, S3, X1, X2, X3, R123, L123, BBF2 ) ! Interaction energies associated with nodes X1, X2, and X3 - real(c_double), intent(inout) :: U1, U2, U3 + real(c_double), intent(inout) :: U1, U2, U3 ! Forces exerted on nodes X1, X2, and X3 - real(c_double), intent(inout), dimension(0:2) :: F1, F2, F3 + real(c_double), intent(inout), dimension(0:2) :: F1, F2, F3 ! Contributions of nodes X1, X2, and X3 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2, S3 - ! Coordinates of nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2, X3 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2, S3 + ! Coordinates of nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2, X3 ! Radius of nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R123 + real(c_double), intent(in) :: R123 ! Equilibrium length of segment (X1,X2) and (X2,X3) (It is assumed to be the same for both segments) - real(c_double), intent(in) :: L123 + real(c_double), intent(in) :: L123 integer(c_int), intent(inout) :: BBF2 !------------------------------------------------------------------------------------------- integer(c_int) :: ii, jj, Event @@ -105,9 +105,9 @@ contains !********************************************************************** U = U / 4.0d+00 F = - F - F1 = F1 + G0 * F - F2 = F2 + G1 * F - F3 = F3 + G2 * F + F1 = F1 + G0 * F + F2 = F2 + G1 * F + F3 = F3 + G2 * F U1 = U1 + U U2 = U2 + 2.0d+00 * U @@ -117,16 +117,16 @@ contains !********************************************************************** do ii = 0, 2 do jj = 0, 2 S = 0.5d+00 * ( X1(ii) - X2(ii) ) * G0(jj) - S1(ii,jj) = S1(ii,jj) + S - S2(ii,jj) = S2(ii,jj) + S + S1(ii,jj) = S1(ii,jj) + S + S2(ii,jj) = S2(ii,jj) + S S = 0.5d+00 * ( X3(ii) - X2(ii) ) * G2(jj) - S3(ii,jj) = S3(ii,jj) + S - S2(ii,jj) = S2(ii,jj) + S + S3(ii,jj) = S3(ii,jj) + S + S2(ii,jj) = S2(ii,jj) + S end do end do end subroutine TubeBendingForceField !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! The purpose of subroutine SegmentTubeForceField is to calculate interaction forces + ! The purpose of subroutine SegmentTubeForceField is to calculate interaction forces ! (as well potential energies and components of the virial stress tensor) between a segment ! (X1,X2) and a sequence of segments which belongs to a single CNT. @@ -134,7 +134,7 @@ contains !********************************************************************** ! neighbor list of segment (X1,X2). ! The nodes in X are assumed to be ordered according to their physical appearance in the nanotube. - ! It means that (X(i),X(i+1)) are either correspond to a real segment or divided by segments + ! It means that (X(i),X(i+1)) are either correspond to a real segment or divided by segments ! that do not belong to a nanotube. ! Concept of the extended chain: @@ -143,45 +143,45 @@ contains !********************************************************************** ! If node Xe follows XN and Xe is the nanotube end, then the extended chain is (X1,...,XN,Xe) and Ee = 2. ! In all other cases, the extended chain coincides with (X1,...,XN) and Ee = 0. ! If the extended chain contains additional node, then non-zero force is exerted on this node. - + subroutine SegmentTubeForceField ( U1, U2, U, F1, F2, F, Fe, S1, S2, S, Se, X1, X2, R12, N, X, Xe,& - BBF, R, E1, E2, Ee, TPMType ) + BBF, R, E1, E2, Ee, TPMType ) ! Number of nodes in array X - integer(c_int), intent(in) :: N - ! Interaction energies associated with nodes X1 and X2 - real(c_double), intent(inout) :: U1, U2 + integer(c_int), intent(in) :: N + ! Interaction energies associated with nodes X1 and X2 + real(c_double), intent(inout) :: U1, U2 ! Interaction energies associated with nodes X - real(c_double), intent(inout), dimension(0:N-1) :: U + real(c_double), intent(inout), dimension(0:N-1) :: U ! Forces exerted on nodes X1 and X2 - real(c_double), intent(inout), dimension(0:2) :: F1, F2 + real(c_double), intent(inout), dimension(0:2) :: F1, F2 ! Forces exerted on nodes X - real(c_double), intent(inout), dimension(0:2,0:N-1) :: F + real(c_double), intent(inout), dimension(0:2,0:N-1) :: F ! Force exerted on node Xe (can be updated only if Ee > 0) - real(c_double), intent(inout), dimension(0:2) :: Fe + real(c_double), intent(inout), dimension(0:2) :: Fe ! Contributions of nodes X1 and X2 to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 + real(c_double), intent(inout), dimension(0:2,0:2) :: S1, S2 ! Contributions of nodes X to the virial stress tensor - real(c_double), intent(inout), dimension(0:2,0:2,0:N-1) :: S + real(c_double), intent(inout), dimension(0:2,0:2,0:N-1) :: S ! Contributions of node Xe to the virial stress tensor (can be updated only if Ee > 0) - real(c_double), intent(inout), dimension(0:2,0:2) :: Se - ! Coordinates of the segment nodes - real(c_double), intent(in), dimension(0:2) :: X1, X2 + real(c_double), intent(inout), dimension(0:2,0:2) :: Se + ! Coordinates of the segment nodes + real(c_double), intent(in), dimension(0:2) :: X1, X2 ! Radius of a nanotube the segment (X1,X2) belongs to - real(c_double), intent(in) :: R12 + real(c_double), intent(in) :: R12 ! Coordinates of the nanotube nodes - real(c_double), intent(in), dimension(0:2,0:N-1) :: X + real(c_double), intent(in), dimension(0:2,0:N-1) :: X ! Additional node of the extended chain if Ee > 0 - real(c_double), intent(in), dimension(0:2) :: Xe + real(c_double), intent(in), dimension(0:2) :: Xe ! Bending buckling flags (BBF(i) = 1 in a case of buckling in node i) - integer(c_int), intent(in), dimension(0:N-1) :: BBF + integer(c_int), intent(in), dimension(0:N-1) :: BBF ! Radius of nanotube X - real(c_double), intent(in) :: R + real(c_double), intent(in) :: R ! E1 = 1 if the chain node 0 is a CNT end; E1 = 2 if the chain node N-1 is a CNT end - integer(c_int), intent(in) :: E1, E2 + integer(c_int), intent(in) :: E1, E2 ! Parameter defining the type of the extended chain (0,1,2) - integer(c_int), intent(in) :: Ee + integer(c_int), intent(in) :: Ee ! Type of the tubular potential (0 or 1) - integer(c_int), intent(in) :: TPMType + integer(c_int), intent(in) :: TPMType !------------------------------------------------------------------------------------------- integer(c_int) :: k, ii, jj, IntSign integer(c_int) :: BType, EType, LocalTPMType @@ -191,18 +191,18 @@ contains !********************************************************************** real(c_double), dimension(0:2) :: G, DG, DQ, XX real(c_double) :: UT, DR, DS, DS1 ! Interaction energies associated with nodes X1 and X2 - real(c_double) :: xU1, xU2 + real(c_double) :: xU1, xU2 ! Interaction energies associated with nodes X - real(c_double), dimension(0:N-1) :: xU + real(c_double), dimension(0:N-1) :: xU ! Forces exerted on nodes X1 and X2 - real(c_double), dimension(0:2) :: xF1, xF2 + real(c_double), dimension(0:2) :: xF1, xF2 ! Forces exerted on nodes X - real(c_double), dimension(0:2,0:N-1) :: xF + real(c_double), dimension(0:2,0:N-1) :: xF ! Force exerted on node Xe (can be updated only if Ee > 0) - real(c_double), dimension(0:2) :: xFe + real(c_double), dimension(0:2) :: xFe !------------------------------------------------------------------------------------------- - ! Looking for a buckling point + ! Looking for a buckling point BType = 0 do k = 0, N - 1 if ( BBF(k) == 1 ) then @@ -212,7 +212,7 @@ contains !********************************************************************** end do ! Choosing the LocalTPMType and Etype. - ! LocalTPMType is set to 0 if both ends of the chain are nanotube ends or the chain contains a buckling point. + ! LocalTPMType is set to 0 if both ends of the chain are nanotube ends or the chain contains a buckling point. ! Overwise, LocalTPMType = TPMType. if ( BType == 1 ) then LocalTPMType = 0 @@ -231,7 +231,7 @@ contains !********************************************************************** if ( EType1 .and. EType2 ) then LocalTPMType = 0 else - LocalTPMType = TPMType + LocalTPMType = TPMType if ( EType1 ) then EType = 1 else if ( EType2 ) then @@ -241,7 +241,7 @@ contains !********************************************************************** end if end if end if - + if ( LocalTPMType == 0 ) then IntSign = TPMInteractionFW0 ( QQ, UT, xU1, xU2, xU, xF1, xF2, xF, G1, G2, X1, X2, N, N, X ) else @@ -263,10 +263,10 @@ contains !********************************************************************** ! Contributions to the virial stresses tensor do ii = 0, 2 - DR = 0.125d+00 * ( X2(ii) - X1(ii) ) + DR = 0.125d+00 * ( X2(ii) - X1(ii) ) do jj = 0, 2 DS = DR * ( xF2(jj) - xF1(jj) ) - S1(ii,jj) = S1(ii,jj) + DS + S1(ii,jj) = S1(ii,jj) + DS S2(ii,jj) = S2(ii,jj) + DS end do end do @@ -278,24 +278,24 @@ contains !********************************************************************** do ii = 0, 2 do jj = 0, 2 DS = DQ(ii) * xFe(jj) - S1(ii,jj) = S1(ii,jj) + DS + S1(ii,jj) = S1(ii,jj) + DS S2(ii,jj) = S1(ii,jj) + DS Se(ii,jj) = Se(ii,jj) + DS end do end do end if do k = 0, N - 2 - DQ = 0.5d+00 * ( X(0:2,k+1) + X(0:2,k) ) - XX + DQ = 0.5d+00 * ( X(0:2,k+1) + X(0:2,k) ) - XX call ApplyPeriodicBC ( DQ ) - DQ = 0.125d+00 * DQ - G = G1(0:2,k+1) + G2(0:2,k) + DQ = 0.125d+00 * DQ + G = G1(0:2,k+1) + G2(0:2,k) DG = G1(0:2,k+1) - G2(0:2,k) do ii = 0, 2 - DR = 0.125d+00 * ( X(ii,k+1) - X(ii,k) ) + DR = 0.125d+00 * ( X(ii,k+1) - X(ii,k) ) do jj = 0, 2 DS = DQ(ii) * G(jj) DS1 = DS + DR * DG(jj) - S1(ii,jj) = S1(ii,jj) + DS + S1(ii,jj) = S1(ii,jj) + DS S2(ii,jj) = S2(ii,jj) + DS S(ii,jj,k) = S(ii,jj,k) + DS1 S(ii,jj,k+1) = S(ii,jj,k+1) + DS1 diff --git a/lib/mesont/TPMGeom.f90 b/lib/mesont/TPMGeom.f90 index c5b8fcfaa7..638f2cd27e 100644 --- a/lib/mesont/TPMGeom.f90 +++ b/lib/mesont/TPMGeom.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TPMGeom !************************************************************************************ ! @@ -39,20 +39,20 @@ implicit none !--------------------------------------------------------------------------------------------------- ! Global variables !--------------------------------------------------------------------------------------------------- - + ! Coordinates of the whole domain real(c_double) :: DomXmin, DomXmax, DomYmin, DomYmax, DomZmin, DomZmax real(c_double) :: DomLX, DomLY, DomLZ real(c_double) :: DomLXhalf, DomLYhalf, DomLZhalf - - ! Boundary conditions + + ! Boundary conditions integer(c_int) :: BC_X = 0 integer(c_int) :: BC_Y = 0 integer(c_int) :: BC_Z = 0 ! Skin parameter in NBL and related algorithms real(c_double) :: Rskin = 1.0d+00 - + contains !****************************************************************************************** subroutine ApplyPeriodicBC ( R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -111,12 +111,12 @@ contains !********************************************************************** ! cosA, cosine of the angle between lines. ! D1, D2, displacements. ! L12, unit vector directed along the closest distance. - !------------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------------- real(c_double), intent(inout) :: H, cosA, D1, D2 real(c_double), dimension(0:2), intent(out) :: L12 real(c_double), dimension(0:2), intent(in) :: R1, L1, R2, L2 !------------------------------------------------------------------------------------------- - real(c_double), intent(in) :: Prec + real(c_double), intent(in) :: Prec real(c_double), dimension(0:2) :: Q1, Q2, R real(c_double) :: C, DD1, DD2, C1, C2 !------------------------------------------------------------------------------------------- @@ -151,5 +151,5 @@ contains !********************************************************************** L12 = L12 / H end if end function LineLine !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module TPMGeom !******************************************************************************** diff --git a/lib/mesont/TPMLib.f90 b/lib/mesont/TPMLib.f90 index 3a186917c0..c3c9f5eb4d 100644 --- a/lib/mesont/TPMLib.f90 +++ b/lib/mesont/TPMLib.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TPMLib !************************************************************************************* ! @@ -61,7 +61,7 @@ contains !********************************************************************** !--------------------------------------------------------------------------------------------------- ! Simple mathematical functions !--------------------------------------------------------------------------------------------------- - + real(c_double) function rad ( X ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: X !------------------------------------------------------------------------------------------- @@ -76,7 +76,7 @@ contains !********************************************************************** integer(c_int) function signum ( X ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: X - !------------------------------------------------------------------------------------------- + !------------------------------------------------------------------------------------------- if ( X > 0 ) then signum = 1 else if ( X < 0 ) then @@ -111,7 +111,7 @@ contains !********************************************************************** subroutine V3_ort ( V ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), dimension(0:2), intent(inout) :: V !------------------------------------------------------------------------------------------- - real(c_double) :: Vabs + real(c_double) :: Vabs !------------------------------------------------------------------------------------------- Vabs = S_V3norm3 ( V ) V(0) = V(0) / Vabs @@ -131,7 +131,7 @@ contains !********************************************************************** !--------------------------------------------------------------------------------------------------- ! Handling of spherical and Euler angles !--------------------------------------------------------------------------------------------------- - + subroutine RotationMatrix3 ( M, Psi, Tet, Phi ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Ksi, Tet and Phi are Euler angles !------------------------------------------------------------------------------------------- @@ -156,7 +156,7 @@ contains !********************************************************************** M(2,1) = - sT * cK M(2,2) = cT end subroutine RotationMatrix3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine EulerAngles ( Psi, Tet, L ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: Tet, Psi real(c_double), dimension(0:2), intent(in) :: L @@ -165,7 +165,7 @@ contains !********************************************************************** Psi = atan2 ( L(1), L(0) ) if ( Psi > M_3PI_2 ) then Psi = Psi - M_3PI_2 - else + else Psi = Psi + M_PI_2 end if end subroutine EulerAngles !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -211,5 +211,5 @@ contains !********************************************************************** close ( unit = Fuid ) Fuid = -1 end subroutine CloseFile !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module TPMLib !********************************************************************************* diff --git a/lib/mesont/TPMM0.f90 b/lib/mesont/TPMM0.f90 index bd2e598b69..d2b38fe558 100644 --- a/lib/mesont/TPMM0.f90 +++ b/lib/mesont/TPMM0.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TPMM0 !************************************************************************************** ! @@ -32,7 +32,7 @@ use iso_c_binding, only : c_int, c_double, c_char implicit none contains !****************************************************************************************** - + integer(c_int) function TPMInteractionFSS ( Q, U, F1_1, F1_2, F2_1, F2_2, R1_1, R1_2, R2_1, R2_2, EType ) real(c_double), intent(inout) :: Q, U real(c_double), dimension(0:2), intent(inout) :: F1_1, F1_2, F2_1, F2_2 @@ -48,9 +48,9 @@ contains !********************************************************************** L2 = S_V3norm3 ( Laxis2 ) Laxis2 = Laxis2 / L2 if ( EType < 2 ) then - TPMInteractionFSS = TPMInteractionF ( Q, U, F1_1, F1_2, F2_1, F2_2, Fd, R1_1, R1_2, R2_1, R2_2, 1 ) + TPMInteractionFSS = TPMInteractionF ( Q, U, F1_1, F1_2, F2_1, F2_2, Fd, R1_1, R1_2, R2_1, R2_2, 1 ) R2_3 = R2_2 + R2_2 - R2_1 - IntSign = TPMInteractionF ( Qa, Ua, F1_1a, F1_2a, F2_1a, F2_2a, Fd, R1_1, R1_2, R2_2, R2_3, 1 ) + IntSign = TPMInteractionF ( Qa, Ua, F1_1a, F1_2a, F2_1a, F2_2a, Fd, R1_1, R1_2, R2_2, R2_3, 1 ) if ( IntSign > 0 ) then TPMInteractionFSS = 1 call TPMSegmentForces ( F2_1a, F2_2a, F1_1a, F1_2a, R1_1, R1_2, R2, Laxis2, L2 ) @@ -59,7 +59,7 @@ contains !********************************************************************** F2_1a = F2_1a - F end if else - TPMInteractionFSS = TPMInteractionF ( Q, U, F1_1, F1_2, F2_1, F2_2, Fd, R1_1, R1_2, R2_1, R2_2, 2 ) + TPMInteractionFSS = TPMInteractionF ( Q, U, F1_1, F1_2, F2_1, F2_2, Fd, R1_1, R1_2, R2_1, R2_2, 2 ) R2_3 = R2_1 + R2_1 - R2_2 IntSign = TPMInteractionF ( Qa, Ua, F1_1a, F1_2a, F2_1a, F2_2a, Fd, R1_1, R1_2, R2_1, R2_3, 1 ) if ( IntSign > 0 ) then @@ -74,13 +74,13 @@ contains !********************************************************************** Q = Q - Qa if ( Q < 0.0d+00 ) Q = 0.0d+00 U = U - Ua - F2_1 = F2_1 - F2_1a - F2_2 = F2_2 - F2_2a + F2_1 = F2_1 - F2_1a + F2_2 = F2_2 - F2_2a F1_1 = F1_1 - F1_1a F1_2 = F1_2 - F1_2a end if end function TPMInteractionFSS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMInteractionFW0 ( QQ, U, U1, U2, UU, F1, F2, F, G1, G2, R1, R2, N, NMAX, R ) real(c_double), intent(inout) :: U, U1, U2 integer(c_int), intent(in) :: N, NMAX @@ -142,7 +142,7 @@ contains !********************************************************************** if ( D < Dmina ) Dmina = D end if end if - + DR = R1 - R(0:2,i+1) call ApplyPeriodicBC ( DR ) Dminb = sqr ( DR(0) ) + sqr ( DR(1) ) + sqr ( DR(2) ) @@ -165,20 +165,20 @@ contains !********************************************************************** if ( D < Dminb ) Dminb = D end if end if - + if ( Dmina < Dminb ) then EType = 1 else EType = 2 end if - - if ( TPMInteractionFSS ( QQ(i), Ua, F1_1a, F1_2a, F2_1a, F2_2a, R1, R2, R(0:2,i), R(0:2,i+1), & + + if ( TPMInteractionFSS ( QQ(i), Ua, F1_1a, F1_2a, F2_1a, F2_2a, R1, R2, R(0:2,i), R(0:2,i+1), & EType ) > 0 ) then TPMInteractionFW0 = 1 U = U + Ua - Ua = 0.25d+00 * Ua - U1 = U1 + Ua - U2 = U2 + Ua + Ua = 0.25d+00 * Ua + U1 = U1 + Ua + U2 = U2 + Ua UU(i) = UU(i) + Ua UU(i+1) = UU(i+1) + Ua F1 = F1 + F1_1a @@ -190,5 +190,5 @@ contains !********************************************************************** end if end do end function TPMInteractionFW0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module TPMM0 !********************************************************************************** diff --git a/lib/mesont/TPMM1.f90 b/lib/mesont/TPMM1.f90 index d6c8a193db..d8186683ca 100644 --- a/lib/mesont/TPMM1.f90 +++ b/lib/mesont/TPMM1.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TPMM1 !************************************************************************************** ! @@ -56,9 +56,9 @@ implicit none real(c_double), dimension(0:TPM_MAX_CHAIN-1) :: W, C real(c_double), dimension(0:2) :: RR, E10 real(c_double) :: L10, D10 - + contains !****************************************************************************************** - + subroutine PairWeight1 ( W, E1_1, E1_2, E2_1, E2_2, R2_1, R2_2 ) !!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: W real(c_double), dimension(0:2), intent(out) :: E1_1, E1_2, E2_1, E2_2 @@ -78,7 +78,7 @@ contains !********************************************************************** E2_2 = 0.0d+00 return end if - E20 = 0.5d+00 * ( R2_2 - R2_1 ) + E20 = 0.5d+00 * ( R2_2 - R2_1 ) L20 = sqrt ( S_V3xx ( E20 ) + sqr ( TPMR2 ) ) D20 = L10 + L20 + TPBRcutoff + RSkin if ( D > D20 * D20 ) then @@ -96,12 +96,12 @@ contains !********************************************************************** t = ( D - D10 ) / D20 W = 1.0d+00 - t * t * ( 3.0d+00 - 2.0d+00 * t ) dWdD = 3.0d+00 * t * ( t - 1.0d+00 ) / D20 - E1_1 = dWdD * ( t * E10 - E ) - E1_2 = dWdD * ( - t * E10 - E ) - E2_1 = dWdD * ( E + t * E20 ) - E2_2 = dWdD * ( E - t * E20 ) + E1_1 = dWdD * ( t * E10 - E ) + E1_2 = dWdD * ( - t * E10 - E ) + E2_1 = dWdD * ( E + t * E20 ) + E2_2 = dWdD * ( E - t * E20 ) end subroutine PairWeight1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function EndWeight1 ( W, E1_1, E1_2, E2_1, E2_2, R1_1, R1_2, R2_1, R2_2 ) !!! real(c_double), intent(out) :: W real(c_double), dimension(0:2), intent(out) :: E1_1, E1_2, E2_1, E2_2 @@ -114,7 +114,7 @@ contains !********************************************************************** E = 0.5d+00 * ( R2_1 + R2_2 - ( R1_1 + R1_2 ) ) call ApplyPeriodicBC ( E ) D = S_V3norm3 ( E ) - E20 = 0.5d+00 * ( R2_2 - R2_1 ) + E20 = 0.5d+00 * ( R2_2 - R2_1 ) L20 = sqrt ( S_V3xx ( E20 ) + sqr ( TPMR2 ) ) D1 = L10 + L20 + TPBRcutoff + RSkin if ( D < D1 ) then @@ -126,7 +126,7 @@ contains !********************************************************************** E2_2 = 0.0d+00 return end if - D2 = D1 + TPMC3 + D2 = D1 + TPMC3 if ( D > D2 ) then EndWeight1 = 2 W = 0.0d+00 @@ -142,13 +142,13 @@ contains !********************************************************************** t = ( D - D1 ) / TPMC3 W = 1.0d+00 - t * t * ( 3.0d+00 - 2.0d+00 * t ) dWdD = 3.0d+00 * t * ( t - 1.0d+00 ) / TPMC3 - E1_1 = dWdD * ( E10 - E ) - E1_2 = dWdD * ( - E10 - E ) - E2_1 = dWdD * ( E + E20 ) - E2_2 = dWdD * ( E - E20 ) + E1_1 = dWdD * ( E10 - E ) + E1_2 = dWdD * ( - E10 - E ) + E2_1 = dWdD * ( E + E20 ) + E2_2 = dWdD * ( E - E20 ) end function EndWeight1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - integer(c_int) function TPMInteractionFC1 ( Q, U, F1, F2, P1, P2, Pe, Pe1, R1, R2, Q1, Q2, Qe, Qe1, EType ) + integer(c_int) function TPMInteractionFC1 ( Q, U, F1, F2, P1, P2, Pe, Pe1, R1, R2, Q1, Q2, Qe, Qe1, EType ) real(c_double), intent(out) :: Q, U real(c_double), dimension(0:2), intent(out) :: F1, F2, P1, P2, Pe, Pe1 real(c_double), dimension(0:2), intent(in) :: R1, R2, Q1, Q2, Qe, Qe1 @@ -196,11 +196,11 @@ contains !********************************************************************** end if call TPMSegmentForces ( P1a, P2a, F1a, F2a, R1, R2, QX, M, L ) end if - + if ( CaseID > 0 ) then IntSignb = TPMInteractionF ( Qb, Ub, F1b, F2b, P1b, P2b, Peeb, R1, R2, Q1, Q2, 0 ) end if - + if ( CaseID == 0 ) then TPMInteractionFC1 = IntSigna Q = Qa @@ -226,7 +226,7 @@ contains !********************************************************************** TPMInteractionFC1 = 0 if ( IntSigna > 0 .or. IntSignb > 0 ) TPMInteractionFC1 = 1 W1 = 1.0d+00 - W - DU = Ub - Ua + DU = Ub - Ua Q = W * Qa + W1 * Qb U = W * Ua + W1 * Ub Pe = ( W * Peea / D ) * Me @@ -240,7 +240,7 @@ contains !********************************************************************** end if end if end function TPMInteractionFC1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMInteractionFW1 ( QQ, U, U1, U2, UU, F1, F2, F, Fe, G1, G2, R1, R2, N, NMAX, R, Re, EType ) real(c_double), intent(out) :: U, U1, U2 integer(c_int), intent(in) :: N, NMAX, EType @@ -251,7 +251,7 @@ contains !********************************************************************** real(c_double), dimension(0:2,0:NMAX-1), intent(in) :: R !------------------------------------------------------------------------------------------- integer(c_int) :: i, j - real(c_double) :: Q, WW, DD + real(c_double) :: Q, WW, DD !------------------------------------------------------------------------------------------- Q1 = 0.0d+00 Q2 = 0.0d+00 @@ -259,7 +259,7 @@ contains !********************************************************************** Z1 = 0.0d+00 Z2 = 0.0d+00 TPMInteractionFW1 = 0 - E10 = 0.5d+00 * ( R2 - R1 ) + E10 = 0.5d+00 * ( R2 - R1 ) L10 = sqrt ( S_V3xx ( E10 ) + sqr ( TPMR1 ) ) D10 = TPMR1 + TPMR2 + TPMC123 * TPBRcutoff + RSkin E10 = E10 / L10 @@ -293,10 +293,10 @@ contains !********************************************************************** Qe = 0.0d+00 Qe1 = 0.0d+00 end if - - TPMInteractionFW1 = TPMInteractionFC1 ( Q, U, F1, F2, S1, S2, Pe, Pe1, R1, R2, Q1, Q2, Qe, Qe1, EType ) + + TPMInteractionFW1 = TPMInteractionFC1 ( Q, U, F1, F2, S1, S2, Pe, Pe1, R1, R2, Q1, Q2, Qe, Qe1, EType ) if ( TPMInteractionFW1 == 0 ) return - + W(0:N-2) = W(0:N-2) / WW E1(0:2,0:N-2) = E1(0:2,0:N-2) / WW E2(0:2,0:N-2) = E2(0:2,0:N-2) / WW @@ -322,7 +322,7 @@ contains !********************************************************************** do j = 0, N - 2 if ( j == 0 ) then DR = EE1(0:2,0) * ( 1.0d+00 - W(0) ) - else + else DR = - W(j) * EE1(0:2,0) end if F(0:2,0) = F(0:2,0) + C(j) * DR @@ -337,8 +337,8 @@ contains !********************************************************************** else if ( j == i - 1 ) then G1(0:2,i) = G1(0:2,i) + C(j) * ( EE2(0:2,j) - W(j) * EE2(0:2,i-1) ) G2(0:2,i) = G2(0:2,i) - C(j) * W(j) * EE1(0:2,i) - else - G1(0:2,i) = G1(0:2,i) - C(j) * W(j) * EE2(0:2,i-1) + else + G1(0:2,i) = G1(0:2,i) - C(j) * W(j) * EE2(0:2,i-1) G2(0:2,i) = G2(0:2,i) - C(j) * W(j) * EE1(0:2,i) end if end do @@ -348,7 +348,7 @@ contains !********************************************************************** do j = 0, N - 2 if ( j == N - 2 ) then DR = EE2(0:2,N-2) * ( 1.0d+00 - W(N-2) ) - else + else DR = - W(j) * EE2(0:2,N-2) end if F(0:2,N-1) = F(0:2,N-1) + C(j) * DR @@ -368,5 +368,5 @@ contains !********************************************************************** G1(0:2,N-1) = F(0:2,N-1) G2(0:2,0) = F(0:2,0) end function TPMInteractionFW1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module TPMM1 !********************************************************************************** diff --git a/lib/mesont/TubePotBase.f90 b/lib/mesont/TubePotBase.f90 index dbb15c1457..d278a2390f 100644 --- a/lib/mesont/TubePotBase.f90 +++ b/lib/mesont/TubePotBase.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TubePotBase !******************************************************************************** ! @@ -25,10 +25,10 @@ module TubePotBase !************************************************************ ! !--------------------------------------------------------------------------------------------------- ! -! This module contains basic parameters for all modules involved into calculations of tubular +! This module contains basic parameters for all modules involved into calculations of tubular ! potentials. -! -! It includes definitions of +! +! It includes definitions of ! -- TPBU, Lennard-Jones (12-6) potential ! -- TPBQ, Transfer function ! @@ -43,7 +43,7 @@ implicit none !--------------------------------------------------------------------------------------------------- ! Constants !--------------------------------------------------------------------------------------------------- - + ! Types of the potential with respect to the breathing mode integer(c_int), parameter :: TP_POT_MONO_R = 0 integer(c_int), parameter :: TP_POT_POLY_R = 1 @@ -56,7 +56,7 @@ implicit none ! Mass of C atom real(c_double), parameter :: TPBMc = 12.0107d+00 ! (Da) - + ! Parameters of the Van der Waals interaction between carbon atoms in graphene sheets, see ! Stuart S.J., Tutein A.B., Harrison J.A., J. Chem. Phys. 112(14), 2000 real(c_double), parameter :: TPBEcc = 0.00284d+00 ! (eV) @@ -66,73 +66,73 @@ implicit none ! Dresselhaus et al, Carbon 33(7), 1995 real(c_double), parameter :: TPBAcc = 1.421d+00 ! (A) real(c_double), parameter :: TPBDcc = 4.0d+00 / ( TPBConstD * TPBAcc * TPBAcc ) ! (1/A^2) - + ! Specific heat of carbon nanotubes real(c_double), parameter :: TPBSHcc = 600.0d+00 / K_MDCU ! (eV/(Da*K)) - + ! Cutoff distances for the interactomic potential and transfer function. ! Changes in these parameters can result in necessity to change some numerical parameters too. real(c_double), parameter :: TPBRmincc = 0.001d+00 * TPBScc ! (A) real(c_double), parameter :: TPBRcutoffcc = 3.0d+00 * TPBScc ! (A) real(c_double), parameter :: TPBRcutoff1cc = 2.16d+00 * TPBScc ! (A) - + ! Parameters of the transfer function for non-bonded interaction between carbon atoms real(c_double), parameter :: TPBQScc = 7.0d+00 ! (A) real(c_double), parameter :: TPBQRcutoff1cc = 8.0d+00 ! (A) - + !--------------------------------------------------------------------------------------------------- ! Global variables !--------------------------------------------------------------------------------------------------- - + ! Set to .true. to generate diagnostic and warning messages - logical :: TPErrCheck = .true. - character*512 :: TPErrMsg = '' - - real(c_double) :: TPGeomPrec = 1.0d-06 ! Geometric precision, see TPInt + logical :: TPErrCheck = .true. + character*512 :: TPErrMsg = '' + + real(c_double) :: TPGeomPrec = 1.0d-06 ! Geometric precision, see TPInt integer(c_int) :: TPPotType = TP_POT_MONO_R ! Type of the potential with respect to the breathing mode - + ! Parameters of the interatomic potential and atoms distribution at the surface ! of the tube - + real(c_double) :: TPBM = TPBMc ! Mass of an atom (Da) real(c_double) :: TPBE = TPBEcc ! Depth of the energy well in (12-6) LJ interatomic potential (eV) real(c_double) :: TPBS = TPBScc ! Sigma parameter of (12-6) LJ interatomic potential (A) real(c_double) :: TPBD = TPBDcc ! Numerical density of atoms at the tube surface (1/A^2) real(c_double) :: TPBSH = TPBSHcc ! Specific heat (eV/(Da*K)) - + real(c_double) :: TPBRmin = TPBRmincc ! (A) real(c_double) :: TPBRcutoff = TPBRcutoffcc ! (A) real(c_double) :: TPBRcutoff1 = TPBRcutoff1cc ! (A) ! Parameters of the transfer function - + real(c_double) :: TPBQS = TPBQScc ! Sigma parameter of the transfer function (A) real(c_double) :: TPBQRcutoff1 = TPBQRcutoff1cc! (A) - + ! Auxiliary variables - + real(c_double) :: TPBE4, TPBE24, TPBDRcutoff, TPBQDRcutoff real(c_double) :: TPBQR0 ! Constant-value distance for the transfer function (A) - + ! Table of inter-particle potential, force, and transfer function - + integer(c_int) :: TPBN = TPBNMAX real(c_double) :: TPBDR real(c_double), dimension(0:TPBNMAX-1) :: TPBQ real(c_double), dimension(0:TPBNMAX-1) :: TPBU, TPBdUdR - + contains !****************************************************************************************** integer(c_int) function TPBsizeof () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! TPBsizeof = 8 * ( size ( TPBQ ) + size ( TPBU ) + size ( TPBdUdR ) ) end function TPBsizeof !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Interpolation !--------------------------------------------------------------------------------------------------- real(c_double) function TPBQInt0 ( R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - real(c_double), intent(in) :: R + real(c_double), intent(in) :: R !------------------------------------------------------------------------------------------- real(c_double) :: Z, RR integer(c_int) :: i @@ -140,7 +140,7 @@ contains !********************************************************************** if ( R < TPBRmin ) then !call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10,a,e20.10)' ) ': R < Rmin: R=', R, ', Rmin=', TPBRmin - !call Error ( 'TPBQInt0', TPErrMsg ) + !call Error ( 'TPBQInt0', TPErrMsg ) elseif ( R > TPBRcutoff ) then TPBQInt0 = 0.0d+00 return @@ -149,11 +149,11 @@ contains !********************************************************************** i = int ( RR ) RR = RR - i Z = 1.0d+00 - RR - TPBQInt0 = TPBQ(i) * Z + TPBQ(i+1) * RR + TPBQInt0 = TPBQ(i) * Z + TPBQ(i+1) * RR end function TPBQInt0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) function TPBUInt0 ( R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - real(c_double), intent(in) :: R + real(c_double), intent(in) :: R !------------------------------------------------------------------------------------------- real(c_double) :: Z, RR integer(c_int) :: i @@ -161,7 +161,7 @@ contains !********************************************************************** if ( R < TPBRmin ) then !call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10,a,e20.10)' ) ': R < Rmin: R=', R, ', Rmin=', TPBRmin - !call Error ( 'TPBUInt0', TPErrMsg ) + !call Error ( 'TPBUInt0', TPErrMsg ) elseif ( R > TPBRcutoff ) then TPBUInt0 = 0.0d+00 return @@ -170,12 +170,12 @@ contains !********************************************************************** i = int ( RR ) RR = RR - i Z = 1.0d+00 - RR - TPBUInt0 = TPBU(i) * Z + TPBU(i+1) * RR + TPBUInt0 = TPBU(i) * Z + TPBU(i+1) * RR end function TPBUInt0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPBUInt1 ( U, dUdR, R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: U, dUdR - real(c_double), intent(in) :: R + real(c_double), intent(in) :: R !------------------------------------------------------------------------------------------- real(c_double) :: Z, RR integer(c_int) :: i @@ -183,7 +183,7 @@ contains !********************************************************************** if ( R < TPBRmin ) then !call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10,a,e20.10)' ) ': R < Rmin: R=', R, ', Rmin=', TPBRmin - !call Error ( 'TPBUInt1', TPErrMsg ) + !call Error ( 'TPBUInt1', TPErrMsg ) elseif ( R > TPBRcutoff ) then TPBU = 0.0d+00 TPBdUdR = 0.0d+00 @@ -193,14 +193,14 @@ contains !********************************************************************** i = int ( RR ) RR = RR - i Z = 1.0d+00 - RR - U = TPBU(i) * Z + TPBU(i+1) * RR + U = TPBU(i) * Z + TPBU(i+1) * RR dUdR = TPBdUdR(i) * Z + TPBdUdR(i+1) * RR end subroutine TPBUInt1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Calculation !--------------------------------------------------------------------------------------------------- - + real(c_double) function TPBQCalc0 ( R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: R !------------------------------------------------------------------------------------------- @@ -210,7 +210,7 @@ contains !********************************************************************** TPBQCalc0 = 0.0d+00 else if ( R < TPBQR0 ) then TPBQCalc0 = 1.0d+00 - else + else Z = TPBQS / R Z = Z * Z * Z Z = Z * Z @@ -222,7 +222,7 @@ contains !********************************************************************** endif endif end function TPBQCalc0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + real(c_double) function TPBUCalc0 ( R ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: R !------------------------------------------------------------------------------------------- @@ -230,7 +230,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- if ( R > TPBRcutoff ) then TPBUCalc0 = 0.0d+00 - else + else Z = TPBS / R Z = Z * Z * Z Z = Z * Z @@ -251,7 +251,7 @@ contains !********************************************************************** if ( R > TPBRcutoff ) then U = 0.0d+00 dUdR = 0.0d+00 - else + else Z = TPBS / R Z = Z * Z * Z Z = Z * Z @@ -266,7 +266,7 @@ contains !********************************************************************** endif endif end subroutine TPBUCalc1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPBSegmentForces ( F1, F2, F, M, Laxis, L ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), dimension(0:2), intent(out) :: F1, F2 real(c_double), dimension(0:2), intent(in) :: F, M, Laxis @@ -284,7 +284,7 @@ contains !********************************************************************** !--------------------------------------------------------------------------------------------------- ! Initialization !--------------------------------------------------------------------------------------------------- - + subroutine TPBInit () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) :: R integer(c_int) :: i diff --git a/lib/mesont/TubePotMono.f90 b/lib/mesont/TubePotMono.f90 index 65e58ecf7a..f59c810e4f 100644 --- a/lib/mesont/TubePotMono.f90 +++ b/lib/mesont/TubePotMono.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TubePotMono !******************************************************************************** ! @@ -27,22 +27,22 @@ module TubePotMono !************************************************************ ! ! Four potentials and transfer functions are calculated in this module: ! -! 1. SSTP (segment - semi-infinite tube parallel): Linear density of the potential along -! the segment axis which is produced by a parallel semi-infinite tube. 2D tables for this potential +! 1. SSTP (segment - semi-infinite tube parallel): Linear density of the potential along +! the segment axis which is produced by a parallel semi-infinite tube. 2D tables for this potential ! are generated at initialization or can be loaded from a file. ! -! 2. STP (segment - tube parallel): Linear density of the potential along the segment axis -! which is produced by a parallel infinite tubes. This is only a particular case of the SSTP potential, -! but it is considered separately for computational efficiency. 1D tables of this potential are taken +! 2. STP (segment - tube parallel): Linear density of the potential along the segment axis +! which is produced by a parallel infinite tubes. This is only a particular case of the SSTP potential, +! but it is considered separately for computational efficiency. 1D tables of this potential are taken ! from 2D tables of SSTP potential. ! ! 3. SST (segment - semi-infinite tube): Potential for a segment produced by an arbitrary- -! oriented semi-infinite tube. This potential can not be kept in 2D tables, therefore, all -! data are calculated 'on fly' with the help of SSTP potential and numerical integration along the +! oriented semi-infinite tube. This potential can not be kept in 2D tables, therefore, all +! data are calculated 'on fly' with the help of SSTP potential and numerical integration along the ! segment axis ! -! 4. ST (segment - tube): Potential for a segment produced by an arbitrary-oriented -! infinitely long tube. 2D tables for this potential are generated at initialization or can be +! 4. ST (segment - tube): Potential for a segment produced by an arbitrary-oriented +! infinitely long tube. 2D tables for this potential are generated at initialization or can be ! loaded from a file. ! !*************************************************************************************************** @@ -62,77 +62,77 @@ implicit none integer(c_int), parameter :: TPMNZMAX = 129 integer(c_int), parameter :: TPMNEMAX = 128 - - integer(c_int), parameter :: TPMNHMAX = 1001 - integer(c_int), parameter :: TPMNXMAX = 1001 - integer(c_int), parameter :: TPMNMAX = 1001 - + + integer(c_int), parameter :: TPMNHMAX = 1001 + integer(c_int), parameter :: TPMNXMAX = 1001 + integer(c_int), parameter :: TPMNMAX = 1001 + !--------------------------------------------------------------------------------------------------- ! Global variables !--------------------------------------------------------------------------------------------------- - + integer(c_int) :: TPMStartMode = 1 - character*512 :: TPMFile = 'MESONT-TABTP.xrs' + character(len=512) :: TPMFile = 'MESONT-TABTP.xrs' integer(c_int) :: TPMUnitID ! Unit for the tabulated potential file - + integer(c_int) :: TPMNZ = TPMNZMAX integer(c_int) :: TPMNZ1 = TPMNZMAX - 1 integer(c_int) :: TPMNE = TPMNEMAX integer(c_int) :: TPMNE1 = TPMNEMAX - 1 - + integer(c_int) :: TPMNH = TPMNHMAX integer(c_int) :: TPMNH1 = TPMNHMAX - 1 integer(c_int) :: TPMNX = TPMNXMAX integer(c_int) :: TPMNX1 = TPMNXMAX - 1 - - integer :: TPMChiIndM ! Chirality index M + + integer :: TPMChiIndM ! Chirality index M integer :: TPMChiIndN ! Chirality index N real(c_double) :: TPMR1 real(c_double) :: TPMR2 - + real(c_double) :: TPMHmax real(c_double) :: TPMDH - + ! Parameters of empirical correction functions - + integer(c_int) :: TPMAN = 20 real(c_double) :: TPMAHmin real(c_double) :: TPMAHmax real(c_double) :: TPMADH real(c_double), dimension(0:TPMNHMAX-1) :: TPMAH, TPMAF, TPMAFxx - + ! Fitting parameters that depend on the SWCNT chirality real(c_double) :: TPMCaA = 0.22d+00 ! 0.22 for (10,10) CNTs real(c_double) :: TPMCeA = 0.35d+00 ! 0.35 for (10,10) CNTs real(c_double) :: TPMAHmin0 = 10.0d+00 ! 10.0 A for (10,10) CNTs - + ! Parameters of SSTP integrator - + real(c_double) :: TPMDE real(c_double), dimension(0:TPMNEMAX-1) :: TPMCE, TPMSE - + ! Additional parameters for SSTP potential real(c_double) :: TPMSSTPDelta = 0.25d+00 integer(c_int) :: TPMSSTPNH integer(c_int) :: TPMSSTPNX - + real(c_double) :: TPMSSTPX1 real(c_double) :: TPMSSTPXmax real(c_double) :: TPMSSTPDX - + real(c_double), dimension(0:TPMNHMAX-1,0:TPMNXMAX-1) :: TPMSSTPG real(c_double), dimension(0:TPMNHMAX-1,0:TPMNXMAX-1) :: TPMSSTPF, TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy real(c_double), dimension(0:TPMNHMAX-1) :: TPMSSTPH real(c_double), dimension(0:TPMNXMAX-1) :: TPMSSTPX - + ! Additional parameters for STP potential - + ! In calculations of this potential, some parameters of SSTP potential are also used. ! In particular, STP potential has no its own integrator. All data comes from SSTP integrator. ! It does not result in any computational inefficiency unless the STP potential is used without SSTP one. - + integer(c_int) :: TPMNN = 10 real(c_double), dimension(0:TPMNHMAX-1) :: TPMSTPG real(c_double), dimension(0:TPMNHMAX-1) :: TPMSTPF, TPMSTPFxx @@ -140,25 +140,25 @@ implicit none ! Parameters for ST potential ! Minimum gap dh for ST-potential - real(c_double) :: TPMSTDelta = 1.0d+00 + real(c_double) :: TPMSTDelta = 1.0d+00 ! Number of subdivisions for every grid step in ST-integrator - integer(c_int) :: TPMSTNXS = 10 + integer(c_int) :: TPMSTNXS = 10 real(c_double) :: TPMSTXmax real(c_double) :: TPMSTH1 real(c_double) :: TPMSTH2 real(c_double) :: TPMSTDH12 - + real(c_double), dimension(0:TPMNHMAX-1,0:TPMNXMAX-1) :: TPMSTG real(c_double), dimension(0:TPMNHMAX-1,0:TPMNXMAX-1) :: TPMSTF, TPMSTFxx, TPMSTFyy, TPMSTFxxyy real(c_double), dimension(0:TPMNHMAX-1) :: TPMSTH real(c_double), dimension(0:TPMNXMAX-1) :: TPMSTX - + ! Switching parameters - + ! Height switch (at H=0 in SST-potential) integer(c_int) :: TPMHSwitch = 0 ! 1, use h-switch; 0, do not use the switch real(c_double) :: TPMHS = 3.0d+00 ! Switch height, Angstrom - + ! Angle switch integer(c_int) :: TPMASwitch = 0 ! 1, use a-switch; 0, do not use the switch real(c_double) :: TPMAS = 3.0d+00 ! Switch angle, degree @@ -220,7 +220,7 @@ contains !********************************************************************** R2Y = TPMR1 * TPMSE(j) R2Z = Zmin - D do k = 0, TPMNZ1 ! Integration over the length of the second tube - R = sqr ( R2X - R1X ) + sqr ( R2Y - R1Y ) + sqr ( R2Z ) + R = sqr ( R2X - R1X ) + sqr ( R2Y - R1Y ) + sqr ( R2Z ) if ( R < Rcutoff2 ) then R = dsqrt ( R ) if ( k == 0 .or. k == TPMNZ1 ) then @@ -239,7 +239,7 @@ contains !********************************************************************** Q = Q * C U = U * sqr ( TPBD ) * C end subroutine TPMSSTPIntegrator !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMSSTPInt0 ( Q, U, H, X ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function returns the transfer function Q and potential U for the SSTP potential ! calculated by interpolation in the table without switch. @@ -253,7 +253,7 @@ contains !********************************************************************** i = 1 + int ( H / TPMDH ) j = 1 + int ( ( X + TPMSSTPXMax ) / TPMSSTPDX ) if ( ( i < TPMSSTPNH ) .and. ( j > TPMSSTPNX ) ) then - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg (TPErrMsg ) !write ( TPErrMsg, '(a,e20.10,a,e20.10)' ) 'Tubes intersect each other: H=', H, ', X=', X !call Error ( 'TPMSSTPInt0', TPErrMsg ) @@ -273,7 +273,7 @@ contains !********************************************************************** else XX = X end if - Q = CalcLinFun2_0 ( i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPG ) + Q = CalcLinFun2_0 ( i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPG ) U = CalcSpline2_0 ( i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPF, TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy ) TPMSSTPInt0 = 1 end function TPMSSTPInt0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -303,7 +303,7 @@ contains !********************************************************************** end if end if end function TPMSSTPInt0S !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMSSTPInt1 ( Q, U, Uh, Ux, H, X ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function returns the transfer function Q, potential U, and derivatives Uh=dU/dH and ! Ux=dU/dX for the SSTP potential calculated by interpolation in the table without switch @@ -317,7 +317,7 @@ contains !********************************************************************** i = 1 + int ( H / TPMDH ) j = 1 + int ( ( X + TPMSSTPXMax ) / TPMSSTPDX ) if ( ( i < TPMSSTPNH ) .and. ( j > TPMSSTPNX ) ) then - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10,a,e20.10)' ) 'Tubes intersect each other: H=', H, ', X=', X !call Error ( 'TPMSSTPInt1', TPErrMsg ) @@ -339,15 +339,15 @@ contains !********************************************************************** else XX = X end if - Q = CalcLinFun2_0 ( i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPG ) + Q = CalcLinFun2_0 ( i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPG ) call CalcSpline2_1 ( U, Uh, Ux, i, j, H, XX, TPMNH, TPMNX, TPMSSTPH, TPMSSTPX, TPMSSTPF, & - TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy ) + TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy ) TPMSSTPInt1 = 1 end function TPMSSTPInt1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMSSTPInt1S ( Q, U, Uh, Ux, H, X ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function returns the transfer function Q, potential U, and derivatives Uh=dU/dH and - ! Ux=dU/dX for the SSTP potential calculated by interpolation in the table and switch to + ! Ux=dU/dX for the SSTP potential calculated by interpolation in the table and switch to ! the case of zero H. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U, Uh, Ux @@ -375,7 +375,7 @@ contains !********************************************************************** end if end if end function TPMSSTPInt1S !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPMSSTPWrite () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function writes the table of the SSTP potential to a disk file. !------------------------------------------------------------------------------------------- @@ -412,7 +412,7 @@ contains !********************************************************************** end do end do end subroutine TPMSSTPRead !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPMSSTPInit () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function calculates the table of the SSTP potential. !------------------------------------------------------------------------------------------- @@ -424,7 +424,7 @@ contains !********************************************************************** TPMDE = M_2PI / TPMNE E = 0.0d+00 do i = 0, TPMNE1 - TPMCE(i) = cos ( E ) + TPMCE(i) = cos ( E ) TPMSE(i) = sin ( E ) E = E + TPMDE end do @@ -444,7 +444,7 @@ contains !********************************************************************** do j = 0, TPMNX1 if ( ( i .ge. TPMSSTPNH ) .or. ( j .le. TPMSSTPNX ) ) then call TPMSSTPIntegrator ( TPMSSTPG(i,j), TPMSSTPF(i,j), TPMSSTPH(i), TPMSSTPX(j) ) - print '(2i5,a,e20.10,a,e20.10,a,e20.10,a,e20.10)', i, j, ' H=', TPMSSTPH(i), & + print '(2i5,a,e20.10,a,e20.10,a,e20.10,a,e20.10)', i, j, ' H=', TPMSSTPH(i), & ', X=', TPMSSTPX(j), ', Q=', TPMSSTPG(i,j), ', U=', TPMSSTPF(i,j) end if end do @@ -454,11 +454,11 @@ contains !********************************************************************** call TPMSSTPRead () end if call CreateSpline2Ext ( 3, 3, 3, 3, TPMNH, TPMSSTPNH, TPMNX, TPMSSTPNX, TPMNMAX, TPMSSTPH, TPMSSTPX, & - TPMSSTPF, TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy, FF, MM, DD, K0, K1, K2 ) + TPMSSTPF, TPMSSTPFxx, TPMSSTPFyy, TPMSSTPFxxyy, FF, MM, DD, K0, K1, K2 ) end subroutine TPMSSTPInit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !--------------------------------------------------------------------------------------------------- -! STP potential for an infinite tube interacting with a parallel segment. No actual initialization +! STP potential for an infinite tube interacting with a parallel segment. No actual initialization ! is necessary for this potential, since the data are taken from the table for the SSTP potential. !--------------------------------------------------------------------------------------------------- @@ -473,7 +473,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- i = 1 + int ( H / TPMDH ) if ( i < TPMSSTPNH ) then - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10)' ) 'Tubes intersect each other: H=', H !call Error ( 'TPMSTPInt0', TPErrMsg ) @@ -485,13 +485,13 @@ contains !********************************************************************** return end if if ( i == TPMNH ) i = TPMNH - 1 - Q = CalcLinFun1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPG ) - U = CalcSpline1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPF, TPMSTPFxx ) + Q = CalcLinFun1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPG ) + U = CalcSpline1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPF, TPMSTPFxx ) TPMSTPInt0 = 1 end function TPMSTPInt0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int) function TPMSTPInt1 ( Q, U, dUdH, H ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This function returns the transfer function Q, potential U, and derivative dUdH for + ! This function returns the transfer function Q, potential U, and derivative dUdH for ! the STP potential calculated by interpolation in the table. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U, dUdH @@ -500,7 +500,7 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- i = 1 + int ( H / TPMDH ) if ( i < TPMSSTPNH ) then - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg ( TPErrMsg ) !write ( TPErrMsg, '(a,e20.10)' ) 'Tubes intersect each other: H=', H !call Error ( 'TPMSTPInt0', TPErrMsg ) @@ -512,11 +512,11 @@ contains !********************************************************************** TPMSTPInt1 = 0 return end if - Q = CalcLinFun1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPG ) - call CalcSpline1_1 ( U, dUdH, i, H, TPMNH, TPMSSTPH, TPMSTPF, TPMSTPFxx ) + Q = CalcLinFun1_0 ( i, H, TPMNH, TPMSSTPH, TPMSTPG ) + call CalcSpline1_1 ( U, dUdH, i, H, TPMNH, TPMSSTPH, TPMSTPF, TPMSTPFxx ) TPMSTPInt1 = 1 end function TPMSTPInt1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPMSTPInit () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This function initializes the table of the STP potential !------------------------------------------------------------------------------------------- @@ -524,7 +524,7 @@ contains !********************************************************************** TPMSTPF(0:TPMNH1) = TPMSSTPF(0:TPMNH1,TPMNX1) TPMSTPFxx(0:TPMNH1) = TPMSSTPFxx(0:TPMNH1,TPMNX1) end subroutine TPMSTPInit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Fitting functions for the SST and ST potentials. ! This correction functions are chosen empirically to improve accuracy of the SST and ST potentials. @@ -567,14 +567,14 @@ contains !********************************************************************** X = - ( X1_2 - X1_1 ) / 2.0d+00 do j = 0, ( TPTNXMAX - 1 ) / 2 HH = sqrt ( TPMAH(i) * TPMAH(i) + sqr ( X * sin ( M_PI_2 ) ) ) - IntSign = TPMSTPInt0 ( Qb, Ub, HH ) + IntSign = TPMSTPInt0 ( Qb, Ub, HH ) call TPTSetSegPosition2 ( TPTSeg1, R1_1, R1_2 ) call TPTSetSegPosition2 ( TPTSeg2, R2_1, R2_2 ) - IntSign = TPTSectionPotential ( Qa, Ua, Fa, Ma, TPTSeg1, j, TPTSeg2 ) + IntSign = TPTSectionPotential ( Qa, Ua, Fa, Ma, TPTSeg1, j, TPTSeg2 ) if ( j == 0 ) then Uamin = Ua Ubmin = Ub - else + else if ( Ua < Uamin ) then Uamin = Ua end if @@ -614,7 +614,7 @@ contains !********************************************************************** return end if i = 1 + int ( ( H - TPMAHmin ) / TPMADH ) - TPMA0 = CalcSpline1_0 ( i, H, TPMAN, TPMAH, TPMAF, TPMAFxx ) + TPMA0 = CalcSpline1_0 ( i, H, TPMAN, TPMAH, TPMAF, TPMAFxx ) end function TPMA0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine TPMA1 ( A, Ah, H ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -646,9 +646,9 @@ contains !********************************************************************** i = 1 + int ( ( H - TPMAHmin ) / TPMADH ) call CalcSpline1_1 ( A, Ah, i, H, TPMAN, TPMAH, TPMAF, TPMAFxx ) end subroutine TPMA1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + real(c_double) function TPMCu0 ( H, cosA, sinA ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This function returns the correction function for the magnitude of the potential. + ! This function returns the correction function for the magnitude of the potential. !------------------------------------------------------------------------------------------- real(c_double), intent(in) :: H, cosA, sinA !------------------------------------------------------------------------------------------- @@ -656,7 +656,7 @@ contains !********************************************************************** end function TPMCu0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine TPMCu1 ( Cu, CuH, CuA, H, cosA, sinA ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! The subroutine calculates the correction function Cu for the magnitude of the potential and + ! The subroutine calculates the correction function Cu for the magnitude of the potential and ! its derivatives CuH and CuA. !------------------------------------------------------------------------------------------- real(c_double), intent(ouT) :: Cu, CuH, CuA @@ -664,7 +664,7 @@ contains !********************************************************************** real(c_double) :: AA, AAh, D !------------------------------------------------------------------------------------------- call TPMA1 ( AA, AAh, H ) - D = sqr ( sinA ) + D = sqr ( sinA ) AA = AA - 1.0d+00 Cu = 1.0d+00 + AA * D CuH = AAh * D @@ -672,7 +672,7 @@ contains !********************************************************************** end subroutine TPMCu1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) function TPMCa0 ( cosA, sinA ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This function returns the correction function for the argument of the potential. + ! This function returns the correction function for the argument of the potential. ! If correction is not necessary, it should return sinA. !------------------------------------------------------------------------------------------- real(c_double), intent(in) :: cosA, sinA @@ -681,21 +681,21 @@ contains !********************************************************************** end function TPMCa0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine TPMCa1 ( Ca, CaA, Ka, KaA, cosA, sinA ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This subroutine calculates the correction function Cu for the depth of the potential well - ! and its derivatives CuH and CuA. If correction is not necessary, it returns Ca = sinA + ! This subroutine calculates the correction function Cu for the depth of the potential well + ! and its derivatives CuH and CuA. If correction is not necessary, it returns Ca = sinA ! and CaA = cosA. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Ca, CaA, Ka, KaA real(c_double), intent(in) :: cosA, sinA !------------------------------------------------------------------------------------------- Ka = 1.0d+00 / ( 1.0d+00 - TPMCaA * sqr ( sinA ) ) - Ca = sinA * Ka + Ca = sinA * Ka KaA = 2.0d+00 * TPMCaA * sinA * cosA * sqr ( Ka ) CaA = cosA * Ka + sinA * KaA end subroutine TPMCa1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) function TPMCe0 ( sinA ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This function returns the correction function for the argument of the potential. + ! This function returns the correction function for the argument of the potential. ! If correction is not necessary, it returns sinA. !------------------------------------------------------------------------------------------- real(c_double), intent(in) :: sinA @@ -713,19 +713,19 @@ contains !********************************************************************** CeA = - 2.0d+00 * TPMCeA * sinA * cosA Ke = TPMCeA end subroutine TPMCe1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- -! SST potential for the semi-infinite tube interacting with segment. -! This potential does not need any initialization. All necessary data is taken from tables of the +! SST potential for the semi-infinite tube interacting with segment. +! This potential does not need any initialization. All necessary data is taken from tables of the ! SSTP potential. !--------------------------------------------------------------------------------------------------- integer(c_int) function TPMSSTPotential ( Q, U, X1, X2, H, cosA, D, N ) !!!!!!!!!!!!!!!!!!!! - ! This function calculates the transfer function Q and potential U applied to a segment - ! from a semi-infinite tube based on the numerical integration (trapezoidal rule) along the segment - ! axis for non-parallel objects. + ! This function calculates the transfer function Q and potential U applied to a segment + ! from a semi-infinite tube based on the numerical integration (trapezoidal rule) along the segment + ! axis for non-parallel objects. ! Relative position of the nanotube and segment is given by axial positions of the segment - ! ends X1 and X2, height H, cosA= cos(A), where A is the cross-axis angle, and the displacement + ! ends X1 and X2, height H, cosA= cos(A), where A is the cross-axis angle, and the displacement ! D of a nanotube end. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U @@ -761,7 +761,7 @@ contains !********************************************************************** end function TPMSSTPotential !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int) function TPMSSTPotentialPar ( Q, U, R1_1, Laxis1, R2_1, Laxis2, L1, N ) !!!!! - ! Potential for a segment and a semi-infinite tube is calculated by the numerical + ! Potential for a segment and a semi-infinite tube is calculated by the numerical ! integration (trapezoidal rule) along the segment axis for parallel objects. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U @@ -799,9 +799,9 @@ contains !********************************************************************** Q = Q * DX U = U * DX end function TPMSSTPotentialPar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMSSTForces ( Q, U, F1, F2, Fd, X1, X2, H, cosA, D, N ) !!!!!!!!!!! - ! Potential and forces applied to the segment from a semi-infinite tube are calculated + ! Potential and forces applied to the segment from a semi-infinite tube are calculated ! by the numerical integration (trapezoidal rule) along the segment axis. ! Non-parallel case. !------------------------------------------------------------------------------------------- @@ -859,7 +859,7 @@ contains !********************************************************************** X = X + DX end do if ( TPMSSTForces == 0 ) return - + C = DX * Cu I0 = I0 * C Ih = Ih * C @@ -868,7 +868,7 @@ contains !********************************************************************** Ix = Ix * C Ix1 = Ix1 * C - DX = X2 - X1 + DX = X2 - X1 Q = Q * C U = I0 @@ -877,23 +877,23 @@ contains !********************************************************************** C1 = Ka * Ka * Ih1 C = h * ( C1 + cosA * Ke * Ix ) / DX - F1(0) = X2 * Uh - C + F1(0) = X2 * Uh - C F2(0) = C - X1 * Uh - + C = ( cosA * sinA * C1 + ( Ke * sinA - sinA ) * Ix ) / DX - F1(1) = Ua - X2 * C + F1(1) = Ua - X2 * C F2(1) = X1 * C - Ua - + C1 = Ca * Ca * Ih1 + cosA * Ix C2 = Ca * Ca * Ih2 + cosA * Ix1 F1(2) = ( U - X2 * C1 + C2 ) / DX F2(2) = ( X1 * C1 - C2 - U ) / DX - + Fd = Ce * Ix end function TPMSSTForces !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - integer(c_int) function TPMSSTForcesPar ( Q, U, F1, F2, Fd, R1_1, Laxis1, R2_1, Laxis2, L1, N ) - ! Potential and forces applied to the segment from a semi-infinite tube are calculated by + integer(c_int) function TPMSSTForcesPar ( Q, U, F1, F2, Fd, R1_1, Laxis1, R2_1, Laxis2, L1, N ) + ! Potential and forces applied to the segment from a semi-infinite tube are calculated by ! the numerical integration (trapezoidal rule) along the segment axis. ! Parallel case !------------------------------------------------------------------------------------------- @@ -942,8 +942,8 @@ contains !********************************************************************** U = U + Us Fd = Fd + Usx end if - F1 = F1 + Gamma * Fs - F2 = F2 + Beta * Fs + F1 = F1 + Gamma * Fs + F2 = F2 + Beta * Fs end if X = X + DX end do @@ -954,15 +954,15 @@ contains !********************************************************************** F1 = DX * F1 + Fs F2 = DX * F2 - Fs end function TPMSSTForcesPar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! ST: Potential for a infinite tube interacting with a segment !-------------------------------------------------------------------------------------------------- - + ! ! These functions are used to smooth boundaries in (H,X) domain for ST potential ! - + real(c_double) function TPMSTXMin0 ( H ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: H !------------------------------------------------------------------------------------------- @@ -979,7 +979,7 @@ contains !********************************************************************** TPMSTXMin0 = sqrt ( TPMSTH2 * TPMSTH2 - H * H ) & * ( 1.0d+00 - X * X * X * ( 3.0d+00 * X * ( 2.0d+00 * X - 5.0d+00 ) + 10.0d+00 ) ) end function TPMSTXMin0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + real(c_double) function TPMSTXMax0 ( H ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: H !------------------------------------------------------------------------------------------- @@ -1005,11 +1005,11 @@ contains !********************************************************************** F = 1.0d+00 - X * X * X * ( 3.0d+00 * X * ( 2.0d+00 * X - 5.0d+00 ) + 10.0d+00 ) X = X * ( X - 1.0d+00 ) dFdX = - 30.0d+00 * X * X - XMin = sqrt ( TPMSTH2 * TPMSTH2 - H * H ) + XMin = sqrt ( TPMSTH2 * TPMSTH2 - H * H ) dXMindH = - H * F / XMin + XMin * dFdX / TPMSTDH12 XMin = XMin * F end subroutine TPMSTXMin1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPMSTXMax1 ( XMax, dXMaxdH, H ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: XMax, dXMaxdH real(c_double), intent(in) :: H @@ -1017,11 +1017,11 @@ contains !********************************************************************** XMax = sqrt ( TPMSTXMax * TPMSTXMax - H * H ) dXMaxdH = - H / XMax end subroutine TPMSTXMax1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + ! ! ST (segment-tube) table ! - + subroutine TPMSTIntegrator ( G, F, Q, U, H, X, DX ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(inout) :: G, F, Q, U real(c_double), intent(in) :: H, X, DX @@ -1036,7 +1036,7 @@ contains !********************************************************************** U = 0.0d+00 HH = dsqrt ( sqr ( H ) + sqr ( X ) ) if ( HH > TPMHmax ) return - IntSign = TPMSTPInt0 ( Q, U, HH ) + IntSign = TPMSTPInt0 ( Q, U, HH ) if ( IntSign == 1 ) then G = G + Q * DDX F = F + U * DDX @@ -1059,10 +1059,10 @@ contains !********************************************************************** G = 0.0d+00 F = 0.0d+00 TPMSTInt0 = 2 - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg ( TPErrMsg ) !all Error ( 'TPMSTInt0', 'H < 0' ) - !!return + !!return end if S = signum ( X ) XA = dabs ( X ) @@ -1074,7 +1074,7 @@ contains !********************************************************************** if ( XXX < 0.0d+00 ) then j = 1 XXXX = 0.0d+00 - !call PrintTPErrMsg () + !call PrintTPErrMsg () !write ( TPErrMsg, '(a,e20.10,a,e20.10,a,e20.10)' ) 'X < XMin, X=', XA, ', XMin=', XMin, ', H=', H !call Error ( 'TPMSTInt0', TPErrMsg ) else if ( XXX .ge. 1.0d+00 ) then @@ -1084,8 +1084,8 @@ contains !********************************************************************** XXXX = XXX j = 1 + int ( XXXX * TPMNX1 ) end if - G = S * CalcLinFun2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTG ) - F = S * CalcSpline2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTF, TPMSTFxx, TPMSTFyy, TPMSTFxxyy ) + G = S * CalcLinFun2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTG ) + F = S * CalcSpline2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTF, TPMSTFxx, TPMSTFyy, TPMSTFxxyy ) TPMSTInt0 = 1 end function TPMSTInt0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1109,10 +1109,10 @@ contains !********************************************************************** Fh = 0.0d+00 Fx = 0.0d+00 TPMSTInt1 = 2 - !call PrintTPErrMsg () + !call PrintTPErrMsg () !!call PrintStdLogMsg ( trim ( TPErrMsg ) ) !call Error ( 'TPMSTInt1', 'H < 0' ) - !!return + !!return end if S = signum ( X ) XA = dabs ( X ) @@ -1126,7 +1126,7 @@ contains !********************************************************************** j = 1 XXX = 0.0d+00 XXXX = 0.0d+00 - !call PrintTPErrMsg () + !call PrintTPErrMsg () !write ( TPErrMsg, '(a,e20.10,a,e20.10,a,e20.10)' ) 'X < XMin, X=', XA, ', XMin=', XMin, ', H=', H !call Error ( 'TPMSTInt', TPErrMsg ) else if ( XXX .ge. 1.0d+00 ) then @@ -1134,19 +1134,19 @@ contains !********************************************************************** XXX = 1.0d+00 XXXX = 1.0d+00 else - XXXX = XXX + XXXX = XXX j = 1 + int ( XXXX * TPMNX1 ) end if - G = S * CalcLinFun2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTG ) + G = S * CalcLinFun2_0 ( i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, TPMSTG ) call CalcSpline2_1 ( F, Fh, Fx, i, j, H, XXXX, TPMNH, TPMNX, TPMSTH, TPMSTX, & - TPMSTF, TPMSTFxx, TPMSTFyy, TPMSTFxxyy ) + TPMSTF, TPMSTFxx, TPMSTFyy, TPMSTFxxyy ) Fx = Fx / DX Fh = Fh - Fx * ( dXMaxdH * XXX + dXMindH * ( 1.0d+00 - XXX ) ) F = F * S Fh = Fh * S TPMSTInt1 = 1 end function TPMSTInt1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMSTPotential ( Q, U, X1, X2, H, cosA, CaseID ) !!!!!!!!!!!!!!!!!!! real(c_double), intent(out) :: Q, U real(c_double), intent(in) :: X1, X2, H, cosA @@ -1157,7 +1157,7 @@ contains !********************************************************************** if ( CaseID == MD_LINES_PAR ) then TPMSTPotential = TPMSTPInt0 ( Q, U, H ) U = U * ( X2 - X1 ) - return + return end if TPMSTPotential = 0 sinA = dsqrt ( 1.0d+00 - cosA * cosA ) @@ -1192,12 +1192,12 @@ contains !********************************************************************** F2(2) = - U Q = Q * DX U = U * DX - return + return end if sinA = dsqrt ( 1.0d+00 - cosA * cosA ) call TPMCa1 ( Ca, CaA, Ka, KaA, cosA, sinA ) - IntSign1 = TPMSTInt1 ( GG1, FF1, Fh1, Fx1, H, X1 * Ca ) + IntSign1 = TPMSTInt1 ( GG1, FF1, Fh1, Fx1, H, X1 * Ca ) IntSign2 = TPMSTInt1 ( GG2, FF2, Fh2, Fx2, H, X2 * Ca ) if ( ( IntSign1 .ne. 1 ) .and. ( IntSign2 .ne. 1 ) ) then Q = 0.0d+00 @@ -1205,11 +1205,11 @@ contains !********************************************************************** F1 = 0.0d+00 F2 = 0.0d+00 TPMSTForces = 0 - return + return end if - + call TPMCu1 ( Cu, CuH, CuA, H, cosA, sinA ) - + Q = Cu * ( GG2 - GG1 ) / Ca U = Cu * ( FF2 - FF1 ) / Ca @@ -1218,19 +1218,19 @@ contains !********************************************************************** D = CuH * U / Cu + Cu * ( Fh2 - Fh1 ) / Ca F1(0) = ( X2 * D - C ) / DX F2(0) = ( C - X1 * D ) / DX - + C = cosA * B D = ( CuA / Cu - CaA / Ca ) * U + CaA * Cu * ( X2 * Fx2 - X1 * Fx1 ) / Ca F1(1) = ( D - X2 * C ) / DX F2(1) = ( X1 * C - D ) / DX - + F1(2) = Cu * Fx1 F2(2) = - Cu * Fx2 - + TPMSTForces = 1 end function TPMSTForces !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - integer(c_int) function TPMSTForceTorque( Qi, Ui, Fi, Ti, Q, U, F, T, Psi, PsiA, Cap, L, H, cosA, CaseID ) + integer(c_int) function TPMSTForceTorque( Qi, Ui, Fi, Ti, Q, U, F, T, Psi, PsiA, Cap, L, H, cosA, CaseID ) real(c_double), intent(out) :: Qi, Ui, Fi, Ti, Q, U, F, T, Psi, PsiA, Cap real(c_double), intent(in) :: L, H, cosA integer(c_int), intent(in) :: CaseID @@ -1254,14 +1254,14 @@ contains !********************************************************************** Psi = 0.0d+00 PsiA = 0.0d+00 Cap = 0.0d+00 - return + return end if - + L2 = 0.5d+00 * L sinA = dsqrt ( 1.0d+00 - cosA * cosA ) call TPMCa1 ( Ca, CaA, Ka, KaA, cosA, sinA ) - IntSign = TPMSTInt1 ( GG, FF, Fh, Fx, H, L2 * Ca ) - IntSign = TPMSTInt1 ( GGi, FFi, Fhi, Fxi, H, TPMSTXmax ) + IntSign = TPMSTInt1 ( GG, FF, Fh, Fx, H, L2 * Ca ) + IntSign = TPMSTInt1 ( GGi, FFi, Fhi, Fxi, H, TPMSTXmax ) if ( IntSign .ne. 1 ) then Qi = 0.0d+00 Ui = 0.0d+00 @@ -1275,11 +1275,11 @@ contains !********************************************************************** PsiA = 0.0d+00 Cap = 0.0d+00 TPMSTForceTorque = 0 - return + return end if - + call TPMCu1 ( Cu, CuH, CuA, H, cosA, sinA ) - + Psi = Cu / Ca PsiA = ( CuA * Ca - Cu * CaA ) / Ca / Ca Cap = CuA / Cu - KaA / Ka - cosA / sinA @@ -1287,16 +1287,16 @@ contains !********************************************************************** Ui = 2.0d+00 * Psi * FFi Fi = - 2.0d+00 * ( CuH * FFi / Ca + Psi * Fhi ) Ti = - Cap * Ui - + Q = 2.0d+00 * Cu * GG / Ca U = 2.0d+00 * Cu * FF / Ca F = - 2.0d+00 * ( CuH * FF / Ca + Psi * Fh ) T = - 2.0d+00 * ( ( CuA * Ka - Cu * KaA ) / ( Ka * Ka * sinA ) - Cu * cosA / ( Ka * sinA * sinA ) ) * FF & - 2.0d+00 * Cu / ( Ka * sinA ) * Fx * L2 * ( KaA * sinA + Ka * cosA ) - + TPMSTForceTorque = 1 end function TPMSTForceTorque !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPMSTInit () !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double) :: X, Q, U, DX, DDX, XMin, XMax integer(c_int) :: i, j, k @@ -1307,7 +1307,7 @@ contains !********************************************************************** TPMSTDH12 = TPMSTH2 - TPMSTH1 TPMSTXmax = TPMHMax + TPMSTDelta DX = 1.0 / TPMNX1 - do j = 0, TPMNX1 + do j = 0, TPMNX1 TPMSTX(j) = DX * j end do do i = 0, TPMNH1 @@ -1323,7 +1323,7 @@ contains !********************************************************************** TPMSTF(i,0) = 0.0d+00 TPMSTFyy(i,0) = U TPMSTFyy(i,TPMNX1) = 0.0d+00 - do j = 1, TPMNX1 + do j = 1, TPMNX1 TPMSTG(i,j) = TPMSTG(i,j-1) TPMSTF(i,j) = TPMSTF(i,j-1) do k = 0, TPMSTNXS - 1 @@ -1334,18 +1334,18 @@ contains !********************************************************************** end do end do call CreateSpline2 ( 3, 3, 3, 3, TPMNH, TPMNX, TPMNMAX, TPMSTH, TPMSTX, TPMSTF, TPMSTFxx, & - TPMSTFyy, TPMSTFxxyy, FF, MM, DD, K0, K1, K2 ) + TPMSTFyy, TPMSTFxxyy, FF, MM, DD, K0, K1, K2 ) end subroutine TPMSTInit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !--------------------------------------------------------------------------------------------------- -! Interaction functions: They can be used for calculation of the potential and forces between a +! Interaction functions: They can be used for calculation of the potential and forces between a ! segment and an infinite or semi-infinite nanotube. !--------------------------------------------------------------------------------------------------- subroutine TPMSegmentForces ( F2_1, F2_2, F1_1, F1_2, R1_1, R1_2, R2, Laxis2, L2 ) !!!!!!!!! real(c_double), dimension(0:2), intent(out) :: F2_1, F2_2 real(c_double), dimension(0:2), intent(in) :: F1_1, F1_2, R1_1, R1_2, R2, Laxis2 - real(c_double), intent(in) :: L2 + real(c_double), intent(in) :: L2 !------------------------------------------------------------------------------------------- real(c_double), dimension(0:2) :: F, M, RR !------------------------------------------------------------------------------------------- @@ -1389,11 +1389,11 @@ contains !********************************************************************** L2 = S_V3norm3 ( Laxis2 ) Laxis1 = Laxis1 / L1 Laxis2 = Laxis2 / L2 - L1 = 0.5d+00 * L1 + L1 = 0.5d+00 * L1 L2 = 0.5d+00 * L2 if ( SType2 == 2 ) Laxis2 = - Laxis2 GeomID = LineLine ( H, cosA, D1, D2, L12, R1, Laxis1, R2, Laxis2, TPGeomPrec ) - + ! Angle switch if ( TPMASwitch == 0 ) then if ( GeomID == MD_LINES_PAR ) then @@ -1414,7 +1414,7 @@ contains !********************************************************************** SwitchID = 1 end if end if - + if ( SwitchID < 2 ) then D2 = D2 - L2 if ( SType2 == 0 ) then @@ -1429,14 +1429,14 @@ contains !********************************************************************** Ly = Ly * S if ( IntSigna > 0 ) then F1_1a = F1(0) * L12 + F1(1) * Ly + F1(2) * Laxis1 - F1_2a = F2(0) * L12 + F2(1) * Ly + F2(2) * Laxis1 + F1_2a = F2(0) * L12 + F2(1) * Ly + F2(2) * Laxis1 else F1_1a = 0.0d+00 F1_2a = 0.0d+00 end if end if - - if ( SwitchID > 0 ) then + + if ( SwitchID > 0 ) then if ( SType2 == 0 ) then call LinePoint ( H, L12, R2, Laxis2, R1 ) L12 = L12 - R1 @@ -1451,7 +1451,7 @@ contains !********************************************************************** else L12 = L12 / H F1_1b = F1(0) * L12 + F1(2) * Laxis1 - F1_2b = F2(0) * L12 + F2(2) * Laxis1 + F1_2b = F2(0) * L12 + F2(2) * Laxis1 end if else F1_1b = 0.0d+00 @@ -1480,7 +1480,7 @@ contains !********************************************************************** F1_2 = F1_2b Fd = Fdb TPMInteractionF = IntSignb - else + else W1 = 1.0d+00 - W Q = W * Qa + W1 * Qb U = W * Ua + W1 * Ub @@ -1490,7 +1490,7 @@ contains !********************************************************************** Fd = W * Fda + W1 * Fdb TPMInteractionF = 0 if ( IntSigna > 0 .or. IntSignb > 0 ) TPMInteractionF = 1 - end if + end if ! Calculation of forces for the complimentary tube if ( SType2 == 2 ) Laxis2 = - Laxis2 @@ -1510,7 +1510,7 @@ contains !********************************************************************** F2_1 = F2_1 - DR end if end function TPMInteractionF !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPMInteractionU ( Q, U, R1_1, R1_2, R2_1, R2_2, SType2 ) !!!!!!!!!!! real(c_double), intent(inout) :: Q, U real(c_double), dimension(0:2), intent(in) :: R1_1, R1_2, R2_1, R2_2 @@ -1560,7 +1560,7 @@ contains !********************************************************************** IntSigna = TPMSSTPotential ( Qa, Ua, D1 - L1, D1 + L1, H, cosA, D2 - L2, TPMNN ) end if end if - + if ( SwitchID > 0 ) then if ( Stype2 == 0 ) then call LinePoint ( H, L12, R2, Laxis2, R1 ) @@ -1573,7 +1573,7 @@ contains !********************************************************************** IntSignb = TPMSSTPotentialPar ( Qb, Ub, R1_1, Laxis1, R2_2, Laxis2, 2.0d+00 * L1, TPMNN ) end if end if - + if ( SwitchID == 0 ) then Q = Qa U = Ua @@ -1612,14 +1612,14 @@ contains !********************************************************************** D2 = 2.0d+00 * Delta do i = 0, 2 DD = - Delta - do j = 0 , 1 - RR = R1_1 + do j = 0 , 1 + RR = R1_1 RR(i) = RR(i) + DD IntSign = TPMInteractionU ( QQ, U1_1(j,i), RR, R1_2, R2_1, R2_2, SType2 ) - RR = R1_2 + RR = R1_2 RR(i) = RR(i) + DD IntSign = TPMInteractionU ( QQ, U1_2(j,i), R1_1, RR, R2_1, R2_2, SType2 ) - RR = R2_1 + RR = R2_1 RR(i) = RR(i) + DD; IntSign = TPMInteractionU ( QQ, U2_1(j,i), R1_1, R1_2, RR, R2_2, SType2 ) RR = R2_2 @@ -1635,7 +1635,7 @@ contains !********************************************************************** F2_2(i) = ( U2_2(0,i) - U2_2(1,i) ) / D2 end do end function TPMInteractionFNum !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Initialization !--------------------------------------------------------------------------------------------------- @@ -1643,10 +1643,10 @@ contains !********************************************************************** subroutine TPMInit ( ChiIndM, ChiIndN ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int), intent(in) :: ChiIndM, ChiIndN real(c_double) :: RT, DX - character*512 :: PDate + character(len=512) :: PDate !------------------------------------------------------------------------------------------- TPPotType = TP_POT_MONO_R - + ! Here we calculate the radius of nanotubes RT = TPBAcc * sqrt ( 3.0d+00 * ( ChiIndM * ChiIndM + ChiIndN * ChiIndN + ChiIndM * ChiIndN ) ) / M_2PI @@ -1661,7 +1661,7 @@ contains !********************************************************************** TPMHmax = TPMR1 + TPMR2 + TPBRcutoff TPMDH = TPMHmax / TPMNH1 - + ! Parameters of the angle switch TPMASMin = sqr ( cos ( rad ( TPMAS ) ) ) TPMASMax = 1.0d+00 - TPGeomPrec @@ -1669,30 +1669,29 @@ contains !********************************************************************** if ( TPMStartMode == 1 ) then TPMUnitID = OpenFile ( TPMFile, 'rt', '' ) - read ( unit = TPMUnitID, fmt = '()' ) - read ( unit = TPMUnitID, fmt = '()' ) - read ( unit = TPMUnitID, fmt = '()' ) + read ( unit = TPMUnitID, fmt = '()' ) + read ( unit = TPMUnitID, fmt = '()' ) + read ( unit = TPMUnitID, fmt = '()' ) else TPMUnitID = OpenFile ( TPMFile, 'wt', '' ) - call fdate( PDate ) - write ( unit = TPMUnitID, fmt = '(a,a)' ) 'DATE ', PDate + write ( unit = TPMUnitID, fmt = '(a,a)' ) 'DATE (unknown)' write ( unit = TPMUnitID, fmt = '(a,i3,a,i3,a)' ) & 'Tabulated data of the tubular potential for (', ChiIndM, ',', ChiIndN, ') CNTs' write ( unit = TPMUnitID, fmt = '(a)' ) & 'A. N. Volkov, L. V. Zhigilei, J. Phys. Chem. C 114, 5513-5531, 2010. doi: 10.1021/jp906142h' end if - + call TPMSSTPInit () - + call TPMSTPInit () - + DX = TPMR1 + TPMR2 + TPBRcutoff - call TPMAInit ( - DX, DX, - DX, DX ) - + call TPMAInit ( - DX, DX, - DX, DX ) + call TPMSTInit () call CloseFile ( TPMUnitID ) - + end subroutine TPMInit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + end module TubePotMono !**************************************************************************** diff --git a/lib/mesont/TubePotTrue.f90 b/lib/mesont/TubePotTrue.f90 index 2cb300cc32..98e7450a99 100644 --- a/lib/mesont/TubePotTrue.f90 +++ b/lib/mesont/TubePotTrue.f90 @@ -9,9 +9,9 @@ ! the GNU General Public License. ! ! See the README file in the top-level LAMMPS directory. -! +! ! Contributing author: Alexey N. Volkov, UA, avolkov1@ua.edu -!------------------------------------------------------------------------- +!------------------------------------------------------------------------- module TubePotTrue !******************************************************************************** ! @@ -25,8 +25,8 @@ module TubePotTrue !************************************************************ ! !--------------------------------------------------------------------------------------------------- ! -! This module implements calculation of the true potential and transfer functions for interaction -! between two cylinder segments of nanotubes by direct integration over the surfaces of both +! This module implements calculation of the true potential and transfer functions for interaction +! between two cylinder segments of nanotubes by direct integration over the surfaces of both ! segments. ! !*************************************************************************************************** @@ -55,15 +55,15 @@ implicit none integer(c_int) :: NX, NE ! Number of nodes for numerical integration real(c_double) :: DX, DE ! Spacings real(c_double), dimension(0:2,0:2) :: M ! Transformation matrix - real(c_double), dimension(0:TPTNXMAX-1,0:TPTNXMAX-1,0:2) :: Rtab! Node coordinates + real(c_double), dimension(0:TPTNXMAX-1,0:TPTNXMAX-1,0:2) :: Rtab! Node coordinates end type TPTSEG !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !--------------------------------------------------------------------------------------------------- ! Global variables !--------------------------------------------------------------------------------------------------- - + type(TPTSEG) :: TPTSeg1, TPTSeg2 ! Two segments - + contains !****************************************************************************************** subroutine TPTSegAxisVector ( S, Laxis ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -96,11 +96,11 @@ contains !********************************************************************** !------------------------------------------------------------------------------------------- call TPTSegAxisVector ( S, Laxis ) call TPTSegRadVector ( S, Lrad, Eps ) - R(0) = S%X + X * Laxis(0) + S%R * Lrad(0) + R(0) = S%X + X * Laxis(0) + S%R * Lrad(0) R(1) = S%Y + X * Laxis(1) + S%R * Lrad(1) R(2) = S%Z + X * Laxis(2) + S%R * Lrad(2) end subroutine TPTRadiusVector !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPTCalcSegNodeTable ( S ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! type(TPTSEG), intent(inout) :: S !------------------------------------------------------------------------------------------- @@ -111,7 +111,7 @@ contains !********************************************************************** call RotationMatrix3 ( S%M, S%Psi, S%Theta, S%Phi ) do i = 0, S%NX - 1 Eps = 0.0d+00 - do j = 0, S%NE - 1 + do j = 0, S%NE - 1 call TPTRadiusVector ( S, S%Rtab(i,j,0:2), X, Eps ) Eps = Eps + S%DE end do @@ -133,12 +133,12 @@ contains !********************************************************************** S%Z = Rcenter(2) call TPTCalcSegNodeTable ( S ) end subroutine TPTSetSegPosition1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + subroutine TPTSetSegPosition2 ( S, R1, R2 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! type(TPTSEG), intent(inout) :: S real(c_double), dimension(0:2), intent(in) :: R1, R2 !------------------------------------------------------------------------------------------- - real(c_double), dimension(0:2) :: R, Laxis + real(c_double), dimension(0:2) :: R, Laxis real(c_double) :: L !------------------------------------------------------------------------------------------- R = 0.5 * ( R1 + R2 ) @@ -147,7 +147,7 @@ contains !********************************************************************** Laxis = Laxis / L call TPTSetSegPosition1 ( S, R, Laxis, L ) end subroutine TPTSetSegPosition2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPTCheckIntersection ( S1, S2 ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! type(TPTSEG), intent(in) :: S1, S2 !------------------------------------------------------------------------------------------- @@ -193,7 +193,7 @@ contains !********************************************************************** Xmin = 0.0d+00 Xmax = 0.0d+00 TPTCalcPointRange = 0 - return + return end if Distance = sqrt ( TPBRcutoff * TPBRcutoff - Distance * Distance ) Xmin = Displacement - Distance @@ -218,13 +218,13 @@ contains !********************************************************************** R2_2(1) = - X2_2 * sin ( A ) R2_2(2) = X2_2 * cos ( A ) end subroutine TPTGetEnds !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Tubular potential !--------------------------------------------------------------------------------------------------- - + integer(c_int) function TPTPointPotential ( Q, U, F, R, S ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! This function returns the potential U and force F applied to an atom in position R and + ! This function returns the potential U and force F applied to an atom in position R and ! produced by the segment S. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U @@ -243,7 +243,7 @@ contains !********************************************************************** F = 0.0d+00 if ( TPTCalcPointRange ( S, Xmin, Xmax, R ) == 0 ) return X = - S%L / 2.0 - do i = 0, S%NX - 1 + do i = 0, S%NX - 1 if ( X > Xmin .and. X < Xmax ) then QQ = 0.0d+00 UU = 0.0d+00 @@ -264,7 +264,7 @@ contains !********************************************************************** Q = Q + 0.5d+00 * QQ U = U + 0.5d+00 * UU F = F + 0.5d+00 * FF - else + else Q = Q + QQ U = U + UU F = F + FF @@ -279,7 +279,7 @@ contains !********************************************************************** end function TPTPointPotential !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int) function TPTSectionPotential ( Q, U, F, M, S, i, Ssource ) !!!!!!!!!!!!!!!!!! - ! This function returns the potential U, force F and torque M produced by the segment Ssource + ! This function returns the potential U, force F and torque M produced by the segment Ssource ! and applied to the i-th circular cross-section of the segment S. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U @@ -290,7 +290,7 @@ contains !********************************************************************** integer(c_int) :: j real(c_double), dimension(0:2) :: R, Fp, Mp, Lrad real(c_double) :: Qp, Up, Eps - real(c_double) :: Coeff + real(c_double) :: Coeff !------------------------------------------------------------------------------------------- TPTSectionPotential = 0 Q = 0.0d+00 @@ -321,7 +321,7 @@ contains !********************************************************************** end function TPTSectionPotential !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer(c_int) function TPTSegmentPotential ( Q, U, F, M, S, Ssource ) !!!!!!!!!!!!!!!!!!!!!! - ! This function returns the potential U, force F and torque M produced by the segment + ! This function returns the potential U, force F and torque M produced by the segment ! Ssource and applied to the segment S. !------------------------------------------------------------------------------------------- real(c_double), intent(out) :: Q, U @@ -340,7 +340,7 @@ contains !********************************************************************** TPTSegmentPotential = 2 return end if - do i = 0, S%NX - 1 + do i = 0, S%NX - 1 if ( TPTSectionPotential ( Qc, Uc, Fc, Mc, S, i, Ssource ) == 1 ) then if ( i == 0 .or. i == S%NX - 1 ) then Q = Q + 0.5d+00 * Qc @@ -355,17 +355,17 @@ contains !********************************************************************** end if TPTSegmentPotential = 1 end if - end do + end do Q = Q * S%DX U = U * S%DX F = F * S%DX M = M * S%DX end function TPTSegmentPotential !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + !--------------------------------------------------------------------------------------------------- ! Forces !--------------------------------------------------------------------------------------------------- - + subroutine TPTSegmentForces ( F1, F2, F, M, Laxis, L ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), dimension(0:2), intent(out) :: F1, F2 real(c_double), dimension(0:2), intent(in) :: F, M, Laxis @@ -376,10 +376,10 @@ contains !********************************************************************** FF = 0.5d+00 * F MM = M / L call V3_V3xxV3 ( FFF, MM, Laxis ) - F1 = FF - FFF - F2 = FF + FFF + F1 = FF - FFF + F2 = FF + FFF end subroutine TPTSegmentForces !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - + integer(c_int) function TPTInteractionF ( Q, U, F1_1, F1_2, F2_1, F2_2, R1_1, R1_2, R2_1, R2_2 ) ! This function returns the potential and forces applied to the ends of segments. !------------------------------------------------------------------------------------------- @@ -413,7 +413,7 @@ contains !********************************************************************** !--------------------------------------------------------------------------------------------------- ! Initialization !--------------------------------------------------------------------------------------------------- - + subroutine TPTInit ( R1, R2, NX, NE ) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! real(c_double), intent(in) :: R1, R2 integer(c_int), intent(in) :: NX, NE diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 43070c5156..6f07d1dc1c 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -47,6 +47,7 @@ using namespace InterLayer; #define PGDELTA 1 static const char cite_ilp[] = + "ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" @@ -482,7 +483,7 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */) double dprodnorm1[3] = {0.0, 0.0, 0.0}; double fp1[3] = {0.0, 0.0, 0.0}; double fprod1[3] = {0.0, 0.0, 0.0}; - double delkj[3] = {0.0, 0.0, 0.0}; + double delki[3] = {0.0, 0.0, 0.0}; double fk[3] = {0.0, 0.0, 0.0}; inum = list->inum; @@ -588,12 +589,12 @@ void PairILPGrapheneHBN::calc_FRep(int eflag, int /* vflag */) f[k][0] += fk[0]; f[k][1] += fk[1]; f[k][2] += fk[2]; - delkj[0] = x[k][0] - x[j][0]; - delkj[1] = x[k][1] - x[j][1]; - delkj[2] = x[k][2] - x[j][2]; + delki[0] = x[k][0] - x[i][0]; + delki[1] = x[k][1] - x[i][1]; + delki[2] = x[k][2] - x[i][2]; if (evflag) - ev_tally_xyz(k, j, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delkj[0], - delkj[1], delkj[2]); + ev_tally_xyz(k, i, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delki[0], + delki[1], delki[2]); } if (eflag) pvector[1] += evdwl = Tap * Vilp; diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index e8db858218..f724b4d819 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -47,6 +47,7 @@ using namespace InterLayer; #define PGDELTA 1 static const char cite_kc[] = + "kolmogorov/crespi/full potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" @@ -478,7 +479,7 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */) double dprodnorm1[3] = {0.0, 0.0, 0.0}; double fp1[3] = {0.0, 0.0, 0.0}; double fprod1[3] = {0.0, 0.0, 0.0}; - double delkj[3] = {0.0, 0.0, 0.0}; + double delki[3] = {0.0, 0.0, 0.0}; double fk[3] = {0.0, 0.0, 0.0}; inum = list->inum; @@ -585,12 +586,12 @@ void PairKolmogorovCrespiFull::calc_FRep(int eflag, int /* vflag */) f[k][0] += fk[0]; f[k][1] += fk[1]; f[k][2] += fk[2]; - delkj[0] = x[k][0] - x[j][0]; - delkj[1] = x[k][1] - x[j][1]; - delkj[2] = x[k][2] - x[j][2]; + delki[0] = x[k][0] - x[i][0]; + delki[1] = x[k][1] - x[i][1]; + delki[2] = x[k][2] - x[i][2]; if (evflag) - ev_tally_xyz(k, j, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delkj[0], - delkj[1], delkj[2]); + ev_tally_xyz(k, j, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delki[0], + delki[1], delki[2]); } if (eflag) { diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp index d172d4e9bf..8f219656b7 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.cpp @@ -28,6 +28,7 @@ #include "error.h" #include "force.h" #include "memory.h" +#include "neighbor.h" #include "neigh_list.h" #include "potential_file_reader.h" #include "tokenizer.h" @@ -158,7 +159,18 @@ void PairKolmogorovCrespiZ::compute(int eflag, int vflag) if (eflag) { evdwl = -p.A * p.z06 / r6 + exp1 * sumCff - offset[itype][jtype]; } if (evflag) { - ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0, fsum, fsum, fpair, delx, dely, delz); + ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); + if (vflag_either) { + double fi[3],fj[3]; + fi[0] = delx * fpair1; + fi[1] = dely * fpair1; + fi[2] = 0; + fj[0] = -delx * fpair1; + fj[1] = -dely * fpair1; + fj[2] = 0; + v_tally2_newton(i,fi,x[i]); + v_tally2_newton(j,fj,x[j]); + } } } } @@ -228,6 +240,18 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairKolmogorovCrespiZ::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR,"Pair style kolmogorov/crespi/z requires newton pair on"); + + neighbor->request(this,instance_me); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.h b/src/INTERLAYER/pair_kolmogorov_crespi_z.h index fc07dcb96e..dc73f838a2 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.h +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.h @@ -32,6 +32,7 @@ class PairKolmogorovCrespiZ : public Pair { virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); + void init_style(); double init_one(int, int); static constexpr int NPARAMS_PER_LINE = 11; diff --git a/src/INTERLAYER/pair_lebedeva_z.cpp b/src/INTERLAYER/pair_lebedeva_z.cpp index 76f56e402c..cd788fdba6 100644 --- a/src/INTERLAYER/pair_lebedeva_z.cpp +++ b/src/INTERLAYER/pair_lebedeva_z.cpp @@ -30,6 +30,7 @@ #include "error.h" #include "force.h" #include "memory.h" +#include "neighbor.h" #include "neigh_list.h" #include "potential_file_reader.h" #include "tokenizer.h" @@ -137,16 +138,16 @@ void PairLebedevaZ::compute(int eflag, int vflag) // derivatives fpair = -6.0*p.A*p.z06/r8+p.B*p.alpha*exp1/r; // used for x,y,z der = p.D1+2*p.D2*rhosq-p.lambda1*sumD; // used for x,y - fxy = fpair - 2*p.C*exp2*exp3*der; - fz = fpair + 2*p.C*p.lambda2*sumD*exp2*exp3; + fxy = 2*p.C*exp2*exp3*der; + fz = 2*p.C*p.lambda2*sumD*exp2*exp3; - f[i][0] += delx*fxy; - f[i][1] += dely*fxy; - f[i][2] += delz*fz; + f[i][0] += delx*(fpair-fxy); + f[i][1] += dely*(fpair-fxy); + f[i][2] += delz*(fpair+fz); if (newton_pair || j < nlocal) { - f[j][0] -= delx*fxy; - f[j][1] -= dely*fxy; - f[j][2] -= delz*fz; + f[j][0] -= delx*(fpair-fxy); + f[j][1] -= dely*(fpair-fxy); + f[j][2] -= delz*(fpair+fz); } if (eflag) { @@ -154,8 +155,18 @@ void PairLebedevaZ::compute(int eflag, int vflag) } if (evflag) { - ev_tally_xyz(i,j,nlocal,newton_pair,evdwl,0, - -fxy,-fxy,-fz,delx,dely,delz); + ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); + if (vflag_either) { + double fi[3],fj[3]; + fi[0] = -delx * fxy; + fi[1] = -dely * fxy; + fi[2] = delz * fz; + fj[0] = delx * fxy; + fj[1] = dely * fxy; + fj[2] = -delz * fz; + v_tally2_newton(i,fi,x[i]); + v_tally2_newton(j,fj,x[j]); + } } } } @@ -226,6 +237,18 @@ void PairLebedevaZ::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairLebedevaZ::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR,"Pair style lebedeva/z requires newton pair on"); + + neighbor->request(this,instance_me); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_lebedeva_z.h b/src/INTERLAYER/pair_lebedeva_z.h index 9b2fbd56f8..9b715b185d 100644 --- a/src/INTERLAYER/pair_lebedeva_z.h +++ b/src/INTERLAYER/pair_lebedeva_z.h @@ -32,6 +32,7 @@ class PairLebedevaZ : public Pair { virtual void compute(int, int); void settings(int, char **); void coeff(int, char **); + void init_style(); double init_one(int, int); static constexpr int NPARAMS_PER_LINE = 12; diff --git a/src/KOKKOS/pair_snap_kokkos.h b/src/KOKKOS/pair_snap_kokkos.h index d9e15afd54..bd56d87f59 100644 --- a/src/KOKKOS/pair_snap_kokkos.h +++ b/src/KOKKOS/pair_snap_kokkos.h @@ -44,7 +44,8 @@ struct TagPairSNAPComputeForce{}; struct TagPairSNAPComputeNeigh{}; struct TagPairSNAPComputeCayleyKlein{}; struct TagPairSNAPPreUi{}; -struct TagPairSNAPComputeUi{}; +struct TagPairSNAPComputeUiSmall{}; // more parallelism, more divergence +struct TagPairSNAPComputeUiLarge{}; // less parallelism, no divergence struct TagPairSNAPTransformUi{}; // re-order ulisttot from SoA to AoSoA, zero ylist struct TagPairSNAPComputeZi{}; struct TagPairSNAPBeta{}; @@ -53,7 +54,9 @@ struct TagPairSNAPTransformBi{}; // re-order blist from AoSoA to AoS struct TagPairSNAPComputeYi{}; struct TagPairSNAPComputeYiWithZlist{}; template -struct TagPairSNAPComputeFusedDeidrj{}; +struct TagPairSNAPComputeFusedDeidrjSmall{}; // more parallelism, more divergence +template +struct TagPairSNAPComputeFusedDeidrjLarge{}; // less parallelism, no divergence // CPU backend only struct TagPairSNAPComputeNeighCPU{}; @@ -143,7 +146,10 @@ public: void operator() (TagPairSNAPPreUi,const int iatom_mod, const int j, const int iatom_div) const; KOKKOS_INLINE_FUNCTION - void operator() (TagPairSNAPComputeUi,const typename Kokkos::TeamPolicy::member_type& team) const; + void operator() (TagPairSNAPComputeUiSmall,const typename Kokkos::TeamPolicy::member_type& team) const; + + KOKKOS_INLINE_FUNCTION + void operator() (TagPairSNAPComputeUiLarge,const typename Kokkos::TeamPolicy::member_type& team) const; KOKKOS_INLINE_FUNCTION void operator() (TagPairSNAPTransformUi,const int iatom_mod, const int j, const int iatom_div) const; @@ -168,7 +174,11 @@ public: template KOKKOS_INLINE_FUNCTION - void operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy >::member_type& team) const; + void operator() (TagPairSNAPComputeFusedDeidrjSmall,const typename Kokkos::TeamPolicy >::member_type& team) const; + + template + KOKKOS_INLINE_FUNCTION + void operator() (TagPairSNAPComputeFusedDeidrjLarge,const typename Kokkos::TeamPolicy >::member_type& team) const; // CPU backend only KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index 30a4082711..e66f490f8a 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -341,18 +341,32 @@ void PairSNAPKokkos::compute(int eflag_in, // ComputeUi w/vector parallelism, shared memory, direct atomicAdd into ulisttot { // team_size_compute_ui is defined in `pair_snap_kokkos.h` - // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer const int tile_size = vector_length * (twojmax + 1); const int scratch_size = scratch_size_helper(team_size_compute_ui * tile_size); - // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) - const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); - const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; + if (chunk_size < parallel_thresh) + { + // Version with parallelism over j_bend - SnapAoSoATeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); - policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); - Kokkos::parallel_for("ComputeUi",policy_ui,*this); + // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) + const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); + const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; + + SnapAoSoATeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); + policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeUiSmall",policy_ui,*this); + } else { + // Version w/out parallelism over j_bend + + // total number of teams needed: (natoms / 32) * (max_neighs) + const int n_teams = chunk_size_div * max_neighs; + const int n_teams_div = (n_teams + team_size_compute_ui - 1) / team_size_compute_ui; + + SnapAoSoATeamPolicy policy_ui(n_teams_div, team_size_compute_ui, vector_length); + policy_ui = policy_ui.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeUiLarge",policy_ui,*this); + } } //TransformUi: un-"fold" ulisttot, zero ylist @@ -412,25 +426,51 @@ void PairSNAPKokkos::compute(int eflag_in, const int tile_size = vector_length * (twojmax + 1); const int scratch_size = scratch_size_helper(2 * team_size_compute_fused_deidrj * tile_size); - // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) - const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); - const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; + if (chunk_size < parallel_thresh) + { + // Version with parallelism over j_bend - // x direction - SnapAoSoATeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); - policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); - Kokkos::parallel_for("ComputeFusedDeidrj<0>",policy_fused_deidrj_x,*this); + // total number of teams needed: (natoms / 32) * (max_neighs) * ("bend" locations) + const int n_teams = chunk_size_div * max_neighs * (twojmax + 1); + const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; - // y direction - SnapAoSoATeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); - policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); - Kokkos::parallel_for("ComputeFusedDeidrj<1>",policy_fused_deidrj_y,*this); + // x direction + SnapAoSoATeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjSmall<0>",policy_fused_deidrj_x,*this); - // z direction - SnapAoSoATeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); - policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); - Kokkos::parallel_for("ComputeFusedDeidrj<2>",policy_fused_deidrj_z,*this); + // y direction + SnapAoSoATeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjSmall<1>",policy_fused_deidrj_y,*this); + // z direction + SnapAoSoATeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjSmall<2>",policy_fused_deidrj_z,*this); + } else { + // Version w/out parallelism over j_bend + + // total number of teams needed: (natoms / 32) * (max_neighs) + const int n_teams = chunk_size_div * max_neighs; + const int n_teams_div = (n_teams + team_size_compute_fused_deidrj - 1) / team_size_compute_fused_deidrj; + + // x direction + SnapAoSoATeamPolicy > policy_fused_deidrj_x(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_x = policy_fused_deidrj_x.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjLarge<0>",policy_fused_deidrj_x,*this); + + // y direction + SnapAoSoATeamPolicy > policy_fused_deidrj_y(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_y = policy_fused_deidrj_y.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjLarge<1>",policy_fused_deidrj_y,*this); + + // z direction + SnapAoSoATeamPolicy > policy_fused_deidrj_z(n_teams_div,team_size_compute_fused_deidrj,vector_length); + policy_fused_deidrj_z = policy_fused_deidrj_z.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); + Kokkos::parallel_for("ComputeFusedDeidrjLarge<2>",policy_fused_deidrj_z,*this); + + } } #endif // LMP_KOKKOS_GPU @@ -603,13 +643,13 @@ void PairSNAPKokkos::operator() (TagPairSN for (int icoeff = 0; icoeff < ncoeff; icoeff++) { const auto idxb = icoeff % idxb_max; const auto idx_chem = icoeff / idxb_max; - auto bveci = my_sna.blist(idxb, idx_chem, ii); + real_type bveci = my_sna.blist(ii, idx_chem, idxb); d_beta_pack(iatom_mod,icoeff,iatom_div) += d_coeffi[k]*bveci; k++; for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { const auto jdxb = jcoeff % idxb_max; const auto jdx_chem = jcoeff / idxb_max; - real_type bvecj = my_sna.blist(jdxb, jdx_chem, ii); + real_type bvecj = my_sna.blist(ii, jdx_chem, jdxb); d_beta_pack(iatom_mod,icoeff,iatom_div) += d_coeffi[k]*bvecj; d_beta_pack(iatom_mod,jcoeff,iatom_div) += d_coeffi[k]*bveci; k++; @@ -736,7 +776,7 @@ void PairSNAPKokkos::operator() (TagPairSN template KOKKOS_INLINE_FUNCTION -void PairSNAPKokkos::operator() (TagPairSNAPComputeUi,const typename Kokkos::TeamPolicy::member_type& team) const { +void PairSNAPKokkos::operator() (TagPairSNAPComputeUiSmall,const typename Kokkos::TeamPolicy::member_type& team) const { SNAKokkos my_sna = snaKK; // extract flattened atom_div / neighbor number / bend location @@ -756,11 +796,37 @@ void PairSNAPKokkos::operator() (TagPairSN const int ninside = d_ninside(ii); if (jj >= ninside) return; - my_sna.compute_ui(team,iatom_mod, jbend, jj, iatom_div); + my_sna.compute_ui_small(team, iatom_mod, jbend, jj, iatom_div); }); } +template +KOKKOS_INLINE_FUNCTION +void PairSNAPKokkos::operator() (TagPairSNAPComputeUiLarge,const typename Kokkos::TeamPolicy::member_type& team) const { + SNAKokkos my_sna = snaKK; + + // extract flattened atom_div / neighbor number / bend location + int flattened_idx = team.team_rank() + team.league_rank() * team_size_compute_ui; + + // extract neighbor index, iatom_div + int iatom_div = flattened_idx / max_neighs; // removed "const" to work around GCC 7 bug + int jj = flattened_idx - iatom_div * max_neighs; + + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team, vector_length), + [&] (const int iatom_mod) { + const int ii = iatom_mod + vector_length * iatom_div; + if (ii >= chunk_size) return; + + const int ninside = d_ninside(ii); + if (jj >= ninside) return; + + my_sna.compute_ui_large(team,iatom_mod, jj, iatom_div); + }); + +} + + template KOKKOS_INLINE_FUNCTION void PairSNAPKokkos::operator() (TagPairSNAPTransformUi,const int iatom_mod, const int idxu, const int iatom_div) const { @@ -861,9 +927,9 @@ void PairSNAPKokkos::operator() (TagPairSN for (int itriple = 0; itriple < ntriples; itriple++) { - const auto blocal = my_sna.blist_pack(iatom_mod, idxb, itriple, iatom_div); + const real_type blocal = my_sna.blist_pack(iatom_mod, idxb, itriple, iatom_div); - my_sna.blist(idxb, itriple, iatom) = blocal; + my_sna.blist(iatom, itriple, idxb) = blocal; } } @@ -871,7 +937,7 @@ void PairSNAPKokkos::operator() (TagPairSN template template KOKKOS_INLINE_FUNCTION -void PairSNAPKokkos::operator() (TagPairSNAPComputeFusedDeidrj,const typename Kokkos::TeamPolicy >::member_type& team) const { +void PairSNAPKokkos::operator() (TagPairSNAPComputeFusedDeidrjSmall,const typename Kokkos::TeamPolicy >::member_type& team) const { SNAKokkos my_sna = snaKK; // extract flattened atom_div / neighbor number / bend location @@ -891,12 +957,38 @@ void PairSNAPKokkos::operator() (TagPairSN const int ninside = d_ninside(ii); if (jj >= ninside) return; - my_sna.template compute_fused_deidrj(team, iatom_mod, jbend, jj, iatom_div); + my_sna.template compute_fused_deidrj_small(team, iatom_mod, jbend, jj, iatom_div); }); } +template +template +KOKKOS_INLINE_FUNCTION +void PairSNAPKokkos::operator() (TagPairSNAPComputeFusedDeidrjLarge,const typename Kokkos::TeamPolicy >::member_type& team) const { + SNAKokkos my_sna = snaKK; + + // extract flattened atom_div / neighbor number / bend location + int flattened_idx = team.team_rank() + team.league_rank() * team_size_compute_fused_deidrj; + + // extract neighbor index, iatom_div + int iatom_div = flattened_idx / max_neighs; // removed "const" to work around GCC 7 bug + int jj = flattened_idx - max_neighs * iatom_div; + + Kokkos::parallel_for(Kokkos::ThreadVectorRange(team, vector_length), + [&] (const int iatom_mod) { + const int ii = iatom_mod + vector_length * iatom_div; + if (ii >= chunk_size) return; + + const int ninside = d_ninside(ii); + if (jj >= ninside) return; + + my_sna.template compute_fused_deidrj_large(team, iatom_mod, jj, iatom_div); + + }); +} + /* ---------------------------------------------------------------------- Begin routines that are unique to the CPU codepath. These do not take advantage of AoSoA data layouts, but that could be a good point of @@ -925,13 +1017,13 @@ void PairSNAPKokkos::operator() (TagPairSN for (int icoeff = 0; icoeff < ncoeff; icoeff++) { const auto idxb = icoeff % idxb_max; const auto idx_chem = icoeff / idxb_max; - auto bveci = my_sna.blist(idxb,idx_chem,ii); + real_type bveci = my_sna.blist(ii,idx_chem,idxb); d_beta(icoeff,ii) += d_coeffi[k]*bveci; k++; for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { const auto jdxb = jcoeff % idxb_max; const auto jdx_chem = jcoeff / idxb_max; - auto bvecj = my_sna.blist(jdxb,jdx_chem,ii); + real_type bvecj = my_sna.blist(ii,jdx_chem,jdxb); d_beta(icoeff,ii) += d_coeffi[k]*bvecj; d_beta(jcoeff,ii) += d_coeffi[k]*bveci; k++; @@ -1221,7 +1313,7 @@ void PairSNAPKokkos::operator() (TagPairSN for (int icoeff = 0; icoeff < ncoeff; icoeff++) { const auto idxb = icoeff % idxb_max; const auto idx_chem = icoeff / idxb_max; - evdwl += d_coeffi[icoeff+1]*my_sna.blist(idxb,idx_chem,ii); + evdwl += d_coeffi[icoeff+1]*my_sna.blist(ii,idx_chem,idxb); } // quadratic contributions @@ -1230,12 +1322,12 @@ void PairSNAPKokkos::operator() (TagPairSN for (int icoeff = 0; icoeff < ncoeff; icoeff++) { const auto idxb = icoeff % idxb_max; const auto idx_chem = icoeff / idxb_max; - auto bveci = my_sna.blist(idxb,idx_chem,ii); + real_type bveci = my_sna.blist(ii,idx_chem,idxb); evdwl += 0.5*d_coeffi[k++]*bveci*bveci; for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { auto jdxb = jcoeff % idxb_max; auto jdx_chem = jcoeff / idxb_max; - auto bvecj = my_sna.blist(jdxb,jdx_chem,ii); + auto bvecj = my_sna.blist(ii,jdx_chem,jdxb); evdwl += d_coeffi[k++]*bveci*bvecj; } } diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h index cb7b1b3cc0..0bcb07285c 100644 --- a/src/KOKKOS/sna_kokkos.h +++ b/src/KOKKOS/sna_kokkos.h @@ -45,12 +45,12 @@ struct WignerWrapper { { ; } KOKKOS_INLINE_FUNCTION - complex get(const int& ma) { + complex get(const int& ma) const { return complex(buffer[offset + 2 * vector_length * ma], buffer[offset + vector_length + 2 * vector_length * ma]); } KOKKOS_INLINE_FUNCTION - void set(const int& ma, const complex& store) { + void set(const int& ma, const complex& store) const { buffer[offset + 2 * vector_length * ma] = store.re; buffer[offset + vector_length + 2 * vector_length * ma] = store.im; } @@ -122,8 +122,14 @@ inline void compute_cayley_klein(const int&, const int&, const int&); KOKKOS_INLINE_FUNCTION void pre_ui(const int&, const int&, const int&, const int&); // ForceSNAP + + // version of the code with parallelism over j_bend KOKKOS_INLINE_FUNCTION - void compute_ui(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int, const int); // ForceSNAP + void compute_ui_small(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int, const int); // ForceSNAP + // version of the code without parallelism over j_bend + KOKKOS_INLINE_FUNCTION + void compute_ui_large(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int); // ForceSNAP + KOKKOS_INLINE_FUNCTION void compute_zi(const int&, const int&, const int&); // ForceSNAP KOKKOS_INLINE_FUNCTION @@ -135,6 +141,35 @@ inline KOKKOS_INLINE_FUNCTION void compute_bi(const int&, const int&, const int&); // ForceSNAP + // functions for derivatives, GPU only + // version of the code with parallelism over j_bend + template + KOKKOS_INLINE_FUNCTION + void compute_fused_deidrj_small(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int, const int); //ForceSNAP + // version of the code without parallelism over j_bend + template + KOKKOS_INLINE_FUNCTION + void compute_fused_deidrj_large(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int); //ForceSNAP + + // core "evaluation" functions that get plugged into "compute" functions + // plugged into compute_ui_small, compute_ui_large + KOKKOS_FORCEINLINE_FUNCTION + void evaluate_ui_jbend(const WignerWrapper&, const complex&, const complex&, const real_type&, const int&, + const int&, const int&, const int&); + // plugged into compute_zi, compute_yi + KOKKOS_FORCEINLINE_FUNCTION + complex evaluate_zi(const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, + const int&, const int&, const int&, const int&, const real_type*); + // plugged into compute_yi, compute_yi_with_zlist + KOKKOS_FORCEINLINE_FUNCTION + real_type evaluate_beta_scaled(const int&, const int&, const int&, const int&, const int&, const int&, const int&, const int&, + const Kokkos::View &); + // plugged into compute_fused_deidrj_small, compute_fused_deidrj_large + KOKKOS_FORCEINLINE_FUNCTION + real_type evaluate_duidrj_jbend(const WignerWrapper&, const complex&, const complex&, const real_type&, + const WignerWrapper&, const complex&, const complex&, const real_type&, + const int&, const int&, const int&, const int&); + // functions for bispectrum coefficients, CPU only KOKKOS_INLINE_FUNCTION void pre_ui_cpu(const typename Kokkos::TeamPolicy::member_type& team,const int&,const int&); // ForceSNAP @@ -148,11 +183,6 @@ inline KOKKOS_INLINE_FUNCTION void compute_bi_cpu(const typename Kokkos::TeamPolicy::member_type& team, int); // ForceSNAP - // functions for derivatives, GPU only - template - KOKKOS_INLINE_FUNCTION - void compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int, const int, const int, const int); //ForceSNAP - // functions for derivatives, CPU only KOKKOS_INLINE_FUNCTION void compute_duidrj_cpu(const typename Kokkos::TeamPolicy::member_type& team, int, int); //ForceSNAP @@ -168,23 +198,6 @@ inline KOKKOS_INLINE_FUNCTION void compute_s_dsfac(const real_type, const real_type, real_type&, real_type&); // compute_cayley_klein - static KOKKOS_FORCEINLINE_FUNCTION - void sincos_wrapper(double x, double* sin_, double *cos_) { -#ifdef __SYCL_DEVICE_ONLY__ - *sin_ = sycl::sincos(x, cos_); -#else - sincos(x, sin_, cos_); -#endif - } - static KOKKOS_FORCEINLINE_FUNCTION - void sincos_wrapper(float x, float* sin_, float *cos_) { -#ifdef __SYCL_DEVICE_ONLY__ - *sin_ = sycl::sincos(x, cos_); -#else - sincosf(x, sin_, cos_); -#endif - } - #ifdef TIMING_INFO double* timers; timespec starttime, endtime; @@ -207,7 +220,7 @@ inline int twojmax, diagonalstyle; - t_sna_3d_ll blist; + t_sna_3d blist; t_sna_3c_ll ulisttot; t_sna_3c_ll ulisttot_full; // un-folded ulisttot, cpu only t_sna_3c_ll zlist; diff --git a/src/KOKKOS/sna_kokkos_impl.h b/src/KOKKOS/sna_kokkos_impl.h index 142b55158e..550548df55 100644 --- a/src/KOKKOS/sna_kokkos_impl.h +++ b/src/KOKKOS/sna_kokkos_impl.h @@ -316,7 +316,7 @@ void SNAKokkos::grow_rij(int newnatom, int ulist = t_sna_3c_ll(Kokkos::NoInit("sna:ulist"),1,1,1); zlist = t_sna_3c_ll(Kokkos::NoInit("sna:zlist"),1,1,1); zlist_pack = t_sna_4c_ll(Kokkos::NoInit("sna:zlist_pack"),vector_length,idxz_max,ndoubles,natom_div); - blist = t_sna_3d_ll(Kokkos::NoInit("sna:blist"),idxb_max,ntriples,natom); + blist = t_sna_3d(Kokkos::NoInit("sna:blist"),natom,ntriples,idxb_max); blist_pack = t_sna_4d_ll(Kokkos::NoInit("sna:blist_pack"),vector_length,idxb_max,ntriples,natom_div); ylist = t_sna_3c_ll(Kokkos::NoInit("sna:ylist"),1,1,1); ylist_pack_re = t_sna_4d_ll(Kokkos::NoInit("sna:ylist_pack_re"),vector_length,idxu_half_max,nelements,natom_div); @@ -337,7 +337,7 @@ void SNAKokkos::grow_rij(int newnatom, int ulist = t_sna_3c_ll(Kokkos::NoInit("sna:ulist"),idxu_cache_max,natom,nmax); zlist = t_sna_3c_ll(Kokkos::NoInit("sna:zlist"),idxz_max,ndoubles,natom); zlist_pack = t_sna_4c_ll(Kokkos::NoInit("sna:zlist_pack"),1,1,1,1); - blist = t_sna_3d_ll(Kokkos::NoInit("sna:blist"),idxb_max,ntriples,natom); + blist = t_sna_3d(Kokkos::NoInit("sna:blist"),natom,ntriples,idxb_max); blist_pack = t_sna_4d_ll(Kokkos::NoInit("sna:blist_pack"),1,1,1,1); ylist = t_sna_3c_ll(Kokkos::NoInit("sna:ylist"),idxu_half_max,nelements,natom); ylist_pack_re = t_sna_4d_ll(Kokkos::NoInit("sna:ylist_pack_re"),1,1,1,1); @@ -365,44 +365,44 @@ KOKKOS_INLINE_FUNCTION void SNAKokkos::compute_cayley_klein(const int& iatom_mod, const int& jnbor, const int& iatom_div) { const int iatom = iatom_mod + vector_length * iatom_div; - const auto x = rij(iatom,jnbor,0); - const auto y = rij(iatom,jnbor,1); - const auto z = rij(iatom,jnbor,2); - const auto rsq = x * x + y * y + z * z; - const auto r = sqrt(rsq); - const auto rcut = rcutij(iatom, jnbor); - const auto rscale0 = rfac0 * static_cast(MY_PI) / (rcut - rmin0); - const auto theta0 = (r - rmin0) * rscale0; - real_type sn, cs; - sincos_wrapper(theta0, &sn, &cs); + const real_type x = rij(iatom,jnbor,0); + const real_type y = rij(iatom,jnbor,1); + const real_type z = rij(iatom,jnbor,2); + const real_type rsq = x * x + y * y + z * z; + const real_type r = sqrt(rsq); + const real_type rcut = rcutij(iatom, jnbor); + const real_type rscale0 = rfac0 * static_cast(MY_PI) / (rcut - rmin0); + const real_type theta0 = (r - rmin0) * rscale0; + const real_type sn = sin(theta0); + const real_type cs = cos(theta0); const real_type z0 = r * cs / sn; const real_type dz0dr = z0 / r - (r*rscale0) * (rsq + z0 * z0) / rsq; - const auto wj_local = wj(iatom, jnbor); + const real_type wj_local = wj(iatom, jnbor); real_type sfac, dsfac; compute_s_dsfac(r, rcut, sfac, dsfac); sfac *= wj_local; dsfac *= wj_local; - const auto rinv = static_cast(1.0) / r; - const auto ux = x * rinv; - const auto uy = y * rinv; - const auto uz = z * rinv; + const real_type rinv = static_cast(1.0) / r; + const real_type ux = x * rinv; + const real_type uy = y * rinv; + const real_type uz = z * rinv; - const auto r0inv = static_cast(1.0) / sqrt(r * r + z0 * z0); + const real_type r0inv = static_cast(1.0) / sqrt(r * r + z0 * z0); const complex a = { z0 * r0inv, -z * r0inv }; const complex b = { r0inv * y, -r0inv * x }; - const auto dr0invdr = -r0inv * r0inv * r0inv * (r + z0 * dz0dr); + const real_type dr0invdr = -r0inv * r0inv * r0inv * (r + z0 * dz0dr); - const auto dr0invx = dr0invdr * ux; - const auto dr0invy = dr0invdr * uy; - const auto dr0invz = dr0invdr * uz; + const real_type dr0invx = dr0invdr * ux; + const real_type dr0invy = dr0invdr * uy; + const real_type dr0invz = dr0invdr * uz; - const auto dz0x = dz0dr * ux; - const auto dz0y = dz0dr * uy; - const auto dz0z = dz0dr * uz; + const real_type dz0x = dz0dr * ux; + const real_type dz0y = dz0dr * uy; + const real_type dz0z = dz0dr * uz; const complex dax = { dz0x * r0inv + z0 * dr0invx, -z * dr0invx }; const complex day = { dz0y * r0inv + z0 * dr0invy, -z * dr0invy }; @@ -412,9 +412,9 @@ void SNAKokkos::compute_cayley_klein(const const complex dby = { y * dr0invy + r0inv, -x * dr0invy }; const complex dbz = { y * dr0invz, -x * dr0invz }; - const auto dsfacux = dsfac * ux; - const auto dsfacuy = dsfac * uy; - const auto dsfacuz = dsfac * uz; + const real_type dsfacux = dsfac * ux; + const real_type dsfacuy = dsfac * uy; + const real_type dsfacuz = dsfac * uz; a_pack(iatom_mod,jnbor,iatom_div) = a; b_pack(iatom_mod,jnbor,iatom_div) = b; @@ -479,17 +479,13 @@ void SNAKokkos::pre_ui(const int& iatom_mo accumulating to the total. GPU only. ------------------------------------------------------------------------- */ +// Version of the code that exposes additional parallelism by threading over `j_bend` values + template KOKKOS_INLINE_FUNCTION -void SNAKokkos::compute_ui(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) +void SNAKokkos::compute_ui_small(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) { - // utot(j,ma,mb) = 0 for all j,ma,ma - // utot(j,ma,ma) = 1 for all j,ma - // for j in neighbors of i: - // compute r0 = (x,y,z,z0) - // utot(j,ma,mb) += u(r0;j,ma,mb) for all j,ma,mb - // get shared memory offset // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer const int tile_size = vector_length * (twojmax + 1); @@ -498,13 +494,12 @@ void SNAKokkos::compute_ui(const typename const int scratch_shift = team_rank * tile_size; // extract and wrap - WignerWrapper ulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); - + const WignerWrapper ulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); // load parameters - const auto a = a_pack(iatom_mod, jnbor, iatom_div); - const auto b = b_pack(iatom_mod, jnbor, iatom_div); - const auto sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); + const complex a = a_pack(iatom_mod, jnbor, iatom_div); + const complex b = b_pack(iatom_mod, jnbor, iatom_div); + const real_type sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); const int jelem = element(iatom_mod + vector_length * iatom_div, jnbor); @@ -512,101 +507,144 @@ void SNAKokkos::compute_ui(const typename // this for loop is here for context --- we expose additional // parallelism over this loop instead //for (int j_bend = 0; j_bend <= twojmax; j_bend++) { + evaluate_ui_jbend(ulist_wrapper, a, b, sfac, jelem, iatom_mod, j_bend, iatom_div); +} - // level 0 is just 1. - ulist_wrapper.set(0, complex::one()); +// Version of the code that loops over all `j_bend` values which reduces integer arithmetic +// and some amount of load imbalance, at the expense of reducing parallelism +template +KOKKOS_INLINE_FUNCTION +void SNAKokkos::compute_ui_large(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int jnbor, const int iatom_div) +{ + // get shared memory offset + // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer + const int tile_size = vector_length * (twojmax + 1); - // j from before the bend, don't store, mb == 0 - // this is "creeping up the side" - for (int j = 1; j <= j_bend; j++) { + const int team_rank = team.team_rank(); + const int scratch_shift = team_rank * tile_size; - constexpr int mb = 0; // intentional for readability, compiler should optimize this out + // extract and wrap + const WignerWrapper ulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); - complex ulist_accum = complex::zero(); + // load parameters + const complex a = a_pack(iatom_mod, jnbor, iatom_div); + const complex b = b_pack(iatom_mod, jnbor, iatom_div); + const real_type sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); - int ma; - for (ma = 0; ma < j; ma++) { + const int jelem = element(iatom_mod + vector_length * iatom_div, jnbor); - // grab the cached value - const complex ulist_prev = ulist_wrapper.get(ma); + // we need to "choose" when to bend + #ifdef LMP_KK_DEVICE_COMPILE + #pragma unroll + #endif + for (int j_bend = 0; j_bend <= twojmax; j_bend++) { + evaluate_ui_jbend(ulist_wrapper, a, b, sfac, jelem, iatom_mod, j_bend, iatom_div); + } +} - // ulist_accum += rootpq * a.conj() * ulist_prev; - real_type rootpq = rootpqarray(j - ma, j - mb); - ulist_accum.re += rootpq * (a.re * ulist_prev.re + a.im * ulist_prev.im); - ulist_accum.im += rootpq * (a.re * ulist_prev.im - a.im * ulist_prev.re); +// Core "evaluation" kernel that gets reused in `compute_ui_small` and `compute_ui_large` +template +KOKKOS_FORCEINLINE_FUNCTION +void SNAKokkos::evaluate_ui_jbend(const WignerWrapper& ulist_wrapper, + const complex& a, const complex& b, const real_type& sfac, const int& jelem, + const int& iatom_mod, const int& j_bend, const int& iatom_div) +{ - // store ulist_accum, we atomic accumulate values after the bend, so no atomic add here - ulist_wrapper.set(ma, ulist_accum); + // utot(j,ma,mb) = 0 for all j,ma,ma + // utot(j,ma,ma) = 1 for all j,ma + // for j in neighbors of i: + // compute r0 = (x,y,z,z0) + // utot(j,ma,mb) += u(r0;j,ma,mb) for all j,ma,mb - // next value - // ulist_accum = -rootpq * b.conj() * ulist_prev; - rootpq = rootpqarray(ma + 1, j - mb); - ulist_accum.re = -rootpq * (b.re * ulist_prev.re + b.im * ulist_prev.im); - ulist_accum.im = -rootpq * (b.re * ulist_prev.im - b.im * ulist_prev.re); + // level 0 is just 1. + ulist_wrapper.set(0, complex::one()); - } + // j from before the bend, don't store, mb == 0 + for (int j = 1; j <= j_bend; j++) { - ulist_wrapper.set(ma, ulist_accum); - } + constexpr int mb = 0; // intentional for readability, compiler should optimize this out - // now we're after the bend, start storing but only up to the "half way point" - const int j_half_way = MIN(2 * j_bend, twojmax); + complex ulist_accum = complex::zero(); - int mb = 1; - int j; //= j_bend + 1; // need this value below - for (j = j_bend + 1; j <= j_half_way; j++) { + int ma; + for (ma = 0; ma < j; ma++) { - const int jjup = idxu_half_block[j-1] + (mb - 1) * j; + // grab the cached value + const complex ulist_prev = ulist_wrapper.get(ma); - complex ulist_accum = complex::zero(); - - int ma; - for (ma = 0; ma < j; ma++) { - - // grab the cached value - const complex ulist_prev = ulist_wrapper.get(ma); - - // atomic add the previous level here - Kokkos::atomic_add(&(ulisttot_re_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.re * sfac); - Kokkos::atomic_add(&(ulisttot_im_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.im * sfac); - - // ulist_accum += rootpq * b * ulist_prev; - real_type rootpq = rootpqarray(j - ma, mb); - ulist_accum.re += rootpq * (b.re * ulist_prev.re - b.im * ulist_prev.im); - ulist_accum.im += rootpq * (b.re * ulist_prev.im + b.im * ulist_prev.re); - - // store ulist_accum - ulist_wrapper.set(ma, ulist_accum); - - // next value - // ulist_accum = rootpq * a * ulist_prev; - rootpq = rootpqarray(ma + 1, mb); - ulist_accum.re = rootpq * (a.re * ulist_prev.re - a.im * ulist_prev.im); - ulist_accum.im = rootpq * (a.re * ulist_prev.im + a.im * ulist_prev.re); - } + // ulist_accum += rootpq * a.conj() * ulist_prev; + real_type rootpq = rootpqarray(j - ma, j - mb); + ulist_accum.re += rootpq * (a.re * ulist_prev.re + a.im * ulist_prev.im); + ulist_accum.im += rootpq * (a.re * ulist_prev.im - a.im * ulist_prev.re); + // store ulist_accum, we atomic accumulate values after the bend, so no atomic add here ulist_wrapper.set(ma, ulist_accum); - mb++; + // next value + // ulist_accum = -rootpq * b.conj() * ulist_prev; + rootpq = rootpqarray(ma + 1, j - mb); + ulist_accum.re = -rootpq * (b.re * ulist_prev.re + b.im * ulist_prev.im); + ulist_accum.im = -rootpq * (b.re * ulist_prev.im - b.im * ulist_prev.re); + } - // atomic add the last level + ulist_wrapper.set(ma, ulist_accum); + } + + // now we're after the bend, start storing but only up to the "half way point" + const int j_half_way = MIN(2 * j_bend, twojmax); + + int mb = 1; + int j; //= j_bend + 1; // need this value below + for (j = j_bend + 1; j <= j_half_way; j++) { + const int jjup = idxu_half_block[j-1] + (mb - 1) * j; - for (int ma = 0; ma < j; ma++) { + complex ulist_accum = complex::zero(); + + int ma; + for (ma = 0; ma < j; ma++) { + + // grab the cached value const complex ulist_prev = ulist_wrapper.get(ma); // atomic add the previous level here Kokkos::atomic_add(&(ulisttot_re_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.re * sfac); Kokkos::atomic_add(&(ulisttot_im_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.im * sfac); + + // ulist_accum += rootpq * b * ulist_prev; + real_type rootpq = rootpqarray(j - ma, mb); + ulist_accum.re += rootpq * (b.re * ulist_prev.re - b.im * ulist_prev.im); + ulist_accum.im += rootpq * (b.re * ulist_prev.im + b.im * ulist_prev.re); + + // store ulist_accum + ulist_wrapper.set(ma, ulist_accum); + + // next value + // ulist_accum = rootpq * a * ulist_prev; + rootpq = rootpqarray(ma + 1, mb); + ulist_accum.re = rootpq * (a.re * ulist_prev.re - a.im * ulist_prev.im); + ulist_accum.im = rootpq * (a.re * ulist_prev.im + a.im * ulist_prev.re); } - //} // end of "reference" loop over j_bend + ulist_wrapper.set(ma, ulist_accum); + mb++; + } + + // atomic add the last level + const int jjup = idxu_half_block[j-1] + (mb - 1) * j; + + for (int ma = 0; ma < j; ma++) { + const complex ulist_prev = ulist_wrapper.get(ma); + + // atomic add the previous level here + Kokkos::atomic_add(&(ulisttot_re_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.re * sfac); + Kokkos::atomic_add(&(ulisttot_im_pack(iatom_mod, jjup + ma, jelem, iatom_div)), ulist_prev.im * sfac); + } } - /* ---------------------------------------------------------------------- compute Zi by summing over products of Ui, AoSoA data layout to take advantage of coalescing, avoiding warp @@ -634,47 +672,8 @@ void SNAKokkos::compute_zi(const int& iato for (int elem1 = 0; elem1 < nelements; elem1++) { for (int elem2 = 0; elem2 < nelements; elem2++) { - complex ztmp = complex::zero(); - int jju1 = idxu_block[j1] + (j1+1)*mb1min; - int jju2 = idxu_block[j2] + (j2+1)*mb2max; - int icgb = mb1min*(j2+1) + mb2max; - - #ifdef LMP_KK_DEVICE_COMPILE - #pragma unroll - #endif - for (int ib = 0; ib < nb; ib++) { - - int ma1 = ma1min; - int ma2 = ma2max; - int icga = ma1min*(j2+1) + ma2max; - - #ifdef LMP_KK_DEVICE_COMPILE - #pragma unroll - #endif - for (int ia = 0; ia < na; ia++) { - const auto utot1 = ulisttot_pack(iatom_mod, jju1+ma1, elem1, iatom_div); - const auto utot2 = ulisttot_pack(iatom_mod, jju2+ma2, elem2, iatom_div); - const auto cgcoeff_a = cgblock[icga]; - const auto cgcoeff_b = cgblock[icgb]; - ztmp.re += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.re - utot1.im * utot2.im); - ztmp.im += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.im + utot1.im * utot2.re); - ma1++; - ma2--; - icga += j2; - } // end loop over ia - - jju1 += j1 + 1; - jju2 -= j2 + 1; - icgb += j2; - } // end loop over ib - - if (bnorm_flag) { - ztmp.re /= (j + 1); - ztmp.im /= (j + 1); - } - - zlist_pack(iatom_mod,jjz,idouble,iatom_div) = ztmp; + zlist_pack(iatom_mod,jjz,idouble,iatom_div) = evaluate_zi(j1, j2, j, ma1min, ma2max, mb1min, mb2max, na, nb, iatom_mod, elem1, elem2, iatom_div, cgblock); idouble++; } @@ -721,8 +720,8 @@ void SNAKokkos::compute_bi(const int& iato const int jju_index = jju+mb*(j+1)+ma; const int jjz_index = jjz+mb*(j+1)+ma; if (2*mb == j) return; // I think we can remove this? - const auto utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); - const auto zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); + const complex utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); + const complex zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); sumzu_temp += utot.re * zloc.re + utot.im * zloc.im; } } @@ -737,8 +736,8 @@ void SNAKokkos::compute_bi(const int& iato const int jju_index = jju+(mb-1)*(j+1)+(j+1)+ma; const int jjz_index = jjz+(mb-1)*(j+1)+(j+1)+ma; - const auto utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); - const auto zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); + const complex utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); + const complex zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); sumzu_temp += utot.re * zloc.re + utot.im * zloc.im; } @@ -748,8 +747,8 @@ void SNAKokkos::compute_bi(const int& iato const int jju_index = jju+(mb-1)*(j+1)+(j+1)+ma; const int jjz_index = jjz+(mb-1)*(j+1)+(j+1)+ma; - const auto utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); - const auto zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); + const complex utot = ulisttot_pack(iatom_mod, jju_index, elem3, iatom_div); + const complex zloc = zlist_pack(iatom_mod, jjz_index, idouble, iatom_div); sumzu += static_cast(0.5) * (utot.re * zloc.re + utot.im * zloc.im); } // end if jeven @@ -785,7 +784,6 @@ KOKKOS_INLINE_FUNCTION void SNAKokkos::compute_yi(int iatom_mod, int jjz, int iatom_div, const Kokkos::View &beta_pack) { - real_type betaj; const int j1 = idxz(jjz, 0); const int j2 = idxz(jjz, 1); @@ -805,46 +803,7 @@ void SNAKokkos::compute_yi(int iatom_mod, for (int elem1 = 0; elem1 < nelements; elem1++) { for (int elem2 = 0; elem2 < nelements; elem2++) { - real_type ztmp_r = 0.0; - real_type ztmp_i = 0.0; - - int jju1 = idxu_block[j1] + (j1 + 1) * mb1min; - int jju2 = idxu_block[j2] + (j2 + 1) * mb2max; - int icgb = mb1min * (j2 + 1) + mb2max; - - #ifdef LMP_KK_DEVICE_COMPILE - #pragma unroll - #endif - for (int ib = 0; ib < nb; ib++) { - - int ma1 = ma1min; - int ma2 = ma2max; - int icga = ma1min*(j2+1) + ma2max; - - #ifdef LMP_KK_DEVICE_COMPILE - #pragma unroll - #endif - for (int ia = 0; ia < na; ia++) { - const auto utot1 = ulisttot_pack(iatom_mod,jju1+ma1,elem1,iatom_div); - const auto utot2 = ulisttot_pack(iatom_mod,jju2+ma2,elem2,iatom_div); - const auto cgcoeff_a = cgblock[icga]; - const auto cgcoeff_b = cgblock[icgb]; - ztmp_r += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.re - utot1.im * utot2.im); - ztmp_i += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.im + utot1.im * utot2.re); - ma1++; - ma2--; - icga += j2; - } // end loop over ia - - jju1 += j1 + 1; - jju2 -= j2 + 1; - icgb += j2; - } // end loop over ib - - if (bnorm_flag) { - ztmp_r /= (j + 1); - ztmp_i /= (j + 1); - } + const complex ztmp = evaluate_zi(j1, j2, j, ma1min, ma2max, mb1min, mb2max, na, nb, iatom_mod, elem1, elem2, iatom_div, cgblock); // apply to z(j1,j2,j,ma,mb) to unique element of y(j) // find right y_list[jju] and beta(iatom,jjb) entries @@ -853,30 +812,11 @@ void SNAKokkos::compute_yi(int iatom_mod, // pick out right beta value for (int elem3 = 0; elem3 < nelements; elem3++) { - if (j >= j1) { - const int jjb = idxb_block(j1, j2, j); - const auto itriple = ((elem1 * nelements + elem2) * nelements + elem3) * idxb_max + jjb; - if (j1 == j) { - if (j2 == j) betaj = 3 * beta_pack(iatom_mod, itriple, iatom_div); - else betaj = 2 * beta_pack(iatom_mod, itriple, iatom_div); - } else betaj = beta_pack(iatom_mod, itriple, iatom_div); - } else if (j >= j2) { - const int jjb = idxb_block(j, j2, j1); - const auto itriple = ((elem3 * nelements + elem2) * nelements + elem1) * idxb_max + jjb; - if (j2 == j) betaj = 2 * beta_pack(iatom_mod, itriple, iatom_div); - else betaj = beta_pack(iatom_mod, itriple, iatom_div); - } else { - const int jjb = idxb_block(j2, j, j1); - const auto itriple = ((elem2 * nelements + elem3) * nelements + elem1) * idxb_max + jjb; - betaj = beta_pack(iatom_mod, itriple, iatom_div); - } - if (!bnorm_flag && j1 > j) - betaj *= (j1 + 1) / (j + 1.0); + const real_type betaj = evaluate_beta_scaled(j1, j2, j, iatom_mod, elem1, elem2, elem3, iatom_div, beta_pack); - - Kokkos::atomic_add(&(ylist_pack_re(iatom_mod, jju_half, elem3, iatom_div)), betaj*ztmp_r); - Kokkos::atomic_add(&(ylist_pack_im(iatom_mod, jju_half, elem3, iatom_div)), betaj*ztmp_i); + Kokkos::atomic_add(&(ylist_pack_re(iatom_mod, jju_half, elem3, iatom_div)), betaj * ztmp.re); + Kokkos::atomic_add(&(ylist_pack_im(iatom_mod, jju_half, elem3, iatom_div)), betaj * ztmp.im); } // end loop over elem3 } // end loop over elem2 } // end loop over elem1 @@ -893,7 +833,6 @@ KOKKOS_INLINE_FUNCTION void SNAKokkos::compute_yi_with_zlist(int iatom_mod, int jjz, int iatom_div, const Kokkos::View &beta_pack) { - real_type betaj; const int j1 = idxz(jjz, 0); const int j2 = idxz(jjz, 1); const int j = idxz(jjz, 2); @@ -901,49 +840,123 @@ void SNAKokkos::compute_yi_with_zlist(int int idouble = 0; for (int elem1 = 0; elem1 < nelements; elem1++) { for (int elem2 = 0; elem2 < nelements; elem2++) { - auto ztmp = zlist_pack(iatom_mod,jjz,idouble,iatom_div); + const complex ztmp = zlist_pack(iatom_mod,jjz,idouble,iatom_div); // apply to z(j1,j2,j,ma,mb) to unique element of y(j) // find right y_list[jju] and beta(iatom,jjb) entries // multiply and divide by j+1 factors // account for multiplicity of 1, 2, or 3 // pick out right beta value for (int elem3 = 0; elem3 < nelements; elem3++) { - if (j >= j1) { - const int jjb = idxb_block(j1, j2, j); - const auto itriple = ((elem1 * nelements + elem2) * nelements + elem3) * idxb_max + jjb; - if (j1 == j) { - if (j2 == j) betaj = 3 * beta_pack(iatom_mod, itriple, iatom_div); - else betaj = 2 * beta_pack(iatom_mod, itriple, iatom_div); - } else betaj = beta_pack(iatom_mod, itriple, iatom_div); - } else if (j >= j2) { - const int jjb = idxb_block(j, j2, j1); - const auto itriple = ((elem3 * nelements + elem2) * nelements + elem1) * idxb_max + jjb; - if (j2 == j) betaj = 2 * beta_pack(iatom_mod, itriple, iatom_div); - else betaj = beta_pack(iatom_mod, itriple, iatom_div); - } else { - const int jjb = idxb_block(j2, j, j1); - const auto itriple = ((elem2 * nelements + elem3) * nelements + elem1) * idxb_max + jjb; - betaj = beta_pack(iatom_mod, itriple, iatom_div); - } - if (!bnorm_flag && j1 > j) - betaj *= (j1 + 1) / (j + 1.0); - Kokkos::atomic_add(&(ylist_pack_re(iatom_mod, jju_half, elem3, iatom_div)), betaj*ztmp.re); - Kokkos::atomic_add(&(ylist_pack_im(iatom_mod, jju_half, elem3, iatom_div)), betaj*ztmp.im); + + const real_type betaj = evaluate_beta_scaled(j1, j2, j, iatom_mod, elem1, elem2, elem3, iatom_div, beta_pack); + + Kokkos::atomic_add(&(ylist_pack_re(iatom_mod, jju_half, elem3, iatom_div)), betaj * ztmp.re); + Kokkos::atomic_add(&(ylist_pack_im(iatom_mod, jju_half, elem3, iatom_div)), betaj * ztmp.im); } // end loop over elem3 idouble++; } // end loop over elem2 } // end loop over elem1 } +// Core "evaluation" kernel that computes a single zlist value +// which gets used in both `compute_zi` and `compute_yi` +template +KOKKOS_FORCEINLINE_FUNCTION +typename SNAKokkos::complex SNAKokkos::evaluate_zi(const int& j1, const int& j2, const int& j, + const int& ma1min, const int& ma2max, const int& mb1min, const int& mb2max, const int& na, const int& nb, + const int& iatom_mod, const int& elem1, const int& elem2, const int& iatom_div, const real_type* cgblock) { + + complex ztmp = complex::zero(); + + int jju1 = idxu_block[j1] + (j1+1)*mb1min; + int jju2 = idxu_block[j2] + (j2+1)*mb2max; + int icgb = mb1min*(j2+1) + mb2max; + + #ifdef LMP_KK_DEVICE_COMPILE + #pragma unroll + #endif + for (int ib = 0; ib < nb; ib++) { + + int ma1 = ma1min; + int ma2 = ma2max; + int icga = ma1min*(j2+1) + ma2max; + + #ifdef LMP_KK_DEVICE_COMPILE + #pragma unroll + #endif + for (int ia = 0; ia < na; ia++) { + const complex utot1 = ulisttot_pack(iatom_mod, jju1+ma1, elem1, iatom_div); + const complex utot2 = ulisttot_pack(iatom_mod, jju2+ma2, elem2, iatom_div); + const real_type cgcoeff_a = cgblock[icga]; + const real_type cgcoeff_b = cgblock[icgb]; + ztmp.re += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.re - utot1.im * utot2.im); + ztmp.im += cgcoeff_a * cgcoeff_b * (utot1.re * utot2.im + utot1.im * utot2.re); + ma1++; + ma2--; + icga += j2; + } // end loop over ia + + jju1 += j1 + 1; + jju2 -= j2 + 1; + icgb += j2; + } // end loop over ib + + if (bnorm_flag) { + const real_type scale = static_cast(1) / static_cast(j + 1); + ztmp.re *= scale; + ztmp.im *= scale; + } + + return ztmp; +} + +// Core "evaluation" kernel that extracts and rescales the appropriate `beta` value, +// which gets used in both `compute_yi` and `compute_yi_from_zlist +template +KOKKOS_FORCEINLINE_FUNCTION +typename SNAKokkos::real_type SNAKokkos::evaluate_beta_scaled(const int& j1, const int& j2, const int& j, + const int& iatom_mod, const int& elem1, const int& elem2, const int& elem3, const int& iatom_div, + const Kokkos::View &beta_pack) { + + real_type betaj = 0; + + if (j >= j1) { + const int jjb = idxb_block(j1, j2, j); + const int itriple = ((elem1 * nelements + elem2) * nelements + elem3) * idxb_max + jjb; + if (j1 == j) { + if (j2 == j) betaj = static_cast(3) * beta_pack(iatom_mod, itriple, iatom_div); + else betaj = static_cast(2) * beta_pack(iatom_mod, itriple, iatom_div); + } else betaj = beta_pack(iatom_mod, itriple, iatom_div); + } else if (j >= j2) { + const int jjb = idxb_block(j, j2, j1); + const int itriple = ((elem3 * nelements + elem2) * nelements + elem1) * idxb_max + jjb; + if (j2 == j) betaj = static_cast(2) * beta_pack(iatom_mod, itriple, iatom_div); + else betaj = beta_pack(iatom_mod, itriple, iatom_div); + } else { + const int jjb = idxb_block(j2, j, j1); + const int itriple = ((elem2 * nelements + elem3) * nelements + elem1) * idxb_max + jjb; + betaj = beta_pack(iatom_mod, itriple, iatom_div); + } + + if (!bnorm_flag && j1 > j) { + const real_type scale = static_cast(j1 + 1) / static_cast(j + 1); + betaj *= scale; + } + + return betaj; + +} + /* ---------------------------------------------------------------------- Fused calculation of the derivative of Ui w.r.t. atom j and accumulation into dEidRj. GPU only. ------------------------------------------------------------------------- */ +// Version of the code that exposes additional parallelism by threading over `j_bend` values template template KOKKOS_INLINE_FUNCTION -void SNAKokkos::compute_fused_deidrj(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) +void SNAKokkos::compute_fused_deidrj_small(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int j_bend, const int jnbor, const int iatom_div) { // get shared memory offset // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer @@ -957,157 +970,207 @@ void SNAKokkos::compute_fused_deidrj(const WignerWrapper dulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); // load parameters - const auto a = a_pack(iatom_mod, jnbor, iatom_div); - const auto b = b_pack(iatom_mod, jnbor, iatom_div); - const auto da = da_pack(iatom_mod, jnbor, iatom_div, dir); - const auto db = db_pack(iatom_mod, jnbor, iatom_div, dir); - const auto sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); - const auto dsfacu = sfac_pack(iatom_mod, jnbor, iatom_div, dir + 1); // dsfac * u + const complex a = a_pack(iatom_mod, jnbor, iatom_div); + const complex b = b_pack(iatom_mod, jnbor, iatom_div); + const complex da = da_pack(iatom_mod, jnbor, iatom_div, dir); + const complex db = db_pack(iatom_mod, jnbor, iatom_div, dir); + const real_type sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); + const real_type dsfacu = sfac_pack(iatom_mod, jnbor, iatom_div, dir + 1); // dsfac * u const int jelem = element(iatom_mod + vector_length * iatom_div, jnbor); - auto dedr_full_sum = static_cast(0.); - - // we need to "choose" when to bend - // this for loop is here for context --- we expose additional - // parallelism over this loop instead - //for (int j_bend = 0; j_bend <= twojmax; j_bend++) { - - // level 0 is just 1, 0 - ulist_wrapper.set(0, complex::one()); - dulist_wrapper.set(0, complex::zero()); - - // j from before the bend, don't store, mb == 0 - // this is "creeping up the side" - for (int j = 1; j <= j_bend; j++) { - - constexpr int mb = 0; // intentional for readability, compiler should optimize this out - - complex ulist_accum = complex::zero(); - complex dulist_accum = complex::zero(); - - int ma; - for (ma = 0; ma < j; ma++) { - - // grab the cached value - const complex ulist_prev = ulist_wrapper.get(ma); - const complex dulist_prev = dulist_wrapper.get(ma); - - // ulist_accum += rootpq * a.conj() * ulist_prev; - real_type rootpq = rootpqarray(j - ma, j - mb); - ulist_accum.re += rootpq * (a.re * ulist_prev.re + a.im * ulist_prev.im); - ulist_accum.im += rootpq * (a.re * ulist_prev.im - a.im * ulist_prev.re); - - // product rule of above - dulist_accum.re += rootpq * (da.re * ulist_prev.re + da.im * ulist_prev.im + a.re * dulist_prev.re + a.im * dulist_prev.im); - dulist_accum.im += rootpq * (da.re * ulist_prev.im - da.im * ulist_prev.re + a.re * dulist_prev.im - a.im * dulist_prev.re); - - // store ulist_accum, we atomic accumulate values after the bend, so no atomic add here - ulist_wrapper.set(ma, ulist_accum); - dulist_wrapper.set(ma, dulist_accum); - - // next value - // ulist_accum = -rootpq * b.conj() * ulist_prev; - rootpq = rootpqarray(ma + 1, j - mb); - ulist_accum.re = -rootpq * (b.re * ulist_prev.re + b.im * ulist_prev.im); - ulist_accum.im = -rootpq * (b.re * ulist_prev.im - b.im * ulist_prev.re); - - // product rule of above - dulist_accum.re = -rootpq * (db.re * ulist_prev.re + db.im * ulist_prev.im + b.re * dulist_prev.re + b.im * dulist_prev.im); - dulist_accum.im = -rootpq * (db.re * ulist_prev.im - db.im * ulist_prev.re + b.re * dulist_prev.im - b.im * dulist_prev.re); - - } - - ulist_wrapper.set(ma, ulist_accum); - dulist_wrapper.set(ma, dulist_accum); - } - - // now we're after the bend, start storing but only up to the "half way point" - const int j_half_way = MIN(2 * j_bend, twojmax); - - int mb = 1; - int j; //= j_bend + 1; // need this value below - for (j = j_bend + 1; j <= j_half_way; j++) { - - const int jjup = idxu_half_block[j-1] + (mb - 1) * j; - - complex ulist_accum = complex::zero(); - complex dulist_accum = complex::zero(); - - int ma; - for (ma = 0; ma < j; ma++) { - - // grab y_local early - // this will never be the last element of a row, no need to rescale. - auto y_local = complex(ylist_pack_re(iatom_mod, jjup + ma, jelem, iatom_div), ylist_pack_im(iatom_mod, jjup+ma, jelem, iatom_div)); - - // grab the cached value - const complex ulist_prev = ulist_wrapper.get(ma); - const complex dulist_prev = dulist_wrapper.get(ma); - - // ulist_accum += rootpq * b * ulist_prev; - real_type rootpq = rootpqarray(j - ma, mb); - ulist_accum.re += rootpq * (b.re * ulist_prev.re - b.im * ulist_prev.im); - ulist_accum.im += rootpq * (b.re * ulist_prev.im + b.im * ulist_prev.re); - - // product rule of above - dulist_accum.re += rootpq * (db.re * ulist_prev.re - db.im * ulist_prev.im + b.re * dulist_prev.re - b.im * dulist_prev.im); - dulist_accum.im += rootpq * (db.re * ulist_prev.im + db.im * ulist_prev.re + b.re * dulist_prev.im + b.im * dulist_prev.re); - - // store ulist_accum - ulist_wrapper.set(ma, ulist_accum); - dulist_wrapper.set(ma, dulist_accum); - - // Directly accumulate deidrj into sum_tmp - const complex du_prod = (dsfacu * ulist_prev) + (sfac * dulist_prev); - dedr_full_sum += du_prod.re * y_local.re + du_prod.im * y_local.im; - - // next value - // ulist_accum = rootpq * a * ulist_prev; - rootpq = rootpqarray(ma + 1, mb); - ulist_accum.re = rootpq * (a.re * ulist_prev.re - a.im * ulist_prev.im); - ulist_accum.im = rootpq * (a.re * ulist_prev.im + a.im * ulist_prev.re); - - // product rule of above - dulist_accum.re = rootpq * (da.re * ulist_prev.re - da.im * ulist_prev.im + a.re * dulist_prev.re - a.im * dulist_prev.im); - dulist_accum.im = rootpq * (da.re * ulist_prev.im + da.im * ulist_prev.re + a.re * dulist_prev.im + a.im * dulist_prev.re); - - } - - ulist_wrapper.set(ma, ulist_accum); - dulist_wrapper.set(ma, dulist_accum); - - mb++; - } - - // accumulate the last level - const int jjup = idxu_half_block[j-1] + (mb - 1) * j; - - for (int ma = 0; ma < j; ma++) { - // grab y_local early - auto y_local = complex(ylist_pack_re(iatom_mod, jjup + ma, jelem, iatom_div), ylist_pack_im(iatom_mod, jjup+ma, jelem, iatom_div)); - if (j % 2 == 1 && 2*(mb-1) == j-1) { // double check me... - if (ma == (mb-1)) { y_local = static_cast(0.5)*y_local; } - else if (ma > (mb-1)) { y_local.re = static_cast(0.); y_local.im = static_cast(0.); } // can probably avoid this outright - // else the ma < mb gets "double counted", cancelling the 0.5. - } - - const complex ulist_prev = ulist_wrapper.get(ma); - const complex dulist_prev = dulist_wrapper.get(ma); - - // Directly accumulate deidrj into sum_tmp - const complex du_prod = (dsfacu * ulist_prev) + (sfac * dulist_prev); - dedr_full_sum += du_prod.re * y_local.re + du_prod.im * y_local.im; - - } - //} // end reference loop over j_bend + // compute the contribution to dedr_full_sum for one "bend" location + const real_type dedr_full_sum = evaluate_duidrj_jbend(ulist_wrapper, a, b, sfac, dulist_wrapper, da, db, dsfacu, + jelem, iatom_mod, j_bend, iatom_div); // dedr gets zeroed out at the start of each iteration in compute_cayley_klein Kokkos::atomic_add(&(dedr(iatom_mod + vector_length * iatom_div, jnbor, dir)), static_cast(2.0) * dedr_full_sum); } +// Version of the code that loops over all `j_bend` values which reduces integer arithmetic +// and some amount of load imbalance, at the expense of reducing parallelism +template +template +KOKKOS_INLINE_FUNCTION +void SNAKokkos::compute_fused_deidrj_large(const typename Kokkos::TeamPolicy::member_type& team, const int iatom_mod, const int jnbor, const int iatom_div) +{ + // get shared memory offset + // scratch size: 32 atoms * (twojmax+1) cached values, no double buffer + const int tile_size = vector_length * (twojmax + 1); + const int team_rank = team.team_rank(); + const int scratch_shift = team_rank * tile_size; + + // extract, wrap shared memory buffer + WignerWrapper ulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); + WignerWrapper dulist_wrapper((complex*)team.team_shmem().get_shmem(team.team_size() * tile_size * sizeof(complex), 0) + scratch_shift, iatom_mod); + + // load parameters + const complex a = a_pack(iatom_mod, jnbor, iatom_div); + const complex b = b_pack(iatom_mod, jnbor, iatom_div); + const complex da = da_pack(iatom_mod, jnbor, iatom_div, dir); + const complex db = db_pack(iatom_mod, jnbor, iatom_div, dir); + const real_type sfac = sfac_pack(iatom_mod, jnbor, iatom_div, 0); + const real_type dsfacu = sfac_pack(iatom_mod, jnbor, iatom_div, dir + 1); // dsfac * u + + const int jelem = element(iatom_mod + vector_length * iatom_div, jnbor); + + // compute the contributions to dedr_full_sum for all "bend" locations + real_type dedr_full_sum = static_cast(0); + #ifdef LMP_KK_DEVICE_COMPILE + #pragma unroll + #endif + for (int j_bend = 0; j_bend <= twojmax; j_bend++) { + dedr_full_sum += evaluate_duidrj_jbend(ulist_wrapper, a, b, sfac, dulist_wrapper, da, db, dsfacu, + jelem, iatom_mod, j_bend, iatom_div); + } + + // there's one thread per atom, neighbor pair, so no need to make this atomic + dedr(iatom_mod + vector_length * iatom_div, jnbor, dir) = static_cast(2.0) * dedr_full_sum; + +} + +// Core "evaluation" kernel that gets reused in `compute_fused_deidrj_small` and +// `compute_fused_deidrj_large` +template +KOKKOS_FORCEINLINE_FUNCTION +typename SNAKokkos::real_type SNAKokkos::evaluate_duidrj_jbend(const WignerWrapper& ulist_wrapper, const complex& a, const complex& b, const real_type& sfac, + const WignerWrapper& dulist_wrapper, const complex& da, const complex& db, const real_type& dsfacu, + const int& jelem, const int& iatom_mod, const int& j_bend, const int& iatom_div) { + + real_type dedr_full_sum = static_cast(0); + + // level 0 is just 1, 0 + ulist_wrapper.set(0, complex::one()); + dulist_wrapper.set(0, complex::zero()); + + // j from before the bend, don't store, mb == 0 + // this is "creeping up the side" + for (int j = 1; j <= j_bend; j++) { + + constexpr int mb = 0; // intentional for readability, compiler should optimize this out + + complex ulist_accum = complex::zero(); + complex dulist_accum = complex::zero(); + + int ma; + for (ma = 0; ma < j; ma++) { + + // grab the cached value + const complex ulist_prev = ulist_wrapper.get(ma); + const complex dulist_prev = dulist_wrapper.get(ma); + + // ulist_accum += rootpq * a.conj() * ulist_prev; + real_type rootpq = rootpqarray(j - ma, j - mb); + ulist_accum.re += rootpq * (a.re * ulist_prev.re + a.im * ulist_prev.im); + ulist_accum.im += rootpq * (a.re * ulist_prev.im - a.im * ulist_prev.re); + + // product rule of above + dulist_accum.re += rootpq * (da.re * ulist_prev.re + da.im * ulist_prev.im + a.re * dulist_prev.re + a.im * dulist_prev.im); + dulist_accum.im += rootpq * (da.re * ulist_prev.im - da.im * ulist_prev.re + a.re * dulist_prev.im - a.im * dulist_prev.re); + + // store ulist_accum, we atomic accumulate values after the bend, so no atomic add here + ulist_wrapper.set(ma, ulist_accum); + dulist_wrapper.set(ma, dulist_accum); + + // next value + // ulist_accum = -rootpq * b.conj() * ulist_prev; + rootpq = rootpqarray(ma + 1, j - mb); + ulist_accum.re = -rootpq * (b.re * ulist_prev.re + b.im * ulist_prev.im); + ulist_accum.im = -rootpq * (b.re * ulist_prev.im - b.im * ulist_prev.re); + + // product rule of above + dulist_accum.re = -rootpq * (db.re * ulist_prev.re + db.im * ulist_prev.im + b.re * dulist_prev.re + b.im * dulist_prev.im); + dulist_accum.im = -rootpq * (db.re * ulist_prev.im - db.im * ulist_prev.re + b.re * dulist_prev.im - b.im * dulist_prev.re); + + } + + ulist_wrapper.set(ma, ulist_accum); + dulist_wrapper.set(ma, dulist_accum); + } + + // now we're after the bend, start storing but only up to the "half way point" + const int j_half_way = MIN(2 * j_bend, twojmax); + + int mb = 1; + int j; //= j_bend + 1; // need this value below + for (j = j_bend + 1; j <= j_half_way; j++) { + + const int jjup = idxu_half_block[j-1] + (mb - 1) * j; + + complex ulist_accum = complex::zero(); + complex dulist_accum = complex::zero(); + + int ma; + for (ma = 0; ma < j; ma++) { + + // grab y_local early + // this will never be the last element of a row, no need to rescale. + complex y_local = complex(ylist_pack_re(iatom_mod, jjup + ma, jelem, iatom_div), ylist_pack_im(iatom_mod, jjup+ma, jelem, iatom_div)); + + // grab the cached value + const complex ulist_prev = ulist_wrapper.get(ma); + const complex dulist_prev = dulist_wrapper.get(ma); + + // ulist_accum += rootpq * b * ulist_prev; + real_type rootpq = rootpqarray(j - ma, mb); + ulist_accum.re += rootpq * (b.re * ulist_prev.re - b.im * ulist_prev.im); + ulist_accum.im += rootpq * (b.re * ulist_prev.im + b.im * ulist_prev.re); + + // product rule of above + dulist_accum.re += rootpq * (db.re * ulist_prev.re - db.im * ulist_prev.im + b.re * dulist_prev.re - b.im * dulist_prev.im); + dulist_accum.im += rootpq * (db.re * ulist_prev.im + db.im * ulist_prev.re + b.re * dulist_prev.im + b.im * dulist_prev.re); + + // store ulist_accum + ulist_wrapper.set(ma, ulist_accum); + dulist_wrapper.set(ma, dulist_accum); + + // Directly accumulate deidrj into sum_tmp + const complex du_prod = (dsfacu * ulist_prev) + (sfac * dulist_prev); + dedr_full_sum += du_prod.re * y_local.re + du_prod.im * y_local.im; + + // next value + // ulist_accum = rootpq * a * ulist_prev; + rootpq = rootpqarray(ma + 1, mb); + ulist_accum.re = rootpq * (a.re * ulist_prev.re - a.im * ulist_prev.im); + ulist_accum.im = rootpq * (a.re * ulist_prev.im + a.im * ulist_prev.re); + + // product rule of above + dulist_accum.re = rootpq * (da.re * ulist_prev.re - da.im * ulist_prev.im + a.re * dulist_prev.re - a.im * dulist_prev.im); + dulist_accum.im = rootpq * (da.re * ulist_prev.im + da.im * ulist_prev.re + a.re * dulist_prev.im + a.im * dulist_prev.re); + + } + + ulist_wrapper.set(ma, ulist_accum); + dulist_wrapper.set(ma, dulist_accum); + + mb++; + } + + // accumulate the last level + const int jjup = idxu_half_block[j-1] + (mb - 1) * j; + + for (int ma = 0; ma < j; ma++) { + // grab y_local early + complex y_local = complex(ylist_pack_re(iatom_mod, jjup + ma, jelem, iatom_div), ylist_pack_im(iatom_mod, jjup+ma, jelem, iatom_div)); + if (j % 2 == 1 && 2*(mb-1) == j-1) { // double check me... + if (ma == (mb-1)) { y_local = static_cast(0.5)*y_local; } + else if (ma > (mb-1)) { y_local.re = static_cast(0.); y_local.im = static_cast(0.); } // can probably avoid this outright + // else the ma < mb gets "double counted", cancelling the 0.5. + } + + const complex ulist_prev = ulist_wrapper.get(ma); + const complex dulist_prev = dulist_wrapper.get(ma); + + // Directly accumulate deidrj into sum_tmp + const complex du_prod = (dsfacu * ulist_prev) + (sfac * dulist_prev); + dedr_full_sum += du_prod.re * y_local.re + du_prod.im * y_local.im; + + } + + return dedr_full_sum; +} /* ---------------------------------------------------------------------- * CPU routines @@ -1238,8 +1301,9 @@ void SNAKokkos::compute_zi_cpu(const int& } // end loop over ib if (bnorm_flag) { - zlist(jjz, idouble, iatom).re /= (j+1); - zlist(jjz, idouble, iatom).im /= (j+1); + const real_type scale = static_cast(1) / static_cast(j + 1); + zlist(jjz, idouble, iatom).re *= scale; + zlist(jjz, idouble, iatom).im *= scale; } idouble++; } // end loop over elem2 @@ -1268,7 +1332,7 @@ void SNAKokkos::compute_bi_cpu(const typen int idouble = 0; for (int elem1 = 0; elem1 < nelements; elem1++) { for (int elem2 = 0; elem2 < nelements; elem2++) { - auto jalloy = idouble; // must be non-const to work around gcc compiler bug + int jalloy = idouble; // must be non-const to work around gcc compiler bug for (int elem3 = 0; elem3 < nelements; elem3++) { Kokkos::parallel_for(Kokkos::TeamThreadRange(team,idxb_max), [&] (const int& jjb) { @@ -1331,7 +1395,7 @@ void SNAKokkos::compute_bi_cpu(const typen } } - blist(jjb, itriple, iatom) = sumzu; + blist(iatom, itriple, jjb) = sumzu; }); }); //} // end loop over j @@ -1410,8 +1474,9 @@ void SNAKokkos::compute_yi_cpu(int iter, } // end loop over ib if (bnorm_flag) { - ztmp_i /= j + 1; - ztmp_r /= j + 1; + const real_type scale = static_cast(1) / static_cast(j + 1); + ztmp_i *= scale; + ztmp_r *= scale; } // apply to z(j1,j2,j,ma,mb) to unique element of y(j) @@ -1424,24 +1489,24 @@ void SNAKokkos::compute_yi_cpu(int iter, if (j >= j1) { const int jjb = idxb_block(j1, j2, j); - const auto itriple = ((elem1 * nelements + elem2) * nelements + elem3) * idxb_max + jjb; + const int itriple = ((elem1 * nelements + elem2) * nelements + elem3) * idxb_max + jjb; if (j1 == j) { if (j2 == j) betaj = 3 * beta(itriple, iatom); else betaj = 2 * beta(itriple, iatom); } else betaj = beta(itriple, iatom); } else if (j >= j2) { const int jjb = idxb_block(j, j2, j1); - const auto itriple = ((elem3 * nelements + elem2) * nelements + elem1) * idxb_max + jjb; + const int itriple = ((elem3 * nelements + elem2) * nelements + elem1) * idxb_max + jjb; if (j2 == j) betaj = 2 * beta(itriple, iatom); else betaj = beta(itriple, iatom); } else { const int jjb = idxb_block(j2, j, j1); - const auto itriple = ((elem2 * nelements + elem3) * nelements + elem1) * idxb_max + jjb; + const int itriple = ((elem2 * nelements + elem3) * nelements + elem1) * idxb_max + jjb; betaj = beta(itriple, iatom); } if (!bnorm_flag && j1 > j) - betaj *= (j1 + 1) / (j + 1.0); + betaj *= static_cast(j1 + 1) / static_cast(j + 1); Kokkos::atomic_add(&(ylist(jju_half, elem3, iatom).re), betaj*ztmp_r); Kokkos::atomic_add(&(ylist(jju_half, elem3, iatom).im), betaj*ztmp_i); @@ -1469,9 +1534,10 @@ void SNAKokkos::compute_duidrj_cpu(const t z = rij(iatom,jnbor,2); rsq = x * x + y * y + z * z; r = sqrt(rsq); - auto rscale0 = rfac0 * static_cast(MY_PI) / (rcutij(iatom,jnbor) - rmin0); + real_type rscale0 = rfac0 * static_cast(MY_PI) / (rcutij(iatom,jnbor) - rmin0); theta0 = (r - rmin0) * rscale0; - sincos_wrapper(theta0, &sn, &cs); + sn = sin(theta0); + cs = cos(theta0); z0 = r * cs / sn; dz0dr = z0 / r - (r*rscale0) * (rsq + z0 * z0) / rsq; @@ -1559,7 +1625,7 @@ KOKKOS_INLINE_FUNCTION void SNAKokkos::add_uarraytot(const typename Kokkos::TeamPolicy::member_type& team, int iatom, int jnbor, const real_type& r, const real_type& wj, const real_type& rcut, int jelem) { - const auto sfac = compute_sfac(r, rcut) * wj; + const real_type sfac = compute_sfac(r, rcut) * wj; Kokkos::parallel_for(Kokkos::ThreadVectorRange(team,twojmax+1), [&] (const int& j) { @@ -2168,7 +2234,7 @@ real_type SNAKokkos::compute_sfac(real_typ if (r <= rmin0) return one; else if (r > rcut) return zero; else { - auto rcutfac = static_cast(MY_PI) / (rcut - rmin0); + real_type rcutfac = static_cast(MY_PI) / (rcut - rmin0); return onehalf * (cos((r - rmin0) * rcutfac) + one); } } @@ -2188,7 +2254,7 @@ real_type SNAKokkos::compute_dsfac(real_ty if (r <= rmin0) return zero; else if (r > rcut) return zero; else { - auto rcutfac = static_cast(MY_PI) / (rcut - rmin0); + real_type rcutfac = static_cast(MY_PI) / (rcut - rmin0); return -onehalf * sin((r - rmin0) * rcutfac) * rcutfac; } } @@ -2206,9 +2272,10 @@ void SNAKokkos::compute_s_dsfac(const real if (r <= rmin0) { sfac = one; dsfac = zero; } else if (r > rcut) { sfac = zero; dsfac = zero; } else { - const auto rcutfac = static_cast(MY_PI) / (rcut - rmin0); - real_type sn, cs; - sincos_wrapper((r - rmin0) * rcutfac, &sn, &cs); // need to create a wrapper + const real_type rcutfac = static_cast(MY_PI) / (rcut - rmin0); + const real_type theta0 = (r - rmin0) * rcutfac; + const real_type sn = sin(theta0); + const real_type cs = cos(theta0); sfac = onehalf * (cs + one); dsfac = -onehalf * sn * rcutfac; diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index e2fa4823bf..84c060a557 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -516,7 +516,6 @@ double FixAtomSwap::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); if (modify->n_post_force) modify->post_force(vflag); - if (modify->n_end_of_step) modify->end_of_step(); update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 2d04af50b8..2497b3d976 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -1108,7 +1108,7 @@ double FixChargeRegulation::energy_full() { if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force) modify->post_force(vflag); - if (modify->n_end_of_step) modify->end_of_step(); + update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); return total_energy; diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index fc1b1c03db..3420c23e82 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2319,10 +2319,9 @@ double FixGCMC::energy_full() if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_post_force) modify->post_force(vflag); - if (modify->n_end_of_step) modify->end_of_step(); // NOTE: all fixes with energy_global_flag set and which - // operate at pre_force() or post_force() or end_of_step() + // operate at pre_force() or post_force() // and which user has enabled via fix_modify energy yes, // will contribute to total MC energy via pe->compute_scalar() diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 7b4a749f2e..f3204ca800 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -1053,10 +1053,9 @@ double FixWidom::energy_full() if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); if (modify->n_pre_force) modify->pre_force(vflag); - if (modify->n_end_of_step) modify->end_of_step(); // NOTE: all fixes with energy_global_flag set and which - // operate at pre_force() or post_force() or end_of_step() + // operate at pre_force() or post_force() // and which user has enabled via fix_modify energy yes, // will contribute to total MC energy via pe->compute_scalar() diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index dd023e096c..645dc7a213 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -628,7 +628,8 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) chemflag = 0; bnormflag = 0; wselfallflag = 0; - chunksize = 4096; + chunksize = 32768; + parallel_thresh = 8192; // open SNAP parameter file on proc 0 @@ -696,6 +697,8 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) wselfallflag = utils::inumeric(FLERR,keyval.c_str(),false,lmp); else if (keywd == "chunksize") chunksize = utils::inumeric(FLERR,keyval.c_str(),false,lmp); + else if (keywd == "parallelthresh") + parallel_thresh = utils::inumeric(FLERR,keyval.c_str(),false,lmp); else error->all(FLERR,"Unknown parameter '{}' in SNAP " "parameter file", keywd); diff --git a/src/ML-SNAP/pair_snap.h b/src/ML-SNAP/pair_snap.h index af24685ec1..9b07282462 100644 --- a/src/ML-SNAP/pair_snap.h +++ b/src/ML-SNAP/pair_snap.h @@ -59,7 +59,7 @@ class PairSNAP : public Pair { double **scale; // for thermodynamic integration int twojmax, switchflag, bzeroflag, bnormflag; int chemflag, wselfallflag; - int chunksize; + int chunksize,parallel_thresh; double rfac0, rmin0, wj1, wj2; int rcutfacflag, twojmaxflag; // flags for required parameters int beta_max; // length of beta diff --git a/src/MOFFF/README b/src/MOFFF/README index fa3cb0ef87..6d7f111cb5 100644 --- a/src/MOFFF/README +++ b/src/MOFFF/README @@ -20,7 +20,7 @@ charges (dsf and long-range treatment of charges) out-of-plane angle See the file doc/drude_tutorial.html for getting started. -See the doc pages for "pair_style buck6d/coul/gauss", "anlge_style class2", +See the doc pages for "pair_style buck6d/coul/gauss", "angle_style class2", "angle_style cosine/buck6d", and "improper_style inversion/harmonic" commands to get started. Also see the above mentioned website and literature for further documentation about the force field. diff --git a/src/OPENMP/domain_omp.cpp b/src/OPENMP/domain_omp.cpp index 94a0b094a7..40be2f997a 100644 --- a/src/OPENMP/domain_omp.cpp +++ b/src/OPENMP/domain_omp.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -16,13 +15,16 @@ Contributing author : Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "accelerator_omp.h" #include "atom.h" +#include "error.h" +#include "omp_compat.h" using namespace LAMMPS_NS; -typedef struct { double x,y,z; } dbl3_t; +typedef struct { + double x, y, z; +} dbl3_t; /* ---------------------------------------------------------------------- enforce PBC and modify box image flags for each atom @@ -37,20 +39,35 @@ typedef struct { double x,y,z; } dbl3_t; void DomainOMP::pbc() { - dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; - dbl3_t * _noalias const v = (dbl3_t *)&atom->v[0][0]; - const double * _noalias const lo = (triclinic == 0) ? boxlo : boxlo_lamda; - const double * _noalias const hi = (triclinic == 0) ? boxhi : boxhi_lamda; - const double * _noalias const period = (triclinic == 0) ? prd : prd_lamda; - const int * _noalias const mask = atom->mask; - imageint * _noalias const image = atom->image; const int nlocal = atom->nlocal; + if (!nlocal) return; + + // verify owned atoms have valid numerical coords + // may not if computed pairwise force between 2 atoms at same location + + const double *_noalias const coord = &atom->x[0][0]; + const int n3 = 3 * nlocal; + int flag = 0; +#if defined(_OPENMP) // clang-format off +#pragma omp parallel for LMP_DEFAULT_NONE schedule(static) reduction(+:flag) +#endif // clang-format on + for (int i = 0; i < n3; i++) + if (!std::isfinite(coord[i])) flag = 1; + if (flag) error->one(FLERR, "Non-numeric atom coords - simulation unstable"); + + dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; + dbl3_t *_noalias const v = (dbl3_t *) &atom->v[0][0]; + const double *_noalias const lo = (triclinic == 0) ? boxlo : boxlo_lamda; + const double *_noalias const hi = (triclinic == 0) ? boxhi : boxhi_lamda; + const double *_noalias const period = (triclinic == 0) ? prd : prd_lamda; + const int *_noalias const mask = atom->mask; + imageint *_noalias const image = atom->image; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) #endif for (int i = 0; i < nlocal; i++) { - imageint idim,otherdims; + imageint idim, otherdims; if (xperiodic) { if (x[i].x < lo[0]) { @@ -64,7 +81,7 @@ void DomainOMP::pbc() } if (x[i].x >= hi[0]) { x[i].x -= period[0]; - x[i].x = MAX(x[i].x,lo[0]); + x[i].x = MAX(x[i].x, lo[0]); if (deform_vremap && mask[i] & deform_groupbit) v[i].x -= h_rate[0]; idim = image[i] & IMGMASK; otherdims = image[i] ^ idim; @@ -89,7 +106,7 @@ void DomainOMP::pbc() } if (x[i].y >= hi[1]) { x[i].y -= period[1]; - x[i].y = MAX(x[i].y,lo[1]); + x[i].y = MAX(x[i].y, lo[1]); if (deform_vremap && mask[i] & deform_groupbit) { v[i].x -= h_rate[5]; v[i].y -= h_rate[1]; @@ -118,7 +135,7 @@ void DomainOMP::pbc() } if (x[i].z >= hi[2]) { x[i].z -= period[2]; - x[i].z = MAX(x[i].z,lo[2]); + x[i].z = MAX(x[i].z, lo[2]); if (deform_vremap && mask[i] & deform_groupbit) { v[i].x -= h_rate[4]; v[i].y -= h_rate[3]; @@ -141,16 +158,17 @@ void DomainOMP::pbc() void DomainOMP::lamda2x(int n) { - dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; const int num = n; + if (!n) return; + dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) #endif for (int i = 0; i < num; i++) { - x[i].x = h[0]*x[i].x + h[5]*x[i].y + h[4]*x[i].z + boxlo[0]; - x[i].y = h[1]*x[i].y + h[3]*x[i].z + boxlo[1]; - x[i].z = h[2]*x[i].z + boxlo[2]; + x[i].x = h[0] * x[i].x + h[5] * x[i].y + h[4] * x[i].z + boxlo[0]; + x[i].y = h[1] * x[i].y + h[3] * x[i].z + boxlo[1]; + x[i].z = h[2] * x[i].z + boxlo[2]; } } @@ -161,8 +179,9 @@ void DomainOMP::lamda2x(int n) void DomainOMP::x2lamda(int n) { - dbl3_t * _noalias const x = (dbl3_t *)&atom->x[0][0]; const int num = n; + if (!n) return; + dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) @@ -172,9 +191,8 @@ void DomainOMP::x2lamda(int n) double delta1 = x[i].y - boxlo[1]; double delta2 = x[i].z - boxlo[2]; - x[i].x = h_inv[0]*delta0 + h_inv[5]*delta1 + h_inv[4]*delta2; - x[i].y = h_inv[1]*delta1 + h_inv[3]*delta2; - x[i].z = h_inv[2]*delta2; + x[i].x = h_inv[0] * delta0 + h_inv[5] * delta1 + h_inv[4] * delta2; + x[i].y = h_inv[1] * delta1 + h_inv[3] * delta2; + x[i].z = h_inv[2] * delta2; } } - diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 0c309b9ead..192331889d 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -140,6 +140,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : rxnfunclist[0] = "rxnsum"; rxnfunclist[1] = "rxnave"; nvvec = 0; + ncustomvars = 0; vvec = nullptr; nxspecial = nullptr; @@ -232,7 +233,6 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : memory->create(molecule_keyword,nreacts,"bond/react:molecule_keyword"); memory->create(nconstraints,nreacts,"bond/react:nconstraints"); memory->create(constraintstr,nreacts,MAXLINE,"bond/react:constraintstr"); - memory->create(constraints,0,nreacts,"bond/react:constraints"); memory->create(var_flag,NUMVARVALS,nreacts,"bond/react:var_flag"); memory->create(var_id,NUMVARVALS,nreacts,"bond/react:var_id"); memory->create(iatomtype,nreacts,"bond/react:iatomtype"); @@ -488,6 +488,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : if (custom_charges_fragid[i] >= 0) CustomCharges(custom_charges_fragid[i],i); } + // get the names of per-atom variables needed by 'rxn' functions of custom constraint + customvarnames(); + // initialize Marsaglia RNG with processor-unique seed (Arrhenius prob) rrhandom = new RanMars*[narrhenius]; @@ -617,7 +620,6 @@ FixBondReact::~FixBondReact() memory->destroy(stabilize_steps_flag); memory->destroy(custom_charges_fragid); memory->destroy(molecule_keyword); - memory->destroy(constraints); memory->destroy(nconstraints); memory->destroy(constraintstr); memory->destroy(create_atoms_flag); @@ -1020,6 +1022,11 @@ void FixBondReact::post_integrate() return; } + // evaluate custom constraint variable values here and forward_comm + get_customvars(); + commflag = 1; + comm->forward_comm_fix(this,ncustomvars); + // run through the superimpose algorithm // this checks if simulation topology matches unreacted mol template superimpose_algorithm(); @@ -2086,6 +2093,100 @@ double FixBondReact::get_temperature(tagint **myglove, int row_offset, int col) return t; } +/* ---------------------------------------------------------------------- +get per-atom variable names used by custom constraint +------------------------------------------------------------------------- */ + +void FixBondReact::customvarnames() +{ + int pos,pos1,pos2,pos3,prev3; + std::string varstr,argstr,varid; + + // search all constraints' varstr for special 'rxn' functions + // add variable names to customvarstrs + // add values to customvars + + for (rxnID = 0; rxnID < nreacts; rxnID++) { + for (int i = 0; i < nconstraints[rxnID]; i++) { + if (constraints[i][rxnID].type == CUSTOM) { + varstr = constraints[i][rxnID].str; + prev3 = -1; + while (true) { + // find next reaction special function occurrence + pos1 = INT_MAX; + for (int i = 0; i < nrxnfunction; i++) { + pos = varstr.find(rxnfunclist[i],prev3+1); + if (pos == std::string::npos) continue; + if (pos < pos1) pos1 = pos; + } + if (pos1 == INT_MAX) break; + + pos2 = varstr.find("(",pos1); + pos3 = varstr.find(")",pos2); + if (pos2 == std::string::npos || pos3 == std::string::npos) + error->all(FLERR,"Bond/react: Illegal rxn function syntax\n"); + prev3 = pos3; + argstr = varstr.substr(pos2+1,pos3-pos2-1); + argstr.erase(remove_if(argstr.begin(), argstr.end(), isspace), argstr.end()); // remove whitespace + pos2 = argstr.find(","); + if (pos2 != std::string::npos) varid = argstr.substr(0,pos2); + else varid = argstr; + // check if we already know about this variable + int varidflag = 0; + for (int j = 0; j < ncustomvars; j++) { + if (customvarstrs[j] == varid) { + varidflag = 1; + break; + } + } + if (!varidflag) { + customvarstrs.resize(ncustomvars+1); + customvarstrs[ncustomvars++] = varid; + } + } + } + } + } +} + +/* ---------------------------------------------------------------------- +evaluate per-atom variables needed for custom constraint +------------------------------------------------------------------------- */ + +void FixBondReact::get_customvars() +{ + double *tempvvec; + std::string varid; + int nall = atom->nlocal + atom->nghost; + + memory->create(tempvvec,nall,"bond/react:tempvvec"); + if (vvec == nullptr) { + memory->create(vvec,nall,ncustomvars,"bond/react:vvec"); + nvvec = nall; + } + if (nvvec < nall) { + memory->grow(vvec,nall,ncustomvars,"bond/react:vvec"); + nvvec = nall; + } + for (int i = 0; i < ncustomvars; i++) { + varid = customvarstrs[i]; + if (varid.substr(0,2) != "v_") error->all(FLERR,"Bond/react: Reaction special function variable " + "name should begin with 'v_'"); + varid = varid.substr(2); + int ivar = input->variable->find(varid.c_str()); + if (ivar < 0) + error->all(FLERR,"Bond/react: Reaction special function variable " + "name does not exist"); + if (!input->variable->atomstyle(ivar)) + error->all(FLERR,"Bond/react: Reaction special function must " + "reference an atom-style variable"); + + input->variable->compute_atom(ivar,igroup,tempvvec,1,0); + for (int j = 0; j < nall; j++) vvec[j][i] = tempvvec[j]; + } + memory->destroy(tempvvec); +} + /* ---------------------------------------------------------------------- evaulate expression for variable constraint ------------------------------------------------------------------------- */ @@ -2120,6 +2221,7 @@ double FixBondReact::custom_constraint(std::string varstr) evlstr.push_back(varstr.substr(prev3+1,pos1-(prev3+1))); prev3 = pos3; argstr = varstr.substr(pos2+1,pos3-pos2-1); + argstr.erase(remove_if(argstr.begin(), argstr.end(), isspace), argstr.end()); // remove whitespace pos2 = argstr.find(","); if (pos2 != std::string::npos) { varid = argstr.substr(0,pos2); @@ -2145,25 +2247,19 @@ currently two 'rxn' functions: rxnsum and rxnave double FixBondReact::rxnfunction(std::string rxnfunc, std::string varid, std::string fragid) { - if (varid.substr(0,2) != "v_") error->one(FLERR,"Bond/react: Reaction special function variable " - "name should begin with 'v_'"); - varid = varid.substr(2); - int ivar = input->variable->find(varid.c_str()); + int ivar = -1; + for (int i = 0; i < ncustomvars; i++) { + if (varid == customvarstrs[i]) { + ivar = i; + break; + } + } + // variable name should always be found, at this point + // however, let's double check for completeness if (ivar < 0) error->one(FLERR,"Bond/react: Reaction special function variable " "name does not exist"); - if (!input->variable->atomstyle(ivar)) - error->one(FLERR,"Bond/react: Reaction special function must " - "reference an atom-style variable"); - if (vvec == nullptr) { - memory->create(vvec,atom->nlocal,"bond/react:vvec"); - nvvec = atom->nlocal; - } - if (nvvec < atom->nlocal) { - memory->grow(vvec,atom->nlocal,"bond/react:vvec"); - nvvec = atom->nlocal; - } - input->variable->compute_atom(ivar,igroup,vvec,1,0); + int ifrag = -1; if (fragid != "all") { ifrag = onemol->findfragment(fragid.c_str()); @@ -2178,14 +2274,14 @@ double FixBondReact::rxnfunction(std::string rxnfunc, std::string varid, if (fragid == "all") { for (int i = 0; i < onemol->natoms; i++) { iatom = atom->map(glove[i][1]); - sumvvec += vvec[iatom]; + sumvvec += vvec[iatom][ivar]; } nsum = onemol->natoms; } else { for (int i = 0; i < onemol->natoms; i++) { if (onemol->fragmentmask[ifrag][i]) { iatom = atom->map(glove[i][1]); - sumvvec += vvec[iatom]; + sumvvec += vvec[iatom][ivar]; nsum++; } } @@ -2830,6 +2926,19 @@ void FixBondReact::update_everything() rxnID = local_mega_glove[0][i]; // reactions already shuffled from dedup procedure, so can skip first N if (iskip[rxnID]++ < nlocalskips[rxnID]) continue; + + // 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)) { + inserted_atoms_flag = 1; + } else { // create aborted + reaction_count_total[rxnID]--; + continue; + } + } + for (int j = 0; j < max_natoms+1; j++) update_mega_glove[j][update_num_mega] = local_mega_glove[j][i]; update_num_mega++; @@ -2842,7 +2951,7 @@ void FixBondReact::update_everything() // we can insert atoms here, now that reactions are finalized // can't do it any earlier, due to skipped reactions (max_rxn) - // reactions that create atoms are always treated as 'global' + // 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]]; @@ -2858,17 +2967,18 @@ void FixBondReact::update_everything() update_mega_glove[j][update_num_mega] = global_mega_glove[j][i]; update_num_mega++; } - // if inserted atoms and global map exists, reset map now instead - // of waiting for comm since other pre-exchange fixes may use it - // invoke map_init() b/c atom count has grown - // do this once after all atom insertions - if (inserted_atoms_flag == 1 && atom->map_style != Atom::MAP_NONE) { - atom->map_init(); - atom->map_set(); - } } delete [] iskip; + // if inserted atoms and global map exists, reset map now instead + // of waiting for comm since other pre-exchange fixes may use it + // invoke map_init() b/c atom count has grown + // do this once after all atom insertions + if (inserted_atoms_flag == 1 && atom->map_style != Atom::MAP_NONE) { + atom->map_init(); + atom->map_set(); + } + // mark to-delete atoms nlocal = atom->nlocal; if (nlocal > nmark) { @@ -3668,7 +3778,7 @@ void FixBondReact::read(int myrxn) else if (strstr(line,"constraints")) { sscanf(line,"%d",&nconstraints[myrxn]); if (maxnconstraints < nconstraints[myrxn]) maxnconstraints = nconstraints[myrxn]; - memory->grow(constraints,maxnconstraints,nreacts,"bond/react:constraints"); + constraints.resize(maxnconstraints, std::vector(nreacts)); } else break; } @@ -4027,6 +4137,15 @@ int FixBondReact::pack_forward_comm(int n, int *list, double *buf, m = 0; + if (commflag == 1) { + for (i = 0; i < n; i++) { + j = list[i]; + for (k = 0; k < ncustomvars; k++) + buf[m++] = vvec[j][k]; + } + return m; + } + if (commflag == 2) { for (i = 0; i < n; i++) { j = list[i]; @@ -4051,12 +4170,16 @@ int FixBondReact::pack_forward_comm(int n, int *list, double *buf, void FixBondReact::unpack_forward_comm(int n, int first, double *buf) { - int i,j,m,ns,last; + int i,j,k,m,ns,last; m = 0; last = first + n; - if (commflag == 2) { + if (commflag == 1) { + for (i = first; i < last; i++) + for (k = 0; k < ncustomvars; k++) + vvec[i][k] = buf[m++]; + } else if (commflag == 2) { for (i = first; i < last; i++) partner[i] = (tagint) ubuf(buf[m++]).i; } else { diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index abb2b5b123..097133cb00 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -139,8 +139,6 @@ class FixBondReact : public Fix { int **delete_atoms; // atoms in pre-reacted templates to delete int **create_atoms; // atoms in post-reacted templates to create int ***chiral_atoms; // pre-react chiral atoms. 1) flag 2) orientation 3-4) ordered atom types - int nvvec; - double *vvec; // per-atom vector to store variable constraint atom-style variable values int **nxspecial, **onemol_nxspecial, **twomol_nxspecial; // full number of 1-4 neighbors tagint **xspecial, **onemol_xspecial, **twomol_xspecial; // full 1-4 neighbor list @@ -151,14 +149,12 @@ class FixBondReact : public Fix { // for all mega_gloves and global_mega_glove: first row is the ID of bond/react tagint **local_mega_glove; // consolidation local of reaction instances tagint **ghostly_mega_glove; // consolidation nonlocal of reaction instances - tagint * - *global_mega_glove; // consolidation (inter-processor) of gloves containing nonlocal atoms + tagint **global_mega_glove; // consolidation (inter-processor) of gloves containing nonlocal atoms int *localsendlist; // indicates ghosts of other procs int local_num_mega; // num of local reaction instances int ghostly_num_mega; // num of ghostly reaction instances int global_megasize; // num of reaction instances in global_mega_glove - int * - pioneers; // during Superimpose Algorithm, atoms which have been assigned, but whose first neighbors haven't + int *pioneers; // during Superimpose Algorithm, atoms which have been assigned, but whose first neighbors haven't int glove_counter; // used to determine when to terminate Superimpose Algorithm void read(int); @@ -180,8 +176,10 @@ class FixBondReact : public Fix { int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); - double custom_constraint(std::string); - double rxnfunction(std::string, std::string, std::string); + 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(std::string); // evaulate expression for custom constraint + double rxnfunction(std::string, std::string, std::string); // eval rxn_sum and rxn_ave int get_chirality(double[12]); // get handedness given an ordered set of coordinates void open(char *); @@ -216,7 +214,11 @@ class FixBondReact : public Fix { double par[MAXCONPAR]; std::string str; }; - Constraint **constraints; + int ncustomvars; + std::vector customvarstrs; + int nvvec; + double **vvec; // per-atom vector to store variable constraint atom-style variable values + std::vector> constraints; // DEBUG diff --git a/src/atom.cpp b/src/atom.cpp index 4135298673..111ce7c93c 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -2471,7 +2471,7 @@ This function is called, e.g. from :doc:`fix property/atom `. */ int Atom::add_custom(const char *name, int flag, int cols) { - int index; + int index = -1; if ((flag == 0) && (cols == 0)) { index = nivector; @@ -2511,7 +2511,8 @@ int Atom::add_custom(const char *name, int flag, int cols) dcols = (int *) memory->srealloc(dcols,ndarray*sizeof(int),"atom:dcols"); dcols[index] = cols; } - + if (index < 0) + error->all(FLERR,"Invalid call to Atom::add_custom()"); return index; } diff --git a/src/domain.cpp b/src/domain.cpp index 7df82fbfb3..daaf41338f 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -528,10 +528,11 @@ void Domain::reset_box() void Domain::pbc() { + int nlocal = atom->nlocal; + if (!nlocal) return; int i; imageint idim,otherdims; double *lo,*hi,*period; - int nlocal = atom->nlocal; double **x = atom->x; double **v = atom->v; int *mask = atom->mask; @@ -542,7 +543,7 @@ void Domain::pbc() double *coord; int n3 = 3*nlocal; - coord = &x[0][0]; // note: x is always initialized to at least one element. + coord = &x[0][0]; int flag = 0; for (i = 0; i < n3; i++) if (!std::isfinite(*coord++)) flag = 1; diff --git a/src/dump.cpp b/src/dump.cpp index ae7086af44..b42797833b 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -100,7 +100,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) maxsbuf = 0; sbuf = nullptr; - maxpbc = 0; + maxpbc = -1; xpbc = vpbc = nullptr; imagepbc = nullptr; diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 7df49f4bc4..6864b1f843 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -31,7 +31,7 @@ enum{MOLECULE,CHARGE,RMASS,IVEC,DVEC,IARRAY,DARRAY}; FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalue(0), style(nullptr), index(nullptr), astyle(nullptr) + nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); @@ -40,7 +40,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; nvalue = narg-iarg; - style = new int[nvalue]; + styles = new int[nvalue]; cols = new int[nvalue]; index = new int[nvalue]; @@ -58,7 +58,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : "already has molecule attribute"); if (molecule_flag) error->all(FLERR,"Fix property/atom cannot specify mol twice"); - style[nvalue] = MOLECULE; + styles[nvalue] = MOLECULE; cols[nvalue] = 0; atom->molecule_flag = molecule_flag = 1; values_peratom++; @@ -69,7 +69,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix property/atom q when atom_style already has charge attribute"); if (q_flag) error->all(FLERR,"Fix property/atom cannot specify q twice"); - style[nvalue] = CHARGE; + styles[nvalue] = CHARGE; cols[nvalue] = 0; atom->q_flag = q_flag = 1; values_peratom++; @@ -80,7 +80,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix property/atom rmass when atom_style already has rmass attribute"); if (rmass_flag) error->all(FLERR,"Fix property/atom cannot specify rmass twice"); - style[nvalue] = RMASS; + styles[nvalue] = RMASS; cols[nvalue] = 0; atom->rmass_flag = rmass_flag = 1; values_peratom++; @@ -90,7 +90,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : // custom atom vector } else if (utils::strmatch(arg[iarg],"^i_")) { - style[nvalue] = IVEC; + styles[nvalue] = IVEC; int flag,ncols; index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); if (index[nvalue] >= 0) @@ -102,7 +102,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : iarg++; } else if (utils::strmatch(arg[iarg],"^d_")) { - style[nvalue] = DVEC; + styles[nvalue] = DVEC; int flag,ncols; index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); if (index[nvalue] >= 0) @@ -129,10 +129,10 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (arg[iarg][0] == 'i') { which = 0; - style[nvalue] = IARRAY; + styles[nvalue] = IARRAY; } else { which = 1; - style[nvalue] = DARRAY; + styles[nvalue] = DARRAY; } index[nvalue] = atom->add_custom(&arg[iarg][3],which,ncols); cols[nvalue] = ncols; @@ -165,9 +165,9 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (border == 0) { int flag = 0; for (int i = 0; i < nvalue; i++) - if (style[i] == MOLECULE - || style[i] == CHARGE - || style[i] == RMASS) flag = 1; + if (styles[i] == MOLECULE + || styles[i] == CHARGE + || styles[i] == RMASS) flag = 1; if (flag && comm->me == 0) error->warning(FLERR,"Fix property/atom mol or charge or rmass " "w/out ghost communication"); @@ -201,30 +201,30 @@ FixPropertyAtom::~FixPropertyAtom() // set ptrs to a null pointer, so they no longer exist for Atom class for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) { + if (styles[nv] == MOLECULE) { atom->molecule_flag = 0; memory->destroy(atom->molecule); atom->molecule = nullptr; - } else if (style[nv] == CHARGE) { + } else if (styles[nv] == CHARGE) { atom->q_flag = 0; memory->destroy(atom->q); atom->q = nullptr; - } else if (style[nv] == RMASS) { + } else if (styles[nv] == RMASS) { atom->rmass_flag = 0; memory->destroy(atom->rmass); atom->rmass = nullptr; - } else if (style[nv] == IVEC) { + } else if (styles[nv] == IVEC) { atom->remove_custom(index[nv],0,cols[nv]); - } else if (style[nv] == DVEC) { + } else if (styles[nv] == DVEC) { atom->remove_custom(index[nv],1,cols[nv]); - } else if (style[nv] == IARRAY) { + } else if (styles[nv] == IARRAY) { atom->remove_custom(index[nv],0,cols[nv]); - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { atom->remove_custom(index[nv],1,cols[nv]); } } - delete [] style; + delete [] styles; delete [] cols; delete [] index; delete [] astyle; @@ -291,21 +291,21 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint if ((m = atom->map(itag)) >= 0) { for (j = 0; j < nvalue; j++) { - if (style[j] == MOLECULE) { + if (styles[j] == MOLECULE) { atom->molecule[m] = values.next_tagint(); - } else if (style[j] == CHARGE) { + } else if (styles[j] == CHARGE) { atom->q[m] = values.next_double(); - } else if (style[j] == RMASS) { + } else if (styles[j] == RMASS) { atom->rmass[m] = values.next_double(); - } else if (style[j] == IVEC) { + } else if (styles[j] == IVEC) { atom->ivector[index[j]][m] = values.next_int(); - } else if (style[j] == DVEC) { + } else if (styles[j] == DVEC) { atom->dvector[index[j]][m] = values.next_double(); - } else if (style[j] == IARRAY) { + } else if (styles[j] == IARRAY) { ncol = cols[j]; for (k = 0; k < ncol; k++) atom->iarray[index[j]][m][k] = values.next_int(); - } else if (style[j] == DARRAY) { + } else if (styles[j] == DARRAY) { ncol = cols[j]; for (k = 0; k < ncol; k++) atom->darray[index[j]][m][k] = values.next_double(); @@ -365,34 +365,34 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) int icol = 1; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) { + if (styles[nv] == MOLECULE) { tagint *molecule = atom->molecule; for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(molecule[i]).d; icol++; - } else if (style[nv] == CHARGE) { + } else if (styles[nv] == CHARGE) { double *q = atom->q; for (i = 0; i < nlocal; i++) buf[i][icol] = q[i]; icol++; - } else if (style[nv] == RMASS) { + } else if (styles[nv] == RMASS) { double *rmass = atom->rmass; for (i = 0; i < nlocal; i++) buf[i][icol] = rmass[i]; icol++; - } else if (style[nv] == IVEC) { + } else if (styles[nv] == IVEC) { int *ivec = atom->ivector[index[nv]]; for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(ivec[i]).d; icol++; - } else if (style[nv] == DVEC) { + } else if (styles[nv] == DVEC) { double *dvec = atom->dvector[index[nv]]; for (i = 0; i < nlocal; i++) buf[i][icol] = dvec[i]; icol++; - } else if (style[nv] == IARRAY) { + } else if (styles[nv] == IARRAY) { int **iarray = atom->iarray[index[nv]]; ncol = cols[nv]; for (i = 0; i < nlocal; i++) for (k = 0; k < ncol; k++) buf[i][icol+k] = ubuf(iarray[i][k]).d; icol += ncol; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; for (i = 0; i < nlocal; i++) @@ -412,19 +412,19 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp) { - if (nvalue == 1 && style[0] == MOLECULE) fprintf(fp,"\nMolecules\n\n"); - else if (nvalue == 1 && style[0] == CHARGE) fprintf(fp,"\nCharges\n\n"); + if (nvalue == 1 && styles[0] == MOLECULE) fprintf(fp,"\nMolecules\n\n"); + else if (nvalue == 1 && styles[0] == CHARGE) fprintf(fp,"\nCharges\n\n"); else { fprintf(fp,"\n%s #",id); // write column hint as comment for (int i = 0; i < nvalue; ++i) { - if (style[i] == MOLECULE) fputs(" mol",fp); - else if (style[i] == CHARGE) fputs(" q",fp); - else if (style[i] == RMASS) fputs(" rmass",fp); - else if (style[i] == IVEC) fprintf(fp," i_%s", atom->ivname[index[i]]); - else if (style[i] == DVEC) fprintf(fp, " d_%s", atom->dvname[index[i]]); - else if (style[i] == IARRAY) fprintf(fp, " i_%s", atom->ianame[index[i]]); - else if (style[i] == DARRAY) fprintf(fp, " d_%s", atom->daname[index[i]]); + if (styles[i] == MOLECULE) fputs(" mol",fp); + else if (styles[i] == CHARGE) fputs(" q",fp); + else if (styles[i] == RMASS) fputs(" rmass",fp); + else if (styles[i] == IVEC) fprintf(fp," i_%s", atom->ivname[index[i]]); + else if (styles[i] == DVEC) fprintf(fp, " d_%s", atom->dvname[index[i]]); + else if (styles[i] == IARRAY) fprintf(fp, " i_%s", atom->ianame[index[i]]); + else if (styles[i] == DARRAY) fprintf(fp, " d_%s", atom->daname[index[i]]); } fputs("\n\n",fp); } @@ -446,22 +446,22 @@ void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp, fprintf(fp,TAGINT_FORMAT,(tagint) ubuf(buf[i][0]).i); icol = 1; for (nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) + if (styles[nv] == MOLECULE) fprintf(fp," " TAGINT_FORMAT,(tagint) ubuf(buf[i][icol++]).i); - else if (style[nv] == CHARGE) + else if (styles[nv] == CHARGE) fprintf(fp," %g",buf[i][icol++]); - else if (style[nv] == RMASS) + else if (styles[nv] == RMASS) fprintf(fp," %g",buf[i][icol++]); - else if (style[nv] == IVEC) + else if (styles[nv] == IVEC) fprintf(fp," %d",(int) ubuf(buf[i][icol++]).i); - else if (style[nv] == DVEC) + else if (styles[nv] == DVEC) fprintf(fp," %g",buf[i][icol++]); - else if (style[nv] == IARRAY) { + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) fprintf(fp," %d",(int) ubuf(buf[i][icol+k]).i); icol += ncol; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) fprintf(fp," %g",buf[i][icol+k]); @@ -480,13 +480,13 @@ double FixPropertyAtom::memory_usage() { double bytes = 0.0; for (int m = 0; m < nvalue; m++) { - if (style[m] == MOLECULE) bytes = atom->nmax * sizeof(tagint); - else if (style[m] == CHARGE) bytes = atom->nmax * sizeof(double); - else if (style[m] == RMASS) bytes = atom->nmax * sizeof(double); - else if (style[m] == IVEC) bytes = atom->nmax * sizeof(int); - else if (style[m] == DVEC) bytes = atom->nmax * sizeof(double); - else if (style[m] == IARRAY) bytes = atom->nmax * cols[m] * sizeof(int); - else if (style[m] == DARRAY) bytes = atom->nmax * cols[m] * sizeof(double); + if (styles[m] == MOLECULE) bytes = atom->nmax * sizeof(tagint); + else if (styles[m] == CHARGE) bytes = atom->nmax * sizeof(double); + else if (styles[m] == RMASS) bytes = atom->nmax * sizeof(double); + else if (styles[m] == IVEC) bytes = atom->nmax * sizeof(int); + else if (styles[m] == DVEC) bytes = atom->nmax * sizeof(double); + else if (styles[m] == IARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(int); + else if (styles[m] == DARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(double); } return bytes; } @@ -501,33 +501,33 @@ double FixPropertyAtom::memory_usage() void FixPropertyAtom::grow_arrays(int nmax) { for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) { + if (styles[nv] == MOLECULE) { memory->grow(atom->molecule,nmax,"atom:molecule"); size_t nbytes = (nmax-nmax_old) * sizeof(tagint); memset(&atom->molecule[nmax_old],0,nbytes); - } else if (style[nv] == CHARGE) { + } else if (styles[nv] == CHARGE) { memory->grow(atom->q,nmax,"atom:q"); size_t nbytes = (nmax-nmax_old) * sizeof(double); memset(&atom->q[nmax_old],0,nbytes); - } else if (style[nv] == RMASS) { + } else if (styles[nv] == RMASS) { memory->grow(atom->rmass,nmax,"atom:rmass"); size_t nbytes = (nmax-nmax_old) * sizeof(double); memset(&atom->rmass[nmax_old],0,nbytes); - } else if (style[nv] == IVEC) { + } else if (styles[nv] == IVEC) { memory->grow(atom->ivector[index[nv]],nmax,"atom:ivector"); size_t nbytes = (nmax-nmax_old) * sizeof(int); memset(&atom->ivector[index[nv]][nmax_old],0,nbytes); - } else if (style[nv] == DVEC) { + } else if (styles[nv] == DVEC) { memory->grow(atom->dvector[index[nv]],nmax,"atom:dvector"); size_t nbytes = (nmax-nmax_old) * sizeof(double); memset(&atom->dvector[index[nv]][nmax_old],0,nbytes); - } else if (style[nv] == IARRAY) { + } else if (styles[nv] == IARRAY) { memory->grow(atom->iarray[index[nv]],nmax,cols[nv],"atom:iarray"); - size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(int); + size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(int); if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0],0,nbytes); - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { memory->grow(atom->darray[index[nv]],nmax,cols[nv],"atom:darray"); - size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(double); + size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(double); if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0],0,nbytes); } } @@ -544,21 +544,21 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) int k,ncol; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) + if (styles[nv] == MOLECULE) atom->molecule[j] = atom->molecule[i]; - else if (style[nv] == CHARGE) + else if (styles[nv] == CHARGE) atom->q[j] = atom->q[i]; - else if (style[nv] == RMASS) + else if (styles[nv] == RMASS) atom->rmass[j] = atom->rmass[i]; - else if (style[nv] == IVEC) + else if (styles[nv] == IVEC) atom->ivector[index[nv]][j] = atom->ivector[index[nv]][i]; - else if (style[nv] == DVEC) + else if (styles[nv] == DVEC) atom->dvector[index[nv]][j] = atom->dvector[index[nv]][i]; - else if (style[nv] == IARRAY) { + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k]; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k]; @@ -576,37 +576,37 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf) int m = 0; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) { + if (styles[nv] == MOLECULE) { tagint *molecule = atom->molecule; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = ubuf(molecule[j]).d; } - } else if (style[nv] == CHARGE) { + } else if (styles[nv] == CHARGE) { double *q = atom->q; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = q[j]; } - } else if (style[nv] == RMASS) { + } else if (styles[nv] == RMASS) { double *rmass = atom->rmass; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = rmass[j]; } - } else if (style[nv] == IVEC) { + } else if (styles[nv] == IVEC) { int *ivector = atom->ivector[index[nv]]; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = ubuf(ivector[j]).d; } - } else if (style[nv] == DVEC) { + } else if (styles[nv] == DVEC) { double *dvector = atom->dvector[index[nv]]; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = dvector[j]; } - } else if (style[nv] == IARRAY) { + } else if (styles[nv] == IARRAY) { int **iarray = atom->iarray[index[nv]]; ncol = cols[nv]; for (i = 0; i < n; i++) { @@ -614,7 +614,7 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf) for (k = 0; k < ncol; k++) buf[m++] = ubuf(iarray[j][k]).d; } - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; for (i = 0; i < n; i++) { @@ -638,39 +638,39 @@ int FixPropertyAtom::unpack_border(int n, int first, double *buf) int m = 0; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) { + if (styles[nv] == MOLECULE) { tagint *molecule = atom->molecule; last = first + n; for (i = first; i < last; i++) molecule[i] = (tagint) ubuf(buf[m++]).i; - } else if (style[nv] == CHARGE) { + } else if (styles[nv] == CHARGE) { double *q = atom->q; last = first + n; for (i = first; i < last; i++) q[i] = buf[m++]; - } else if (style[nv] == RMASS) { + } else if (styles[nv] == RMASS) { double *rmass = atom->rmass; last = first + n; for (i = first; i < last; i++) rmass[i] = buf[m++]; - } else if (style[nv] == IVEC) { + } else if (styles[nv] == IVEC) { int *ivector = atom->ivector[index[nv]]; last = first + n; for (i = first; i < last; i++) ivector[i] = (int) ubuf(buf[m++]).i; - } else if (style[nv] == DVEC) { + } else if (styles[nv] == DVEC) { double *dvector = atom->dvector[index[nv]]; last = first + n; for (i = first; i < last; i++) dvector[i] = buf[m++]; - } else if (style[nv] == IARRAY) { + } else if (styles[nv] == IARRAY) { int **iarray = atom->iarray[index[nv]]; ncol = cols[nv]; last = first + n; for (i = first; i < last; i++) for (k = 0; k < ncol; k++) iarray[i][k] = (int) ubuf(buf[m++]).i; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; last = first + n; @@ -693,16 +693,16 @@ int FixPropertyAtom::pack_exchange(int i, double *buf) int m = 0; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; - else if (style[nv] == CHARGE) buf[m++] = atom->q[i]; - else if (style[nv] == RMASS) buf[m++] = atom->rmass[i]; - else if (style[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; - else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; - else if (style[nv] == IARRAY) { + if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; + else if (styles[nv] == CHARGE) buf[m++] = atom->q[i]; + else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; + else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; + else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) buf[m++] = atom->darray[index[nv]][i][k]; @@ -722,21 +722,21 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) int m = 0; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) + if (styles[nv] == MOLECULE) atom->molecule[nlocal] = (tagint) ubuf(buf[m++]).i; - else if (style[nv] == CHARGE) + else if (styles[nv] == CHARGE) atom->q[nlocal] = buf[m++]; - else if (style[nv] == RMASS) + else if (styles[nv] == RMASS) atom->rmass[nlocal] = buf[m++]; - else if (style[nv] == IVEC) + else if (styles[nv] == IVEC) atom->ivector[index[nv]][nlocal] = (int) ubuf(buf[m++]).i; - else if (style[nv] == DVEC) + else if (styles[nv] == DVEC) atom->dvector[index[nv]][nlocal] = buf[m++]; - else if (style[nv] == IARRAY) { + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->darray[index[nv]][nlocal][k] = buf[m++]; @@ -760,16 +760,16 @@ int FixPropertyAtom::pack_restart(int i, double *buf) int m = 1; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; - else if (style[nv] == CHARGE) buf[m++] = atom->q[i]; - else if (style[nv] == RMASS) buf[m++] = atom->rmass[i]; - else if (style[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; - else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; - else if (style[nv] == IARRAY) { + if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; + else if (styles[nv] == CHARGE) buf[m++] = atom->q[i]; + else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; + else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; + else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) buf[m++] = atom->darray[index[nv]][i][k]; @@ -796,21 +796,21 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) m++; for (int nv = 0; nv < nvalue; nv++) { - if (style[nv] == MOLECULE) + if (styles[nv] == MOLECULE) atom->molecule[nlocal] = (tagint) ubuf(extra[nlocal][m++]).i; - else if (style[nv] == CHARGE) + else if (styles[nv] == CHARGE) atom->q[nlocal] = extra[nlocal][m++]; - else if (style[nv] == RMASS) + else if (styles[nv] == RMASS) atom->rmass[nlocal] = extra[nlocal][m++]; - else if (style[nv] == IVEC) + else if (styles[nv] == IVEC) atom->ivector[index[nv]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; - else if (style[nv] == DVEC) + else if (styles[nv] == DVEC) atom->dvector[index[nv]][nlocal] = extra[nlocal][m++]; - else if (style[nv] == IARRAY) { + else if (styles[nv] == IARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->iarray[index[nv]][nlocal][k] = (int) ubuf(extra[nlocal][m++]).i; - } else if (style[nv] == DARRAY) { + } else if (styles[nv] == DARRAY) { ncol = cols[nv]; for (k = 0; k < ncol; k++) atom->darray[index[nv]][nlocal][k] = extra[nlocal][m++]; diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index 08cee7d94c..8580865e59 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -53,7 +53,7 @@ class FixPropertyAtom : public Fix { protected: int nvalue, border; int molecule_flag, q_flag, rmass_flag; // flags for specific fields - int *style; // style of each value, see enum + int *styles; // style of each value, see enum int *index; // indices into atom custom data structs int *cols; // columns per value, for arrays char *astyle; // atom style at instantiation diff --git a/src/info.cpp b/src/info.cpp index 7c0eb572db..a936ed8bd3 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -1356,8 +1356,10 @@ std::string Info::get_openmp_info() // Supported OpenMP version corresponds to the release date of the // specifications as posted at https://www.openmp.org/specifications/ -#if _OPENMP > 201811 - return "OpenMP newer than version 5.0"; +#if _OPENMP > 202011 + return "OpenMP newer than version 5.1"; +#elif _OPENMP == 202011 + return "OpenMP 5.1"; #elif _OPENMP == 201811 return "OpenMP 5.0"; #elif _OPENMP == 201611 diff --git a/src/library.cpp b/src/library.cpp index db609351f7..b60f8659ee 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -2712,7 +2712,7 @@ Below is a brief C code demonstrating accessing this collected bond information. #include #include - #include + #include #include "library.h" int main(int argc, char **argv) diff --git a/src/library.h b/src/library.h index 17943e3808..e55f906a11 100644 --- a/src/library.h +++ b/src/library.h @@ -35,7 +35,7 @@ #endif #if defined(LAMMPS_BIGBIG) || defined(LAMMPS_SMALLBIG) -#include /* for int64_t */ +#include /* for int64_t */ #endif /** Data type constants for extracting data from atoms, computes and fixes diff --git a/src/memory.h b/src/memory.h index 5171a4a718..b42f1e0866 100644 --- a/src/memory.h +++ b/src/memory.h @@ -27,7 +27,7 @@ class Memory : protected Pointers { void sfree(void *); void fail(const char *); - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create/grow/destroy vecs and multidim arrays with contiguous memory blocks only use with primitive data types, e.g. 1d vec of ints, 2d array of doubles fail() prevents use with pointers, @@ -36,12 +36,15 @@ class Memory : protected Pointers { for these other cases, use smalloc/srealloc/sfree directly ------------------------------------------------------------------------- */ - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 1d array ------------------------------------------------------------------------- */ template TYPE *create(TYPE *&array, int n, const char *name) { + // POSSIBLE future change + //if (n <= 0) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * n; array = (TYPE *) smalloc(nbytes, name); return array; @@ -53,12 +56,18 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- grow or shrink 1d array ------------------------------------------------------------------------- */ template TYPE *grow(TYPE *&array, int n, const char *name) { + // POSSIBLE future change + //if (n <= 0) { + // destroy(array); + // return nullptr; + // } + if (array == nullptr) return create(array, n, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n; @@ -72,7 +81,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 1d array ------------------------------------------------------------------------- */ @@ -82,13 +91,16 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- 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) { + // POSSIBLE future change + // if (nlo > nhi) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * (nhi - nlo + 1); array = (TYPE *) smalloc(nbytes, name); array -= nlo; @@ -102,7 +114,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 1d array with index offset ------------------------------------------------------------------------- */ @@ -112,12 +124,15 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 2d array ------------------------------------------------------------------------- */ template TYPE **create(TYPE **&array, int n1, int n2, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2; TYPE *data = (TYPE *) smalloc(nbytes, name); nbytes = ((bigint) sizeof(TYPE *)) * n1; @@ -138,13 +153,19 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- 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) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0) { + // destroy(array); + // return nullptr; + // } + if (array == nullptr) return create(array, n1, n2, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2; @@ -167,7 +188,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 2d array ------------------------------------------------------------------------- */ @@ -179,12 +200,15 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 2d array with a ragged 2nd dimension ------------------------------------------------------------------------- */ template TYPE **create_ragged(TYPE **&array, int n1, int *n2, const char *name) { + // POSSIBLE future change + //if (n1 <= 0) return nullptr; + bigint n2sum = 0; for (int i = 0; i < n1; i++) n2sum += n2[i]; @@ -208,7 +232,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive cannot grow it ------------------------------------------------------------------------- */ @@ -216,6 +240,9 @@ class Memory : protected Pointers { template TYPE **create2d_offset(TYPE **&array, int n1, int n2lo, int n2hi, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2lo > n2hi) return nullptr; + int n2 = n2hi - n2lo + 1; create(array, n1, n2, name); for (int i = 0; i < n1; i++) array[i] -= n2lo; @@ -230,7 +257,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset ------------------------------------------------------------------------- */ @@ -242,12 +269,15 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 3d array ------------------------------------------------------------------------- */ template TYPE ***create(TYPE ***&array, int n1, int n2, int n3, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0 || n3 <= 0) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2 * n3; TYPE *data = (TYPE *) smalloc(nbytes, name); nbytes = ((bigint) sizeof(TYPE *)) * n1 * n2; @@ -276,13 +306,19 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- 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) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0 || n3 <= 0) { + // destroy(array); + // return nullptr; + //}; + if (array == nullptr) return create(array, n1, n2, n3, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2 * n3; @@ -313,7 +349,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 3d array ------------------------------------------------------------------------- */ @@ -326,7 +362,7 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 3d array with 1st index from n1lo to n1hi inclusive cannot grow it ------------------------------------------------------------------------- */ @@ -334,6 +370,8 @@ class Memory : protected Pointers { template TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, int n2, int n3, const char *name) { + if (n1lo > n1hi || n2 <= 0 || n3 <= 0) return nullptr; + int n1 = n1hi - n1lo + 1; create(array, n1, n2, n3, name); array -= n1lo; @@ -348,7 +386,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- free a 3d array with 1st index offset ------------------------------------------------------------------------- */ @@ -361,7 +399,7 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 3d array with 1st index from n1lo to n1hi inclusive, 2nd index from n2lo to n2hi inclusive, @@ -373,6 +411,8 @@ class Memory : protected Pointers { TYPE ***create3d_offset(TYPE ***&array, int n1lo, int n1hi, int n2lo, int n2hi, int n3lo, int n3hi, const char *name) { + if (n1lo > n1hi || n2lo > n2hi || n3lo > n3hi) return nullptr; + int n1 = n1hi - n1lo + 1; int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; @@ -393,7 +433,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset ------------------------------------------------------------------------- */ @@ -407,13 +447,16 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 4d array ------------------------------------------------------------------------- */ template TYPE ****create(TYPE ****&array, int n1, int n2, int n3, int n4, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0 || n3 <= 0 || n4 <= 0) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2 * n3 * n4; TYPE *data = (TYPE *) smalloc(nbytes, name); nbytes = ((bigint) sizeof(TYPE *)) * n1 * n2 * n3; @@ -451,7 +494,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- grow or shrink 1st dim of a 4d array last 3 dims must stay the same ------------------------------------------------------------------------- */ @@ -459,6 +502,12 @@ class Memory : protected Pointers { template TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0 || n3 <= 0 || n4 <= 0) { + // destroy(array); + // return nullptr; + // } + if (array == nullptr) return create(array, n1, n2, n3, n4, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2 * n3 * n4; @@ -498,7 +547,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 4d array ------------------------------------------------------------------------- */ @@ -512,7 +561,7 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 4d array with indices 2nd index from n2lo to n2hi inclusive 3rd index from n3lo to n3hi inclusive @@ -524,6 +573,8 @@ class Memory : protected Pointers { TYPE ****create4d_offset(TYPE ****&array, int n1, int n2lo, int n2hi, int n3lo, int n3hi, int n4lo, int n4hi, const char *name) { + if (n1 <= 0 || n2lo > n2hi || n3lo > n3hi || n4lo > n4hi) return nullptr; + int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; int n4 = n4hi - n4lo + 1; @@ -545,8 +596,8 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- - free a 4d array with indices 2,3, and 4 offset +/* ---------------------------------------------------------------------- + free a 4d array with indices 2,3,4 offset ------------------------------------------------------------------------- */ template @@ -560,13 +611,16 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- create a 5d array ------------------------------------------------------------------------- */ template TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, int n5, const char *name) { + // POSSIBLE future change + //if (n1 <= 0 || n2 <= 0 || n3 <= 0 || n4 <= 0 || n5 <= 0) return nullptr; + bigint nbytes = ((bigint) sizeof(TYPE)) * n1 * n2 * n3 * n4 * n5; TYPE *data = (TYPE *) smalloc(nbytes, name); nbytes = ((bigint) sizeof(TYPE *)) * n1 * n2 * n3 * n4; @@ -611,7 +665,7 @@ class Memory : protected Pointers { return nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- destroy a 5d array ------------------------------------------------------------------------- */ @@ -626,7 +680,7 @@ class Memory : protected Pointers { array = nullptr; } - /* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- memory usage of arrays, including pointers ------------------------------------------------------------------------- */ diff --git a/src/molecule.cpp b/src/molecule.cpp index 1194f2c584..138b4e0749 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -148,13 +148,15 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : if (me == 0) utils::logmesg(lmp,"Read molecule template {}:\n {} molecules\n" + " {} fragments\n" " {} atoms with max type {}\n" " {} bonds with max type {}\n" " {} angles with max type {}\n" " {} dihedrals with max type {}\n" " {} impropers with max type {}\n", id,nmolecules, - natoms,ntypes,nbonds,nbondtypes,nangles,nangletypes, - ndihedrals,ndihedraltypes,nimpropers,nimpropertypes); + nfragments,natoms,ntypes,nbonds,nbondtypes,nangles, + nangletypes,ndihedrals,ndihedraltypes,nimpropers, + nimpropertypes); } /* ---------------------------------------------------------------------- */ diff --git a/src/pair_table.cpp b/src/pair_table.cpp index f064d56377..60272b5276 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,24 +17,21 @@ #include "pair_table.h" -#include - -#include - #include "atom.h" -#include "force.h" #include "comm.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" - -#include "tokenizer.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" #include "table_file_reader.h" +#include "tokenizer.h" +#include +#include using namespace LAMMPS_NS; -enum{NONE,RLINEAR,RSQ,BMP}; +enum { NONE, RLINEAR, RSQ, BMP }; #define EPSILONR 1.0e-6 @@ -68,17 +64,17 @@ PairTable::~PairTable() void PairTable::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype,itable; - double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double rsq,factor_lj,fraction,value,a,b; - int *ilist,*jlist,*numneigh,**firstneigh; + int i, j, ii, jj, inum, jnum, itype, jtype, itable; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair; + double rsq, factor_lj, fraction, value, a, b; + int *ilist, *jlist, *numneigh, **firstneigh; Table *tb; union_int_float_t rsq_lookup; int tlm1 = tablength - 1; evdwl = 0.0; - ev_init(eflag,vflag); + ev_init(eflag, vflag); double **x = atom->x; double **f = atom->f; @@ -111,71 +107,70 @@ void PairTable::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; jtype = type[j]; if (rsq < cutsq[itype][jtype]) { tb = &tables[tabindex[itype][jtype]]; if (rsq < tb->innersq) - error->one(FLERR,"Pair distance < table inner cutoff: " - "ijtype {} {} dist {}",itype,jtype,sqrt(rsq)); + error->one(FLERR, "Pair distance < table inner cutoff: ijtype {} {} dist {}", itype, + jtype, sqrt(rsq)); if (tabstyle == LOOKUP) { - itable = static_cast ((rsq - tb->innersq) * tb->invdelta); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); if (itable >= tlm1) - error->one(FLERR,"Pair distance > table outer cutoff: " - "ijtype {} {} dist {}",itype,jtype,sqrt(rsq)); + error->one(FLERR, "Pair distance > table outer cutoff: ijtype {} {} dist {}", itype, + jtype, sqrt(rsq)); fpair = factor_lj * tb->f[itable]; } else if (tabstyle == LINEAR) { - itable = static_cast ((rsq - tb->innersq) * tb->invdelta); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); if (itable >= tlm1) - error->one(FLERR,"Pair distance > table outer cutoff: " - "ijtype {} {} dist {}",itype,jtype,sqrt(rsq)); + error->one(FLERR, "Pair distance > table outer cutoff: ijtype {} {} dist {}", itype, + jtype, sqrt(rsq)); fraction = (rsq - tb->rsq[itable]) * tb->invdelta; - value = tb->f[itable] + fraction*tb->df[itable]; + value = tb->f[itable] + fraction * tb->df[itable]; fpair = factor_lj * value; } else if (tabstyle == SPLINE) { - itable = static_cast ((rsq - tb->innersq) * tb->invdelta); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); if (itable >= tlm1) - error->one(FLERR,"Pair distance > table outer cutoff: " - "ijtype {} {} dist {}",itype,jtype,sqrt(rsq)); + error->one(FLERR, "Pair distance > table outer cutoff: ijtype {} {} dist {}", itype, + jtype, sqrt(rsq)); b = (rsq - tb->rsq[itable]) * tb->invdelta; a = 1.0 - b; - value = a * tb->f[itable] + b * tb->f[itable+1] + - ((a*a*a-a)*tb->f2[itable] + (b*b*b-b)*tb->f2[itable+1]) * - tb->deltasq6; + value = a * tb->f[itable] + b * tb->f[itable + 1] + + ((a * a * a - a) * tb->f2[itable] + (b * b * b - b) * tb->f2[itable + 1]) * + tb->deltasq6; fpair = factor_lj * value; } else { rsq_lookup.f = rsq; itable = rsq_lookup.i & tb->nmask; itable >>= tb->nshiftbits; fraction = (rsq_lookup.f - tb->rsq[itable]) * tb->drsq[itable]; - value = tb->f[itable] + fraction*tb->df[itable]; + value = tb->f[itable] + fraction * tb->df[itable]; fpair = factor_lj * value; } - f[i][0] += delx*fpair; - f[i][1] += dely*fpair; - f[i][2] += delz*fpair; + f[i][0] += delx * fpair; + f[i][1] += dely * fpair; + f[i][2] += delz * fpair; if (newton_pair || j < nlocal) { - f[j][0] -= delx*fpair; - f[j][1] -= dely*fpair; - f[j][2] -= delz*fpair; + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; } if (eflag) { if (tabstyle == LOOKUP) evdwl = tb->e[itable]; else if (tabstyle == LINEAR || tabstyle == BITMAP) - evdwl = tb->e[itable] + fraction*tb->de[itable]; + evdwl = tb->e[itable] + fraction * tb->de[itable]; else - evdwl = a * tb->e[itable] + b * tb->e[itable+1] + - ((a*a*a-a)*tb->e2[itable] + (b*b*b-b)*tb->e2[itable+1]) * - tb->deltasq6; + evdwl = a * tb->e[itable] + b * tb->e[itable + 1] + + ((a * a * a - a) * tb->e2[itable] + (b * b * b - b) * tb->e2[itable + 1]) * + tb->deltasq6; evdwl *= factor_lj; } - if (evflag) ev_tally(i,j,nlocal,newton_pair, - evdwl,0.0,fpair,delx,dely,delz); + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); } } } @@ -192,13 +187,13 @@ void PairTable::allocate() allocated = 1; const int nt = atom->ntypes + 1; - memory->create(setflag,nt,nt,"pair:setflag"); - memory->create(cutsq,nt,nt,"pair:cutsq"); - memory->create(tabindex,nt,nt,"pair:tabindex"); + memory->create(setflag, nt, nt, "pair:setflag"); + memory->create(cutsq, nt, nt, "pair:cutsq"); + memory->create(tabindex, nt, nt, "pair:tabindex"); - memset(&setflag[0][0],0,sizeof(int)*nt*nt); - memset(&cutsq[0][0],0,sizeof(double)*nt*nt); - memset(&tabindex[0][0],0,sizeof(int)*nt*nt); + memset(&setflag[0][0], 0, sizeof(int) * nt * nt); + memset(&cutsq[0][0], 0, sizeof(double) * nt * nt); + memset(&tabindex[0][0], 0, sizeof(int) * nt * nt); } /* ---------------------------------------------------------------------- @@ -207,30 +202,41 @@ void PairTable::allocate() void PairTable::settings(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal pair_style command"); + if (narg < 2) error->all(FLERR, "Illegal pair_style command"); // new settings - if (strcmp(arg[0],"lookup") == 0) tabstyle = LOOKUP; - else if (strcmp(arg[0],"linear") == 0) tabstyle = LINEAR; - else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; - else if (strcmp(arg[0],"bitmap") == 0) tabstyle = BITMAP; - else error->all(FLERR,"Unknown table style in pair_style command: {}", arg[0]); + if (strcmp(arg[0], "lookup") == 0) + tabstyle = LOOKUP; + else if (strcmp(arg[0], "linear") == 0) + tabstyle = LINEAR; + else if (strcmp(arg[0], "spline") == 0) + tabstyle = SPLINE; + else if (strcmp(arg[0], "bitmap") == 0) + tabstyle = BITMAP; + else + error->all(FLERR, "Unknown table style in pair_style command: {}", arg[0]); - tablength = utils::inumeric(FLERR,arg[1],false,lmp); - if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); + tablength = utils::inumeric(FLERR, arg[1], false, lmp); + if (tablength < 2) error->all(FLERR, "Illegal number of pair table entries"); // optional keywords // assert the tabulation is compatible with a specific long-range solver int iarg = 2; while (iarg < narg) { - if (strcmp(arg[iarg],"ewald") == 0) ewaldflag = 1; - else if (strcmp(arg[iarg],"pppm") == 0) pppmflag = 1; - else if (strcmp(arg[iarg],"msm") == 0) msmflag = 1; - else if (strcmp(arg[iarg],"dispersion") == 0) dispersionflag = 1; - else if (strcmp(arg[iarg],"tip4p") == 0) tip4pflag = 1; - else error->all(FLERR,"Illegal pair_style command"); + if (strcmp(arg[iarg], "ewald") == 0) + ewaldflag = 1; + else if (strcmp(arg[iarg], "pppm") == 0) + pppmflag = 1; + else if (strcmp(arg[iarg], "msm") == 0) + msmflag = 1; + else if (strcmp(arg[iarg], "dispersion") == 0) + dispersionflag = 1; + else if (strcmp(arg[iarg], "tip4p") == 0) + tip4pflag = 1; + else + error->all(FLERR, "Illegal pair_style command"); iarg++; } @@ -256,44 +262,45 @@ void PairTable::settings(int narg, char **arg) void PairTable::coeff(int narg, char **arg) { - if (narg != 4 && narg != 5) error->all(FLERR,"Illegal pair_coeff command"); + if (narg != 4 && narg != 5) error->all(FLERR, "Illegal pair_coeff command"); if (!allocated) allocate(); - int ilo,ihi,jlo,jhi; - utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); - utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + int ilo, ihi, jlo, jhi; + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); int me; - MPI_Comm_rank(world,&me); - tables = (Table *) - memory->srealloc(tables,(ntables+1)*sizeof(Table),"pair:tables"); + MPI_Comm_rank(world, &me); + tables = (Table *) memory->srealloc(tables, (ntables + 1) * sizeof(Table), "pair:tables"); Table *tb = &tables[ntables]; null_table(tb); - if (me == 0) read_table(tb,arg[2],arg[3]); + if (me == 0) read_table(tb, arg[2], arg[3]); bcast_table(tb); // set table cutoff - if (narg == 5) tb->cut = utils::numeric(FLERR,arg[4],false,lmp); - else if (tb->rflag) tb->cut = tb->rhi; - else tb->cut = tb->rfile[tb->ninput-1]; + if (narg == 5) + tb->cut = utils::numeric(FLERR, arg[4], false, lmp); + else if (tb->rflag) + tb->cut = tb->rhi; + else + tb->cut = tb->rfile[tb->ninput - 1]; // error check on table parameters // insure cutoff is within table // for BITMAP tables, file values can be in non-ascending order - if (tb->ninput <= 1) error->one(FLERR,"Invalid pair table length"); - double rlo,rhi; + if (tb->ninput <= 1) error->one(FLERR, "Invalid pair table length"); + double rlo, rhi; if (tb->rflag == 0) { rlo = tb->rfile[0]; - rhi = tb->rfile[tb->ninput-1]; + rhi = tb->rfile[tb->ninput - 1]; } else { rlo = tb->rlo; rhi = tb->rhi; } - if (tb->cut <= rlo || tb->cut > rhi) - error->all(FLERR,"Invalid pair table cutoff"); - if (rlo <= 0.0) error->all(FLERR,"Invalid pair table cutoff"); + if (tb->cut <= rlo || tb->cut > rhi) error->all(FLERR, "Pair table cutoff outside of table"); + if (rlo <= 0.0) error->all(FLERR, "Invalid pair table lower boundary"); // match = 1 if don't need to spline read-in tables // this is only the case if r values needed by final tables @@ -301,12 +308,12 @@ void PairTable::coeff(int narg, char **arg) // for tabstyle SPLINE, always need to build spline tables tb->match = 0; - if (tabstyle == LINEAR && tb->ninput == tablength && - tb->rflag == RSQ && tb->rhi == tb->cut) tb->match = 1; - if (tabstyle == BITMAP && tb->ninput == 1 << tablength && - tb->rflag == BMP && tb->rhi == tb->cut) tb->match = 1; + if (tabstyle == LINEAR && tb->ninput == tablength && tb->rflag == RSQ && tb->rhi == tb->cut) + tb->match = 1; + if (tabstyle == BITMAP && tb->ninput == 1 << tablength && tb->rflag == BMP && tb->rhi == tb->cut) + tb->match = 1; if (tb->rflag == BMP && tb->match == 0) - error->all(FLERR,"Bitmapped table in file does not match requested table"); + error->all(FLERR, "Bitmapped table in file does not match requested table"); // spline read-in values and compute r,e,f vectors within table @@ -317,14 +324,14 @@ void PairTable::coeff(int narg, char **arg) int count = 0; for (int i = ilo; i <= ihi; i++) { - for (int j = MAX(jlo,i); j <= jhi; j++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { tabindex[i][j] = ntables; setflag[i][j] = 1; count++; } } - if (count == 0) error->all(FLERR,"Illegal pair_coeff command"); + if (count == 0) error->all(FLERR, "Illegal pair_coeff command"); ntables++; } @@ -334,7 +341,7 @@ void PairTable::coeff(int narg, char **arg) double PairTable::init_one(int i, int j) { - if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); + if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); tabindex[j][i] = tabindex[i][j]; @@ -355,39 +362,36 @@ void PairTable::read_table(Table *tb, char *file, char *keyword) // transparently convert units for supported conversions int unit_convert = reader.get_unit_convert(); - double conversion_factor = utils::get_conversion_factor(utils::ENERGY, - unit_convert); + double conversion_factor = utils::get_conversion_factor(utils::ENERGY, unit_convert); char *line = reader.find_section_start(keyword); - if (!line) { - error->one(FLERR,"Did not find keyword in table file"); - } + if (!line) { error->one(FLERR, "Did not find keyword in table file"); } // read args on 2nd line of section // allocate table arrays for file values line = reader.next_line(); param_extract(tb, line); - memory->create(tb->rfile,tb->ninput,"pair:rfile"); - memory->create(tb->efile,tb->ninput,"pair:efile"); - memory->create(tb->ffile,tb->ninput,"pair:ffile"); + memory->create(tb->rfile, tb->ninput, "pair:rfile"); + memory->create(tb->efile, tb->ninput, "pair:efile"); + memory->create(tb->ffile, tb->ninput, "pair:ffile"); // setup bitmap parameters for table to read in tb->ntablebits = 0; - int masklo,maskhi,nmask,nshiftbits; + int masklo, maskhi, nmask, nshiftbits; if (tb->rflag == BMP) { while (1 << tb->ntablebits < tb->ninput) tb->ntablebits++; if (1 << tb->ntablebits != tb->ninput) - error->one(FLERR,"Bitmapped table is incorrect length in table file"); - init_bitmap(tb->rlo,tb->rhi,tb->ntablebits,masklo,maskhi,nmask,nshiftbits); + error->one(FLERR, "Bitmapped table is incorrect length in table file"); + init_bitmap(tb->rlo, tb->rhi, tb->ntablebits, masklo, maskhi, nmask, nshiftbits); } // read r,e,f table values from file // if rflag set, compute r // if rflag not set, use r from file - double rfile,rnew; + double rfile, rnew; union_int_float_t rsq_lookup; int rerror = 0; @@ -409,22 +413,21 @@ void PairTable::read_table(Table *tb, char *file, char *keyword) rnew = rfile; if (tb->rflag == RLINEAR) - rnew = tb->rlo + (tb->rhi - tb->rlo)*i/(tb->ninput-1); + rnew = tb->rlo + (tb->rhi - tb->rlo) * i / (tb->ninput - 1); else if (tb->rflag == RSQ) { - rnew = tb->rlo*tb->rlo + - (tb->rhi*tb->rhi - tb->rlo*tb->rlo)*i/(tb->ninput-1); + rnew = tb->rlo * tb->rlo + (tb->rhi * tb->rhi - tb->rlo * tb->rlo) * i / (tb->ninput - 1); rnew = sqrt(rnew); } else if (tb->rflag == BMP) { rsq_lookup.i = i << nshiftbits; rsq_lookup.i |= masklo; - if (rsq_lookup.f < tb->rlo*tb->rlo) { + if (rsq_lookup.f < tb->rlo * tb->rlo) { rsq_lookup.i = i << nshiftbits; rsq_lookup.i |= maskhi; } rnew = sqrtf(rsq_lookup.f); } - if (tb->rflag && fabs(rnew-rfile)/rfile > EPSILONR) rerror++; + if (tb->rflag && fabs(rnew - rfile) / rfile > EPSILONR) rerror++; tb->rfile[i] = rnew; } @@ -434,23 +437,23 @@ void PairTable::read_table(Table *tb, char *file, char *keyword) // skip two end points since do not have surrounding secants // inflection point is where curvature changes sign - double r,e,f,rprev,rnext,eprev,enext,fleft,fright; + double r, e, f, rprev, rnext, eprev, enext, fleft, fright; int ferror = 0; // bitmapped tables do not follow regular ordering, so we cannot check them here if (tb->rflag != BMP) { - for (int i = 1; i < tb->ninput-1; i++) { + for (int i = 1; i < tb->ninput - 1; i++) { r = tb->rfile[i]; - rprev = tb->rfile[i-1]; - rnext = tb->rfile[i+1]; + rprev = tb->rfile[i - 1]; + rnext = tb->rfile[i + 1]; e = tb->efile[i]; - eprev = tb->efile[i-1]; - enext = tb->efile[i+1]; + eprev = tb->efile[i - 1]; + enext = tb->efile[i + 1]; f = tb->ffile[i]; - fleft = - (e-eprev) / (r-rprev); - fright = - (enext-e) / (rnext-r); + fleft = -(e - eprev) / (r - rprev); + fright = -(enext - e) / (rnext - r); if (f < fleft && f < fright) ferror++; if (f > fleft && f > fright) ferror++; //printf("Values %d: %g %g %g\n",i,r,e,f); @@ -459,23 +462,26 @@ void PairTable::read_table(Table *tb, char *file, char *keyword) } if (ferror) - error->warning(FLERR,"{} of {} force values in table {} are inconsistent " - "with -dE/dr.\nWARNING: Should only be flagged at " - "inflection points",ferror,tb->ninput,keyword); + error->warning(FLERR, + "{} of {} force values in table {} are inconsistent with -dE/dr.\n" + "WARNING: Should only be flagged at inflection points", + ferror, tb->ninput, keyword); // warn if re-computed distance values differ from file values if (rerror) - error->warning(FLERR,"{} of {} distance values in table {} with relative " - "error\nWARNING: over {} to re-computed values", - rerror,tb->ninput,EPSILONR,keyword); + error->warning(FLERR, + "{} of {} distance values in table {} with relative error\n" + "WARNING: over {} to re-computed values", + rerror, tb->ninput, EPSILONR, keyword); // warn if data was read incompletely, e.g. columns were missing if (cerror) - error->warning(FLERR,"{} of {} lines in table {} were incomplete\n" + error->warning(FLERR, + "{} of {} lines in table {} were incomplete\n" "WARNING: or could not be parsed completely", - cerror,tb->ninput,keyword); + cerror, tb->ninput, keyword); } /* ---------------------------------------------------------------------- @@ -486,29 +492,29 @@ void PairTable::read_table(Table *tb, char *file, char *keyword) void PairTable::bcast_table(Table *tb) { - MPI_Bcast(&tb->ninput,1,MPI_INT,0,world); + MPI_Bcast(&tb->ninput, 1, MPI_INT, 0, world); int me; - MPI_Comm_rank(world,&me); + MPI_Comm_rank(world, &me); if (me > 0) { - memory->create(tb->rfile,tb->ninput,"pair:rfile"); - memory->create(tb->efile,tb->ninput,"pair:efile"); - memory->create(tb->ffile,tb->ninput,"pair:ffile"); + memory->create(tb->rfile, tb->ninput, "pair:rfile"); + memory->create(tb->efile, tb->ninput, "pair:efile"); + memory->create(tb->ffile, tb->ninput, "pair:ffile"); } - MPI_Bcast(tb->rfile,tb->ninput,MPI_DOUBLE,0,world); - MPI_Bcast(tb->efile,tb->ninput,MPI_DOUBLE,0,world); - MPI_Bcast(tb->ffile,tb->ninput,MPI_DOUBLE,0,world); + MPI_Bcast(tb->rfile, tb->ninput, MPI_DOUBLE, 0, world); + MPI_Bcast(tb->efile, tb->ninput, MPI_DOUBLE, 0, world); + MPI_Bcast(tb->ffile, tb->ninput, MPI_DOUBLE, 0, world); - MPI_Bcast(&tb->rflag,1,MPI_INT,0,world); + MPI_Bcast(&tb->rflag, 1, MPI_INT, 0, world); if (tb->rflag) { - MPI_Bcast(&tb->rlo,1,MPI_DOUBLE,0,world); - MPI_Bcast(&tb->rhi,1,MPI_DOUBLE,0,world); + MPI_Bcast(&tb->rlo, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&tb->rhi, 1, MPI_DOUBLE, 0, world); } - MPI_Bcast(&tb->fpflag,1,MPI_INT,0,world); + MPI_Bcast(&tb->fpflag, 1, MPI_INT, 0, world); if (tb->fpflag) { - MPI_Bcast(&tb->fplo,1,MPI_DOUBLE,0,world); - MPI_Bcast(&tb->fphi,1,MPI_DOUBLE,0,world); + MPI_Bcast(&tb->fplo, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&tb->fphi, 1, MPI_DOUBLE, 0, world); } } @@ -519,22 +525,22 @@ void PairTable::bcast_table(Table *tb) void PairTable::spline_table(Table *tb) { - memory->create(tb->e2file,tb->ninput,"pair:e2file"); - memory->create(tb->f2file,tb->ninput,"pair:f2file"); + memory->create(tb->e2file, tb->ninput, "pair:e2file"); + memory->create(tb->f2file, tb->ninput, "pair:f2file"); - double ep0 = - tb->ffile[0]; - double epn = - tb->ffile[tb->ninput-1]; - spline(tb->rfile,tb->efile,tb->ninput,ep0,epn,tb->e2file); + double ep0 = -tb->ffile[0]; + double epn = -tb->ffile[tb->ninput - 1]; + spline(tb->rfile, tb->efile, tb->ninput, ep0, epn, tb->e2file); if (tb->fpflag == 0) { tb->fplo = (tb->ffile[1] - tb->ffile[0]) / (tb->rfile[1] - tb->rfile[0]); - tb->fphi = (tb->ffile[tb->ninput-1] - tb->ffile[tb->ninput-2]) / - (tb->rfile[tb->ninput-1] - tb->rfile[tb->ninput-2]); + tb->fphi = (tb->ffile[tb->ninput - 1] - tb->ffile[tb->ninput - 2]) / + (tb->rfile[tb->ninput - 1] - tb->rfile[tb->ninput - 2]); } double fp0 = tb->fplo; double fpn = tb->fphi; - spline(tb->rfile,tb->ffile,tb->ninput,fp0,fpn,tb->f2file); + spline(tb->rfile, tb->ffile, tb->ninput, fp0, fpn, tb->f2file); } /* ---------------------------------------------------------------------- @@ -557,9 +563,12 @@ void PairTable::param_extract(Table *tb, char *line) if (word == "N") { tb->ninput = values.next_int(); } else if ((word == "R") || (word == "RSQ") || (word == "BITMAP")) { - if (word == "R") tb->rflag = RLINEAR; - else if (word == "RSQ") tb->rflag = RSQ; - else if (word == "BITMAP") tb->rflag = BMP; + if (word == "R") + tb->rflag = RLINEAR; + else if (word == "RSQ") + tb->rflag = RSQ; + else if (word == "BITMAP") + tb->rflag = BMP; tb->rlo = values.next_double(); tb->rhi = values.next_double(); } else if (word == "FPRIME") { @@ -567,14 +576,14 @@ void PairTable::param_extract(Table *tb, char *line) tb->fplo = values.next_double(); tb->fphi = values.next_double(); } else { - error->one(FLERR,"Invalid keyword {} in pair table parameters", word); + error->one(FLERR, "Invalid keyword {} in pair table parameters", word); } } } catch (TokenizerException &e) { error->one(FLERR, e.what()); } - if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); + if (tb->ninput == 0) error->one(FLERR, "Pair table parameters did not set N"); } /* ---------------------------------------------------------------------- @@ -583,18 +592,20 @@ void PairTable::param_extract(Table *tb, char *line) void PairTable::compute_table(Table *tb) { - int tlm1 = tablength-1; + int tlm1 = tablength - 1; // inner = inner table bound // cut = outer table bound // delta = table spacing in rsq for N-1 bins double inner; - if (tb->rflag) inner = tb->rlo; - else inner = tb->rfile[0]; - tb->innersq = inner*inner; - tb->delta = (tb->cut*tb->cut - tb->innersq) / tlm1; - tb->invdelta = 1.0/tb->delta; + if (tb->rflag) + inner = tb->rlo; + else + inner = tb->rfile[0]; + tb->innersq = inner * inner; + tb->delta = (tb->cut * tb->cut - tb->innersq) / tlm1; + tb->invdelta = 1.0 / tb->delta; // direct lookup tables // N-1 evenly spaced bins in rsq from inner to cut @@ -604,15 +615,15 @@ void PairTable::compute_table(Table *tb) // e,f are never a match to read-in values, always computed via spline interp if (tabstyle == LOOKUP) { - memory->create(tb->e,tlm1,"pair:e"); - memory->create(tb->f,tlm1,"pair:f"); + memory->create(tb->e, tlm1, "pair:e"); + memory->create(tb->f, tlm1, "pair:f"); - double r,rsq; + double r, rsq; for (int i = 0; i < tlm1; i++) { - rsq = tb->innersq + (i+0.5)*tb->delta; + rsq = tb->innersq + (i + 0.5) * tb->delta; r = sqrt(rsq); - tb->e[i] = splint(tb->rfile,tb->efile,tb->e2file,tb->ninput,r); - tb->f[i] = splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,r)/r; + tb->e[i] = splint(tb->rfile, tb->efile, tb->e2file, tb->ninput, r); + tb->f[i] = splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, r) / r; } } @@ -625,29 +636,29 @@ void PairTable::compute_table(Table *tb) // e,f can match read-in values, else compute via spline interp if (tabstyle == LINEAR) { - memory->create(tb->rsq,tablength,"pair:rsq"); - memory->create(tb->e,tablength,"pair:e"); - memory->create(tb->f,tablength,"pair:f"); - memory->create(tb->de,tlm1,"pair:de"); - memory->create(tb->df,tlm1,"pair:df"); + memory->create(tb->rsq, tablength, "pair:rsq"); + memory->create(tb->e, tablength, "pair:e"); + memory->create(tb->f, tablength, "pair:f"); + memory->create(tb->de, tlm1, "pair:de"); + memory->create(tb->df, tlm1, "pair:df"); - double r,rsq; + double r, rsq; for (int i = 0; i < tablength; i++) { - rsq = tb->innersq + i*tb->delta; + rsq = tb->innersq + i * tb->delta; r = sqrt(rsq); tb->rsq[i] = rsq; if (tb->match) { tb->e[i] = tb->efile[i]; - tb->f[i] = tb->ffile[i]/r; + tb->f[i] = tb->ffile[i] / r; } else { - tb->e[i] = splint(tb->rfile,tb->efile,tb->e2file,tb->ninput,r); - tb->f[i] = splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,r)/r; + tb->e[i] = splint(tb->rfile, tb->efile, tb->e2file, tb->ninput, r); + tb->f[i] = splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, r) / r; } } for (int i = 0; i < tlm1; i++) { - tb->de[i] = tb->e[i+1] - tb->e[i]; - tb->df[i] = tb->f[i+1] - tb->f[i]; + tb->de[i] = tb->e[i + 1] - tb->e[i]; + tb->df[i] = tb->f[i + 1] - tb->f[i]; } } @@ -660,25 +671,25 @@ void PairTable::compute_table(Table *tb) // e,f can match read-in values, else compute via spline interp if (tabstyle == SPLINE) { - memory->create(tb->rsq,tablength,"pair:rsq"); - memory->create(tb->e,tablength,"pair:e"); - memory->create(tb->f,tablength,"pair:f"); - memory->create(tb->e2,tablength,"pair:e2"); - memory->create(tb->f2,tablength,"pair:f2"); + memory->create(tb->rsq, tablength, "pair:rsq"); + memory->create(tb->e, tablength, "pair:e"); + memory->create(tb->f, tablength, "pair:f"); + memory->create(tb->e2, tablength, "pair:e2"); + memory->create(tb->f2, tablength, "pair:f2"); - tb->deltasq6 = tb->delta*tb->delta / 6.0; + tb->deltasq6 = tb->delta * tb->delta / 6.0; - double r,rsq; + double r, rsq; for (int i = 0; i < tablength; i++) { - rsq = tb->innersq + i*tb->delta; + rsq = tb->innersq + i * tb->delta; r = sqrt(rsq); tb->rsq[i] = rsq; if (tb->match) { tb->e[i] = tb->efile[i]; - tb->f[i] = tb->ffile[i]/r; + tb->f[i] = tb->ffile[i] / r; } else { - tb->e[i] = splint(tb->rfile,tb->efile,tb->e2file,tb->ninput,r); - tb->f[i] = splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,r); + tb->e[i] = splint(tb->rfile, tb->efile, tb->e2file, tb->ninput, r); + tb->f[i] = splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, r); } } @@ -686,38 +697,39 @@ void PairTable::compute_table(Table *tb) // h(r) = e(r) and g(r) = r^2 // dh/dg = (de/dr) / 2r = -f/2r - double ep0 = - tb->f[0] / (2.0 * sqrt(tb->innersq)); - double epn = - tb->f[tlm1] / (2.0 * tb->cut); - spline(tb->rsq,tb->e,tablength,ep0,epn,tb->e2); + double ep0 = -tb->f[0] / (2.0 * sqrt(tb->innersq)); + double epn = -tb->f[tlm1] / (2.0 * tb->cut); + spline(tb->rsq, tb->e, tablength, ep0, epn, tb->e2); // fp0,fpn = dh/dg at inner and at cut // h(r) = f(r)/r and g(r) = r^2 // dh/dg = (1/r df/dr - f/r^2) / 2r // dh/dg in secant approx = (f(r2)/r2 - f(r1)/r1) / (g(r2) - g(r1)) - double fp0,fpn; + double fp0, fpn; double secant_factor = 0.1; - if (tb->fpflag) fp0 = (tb->fplo/sqrt(tb->innersq) - tb->f[0]/tb->innersq) / - (2.0 * sqrt(tb->innersq)); + if (tb->fpflag) + fp0 = (tb->fplo / sqrt(tb->innersq) - tb->f[0] / tb->innersq) / (2.0 * sqrt(tb->innersq)); else { double rsq1 = tb->innersq; - double rsq2 = rsq1 + secant_factor*tb->delta; - fp0 = (splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,sqrt(rsq2)) / - sqrt(rsq2) - tb->f[0] / sqrt(rsq1)) / (secant_factor*tb->delta); + double rsq2 = rsq1 + secant_factor * tb->delta; + fp0 = (splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, sqrt(rsq2)) / sqrt(rsq2) - + tb->f[0] / sqrt(rsq1)) / + (secant_factor * tb->delta); } - if (tb->fpflag && tb->cut == tb->rfile[tb->ninput-1]) fpn = - (tb->fphi/tb->cut - tb->f[tlm1]/(tb->cut*tb->cut)) / (2.0 * tb->cut); + if (tb->fpflag && tb->cut == tb->rfile[tb->ninput - 1]) + fpn = (tb->fphi / tb->cut - tb->f[tlm1] / (tb->cut * tb->cut)) / (2.0 * tb->cut); else { double rsq2 = tb->cut * tb->cut; - double rsq1 = rsq2 - secant_factor*tb->delta; + double rsq1 = rsq2 - secant_factor * tb->delta; fpn = (tb->f[tlm1] / sqrt(rsq2) - - splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,sqrt(rsq1)) / - sqrt(rsq1)) / (secant_factor*tb->delta); + splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, sqrt(rsq1)) / sqrt(rsq1)) / + (secant_factor * tb->delta); } for (int i = 0; i < tablength; i++) tb->f[i] /= sqrt(tb->rsq[i]); - spline(tb->rsq,tb->f,tablength,fp0,fpn,tb->f2); + spline(tb->rsq, tb->f, tablength, fp0, fpn, tb->f2); } // bitmapped linear tables @@ -728,21 +740,21 @@ void PairTable::compute_table(Table *tb) if (tabstyle == BITMAP) { double r; union_int_float_t rsq_lookup; - int masklo,maskhi; + int masklo, maskhi; // linear lookup tables of length ntable = 2^n // stored value = value at lower edge of bin - init_bitmap(inner,tb->cut,tablength,masklo,maskhi,tb->nmask,tb->nshiftbits); + init_bitmap(inner, tb->cut, tablength, masklo, maskhi, tb->nmask, tb->nshiftbits); int ntable = 1 << tablength; int ntablem1 = ntable - 1; - memory->create(tb->rsq,ntable,"pair:rsq"); - memory->create(tb->e,ntable,"pair:e"); - memory->create(tb->f,ntable,"pair:f"); - memory->create(tb->de,ntable,"pair:de"); - memory->create(tb->df,ntable,"pair:df"); - memory->create(tb->drsq,ntable,"pair:drsq"); + memory->create(tb->rsq, ntable, "pair:rsq"); + memory->create(tb->e, ntable, "pair:e"); + memory->create(tb->f, ntable, "pair:f"); + memory->create(tb->de, ntable, "pair:de"); + memory->create(tb->df, ntable, "pair:df"); + memory->create(tb->drsq, ntable, "pair:drsq"); union_int_float_t minrsq_lookup; minrsq_lookup.i = 0 << tb->nshiftbits; @@ -759,20 +771,20 @@ void PairTable::compute_table(Table *tb) tb->rsq[i] = rsq_lookup.f; if (tb->match) { tb->e[i] = tb->efile[i]; - tb->f[i] = tb->ffile[i]/r; + tb->f[i] = tb->ffile[i] / r; } else { - tb->e[i] = splint(tb->rfile,tb->efile,tb->e2file,tb->ninput,r); - tb->f[i] = splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,r)/r; + tb->e[i] = splint(tb->rfile, tb->efile, tb->e2file, tb->ninput, r); + tb->f[i] = splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, r) / r; } - minrsq_lookup.f = MIN(minrsq_lookup.f,rsq_lookup.f); + minrsq_lookup.f = MIN(minrsq_lookup.f, rsq_lookup.f); } tb->innersq = minrsq_lookup.f; for (int i = 0; i < ntablem1; i++) { - tb->de[i] = tb->e[i+1] - tb->e[i]; - tb->df[i] = tb->f[i+1] - tb->f[i]; - tb->drsq[i] = 1.0/(tb->rsq[i+1] - tb->rsq[i]); + tb->de[i] = tb->e[i + 1] - tb->e[i]; + tb->df[i] = tb->f[i + 1] - tb->f[i]; + tb->drsq[i] = 1.0 / (tb->rsq[i + 1] - tb->rsq[i]); } // get the delta values for the last table entries @@ -780,7 +792,7 @@ void PairTable::compute_table(Table *tb) tb->de[ntablem1] = tb->e[0] - tb->e[ntablem1]; tb->df[ntablem1] = tb->f[0] - tb->f[ntablem1]; - tb->drsq[ntablem1] = 1.0/(tb->rsq[0] - tb->rsq[ntablem1]); + tb->drsq[ntablem1] = 1.0 / (tb->rsq[0] - tb->rsq[ntablem1]); // get the correct delta values at itablemax // smallest r is in bin itablemin @@ -792,7 +804,7 @@ void PairTable::compute_table(Table *tb) // if tb->match, data at cut*cut is unavailable, so we'll take // deltas at itablemax-1 as a good approximation - double e_tmp,f_tmp; + double e_tmp, f_tmp; int itablemin = minrsq_lookup.i & tb->nmask; itablemin >>= tb->nshiftbits; int itablemax = itablemin - 1; @@ -801,19 +813,19 @@ void PairTable::compute_table(Table *tb) if (itablemax == 0) itablemaxm1 = ntablem1; rsq_lookup.i = itablemax << tb->nshiftbits; rsq_lookup.i |= maskhi; - if (rsq_lookup.f < tb->cut*tb->cut) { + if (rsq_lookup.f < tb->cut * tb->cut) { if (tb->match) { tb->de[itablemax] = tb->de[itablemaxm1]; tb->df[itablemax] = tb->df[itablemaxm1]; tb->drsq[itablemax] = tb->drsq[itablemaxm1]; } else { - rsq_lookup.f = tb->cut*tb->cut; + rsq_lookup.f = tb->cut * tb->cut; r = sqrtf(rsq_lookup.f); - e_tmp = splint(tb->rfile,tb->efile,tb->e2file,tb->ninput,r); - f_tmp = splint(tb->rfile,tb->ffile,tb->f2file,tb->ninput,r)/r; + e_tmp = splint(tb->rfile, tb->efile, tb->e2file, tb->ninput, r); + f_tmp = splint(tb->rfile, tb->ffile, tb->f2file, tb->ninput, r) / r; tb->de[itablemax] = e_tmp - tb->e[itablemax]; tb->df[itablemax] = f_tmp - tb->f[itablemax]; - tb->drsq[itablemax] = 1.0/(rsq_lookup.f - tb->rsq[itablemax]); + tb->drsq[itablemax] = 1.0 / (rsq_lookup.f - tb->rsq[itablemax]); } } } @@ -857,55 +869,58 @@ void PairTable::free_table(Table *tb) spline and splint routines modified from Numerical Recipes ------------------------------------------------------------------------- */ -void PairTable::spline(double *x, double *y, int n, - double yp1, double ypn, double *y2) +void PairTable::spline(double *x, double *y, int n, double yp1, double ypn, double *y2) { - int i,k; - double p,qn,sig,un; + int i, k; + double p, qn, sig, un; double *u = new double[n]; - if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; + if (yp1 > 0.99e30) + y2[0] = u[0] = 0.0; else { y2[0] = -0.5; - u[0] = (3.0/(x[1]-x[0])) * ((y[1]-y[0]) / (x[1]-x[0]) - yp1); + u[0] = (3.0 / (x[1] - x[0])) * ((y[1] - y[0]) / (x[1] - x[0]) - yp1); } - for (i = 1; i < n-1; i++) { - sig = (x[i]-x[i-1]) / (x[i+1]-x[i-1]); - p = sig*y2[i-1] + 2.0; - y2[i] = (sig-1.0) / p; - u[i] = (y[i+1]-y[i]) / (x[i+1]-x[i]) - (y[i]-y[i-1]) / (x[i]-x[i-1]); - u[i] = (6.0*u[i] / (x[i+1]-x[i-1]) - sig*u[i-1]) / p; + for (i = 1; i < n - 1; i++) { + sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]); + p = sig * y2[i - 1] + 2.0; + y2[i] = (sig - 1.0) / p; + u[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]) - (y[i] - y[i - 1]) / (x[i] - x[i - 1]); + u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p; } - if (ypn > 0.99e30) qn = un = 0.0; + if (ypn > 0.99e30) + qn = un = 0.0; else { qn = 0.5; - un = (3.0/(x[n-1]-x[n-2])) * (ypn - (y[n-1]-y[n-2]) / (x[n-1]-x[n-2])); + un = (3.0 / (x[n - 1] - x[n - 2])) * (ypn - (y[n - 1] - y[n - 2]) / (x[n - 1] - x[n - 2])); } - y2[n-1] = (un-qn*u[n-2]) / (qn*y2[n-2] + 1.0); - for (k = n-2; k >= 0; k--) y2[k] = y2[k]*y2[k+1] + u[k]; + y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0); + for (k = n - 2; k >= 0; k--) y2[k] = y2[k] * y2[k + 1] + u[k]; - delete [] u; + delete[] u; } /* ---------------------------------------------------------------------- */ double PairTable::splint(double *xa, double *ya, double *y2a, int n, double x) { - int klo,khi,k; - double h,b,a,y; + int klo, khi, k; + double h, b, a, y; klo = 0; - khi = n-1; - while (khi-klo > 1) { - k = (khi+klo) >> 1; - if (xa[k] > x) khi = k; - else klo = k; + khi = n - 1; + while (khi - klo > 1) { + k = (khi + klo) >> 1; + if (xa[k] > x) + khi = k; + else + klo = k; } - h = xa[khi]-xa[klo]; - a = (xa[khi]-x) / h; - b = (x-xa[klo]) / h; - y = a*ya[klo] + b*ya[khi] + - ((a*a*a-a)*y2a[klo] + (b*b*b-b)*y2a[khi]) * (h*h)/6.0; + h = xa[khi] - xa[klo]; + a = (xa[khi] - x) / h; + b = (x - xa[klo]) / h; + y = a * ya[klo] + b * ya[khi] + + ((a * a * a - a) * y2a[klo] + (b * b * b - b) * y2a[khi]) * (h * h) / 6.0; return y; } @@ -934,13 +949,13 @@ void PairTable::read_restart(FILE *fp) void PairTable::write_restart_settings(FILE *fp) { - fwrite(&tabstyle,sizeof(int),1,fp); - fwrite(&tablength,sizeof(int),1,fp); - fwrite(&ewaldflag,sizeof(int),1,fp); - fwrite(&pppmflag,sizeof(int),1,fp); - fwrite(&msmflag,sizeof(int),1,fp); - fwrite(&dispersionflag,sizeof(int),1,fp); - fwrite(&tip4pflag,sizeof(int),1,fp); + fwrite(&tabstyle, sizeof(int), 1, fp); + fwrite(&tablength, sizeof(int), 1, fp); + fwrite(&ewaldflag, sizeof(int), 1, fp); + fwrite(&pppmflag, sizeof(int), 1, fp); + fwrite(&msmflag, sizeof(int), 1, fp); + fwrite(&dispersionflag, sizeof(int), 1, fp); + fwrite(&tip4pflag, sizeof(int), 1, fp); } /* ---------------------------------------------------------------------- @@ -950,54 +965,52 @@ void PairTable::write_restart_settings(FILE *fp) void PairTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); - utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &tabstyle, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &tablength, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &ewaldflag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &pppmflag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &msmflag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &dispersionflag, sizeof(int), 1, fp, nullptr, error); + utils::sfread(FLERR, &tip4pflag, sizeof(int), 1, fp, nullptr, error); } - MPI_Bcast(&tabstyle,1,MPI_INT,0,world); - MPI_Bcast(&tablength,1,MPI_INT,0,world); - MPI_Bcast(&ewaldflag,1,MPI_INT,0,world); - MPI_Bcast(&pppmflag,1,MPI_INT,0,world); - MPI_Bcast(&msmflag,1,MPI_INT,0,world); - MPI_Bcast(&dispersionflag,1,MPI_INT,0,world); - MPI_Bcast(&tip4pflag,1,MPI_INT,0,world); + MPI_Bcast(&tabstyle, 1, MPI_INT, 0, world); + MPI_Bcast(&tablength, 1, MPI_INT, 0, world); + MPI_Bcast(&ewaldflag, 1, MPI_INT, 0, world); + MPI_Bcast(&pppmflag, 1, MPI_INT, 0, world); + MPI_Bcast(&msmflag, 1, MPI_INT, 0, world); + MPI_Bcast(&dispersionflag, 1, MPI_INT, 0, world); + MPI_Bcast(&tip4pflag, 1, MPI_INT, 0, world); } /* ---------------------------------------------------------------------- */ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, - double /*factor_coul*/, double factor_lj, - double &fforce) + double /*factor_coul*/, double factor_lj, double &fforce) { int itable; - double fraction,value,a,b,phi; + double fraction, value, a, b, phi; int tlm1 = tablength - 1; Table *tb = &tables[tabindex[itype][jtype]]; - if (rsq < tb->innersq) error->one(FLERR,"Pair distance < table inner cutoff"); + if (rsq < tb->innersq) error->one(FLERR, "Pair distance < table inner cutoff"); if (tabstyle == LOOKUP) { - itable = static_cast ((rsq-tb->innersq) * tb->invdelta); - if (itable >= tlm1) error->one(FLERR,"Pair distance > table outer cutoff"); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); + if (itable >= tlm1) error->one(FLERR, "Pair distance > table outer cutoff"); fforce = factor_lj * tb->f[itable]; } else if (tabstyle == LINEAR) { - itable = static_cast ((rsq-tb->innersq) * tb->invdelta); - if (itable >= tlm1) error->one(FLERR,"Pair distance > table outer cutoff"); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); + if (itable >= tlm1) error->one(FLERR, "Pair distance > table outer cutoff"); fraction = (rsq - tb->rsq[itable]) * tb->invdelta; - value = tb->f[itable] + fraction*tb->df[itable]; + value = tb->f[itable] + fraction * tb->df[itable]; fforce = factor_lj * value; } else if (tabstyle == SPLINE) { - itable = static_cast ((rsq-tb->innersq) * tb->invdelta); - if (itable >= tlm1) error->one(FLERR,"Pair distance > table outer cutoff"); + itable = static_cast((rsq - tb->innersq) * tb->invdelta); + if (itable >= tlm1) error->one(FLERR, "Pair distance > table outer cutoff"); b = (rsq - tb->rsq[itable]) * tb->invdelta; a = 1.0 - b; - value = a * tb->f[itable] + b * tb->f[itable+1] + - ((a*a*a-a)*tb->f2[itable] + (b*b*b-b)*tb->f2[itable+1]) * - tb->deltasq6; + value = a * tb->f[itable] + b * tb->f[itable + 1] + + ((a * a * a - a) * tb->f2[itable] + (b * b * b - b) * tb->f2[itable + 1]) * tb->deltasq6; fforce = factor_lj * value; } else { union_int_float_t rsq_lookup; @@ -1005,18 +1018,18 @@ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, itable = rsq_lookup.i & tb->nmask; itable >>= tb->nshiftbits; fraction = (rsq_lookup.f - tb->rsq[itable]) * tb->drsq[itable]; - value = tb->f[itable] + fraction*tb->df[itable]; + value = tb->f[itable] + fraction * tb->df[itable]; fforce = factor_lj * value; } if (tabstyle == LOOKUP) phi = tb->e[itable]; else if (tabstyle == LINEAR || tabstyle == BITMAP) - phi = tb->e[itable] + fraction*tb->de[itable]; + phi = tb->e[itable] + fraction * tb->de[itable]; else - phi = a * tb->e[itable] + b * tb->e[itable+1] + - ((a*a*a-a)*tb->e2[itable] + (b*b*b-b)*tb->e2[itable+1]) * tb->deltasq6; - return factor_lj*phi; + phi = a * tb->e[itable] + b * tb->e[itable + 1] + + ((a * a * a - a) * tb->e2[itable] + (b * b * b - b) * tb->e2[itable + 1]) * tb->deltasq6; + return factor_lj * phi; } /* ---------------------------------------------------------------------- @@ -1028,8 +1041,8 @@ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, void *PairTable::extract(const char *str, int &dim) { - if (strcmp(str,"cut_coul") != 0) return nullptr; - if (ntables == 0) error->all(FLERR,"All pair coeffs are not set"); + if (strcmp(str, "cut_coul") != 0) return nullptr; + if (ntables == 0) error->all(FLERR, "All pair coeffs are not set"); // only check for cutoff consistency if claiming to be KSpace compatible @@ -1037,9 +1050,9 @@ void *PairTable::extract(const char *str, int &dim) double cut_coul = tables[0].cut; for (int m = 1; m < ntables; m++) if (tables[m].cut != cut_coul) - error->all(FLERR, - "Pair table cutoffs must all be equal to use with KSpace"); + error->all(FLERR, "Pair table cutoffs must all be equal to use with KSpace"); dim = 0; return &tables[0].cut; - } else return nullptr; + } else + return nullptr; } diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index 58e2e36db0..8abaafd093 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -19,8 +19,8 @@ // Syntax: binary2txt file1 file2 ... // Creates: file1.txt file2.txt ... -#include -#include +#include +#include // these must match settings in src/lmptype.h which builds LAMMPS with // -DLAMMPS_SMALLBIG (the default), -DLAMMPS_BIGBIG, or -DLAMMPS_SMALLSMALL @@ -57,10 +57,10 @@ typedef int64_t bigint; int main(int narg, char **arg) { - int i,j,k,m,n; - bigint ntimestep,natoms; - int size_one,nchunk,triclinic; - double xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz; + int i, j, k, m, n; + bigint ntimestep, natoms; + int size_one, nchunk, triclinic; + double xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz; int boundary[3][2]; char boundstr[9]; @@ -75,25 +75,25 @@ int main(int narg, char **arg) // loop over files for (int iarg = 1; iarg < narg; iarg++) { - printf("%s:",arg[iarg]); + printf("%s:", arg[iarg]); fflush(stdout); - FILE *fp = fopen(arg[iarg],"rb"); + FILE *fp = fopen(arg[iarg], "rb"); if (!fp) { - printf("ERROR: Could not open %s\n",arg[iarg]); + printf("ERROR: Could not open %s\n", arg[iarg]); return 1; } n = strlen(arg[iarg]) + 1 + 4; char *filetxt = new char[n]; - strcpy(filetxt,arg[iarg]); - strcat(filetxt,".txt"); - FILE *fptxt = fopen(filetxt,"w"); - delete [] filetxt; + strcpy(filetxt, arg[iarg]); + strcat(filetxt, ".txt"); + FILE *fptxt = fopen(filetxt, "w"); + delete[] filetxt; // detect newer format - char * magic_string = nullptr; - char * columns = nullptr; - char * unit_style = nullptr; + char *magic_string = nullptr; + char *columns = nullptr; + char *unit_style = nullptr; // loop over snapshots in file @@ -101,7 +101,7 @@ int main(int narg, char **arg) int endian = 0x0001; int revision = 0x0001; - fread(&ntimestep,sizeof(bigint),1,fp); + fread(&ntimestep, sizeof(bigint), 1, fp); // detect end-of-file @@ -116,7 +116,7 @@ int main(int narg, char **arg) // first bigint encodes negative format name length bigint magic_string_len = -ntimestep; - delete [] magic_string; + delete[] magic_string; magic_string = new char[magic_string_len + 1]; fread(magic_string, sizeof(char), magic_string_len, fp); magic_string[magic_string_len] = '\0'; @@ -128,24 +128,24 @@ int main(int narg, char **arg) fread(&revision, sizeof(int), 1, fp); // read the real ntimestep - fread(&ntimestep,sizeof(bigint),1,fp); + fread(&ntimestep, sizeof(bigint), 1, fp); } - fread(&natoms,sizeof(bigint),1,fp); - fread(&triclinic,sizeof(int),1,fp); - fread(&boundary[0][0],6*sizeof(int),1,fp); - fread(&xlo,sizeof(double),1,fp); - fread(&xhi,sizeof(double),1,fp); - fread(&ylo,sizeof(double),1,fp); - fread(&yhi,sizeof(double),1,fp); - fread(&zlo,sizeof(double),1,fp); - fread(&zhi,sizeof(double),1,fp); + fread(&natoms, sizeof(bigint), 1, fp); + fread(&triclinic, sizeof(int), 1, fp); + fread(&boundary[0][0], 6 * sizeof(int), 1, fp); + fread(&xlo, sizeof(double), 1, fp); + fread(&xhi, sizeof(double), 1, fp); + fread(&ylo, sizeof(double), 1, fp); + fread(&yhi, sizeof(double), 1, fp); + fread(&zlo, sizeof(double), 1, fp); + fread(&zhi, sizeof(double), 1, fp); if (triclinic) { - fread(&xy,sizeof(double),1,fp); - fread(&xz,sizeof(double),1,fp); - fread(&yz,sizeof(double),1,fp); + fread(&xy, sizeof(double), 1, fp); + fread(&xz, sizeof(double), 1, fp); + fread(&yz, sizeof(double), 1, fp); } - fread(&size_one,sizeof(int),1,fp); + fread(&size_one, sizeof(int), 1, fp); if (magic_string && revision > 0x0001) { // newer format includes units string, columns string @@ -155,8 +155,8 @@ int main(int narg, char **arg) if (len > 0) { // has units - delete [] unit_style; - unit_style = new char[len+1]; + delete[] unit_style; + unit_style = new char[len + 1]; fread(unit_style, sizeof(char), len, fp); unit_style[len] = '\0'; fprintf(fptxt, "ITEM: UNITS\n"); @@ -173,90 +173,94 @@ int main(int narg, char **arg) } fread(&len, sizeof(int), 1, fp); - delete [] columns; - columns = new char[len+1]; + delete[] columns; + columns = new char[len + 1]; fread(columns, sizeof(char), len, fp); columns[len] = '\0'; } - fread(&nchunk,sizeof(int),1,fp); + fread(&nchunk, sizeof(int), 1, fp); - fprintf(fptxt,"ITEM: TIMESTEP\n"); - fprintf(fptxt,BIGINT_FORMAT "\n",ntimestep); - fprintf(fptxt,"ITEM: NUMBER OF ATOMS\n"); - fprintf(fptxt,BIGINT_FORMAT "\n",natoms); + fprintf(fptxt, "ITEM: TIMESTEP\n"); + fprintf(fptxt, BIGINT_FORMAT "\n", ntimestep); + fprintf(fptxt, "ITEM: NUMBER OF ATOMS\n"); + fprintf(fptxt, BIGINT_FORMAT "\n", natoms); m = 0; for (int idim = 0; idim < 3; idim++) { for (int iside = 0; iside < 2; iside++) { - if (boundary[idim][iside] == 0) boundstr[m++] = 'p'; - else if (boundary[idim][iside] == 1) boundstr[m++] = 'f'; - else if (boundary[idim][iside] == 2) boundstr[m++] = 's'; - else if (boundary[idim][iside] == 3) boundstr[m++] = 'm'; + if (boundary[idim][iside] == 0) + boundstr[m++] = 'p'; + else if (boundary[idim][iside] == 1) + boundstr[m++] = 'f'; + else if (boundary[idim][iside] == 2) + boundstr[m++] = 's'; + else if (boundary[idim][iside] == 3) + boundstr[m++] = 'm'; } boundstr[m++] = ' '; } boundstr[8] = '\0'; if (!triclinic) { - fprintf(fptxt,"ITEM: BOX BOUNDS %s\n",boundstr); - fprintf(fptxt,"%-1.16e %-1.16e\n",xlo,xhi); - fprintf(fptxt,"%-1.16e %-1.16e\n",ylo,yhi); - fprintf(fptxt,"%-1.16e %-1.16e\n",zlo,zhi); + fprintf(fptxt, "ITEM: BOX BOUNDS %s\n", boundstr); + fprintf(fptxt, "%-1.16e %-1.16e\n", xlo, xhi); + fprintf(fptxt, "%-1.16e %-1.16e\n", ylo, yhi); + fprintf(fptxt, "%-1.16e %-1.16e\n", zlo, zhi); } else { - fprintf(fptxt,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - fprintf(fptxt,"%-1.16e %-1.16e %-1.16e\n",xlo,xhi,xy); - fprintf(fptxt,"%-1.16e %-1.16e %-1.16e\n",ylo,yhi,xz); - fprintf(fptxt,"%-1.16e %-1.16e %-1.16e\n",zlo,zhi,yz); + fprintf(fptxt, "ITEM: BOX BOUNDS xy xz yz %s\n", boundstr); + fprintf(fptxt, "%-1.16e %-1.16e %-1.16e\n", xlo, xhi, xy); + fprintf(fptxt, "%-1.16e %-1.16e %-1.16e\n", ylo, yhi, xz); + fprintf(fptxt, "%-1.16e %-1.16e %-1.16e\n", zlo, zhi, yz); } if (columns) - fprintf(fptxt,"ITEM: ATOMS %s\n", columns); + fprintf(fptxt, "ITEM: ATOMS %s\n", columns); else - fprintf(fptxt,"ITEM: ATOMS\n"); + fprintf(fptxt, "ITEM: ATOMS\n"); // loop over processor chunks in file for (i = 0; i < nchunk; i++) { - fread(&n,sizeof(int),1,fp); + fread(&n, sizeof(int), 1, fp); // extend buffer to fit chunk size if (n > maxbuf) { - if (buf) delete [] buf; + if (buf) delete[] buf; buf = new double[n]; maxbuf = n; } // read chunk and write as size_one values per line - fread(buf,sizeof(double),n,fp); + fread(buf, sizeof(double), n, fp); n /= size_one; m = 0; for (j = 0; j < n; j++) { for (k = 0; k < size_one; k++) { - if(k+1 < size_one) { - fprintf(fptxt,"%g ",buf[m++]); + if (k + 1 < size_one) { + fprintf(fptxt, "%g ", buf[m++]); } else { - fprintf(fptxt,"%g",buf[m++]); + fprintf(fptxt, "%g", buf[m++]); } } - fprintf(fptxt,"\n"); + fprintf(fptxt, "\n"); } } - printf(" " BIGINT_FORMAT,ntimestep); + printf(" " BIGINT_FORMAT, ntimestep); fflush(stdout); } printf("\n"); - delete [] columns; - delete [] magic_string; - delete [] unit_style; + delete[] columns; + delete[] magic_string; + delete[] unit_style; columns = nullptr; magic_string = nullptr; unit_style = nullptr; } - if (buf) delete [] buf; + if (buf) delete[] buf; return 0; } diff --git a/tools/chain.f b/tools/chain.f deleted file mode 100644 index 52481f5d0d..0000000000 --- a/tools/chain.f +++ /dev/null @@ -1,321 +0,0 @@ -c Create LAMMPS data file for collection of -c polymer bead-spring chains of various lengths and bead sizes -c Syntax: chain < def.chain > data.file -c def.chain is input file that specifies the chains -c data.file is output file that will be input for LAMMPS -c includes image flags in data file so chains can be unraveled later - - program chain - - integer swaptype - integer, allocatable :: nchain(:),nmonomer(:) - integer, allocatable :: ntype(:),nbondtype(:) - integer, allocatable :: type(:),molecule(:) - integer, allocatable :: imagex(:),imagey(:),imagez(:) - real*8, allocatable :: x(:),y(:),z(:) - real*8, allocatable :: bondlength(:),restrict(:) - common xprd,yprd,zprd,xboundlo,xboundhi, - $ yboundlo,yboundhi,zboundlo,zboundhi - real*8 random - 900 format(a) - 901 format(2f15.6,a) - 902 format(i3,f5.1) - 903 format(i10,i8,i8,3f10.4,3i4) - 904 format(i9,i3,2i9) - -c read chain definitions - - read (5,*) - read (5,*) - read (5,*) rhostar - read (5,*) iseed - read (5,*) nsets - read (5,*) swaptype - - allocate(nchain(nsets)) - allocate(nmonomer(nsets)) - allocate(ntype(nsets)) - allocate(nbondtype(nsets)) - allocate(bondlength(nsets)) - allocate(restrict(nsets)) - - do iset = 1,nsets - read (5,*) - read (5,*) nchain(iset) - read (5,*) nmonomer(iset) - read (5,*) ntype(iset) - read (5,*) nbondtype(iset) - read (5,*) bondlength(iset) - read (5,*) restrict(iset) - enddo - -c natoms = total # of monomers - - natoms = 0 - do iset = 1,nsets - natoms = natoms + nchain(iset)*nmonomer(iset) - enddo - - allocate(x(natoms)) - allocate(y(natoms)) - allocate(z(natoms)) - allocate(type(natoms)) - allocate(molecule(natoms)) - allocate(imagex(natoms)) - allocate(imagey(natoms)) - allocate(imagez(natoms)) - -c setup box size (sigma = 1.0) - - volume = natoms/rhostar - xprd = volume**(1.0/3.0) - yprd = xprd - zprd = xprd - - xboundlo = -xprd/2.0 - xboundhi = -xboundlo - yboundlo = xboundlo - yboundhi = xboundhi - zboundlo = xboundlo - zboundhi = xboundhi - -c generate random chains -c loop over sets and chains in each set - - n = 0 - nmolecule = 0 - - do iset = 1,nsets - do ichain = 1,nchain(iset) - nmolecule = nmolecule + 1 - -c random starting point for the chain in the box - - x1 = 0.0 - y1 = 0.0 - z1 = 0.0 - x2 = xboundlo + random(iseed)*xprd - y2 = yboundlo + random(iseed)*yprd - z2 = zboundlo + random(iseed)*zprd - -c store 1st monomer of chain -c 1st monomer is always in original box (image = 0) - - call pbc(x2,y2,z2) - n = n + 1 - x(n) = x2 - y(n) = y2 - z(n) = z2 - type(n) = ntype(iset) - imagex(n) = 0 - imagey(n) = 0 - imagez(n) = 0 - if (swaptype == 0) then - molecule(n) = nmolecule - else - molecule(n) = 1 - endif - -c generate rest of monomers in this chain - - do imonomer = 2,nmonomer(iset) - - x0 = x1 - y0 = y1 - z0 = z1 - x1 = x2 - y1 = y2 - z1 = z2 - -c random point inside sphere of unit radius - - 10 xinner = 2.0*random(iseed) - 1.0 - yinner = 2.0*random(iseed) - 1.0 - zinner = 2.0*random(iseed) - 1.0 - rsq = xinner*xinner + yinner*yinner + zinner*zinner - if (rsq > 1.0) goto 10 - -c project point to surface of sphere of unit radius - - r = sqrt(rsq) - xsurf = xinner/r - ysurf = yinner/r - zsurf = zinner/r - -c create new point by scaling unit offsets by bondlength (sigma = 1.0) - - x2 = x1 + xsurf*bondlength(iset) - y2 = y1 + ysurf*bondlength(iset) - z2 = z1 + zsurf*bondlength(iset) - -c check that new point meets restriction requirement -c only for 3rd monomer and beyond - - dx = x2 - x0 - dy = y2 - y0 - dz = z2 - z0 - r = sqrt(dx*dx + dy*dy + dz*dz) - - if (imonomer > 2 .and. r <= restrict(iset)) goto 10 - -c store new point -c if delta to previous bead is large, then increment/decrement image flag - - call pbc(x2,y2,z2) - n = n + 1 - x(n) = x2 - y(n) = y2 - z(n) = z2 - type(n) = ntype(iset) - - if (abs(x(n)-x(n-1)) < 2.0*bondlength(iset)) then - imagex(n) = imagex(n-1) - else if (x(n) - x(n-1) < 0.0) then - imagex(n) = imagex(n-1) + 1 - else if (x(n) - x(n-1) > 0.0) then - imagex(n) = imagex(n-1) - 1 - endif - - if (abs(y(n)-y(n-1)) < 2.0*bondlength(iset)) then - imagey(n) = imagey(n-1) - else if (y(n) - y(n-1) < 0.0) then - imagey(n) = imagey(n-1) + 1 - else if (y(n) - y(n-1) > 0.0) then - imagey(n) = imagey(n-1) - 1 - endif - - if (abs(z(n)-z(n-1)) < 2.0*bondlength(iset)) then - imagez(n) = imagez(n-1) - else if (z(n) - z(n-1) < 0.0) then - imagez(n) = imagez(n-1) + 1 - else if (z(n) - z(n-1) > 0.0) then - imagez(n) = imagez(n-1) - 1 - endif - - if (swaptype == 0) then - molecule(n) = nmolecule - else if (swaptype == 1) then - molecule(n) = imonomer - else if (swaptype == 2) then - if (imonomer <= nmonomer(iset)/2) then - molecule(n) = imonomer - else - molecule(n) = nmonomer(iset)+1-imonomer - endif - endif - - enddo - - enddo - enddo - -c compute quantities needed for LAMMPS file - - nbonds = 0 - ntypes = 0 - nbondtypes = 0 - do iset = 1,nsets - nbonds = nbonds + nchain(iset)*(nmonomer(iset)-1) - if (ntype(iset) > ntypes) ntypes = ntype(iset) - if (nbondtype(iset) > nbondtypes) - $ nbondtypes = nbondtype(iset) - enddo - -c write out LAMMPS file - - write (6,900) 'LAMMPS FENE chain data file' - write (6,*) - - write (6,*) natoms,' atoms' - write (6,*) nbonds,' bonds' - write (6,*) 0,' angles' - write (6,*) 0,' dihedrals' - write (6,*) 0,' impropers' - write (6,*) - - write (6,*) ntypes,' atom types' - write (6,*) nbondtypes,' bond types' - write (6,*) 0,' angle types' - write (6,*) 0,' dihedral types' - write (6,*) 0,' improper types' - write (6,*) - - write (6,901) xboundlo,xboundhi,' xlo xhi' - write (6,901) yboundlo,yboundhi,' ylo yhi' - write (6,901) zboundlo,zboundhi,' zlo zhi' - - write (6,*) - write (6,900) 'Masses' - write (6,*) - - do i = 1,ntypes - write (6,902) i,1.0 - enddo - - write (6,*) - write (6,900) 'Atoms' - write (6,*) - - do i = 1,natoms - write (6,903) i,molecule(i),type(i),x(i),y(i),z(i), - $ imagex(i),imagey(i),imagez(i) - enddo - - if (nbonds > 0) then - - write (6,*) - write (6,900) 'Bonds' - write (6,*) - - n = 0 - m = 0 - do iset = 1,nsets - do ichain = 1,nchain(iset) - do imonomer = 1,nmonomer(iset) - n = n + 1 - if (imonomer /= nmonomer(iset)) then - m = m + 1 - write (6,904) m,nbondtype(iset),n,n+1 - endif - enddo - enddo - enddo - - endif - - end - -c ************ -c Subroutines -c ************ - -c periodic boundary conditions - map atom back into periodic box - - subroutine pbc(x,y,z) - common xprd,yprd,zprd,xboundlo,xboundhi, - $ yboundlo,yboundhi,zboundlo,zboundhi - - if (x < xboundlo) x = x + xprd - if (x >= xboundhi) x = x - xprd - if (y < yboundlo) y = y + yprd - if (y >= yboundhi) y = y - yprd - if (z < zboundlo) z = z + zprd - if (z >= zboundhi) z = z - zprd - - return - end - - -c RNG from Numerical Recipes - - real*8 function random(iseed) - real*8 aa,mm,sseed - parameter (aa=16807.0D0,mm=2147483647.0D0) - - sseed = iseed - sseed = mod(aa*sseed,mm) - random = sseed/mm - iseed = sseed - - return - end diff --git a/tools/chain.f90 b/tools/chain.f90 new file mode 100644 index 0000000000..5fed083e63 --- /dev/null +++ b/tools/chain.f90 @@ -0,0 +1,333 @@ +! Create LAMMPS data file for collection of +! polymer bead-spring chains of various lengths and bead sizes +! Syntax: chain < def.chain > data.file +! def.chain is input file that specifies the chains +! data.file is output file that will be input for LAMMPS +! includes image flags in data file so chains can be unraveled later + +MODULE boxchain + IMPLICIT NONE + PUBLIC + REAL(KIND=8) :: xprd,yprd,zprd,xboundlo,xboundhi,yboundlo,yboundhi,zboundlo,zboundhi + +CONTAINS + + ! periodic boundary conditions - map atom back into periodic box + + SUBROUTINE pbc(x,y,z) + REAL(KIND=8), INTENT(inout) :: x,y,z + + IF (x < xboundlo) x = x + xprd + IF (x >= xboundhi) x = x - xprd + IF (y < yboundlo) y = y + yprd + IF (y >= yboundhi) y = y - yprd + IF (z < zboundlo) z = z + zprd + IF (z >= zboundhi) z = z - zprd + + END SUBROUTINE pbc +END MODULE boxchain + +MODULE rngchain + IMPLICIT NONE + +CONTAINS + + ! *very* minimal random number generator + + REAL(KIND=8) FUNCTION random(iseed) + IMPLICIT NONE + INTEGER, INTENT(inout) :: iseed + REAL(KIND=8), PARAMETER :: aa=16807.0_8, mm=2147483647.0_8 + REAL(KIND=8) :: sseed + + sseed = REAL(iseed) + sseed = MOD(aa*sseed,mm) + random = sseed/mm + iseed = INT(sseed) + END FUNCTION random +END MODULE rngchain + +PROGRAM chain + USE boxchain + USE rngchain + IMPLICIT NONE + + INTEGER, ALLOCATABLE :: nchain(:),nmonomer(:) + INTEGER, ALLOCATABLE :: ntype(:),nbondtype(:) + INTEGER, ALLOCATABLE :: atomtype(:),molecule(:) + INTEGER, ALLOCATABLE :: imagex(:),imagey(:),imagez(:) + REAL(KIND=8), ALLOCATABLE :: x(:),y(:),z(:) + REAL(KIND=8), ALLOCATABLE :: bondlength(:),restrict(:) + INTEGER :: i, n, m, nmolecule, natoms, ntypes, nbonds, nbondtypes + INTEGER :: swaptype, iseed, nsets, iset, ichain, imonomer + REAL(KIND=8) :: r, rhostar, volume, rsq, xinner, yinner, zinner, xsurf, ysurf, zsurf + REAL(KIND=8) :: x0, y0, z0, x1, y1, z1, x2, y2, z2, dx, dy, dz + + LOGICAL :: again + + ! read chain definitions + + READ (5,*) + READ (5,*) + READ (5,*) rhostar + READ (5,*) iseed + READ (5,*) nsets + READ (5,*) swaptype + + ALLOCATE(nchain(nsets)) + ALLOCATE(nmonomer(nsets)) + ALLOCATE(ntype(nsets)) + ALLOCATE(nbondtype(nsets)) + ALLOCATE(bondlength(nsets)) + ALLOCATE(restrict(nsets)) + + DO iset = 1,nsets + READ (5,*) + READ (5,*) nchain(iset) + READ (5,*) nmonomer(iset) + READ (5,*) ntype(iset) + READ (5,*) nbondtype(iset) + READ (5,*) bondlength(iset) + READ (5,*) restrict(iset) + ENDDO + + ! natoms = total # of monomers + + natoms = 0 + DO iset = 1,nsets + natoms = natoms + nchain(iset)*nmonomer(iset) + ENDDO + + ALLOCATE(x(natoms)) + ALLOCATE(y(natoms)) + ALLOCATE(z(natoms)) + ALLOCATE(atomtype(natoms)) + ALLOCATE(molecule(natoms)) + ALLOCATE(imagex(natoms)) + ALLOCATE(imagey(natoms)) + ALLOCATE(imagez(natoms)) + + ! setup box size (sigma = 1.0) + + volume = natoms/rhostar + xprd = volume**(1.0/3.0) + yprd = xprd + zprd = xprd + + xboundlo = -xprd/2.0 + xboundhi = -xboundlo + yboundlo = xboundlo + yboundhi = xboundhi + zboundlo = xboundlo + zboundhi = xboundhi + + ! generate random chains + ! loop over sets and chains in each set + + n = 0 + nmolecule = 0 + + DO iset = 1,nsets + DO ichain = 1,nchain(iset) + nmolecule = nmolecule + 1 + + ! random starting point for the chain in the box + + x1 = 0.0 + y1 = 0.0 + z1 = 0.0 + x2 = xboundlo + random(iseed)*xprd + y2 = yboundlo + random(iseed)*yprd + z2 = zboundlo + random(iseed)*zprd + + ! store 1st monomer of chain + ! 1st monomer is always in original box (image = 0) + + CALL pbc(x2,y2,z2) + + n = n + 1 + x(n) = x2 + y(n) = y2 + z(n) = z2 + atomtype(n) = ntype(iset) + imagex(n) = 0 + imagey(n) = 0 + imagez(n) = 0 + IF (swaptype == 0) THEN + molecule(n) = nmolecule + ELSE + molecule(n) = 1 + END IF + + ! generate rest of monomers in this chain + + DO imonomer = 2, nmonomer(iset) + + x0 = x1 + y0 = y1 + z0 = z1 + x1 = x2 + y1 = y2 + z1 = z2 + + again = .TRUE. + DO WHILE (again) + ! random point inside sphere of unit radius + + xinner = 2.0*random(iseed) - 1.0 + yinner = 2.0*random(iseed) - 1.0 + zinner = 2.0*random(iseed) - 1.0 + rsq = xinner*xinner + yinner*yinner + zinner*zinner + IF (rsq > 1.0) CYCLE + + ! project point to surface of sphere of unit radius + + r = SQRT(rsq) + xsurf = xinner/r + ysurf = yinner/r + zsurf = zinner/r + + ! create new point by scaling unit offsets by bondlength (sigma = 1.0) + + x2 = x1 + xsurf*bondlength(iset) + y2 = y1 + ysurf*bondlength(iset) + z2 = z1 + zsurf*bondlength(iset) + + ! check that new point meets restriction requirement + ! only for 3rd monomer and beyond + + dx = x2 - x0 + dy = y2 - y0 + dz = z2 - z0 + r = SQRT(dx*dx + dy*dy + dz*dz) + + IF (imonomer > 2 .AND. r <= restrict(iset)) CYCLE + + ! store new point + again = .FALSE. + + ! if delta to previous bead is large, then increment/decrement image flag + + CALL pbc(x2,y2,z2) + n = n + 1 + x(n) = x2 + y(n) = y2 + z(n) = z2 + atomtype(n) = ntype(iset) + + IF (ABS(x(n)-x(n-1)) < 2.0*bondlength(iset)) THEN + imagex(n) = imagex(n-1) + ELSE IF (x(n) - x(n-1) < 0.0) THEN + imagex(n) = imagex(n-1) + 1 + ELSE IF (x(n) - x(n-1) > 0.0) THEN + imagex(n) = imagex(n-1) - 1 + ENDIF + + IF (ABS(y(n)-y(n-1)) < 2.0*bondlength(iset)) THEN + imagey(n) = imagey(n-1) + ELSE IF (y(n) - y(n-1) < 0.0) THEN + imagey(n) = imagey(n-1) + 1 + ELSE IF (y(n) - y(n-1) > 0.0) THEN + imagey(n) = imagey(n-1) - 1 + ENDIF + + IF (ABS(z(n)-z(n-1)) < 2.0*bondlength(iset)) THEN + imagez(n) = imagez(n-1) + ELSE IF (z(n) - z(n-1) < 0.0) THEN + imagez(n) = imagez(n-1) + 1 + ELSE IF (z(n) - z(n-1) > 0.0) THEN + imagez(n) = imagez(n-1) - 1 + ENDIF + + IF (swaptype == 0) THEN + molecule(n) = nmolecule + ELSE IF (swaptype == 1) THEN + molecule(n) = imonomer + ELSE IF (swaptype == 2) THEN + IF (imonomer <= nmonomer(iset)/2) THEN + molecule(n) = imonomer + ELSE + molecule(n) = nmonomer(iset)+1-imonomer + ENDIF + ENDIF + ENDDO + ENDDO + + ENDDO + ENDDO + + ! compute quantities needed for LAMMPS file + + nbonds = 0 + ntypes = 0 + nbondtypes = 0 + DO iset = 1,nsets + nbonds = nbonds + nchain(iset)*(nmonomer(iset)-1) + IF (ntype(iset) > ntypes) ntypes = ntype(iset) + IF (nbondtype(iset) > nbondtypes) nbondtypes = nbondtype(iset) + ENDDO + + ! write out LAMMPS file + + WRITE (6,*) 'LAMMPS FENE chain data file' + WRITE (6,*) + + WRITE (6,*) natoms,' atoms' + WRITE (6,*) nbonds,' bonds' + WRITE (6,*) 0,' angles' + WRITE (6,*) 0,' dihedrals' + WRITE (6,*) 0,' impropers' + WRITE (6,*) + + WRITE (6,*) ntypes,' atom types' + WRITE (6,*) nbondtypes,' bond types' + WRITE (6,*) 0,' angle types' + WRITE (6,*) 0,' dihedral types' + WRITE (6,*) 0,' improper types' + WRITE (6,*) + + WRITE (6,'(2F15.6,A)') xboundlo,xboundhi,' xlo xhi' + WRITE (6,'(2F15.6,A)') yboundlo,yboundhi,' ylo yhi' + WRITE (6,'(2F15.6,A)') zboundlo,zboundhi,' zlo zhi' + + WRITE (6,*) + WRITE (6,*) 'Masses' + WRITE (6,*) + + DO i = 1,ntypes + WRITE (6,'(i3,f5.1)') i,1.0 + ENDDO + + WRITE (6,*) + WRITE (6,*) 'Atoms # molecular' + WRITE (6,*) + + DO i = 1,natoms + WRITE (6,'(I10,I8,I8,3F10.4,3I4)') i,molecule(i),atomtype(i),x(i),y(i),z(i), & + imagex(i),imagey(i),imagez(i) + ENDDO + + IF (nbonds > 0) THEN + WRITE (6,*) + WRITE (6,*) 'Bonds' + WRITE (6,*) + + n = 0 + m = 0 + DO iset = 1,nsets + DO ichain = 1,nchain(iset) + DO imonomer = 1,nmonomer(iset) + n = n + 1 + IF (imonomer /= nmonomer(iset)) THEN + m = m + 1 + WRITE (6,'(i9,i3,2i9)') m,nbondtype(iset),n,n+1 + ENDIF + ENDDO + ENDDO + ENDDO + ENDIF + + DEALLOCATE(nchain, nmonomer, ntype, nbondtype, bondlength, restrict) + DEALLOCATE(x, y, z, atomtype, molecule, imagex, imagey, imagez) + +END PROGRAM chain diff --git a/tools/coding_standard/whitespace.py b/tools/coding_standard/whitespace.py index 2f84e1aa6d..f07aa4a65e 100644 --- a/tools/coding_standard/whitespace.py +++ b/tools/coding_standard/whitespace.py @@ -34,6 +34,7 @@ exclude: - lib/hdnnp - lib/kim - lib/kokkos + - lib/latte - lib/machdyn - lib/mdi - lib/mscg @@ -41,6 +42,7 @@ exclude: - lib/plumed - lib/quip - lib/scafacos + - lib/voronoi - src/Make.sh patterns: - "*.c" @@ -51,6 +53,7 @@ patterns: - "*.py" - "*.rst" - "*.sh" + - "*.f90" - ".gitignore" - "README" - "requirements.txt" diff --git a/tools/micelle2d.f b/tools/micelle2d.f deleted file mode 100644 index 7bc879fcf9..0000000000 --- a/tools/micelle2d.f +++ /dev/null @@ -1,233 +0,0 @@ -c Create LAMMPS 2003 input file for 2d LJ simulation of micelles -c -c Syntax: micelle2d < def.micelle2d > data.file -c -c def file contains size of system and number to turn into surfactants -c attaches a random surfactant tail(s) to random head -c if nonflag is set, will attach 2nd-neighbor bonds in surfactant -c solvent atoms = type 1 -c micelle heads = type 2 -c micelle tails = type 3,4,5,etc. - - program micelle2d - parameter (maxatom=100000,maxbond=10000) - real*4 x(2,maxatom) - integer type(maxatom),molecule(maxatom) - integer bondatom(2,maxbond),bondtype(maxbond) - common xprd,yprd,zprd,xboundlo,xboundhi,yboundlo,yboundhi, - $ zboundlo,zboundhi - 999 format (3i7,3f8.3) - 998 format (4i7) - - read (5,*) - read (5,*) - read (5,*) rhostar - read (5,*) iseed - read (5,*) nx,ny - read (5,*) nsurf - read (5,*) r0 - read (5,*) ntails - read (5,*) nonflag - - natoms = nx*ny - if (natoms+nsurf*ntails.gt.maxatom) then - write (6,*) 'Too many atoms - boost maxatom' - call exit(0) - endif - - nbonds = nsurf*ntails - if (nonflag.eq.1) nbonds = nbonds + nsurf*(ntails-1) - if (nbonds.gt.maxbond) then - write (6,*) 'Too many surfactants - boost maxbond' - call exit(0) - endif - -c box size - - rlattice = (1.0/rhostar) ** 0.5 - - xboundlo = 0.0 - xboundhi = nx*rlattice - yboundlo = 0.0 - yboundhi = ny*rlattice - zboundlo = -0.1 - zboundhi = 0.1 - - sigma = 1.0 - - xprd = xboundhi - xboundlo - yprd = yboundhi - yboundlo - zprd = zboundhi - zboundlo - -c initial square lattice of solvents - - m = 0 - do j = 1,ny - do i = 1,nx - m = m + 1 - x(1,m) = xboundlo + (i-1)*rlattice - x(2,m) = yboundlo + (j-1)*rlattice - molecule(m) = 0 - type(m) = 1 - enddo - enddo - -c turn some into surfactants with molecule ID -c head changes to type 2 -c create ntails for each head of types 3,4,... -c each tail is at distance r0 away in straight line with random orientation - - do i = 1,nsurf - - 10 m = random(iseed)*natoms + 1 - if (m.gt.natoms) m = natoms - if (molecule(m) .ne. 0) goto 10 - - molecule(m) = i - type(m) = 2 - - angle = random(iseed)*2.0*3.1415926 - do j = 1,ntails - k = (i-1)*ntails + j - x(1,natoms+k) = x(1,m) + cos(angle)*j*r0*sigma - x(2,natoms+k) = x(2,m) + sin(angle)*j*r0*sigma - molecule(natoms+k) = i - type(natoms+k) = 2+j - call pbc(x(1,natoms+k),x(2,natoms+k)) - if (j.eq.1) bondatom(1,k) = m - if (j.ne.1) bondatom(1,k) = natoms+k-1 - bondatom(2,k) = natoms+k - bondtype(k) = 1 - enddo - - enddo - -c if nonflag is set, add (ntails-1) 2nd nearest neighbor bonds to end -c of bond list -c k = location in bondatom list where nearest neighbor bonds for -c this surfactant are stored - - if (nonflag.eq.1) then - - nbonds = nsurf*ntails - do i = 1,nsurf - do j = 1,ntails-1 - k = (i-1)*ntails + j - nbonds = nbonds + 1 - bondatom(1,nbonds) = bondatom(1,k) - bondatom(2,nbonds) = bondatom(2,k+1) - bondtype(nbonds) = 2 - enddo - enddo - - endif - -c write LAMMPS data file - - natoms = natoms + nsurf*ntails - nbonds = nsurf*ntails - if (nonflag.eq.1) nbonds = nbonds + nsurf*(ntails-1) - ntypes = 2 + ntails - nbondtypes = 1 - if (nonflag.eq.1) nbondtypes = 2 - - if (nsurf.eq.0) then - ntypes = 1 - nbondtypes = 0 - endif - - write (6,*) 'LAMMPS 2d micelle data file' - write (6,*) - - write (6,*) natoms,' atoms' - write (6,*) nbonds,' bonds' - write (6,*) 0,' angles' - write (6,*) 0,' dihedrals' - write (6,*) 0,' impropers' - write (6,*) - - write (6,*) ntypes,' atom types' - write (6,*) nbondtypes,' bond types' - write (6,*) 0,' angle types' - write (6,*) 0,' dihedral types' - write (6,*) 0,' improper types' - write (6,*) - - write (6,*) xboundlo,xboundhi,' xlo xhi' - write (6,*) yboundlo,yboundhi,' ylo yhi' - write (6,*) zboundlo,zboundhi,' zlo zhi' - - write (6,*) - write (6,*) 'Masses' - write (6,*) - - do i = 1,ntypes - write (6,*) i,1.0 - enddo - - write (6,*) - write (6,*) 'Atoms' - write (6,*) - - do i = 1,natoms - write (6,999) i,molecule(i),type(i),x(1,i),x(2,i),0.0 - enddo - - if (nsurf.gt.0) then - - write (6,*) - write (6,*) 'Bonds' - write (6,*) - - do i = 1,nbonds - write (6,998) i,bondtype(i),bondatom(1,i),bondatom(2,i) - enddo - - endif - -c write Xmovie bond geometry file - - open(1,file='bond.micelle') - - write (1,*) 'ITEM: BONDS' - do i = 1,nbonds - write (1,*) bondtype(i),bondatom(1,i),bondatom(2,i) - enddo - - close(1) - - end - - -c ************ -c Subroutines -c ************ - -c periodic boundary conditions - map atom back into periodic box - - subroutine pbc(x,y) - common xprd,yprd,zprd,xboundlo,xboundhi,yboundlo,yboundhi, - $ zboundlo,zboundhi - - if (x.lt.xboundlo) x = x + xprd - if (x.ge.xboundhi) x = x - xprd - if (y.lt.yboundlo) y = y + yprd - if (y.ge.yboundhi) y = y - yprd - - return - end - - -c RNG - compute in double precision, return single - - real*4 function random(iseed) - real*8 aa,mm,sseed - parameter (aa=16807.0D0,mm=2147483647.0D0) - - sseed = iseed - sseed = mod(aa*sseed,mm) - random = sseed/mm - iseed = sseed - - return - end diff --git a/tools/micelle2d.f90 b/tools/micelle2d.f90 new file mode 100644 index 0000000000..a7a6b20568 --- /dev/null +++ b/tools/micelle2d.f90 @@ -0,0 +1,231 @@ +! Create LAMMPS data file for 2d LJ simulation of micelles +! +! Syntax: micelle2d < def.micelle2d > data.file +! +! def file contains size of system and number to turn into surfactants +! attaches a random surfactant tail(s) to random head +! if nonflag is set, will attach 2nd-neighbor bonds in surfactant +! solvent atoms = type 1 +! micelle heads = type 2 +! micelle tails = type 3,4,5,etc. + +MODULE boxmicelle + IMPLICIT NONE + PUBLIC + REAL(KIND=8) :: xprd,yprd,zprd,xboundlo,xboundhi,yboundlo,yboundhi,zboundlo,zboundhi + +CONTAINS + + ! periodic boundary conditions - map atom back into periodic box + + SUBROUTINE pbc(x,y) + REAL(KIND=8), INTENT(inout) :: x,y + + IF (x < xboundlo) x = x + xprd + IF (x >= xboundhi) x = x - xprd + IF (y < yboundlo) y = y + yprd + IF (y >= yboundhi) y = y - yprd + + END SUBROUTINE pbc +END MODULE boxmicelle + +MODULE rngmicelle + IMPLICIT NONE + +CONTAINS + + ! *very* minimal random number generator + + REAL(KIND=8) FUNCTION random(iseed) + IMPLICIT NONE + INTEGER, INTENT(inout) :: iseed + REAL(KIND=8), PARAMETER :: aa=16807.0_8, mm=2147483647.0_8 + REAL(KIND=8) :: sseed + + sseed = REAL(iseed) + sseed = MOD(aa*sseed,mm) + random = sseed/mm + iseed = INT(sseed) + END FUNCTION random +END MODULE rngmicelle + +PROGRAM micelle2d + USE boxmicelle + USE rngmicelle + IMPLICIT NONE + + REAL(kind=8), ALLOCATABLE :: x(:,:) + INTEGER, ALLOCATABLE :: atomtype(:), molecule(:) + INTEGER, ALLOCATABLE :: bondatom(:,:),bondtype(:) + INTEGER :: natoms, maxatom, ntypes, nbonds, nbondtypes, iseed + INTEGER :: i, j, k, m, nx, ny, nsurf, ntails, nonflag + REAL(kind=8) :: rhostar, rlattice, sigma, angle,r0 + REAL(kind=8), parameter :: pi = 3.14159265358979323846_8 + LOGICAL :: again + + READ(5,*) + READ(5,*) + READ(5,*) rhostar + READ(5,*) iseed + READ(5,*) nx,ny + READ(5,*) nsurf + READ(5,*) r0 + READ(5,*) ntails + READ(5,*) nonflag + + natoms = nx*ny + maxatom = natoms + nsurf*ntails + ALLOCATE(x(2,maxatom), molecule(maxatom), atomtype(maxatom)) + + nbonds = nsurf*ntails + IF (nonflag.EQ.1) nbonds = nbonds + nsurf*(ntails-1) + ALLOCATE(bondatom(2,nbonds), bondtype(nbonds)) + +! box size + + rlattice = (1.0_8/rhostar) ** 0.5_8 + + xboundlo = 0.0_8 + xboundhi = nx*rlattice + yboundlo = 0.0_8 + yboundhi = ny*rlattice + zboundlo = -0.1_8 + zboundhi = 0.1_8 + + sigma = 1.0_8 + + xprd = xboundhi - xboundlo + yprd = yboundhi - yboundlo + zprd = zboundhi - zboundlo + +! initial square lattice of solvents + + m = 0 + DO j = 1,ny + DO i = 1,nx + m = m + 1 + x(1,m) = xboundlo + (i-1)*rlattice + x(2,m) = yboundlo + (j-1)*rlattice + molecule(m) = 0 + atomtype(m) = 1 + ENDDO + ENDDO + +! turn some into surfactants with molecule ID +! head changes to type 2 +! create ntails for each head of types 3,4,... +! each tail is at distance r0 away in straight line with random orientation + + DO i = 1,nsurf + + again = .TRUE. + DO WHILE(again) + m = INT(random(iseed)*natoms + 1) + IF (m > natoms) m = natoms + IF (molecule(m) /= 0) CYCLE + again = .FALSE. + END DO + molecule(m) = i + atomtype(m) = 2 + + angle = random(iseed)*2.0_8*pi + DO j = 1,ntails + k = (i-1)*ntails + j + x(1,natoms+k) = x(1,m) + COS(angle)*j*r0*sigma + x(2,natoms+k) = x(2,m) + SIN(angle)*j*r0*sigma + molecule(natoms+k) = i + atomtype(natoms+k) = 2+j + CALL pbc(x(1,natoms+k),x(2,natoms+k)) + IF (j == 1) bondatom(1,k) = m + IF (j /= 1) bondatom(1,k) = natoms+k-1 + bondatom(2,k) = natoms+k + bondtype(k) = 1 + ENDDO + + ENDDO + +! if nonflag is set, add (ntails-1) 2nd nearest neighbor bonds to end +! of bond list +! k = location in bondatom list where nearest neighbor bonds for +! this surfactant are stored + + IF (nonflag == 1) THEN + + nbonds = nsurf*ntails + DO i = 1,nsurf + DO j = 1,ntails-1 + k = (i-1)*ntails + j + nbonds = nbonds + 1 + bondatom(1,nbonds) = bondatom(1,k) + bondatom(2,nbonds) = bondatom(2,k+1) + bondtype(nbonds) = 2 + ENDDO + ENDDO + + ENDIF + +! write LAMMPS data file + + natoms = natoms + nsurf*ntails + nbonds = nsurf*ntails + IF (nonflag == 1) nbonds = nbonds + nsurf*(ntails-1) + ntypes = 2 + ntails + nbondtypes = 1 + IF (nonflag == 1) nbondtypes = 2 + + IF (nsurf == 0) THEN + ntypes = 1 + nbondtypes = 0 + ENDIF + + WRITE (6,*) 'LAMMPS 2d micelle data file' + WRITE (6,*) + + WRITE (6,*) natoms,' atoms' + WRITE (6,*) nbonds,' bonds' + WRITE (6,*) 0,' angles' + WRITE (6,*) 0,' dihedrals' + WRITE (6,*) 0,' impropers' + WRITE (6,*) + + WRITE (6,*) ntypes,' atom types' + WRITE (6,*) nbondtypes,' bond types' + WRITE (6,*) 0,' angle types' + WRITE (6,*) 0,' dihedral types' + WRITE (6,*) 0,' improper types' + WRITE (6,*) + + WRITE (6,*) xboundlo,xboundhi,' xlo xhi' + WRITE (6,*) yboundlo,yboundhi,' ylo yhi' + WRITE (6,*) zboundlo,zboundhi,' zlo zhi' + + WRITE (6,*) + WRITE (6,*) 'Masses' + WRITE (6,*) + + DO i = 1,ntypes + WRITE (6,*) i,1.0 + ENDDO + + WRITE (6,*) + WRITE (6,*) 'Atoms # molecular' + WRITE (6,*) + + DO i = 1,natoms + WRITE (6,'(3I7,3F8.3)') i,molecule(i),atomtype(i),x(1,i),x(2,i),0.0 + ENDDO + + IF (nsurf > 0) THEN + + WRITE (6,*) + WRITE (6,*) 'Bonds' + WRITE (6,*) + + DO i = 1,nbonds + WRITE (6,'(4I7)') i,bondtype(i),bondatom(1,i),bondatom(2,i) + ENDDO + + ENDIF + + DEALLOCATE(x,molecule,atomtype,bondtype,bondatom) +END PROGRAM micelle2d diff --git a/unittest/force-styles/tests/atomic-pair-meam.yaml b/unittest/force-styles/tests/atomic-pair-meam.yaml index 6f262c032a..08193987f8 100644 --- a/unittest/force-styles/tests/atomic-pair-meam.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:03 2021 -epsilon: 5e-13 +epsilon: 2.5e-12 prerequisites: ! | pair meam pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml index 7fd61ac2aa..9ee9ee13fb 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_spline.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_spline.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:03 2021 -epsilon: 1e-14 +epsilon: 5e-14 prerequisites: ! | pair meam/spline pre_commands: ! | diff --git a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml index 6a2c16a80d..b1335906c4 100644 --- a/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml +++ b/unittest/force-styles/tests/atomic-pair-polymorphic_eam.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:04 2021 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | pair polymorphic pre_commands: ! | diff --git a/unittest/force-styles/tests/bond-class2.yaml b/unittest/force-styles/tests/bond-class2.yaml index 19647a56ed..a7c9d37cf3 100644 --- a/unittest/force-styles/tests/bond-class2.yaml +++ b/unittest/force-styles/tests/bond-class2.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:21 2021 -epsilon: 1e-13 +epsilon: 4e-13 prerequisites: ! | atom full bond class2 diff --git a/unittest/force-styles/tests/data.bilayer b/unittest/force-styles/tests/data.bilayer index 101bb02480..ceb8a821d7 100644 --- a/unittest/force-styles/tests/data.bilayer +++ b/unittest/force-styles/tests/data.bilayer @@ -1,72 +1,66 @@ -LAMMPS data file. CGCMM style. atom_style full generated by VMD/TopoTools v1.8 on Sun Aug 15 17:12:56 EDT 2021 - 48 atoms - 0 bonds - 0 angles - 0 dihedrals - 0 impropers - 3 atom types - 0 bond types - 0 angle types - 0 dihedral types - 0 improper types - 0 7.38 xlo xhi - 0 8.58 ylo yhi - 0 10.0 zlo zhi +LAMMPS data file via write_data, version 30 Jul 2021, timestep = 0 - Masses +48 atoms +3 atom types - 1 11.000000 # 1 - 2 14.000000 # 2 - 3 12.000000 # 3 +0 7.38 xlo xhi +0 8.58 ylo yhi +-0.010057298274271795 10 zlo zhi - Atoms # full +Masses -1 1 2 -0.420000 0.000000 0.715000 0.000000 # 2 -2 1 1 0.420000 0.000000 2.145000 0.000000 # 1 -3 1 2 -0.420000 1.238416 2.860000 0.000000 # 2 -4 1 1 0.420000 1.238416 4.290000 0.000000 # 1 -5 1 2 -0.420000 0.000000 5.005000 0.000000 # 2 -6 1 1 0.420000 0.000000 6.435000 0.000000 # 1 -7 1 2 -0.420000 1.238416 7.150000 0.000000 # 2 -8 1 1 0.420000 1.238416 8.580000 0.000000 # 1 -9 1 2 -0.420000 2.476833 0.715000 0.000000 # 2 -10 1 1 0.420000 2.476833 2.145000 0.000000 # 1 -11 1 2 -0.420000 3.715249 2.860000 0.000000 # 2 -12 1 1 0.420000 3.715249 4.290000 0.000000 # 1 -13 1 2 -0.420000 2.476833 5.005000 0.000000 # 2 -14 1 1 0.420000 2.476833 6.435000 0.000000 # 1 -15 1 2 -0.420000 3.715249 7.150000 0.000000 # 2 -16 1 1 0.420000 3.715249 8.580000 0.000000 # 1 -17 1 2 -0.420000 4.953665 0.715000 0.000000 # 2 -18 1 1 0.420000 4.953665 2.145000 0.000000 # 1 -19 1 2 -0.420000 6.192081 2.860000 0.000000 # 2 -20 1 1 0.420000 6.192081 4.290000 0.000000 # 1 -21 1 2 -0.420000 4.953665 5.005000 0.000000 # 2 -22 1 1 0.420000 4.953665 6.435000 0.000000 # 1 -23 1 2 -0.420000 6.192081 7.150000 0.000000 # 2 -24 1 1 0.420000 6.192081 8.580000 0.000000 # 1 -25 2 3 0.000000 1.238416 1.430000 3.330000 # 3 -26 2 3 0.000000 0.000000 2.145000 3.330000 # 3 -27 2 3 0.000000 0.000000 3.575000 3.330000 # 3 -28 2 3 0.000000 1.238416 4.290000 3.330000 # 3 -29 2 3 0.000000 1.238416 5.720000 3.330000 # 3 -30 2 3 0.000000 0.000000 6.435000 3.330000 # 3 -31 2 3 0.000000 0.000000 7.865000 3.330000 # 3 -32 2 3 0.000000 1.238416 8.580000 3.330000 # 3 -33 2 3 0.000000 3.715249 1.430000 3.330000 # 3 -34 2 3 0.000000 2.476833 2.145000 3.330000 # 3 -35 2 3 0.000000 2.476833 3.575000 3.330000 # 3 -36 2 3 0.000000 3.715249 4.290000 3.330000 # 3 -37 2 3 0.000000 3.715249 5.720000 3.330000 # 3 -38 2 3 0.000000 2.476833 6.435000 3.330000 # 3 -39 2 3 0.000000 2.476833 7.865000 3.330000 # 3 -40 2 3 0.000000 3.715249 8.580000 3.330000 # 3 -41 2 3 0.000000 6.192081 1.430000 3.330000 # 3 -42 2 3 0.000000 4.953665 2.145000 3.330000 # 3 -43 2 3 0.000000 4.953665 3.575000 3.330000 # 3 -44 2 3 0.000000 6.192081 4.290000 3.330000 # 3 -45 2 3 0.000000 6.192081 5.720000 3.330000 # 3 -46 2 3 0.000000 4.953665 6.435000 3.330000 # 3 -47 2 3 0.000000 4.953665 7.865000 3.330000 # 3 -48 2 3 0.000000 6.192081 8.580000 3.330000 # 3 +1 11 +2 14 +3 12 + +Atoms # full + +1 1 2 -0.42 7.377582386921897 0.7221769963191714 0.0037771363154878545 -1 0 0 +2 1 1 0.42 7.378315948261095 2.1411424242268047 0.005723979908844447 -1 0 0 +3 1 2 -0.42 1.2447887970776952 2.8676004848245533 0.001348446268284902 0 0 0 +4 1 1 0.42 1.2414656689644874 4.28578628613883 0.00011113531427045186 0 0 0 +5 1 2 -0.42 0.002474815180746286 4.9992187428028405 -0.005589712651255407 0 0 0 +6 1 1 0.42 7.379979983665971 6.4385854739759045 0.0010611130348691324 -1 0 0 +7 1 2 -0.42 1.2317585840471603 7.158810080624563 -0.008974942974268898 0 0 0 +8 1 1 0.42 1.2352508770341066 0.0037783122313107898 0.002093671640424837 0 1 0 +9 1 2 -0.42 2.4773332782542727 0.7231766195586773 0.004444922690486966 0 0 0 +10 1 1 0.42 2.4830271537615816 2.1501422709017723 0.006147046087378192 0 0 0 +11 1 2 -0.42 3.709595948985172 2.8691715937849 0.006976742817543793 0 0 0 +12 1 1 0.42 3.7240167199015244 4.289068384919813 0.002345347298470022 0 0 0 +13 1 2 -0.42 2.4712325868621394 4.998856391973726 0.004379902423536359 0 0 0 +14 1 1 0.42 2.474562437522464 6.433656440055303 -0.0012119905144032052 0 0 0 +15 1 2 -0.42 3.725038325222275 7.159189010774339 -0.0002959156829379106 0 0 0 +16 1 1 0.42 3.706133972373436 0.0037306803342563467 0.0015443778464311643 0 1 0 +17 1 2 -0.42 4.956689237720773 0.7233633730273523 0.0032104707105134024 0 0 0 +18 1 1 0.42 4.962115477057346 2.152167902820356 -0.009057298274271795 0 0 0 +19 1 2 -0.42 6.184281256484653 2.869710737578436 0.008366480776279456 0 0 0 +20 1 1 0.42 6.188803450864838 4.284231685327474 -0.008064701146476297 0 0 0 +21 1 2 -0.42 4.949812422011079 5.0147217402047115 -0.006712379416782586 0 0 0 +22 1 1 0.42 4.948281204520974 6.429549384016799 -0.00850282965158244 0 0 0 +23 1 2 -0.42 6.194837058886999 7.1510817137970974 0.0003637878086249291 0 0 0 +24 1 1 0.42 6.197894966950315 8.5753425339448 0.0019680102504640875 0 0 0 +25 2 3 0 1.2443079194694104 1.4354905223825436 3.3292096834113867 0 0 0 +26 2 3 0 0.005953551957362122 2.146347747385198 3.3215903030250176 0 0 0 +27 2 3 0 0.008405194319042002 3.581100920138928 3.3281647749562584 0 0 0 +28 2 3 0 1.2344840653089975 4.28597364831994 3.339107313230218 0 0 0 +29 2 3 0 1.2459826328321986 5.712398010763525 3.3233669025652888 0 0 0 +30 2 3 0 0.0011015360109049533 6.428515735279543 3.328962843282597 0 0 0 +31 2 3 0 0.0053187626578466785 7.857443990429139 3.336147142535144 0 0 0 +32 2 3 0 1.2375058991604755 0.003935190110437195 3.328740186117934 0 1 0 +33 2 3 0 3.722777594386544 1.4230858546509806 3.3239591190330495 0 0 0 +34 2 3 0 2.477738590136957 2.145253431839055 3.329428918999354 0 0 0 +35 2 3 0 2.47490377328119 3.5704865369598786 3.332226684676589 0 0 0 +36 2 3 0 3.7109409527732264 4.284650259616156 3.3369133687377506 0 0 0 +37 2 3 0 3.7215294678437676 5.715823050199925 3.3280047101471597 0 0 0 +38 2 3 0 2.4731365114325135 6.42811664625216 3.321473560073168 0 0 0 +39 2 3 0 2.4849857361078898 7.868035765305644 3.3321074919552114 0 0 0 +40 2 3 0 3.7175249488002753 8.571871486223243 3.334068954044054 0 0 0 +41 2 3 0 6.201483231089492 1.433297921099373 3.338159917163737 0 0 0 +42 2 3 0 4.951929076909173 2.149340612475919 3.3226738827688034 0 0 0 +43 2 3 0 4.960270928343071 3.580837662003859 3.3235852988546646 0 0 0 +44 2 3 0 6.190455345511372 4.287625009635288 3.3335369402978277 0 0 0 +45 2 3 0 6.192023154106657 5.727784070585754 3.3368743347641425 0 0 0 +46 2 3 0 4.951470112194179 6.42552064756887 3.3305236900088024 0 0 0 +47 2 3 0 4.954889130658072 7.858963970208524 3.3224472946591894 0 0 0 +48 2 3 0 6.191151024308316 0.00989854985843345 3.3349274706910026 0 1 0 diff --git a/unittest/force-styles/tests/dihedral-multi_harmonic.yaml b/unittest/force-styles/tests/dihedral-multi_harmonic.yaml index 1694ed2e66..71c5c1927a 100644 --- a/unittest/force-styles/tests/dihedral-multi_harmonic.yaml +++ b/unittest/force-styles/tests/dihedral-multi_harmonic.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:35 2021 -epsilon: 2.5e-13 +epsilon: 5e-13 prerequisites: ! | atom full dihedral multi/harmonic diff --git a/unittest/force-styles/tests/dihedral-quadratic.yaml b/unittest/force-styles/tests/dihedral-quadratic.yaml index ed230b7c23..b1c59e131f 100644 --- a/unittest/force-styles/tests/dihedral-quadratic.yaml +++ b/unittest/force-styles/tests/dihedral-quadratic.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:35 2021 -epsilon: 2.5e-13 +epsilon: 1e-12 prerequisites: ! | atom full dihedral quadratic diff --git a/unittest/force-styles/tests/dihedral-spherical.yaml b/unittest/force-styles/tests/dihedral-spherical.yaml index 1811ce1069..3d0c0686da 100644 --- a/unittest/force-styles/tests/dihedral-spherical.yaml +++ b/unittest/force-styles/tests/dihedral-spherical.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 10:57:54 2021 -epsilon: 2.5e-14 +epsilon: 5e-14 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/dihedral-table_cut_linear.yaml b/unittest/force-styles/tests/dihedral-table_cut_linear.yaml index 7b4c429c96..fdfa9bfcb5 100644 --- a/unittest/force-styles/tests/dihedral-table_cut_linear.yaml +++ b/unittest/force-styles/tests/dihedral-table_cut_linear.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Tue Mar 23 08:05:02 202 -epsilon: 2e-14 +epsilon: 5e-14 prerequisites: ! | atom full dihedral table/cut diff --git a/unittest/force-styles/tests/dihedral-table_cut_spline.yaml b/unittest/force-styles/tests/dihedral-table_cut_spline.yaml index 40437ebbbb..2fabbed8f9 100644 --- a/unittest/force-styles/tests/dihedral-table_cut_spline.yaml +++ b/unittest/force-styles/tests/dihedral-table_cut_spline.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Tue Mar 23 08:06:45 202 -epsilon: 2e-14 +epsilon: 2.5e-13 prerequisites: ! | atom full dihedral table/cut diff --git a/unittest/force-styles/tests/dihedral-table_linear.yaml b/unittest/force-styles/tests/dihedral-table_linear.yaml index 7e2a7d55c1..608208e275 100644 --- a/unittest/force-styles/tests/dihedral-table_linear.yaml +++ b/unittest/force-styles/tests/dihedral-table_linear.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Mon Mar 22 21:19:05 202 -epsilon: 1e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full dihedral table diff --git a/unittest/force-styles/tests/dihedral-table_spline.yaml b/unittest/force-styles/tests/dihedral-table_spline.yaml index 90aab98fba..17c90b86d3 100644 --- a/unittest/force-styles/tests/dihedral-table_spline.yaml +++ b/unittest/force-styles/tests/dihedral-table_spline.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Mar 2021 date_generated: Mon Mar 22 21:19:05 202 -epsilon: 1e-14 +epsilon: 1e-13 prerequisites: ! | atom full dihedral table diff --git a/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml b/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml index 00041030fd..a1e0c30d62 100644 --- a/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-addtorque_const.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 14:22:56 2021 -epsilon: 9e-12 +epsilon: 2.5e-11 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml index 89e6518c7b..9151c9f4aa 100644 --- a/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml +++ b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:54 2021 -epsilon: 2e-14 +epsilon: 1e-13 prerequisites: ! | atom full fix momentum/chunk diff --git a/unittest/force-styles/tests/fix-timestep-nph_sphere.yaml b/unittest/force-styles/tests/fix-timestep-nph_sphere.yaml index 2b3a5efe74..5740f1c772 100644 --- a/unittest/force-styles/tests/fix-timestep-nph_sphere.yaml +++ b/unittest/force-styles/tests/fix-timestep-nph_sphere.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 14:13:03 2021 -epsilon: 5e-14 +epsilon: 2e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_sphere_aniso.yaml b/unittest/force-styles/tests/fix-timestep-npt_sphere_aniso.yaml index e93f5187d0..e920859bf2 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_sphere_aniso.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_sphere_aniso.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 14:10:26 2021 -epsilon: 1e-13 +epsilon: 4e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_sphere_iso.yaml b/unittest/force-styles/tests/fix-timestep-npt_sphere_iso.yaml index 85335e2f0e..4af29dd4d2 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_sphere_iso.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_sphere_iso.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 14:07:35 2021 -epsilon: 5e-14 +epsilon: 2e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-npt_sphere_tri.yaml b/unittest/force-styles/tests/fix-timestep-npt_sphere_tri.yaml index 6ed72bd4ac..a30917cbc6 100644 --- a/unittest/force-styles/tests/fix-timestep-npt_sphere_tri.yaml +++ b/unittest/force-styles/tests/fix-timestep-npt_sphere_tri.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 date_generated: Sun Aug 22 14:15:09 2021 -epsilon: 2e-13 +epsilon: 5e-13 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/fix-timestep-oneway.yaml b/unittest/force-styles/tests/fix-timestep-oneway.yaml index 413902e1ff..654507882e 100644 --- a/unittest/force-styles/tests/fix-timestep-oneway.yaml +++ b/unittest/force-styles/tests/fix-timestep-oneway.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:55 2021 -epsilon: 4e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full fix oneway diff --git a/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml b/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml index 2a4b6d9cb6..fcf9c20ab8 100644 --- a/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml +++ b/unittest/force-styles/tests/fix-timestep-rattle_bond.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:55 2021 -epsilon: 1e-10 +epsilon: 1.5e-10 prerequisites: ! | atom full fix rattle diff --git a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml index 41b3e8c1f9..3da01fa5b8 100644 --- a/unittest/force-styles/tests/fix-timestep-shake_bond.yaml +++ b/unittest/force-styles/tests/fix-timestep-shake_bond.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:58 2021 -epsilon: 3.5e-11 +epsilon: 5e-11 prerequisites: ! | atom full fix shake diff --git a/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml index 779d1b30c3..ebc6fd5bea 100644 --- a/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml +++ b/unittest/force-styles/tests/fix-timestep-wall_harmonic_const.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:59 2021 -epsilon: 3e-14 +epsilon: 4e-14 prerequisites: ! | atom full fix wall/harmonic diff --git a/unittest/force-styles/tests/improper-harmonic.yaml b/unittest/force-styles/tests/improper-harmonic.yaml index bd5c1bb534..fb147a2e71 100644 --- a/unittest/force-styles/tests/improper-harmonic.yaml +++ b/unittest/force-styles/tests/improper-harmonic.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Wed Feb 24 19:35:15 202 -epsilon: 1e-11 +epsilon: 2e-11 prerequisites: ! | atom full improper harmonic diff --git a/unittest/force-styles/tests/kspace-ewald_tilted.yaml b/unittest/force-styles/tests/kspace-ewald_tilted.yaml new file mode 100644 index 0000000000..18d6278187 --- /dev/null +++ b/unittest/force-styles/tests/kspace-ewald_tilted.yaml @@ -0,0 +1,94 @@ +--- +lammps_version: 30 Jul 2021 +date_generated: Tue Aug 24 16:00:03 2021 +epsilon: 8.5e-14 +skip_tests: +prerequisites: ! | + atom full + pair coul/long + kspace ewald +pre_commands: ! "" +post_commands: ! | + pair_modify mix arithmetic + pair_modify table 0 + pair_modify compute no + group none empty + change_box all triclinic + change_box none xy final 0.5 xz final 0.5 yz final 0.5 + kspace_style ewald 1.0e-6 + kspace_modify gewald 0.3 +input_file: in.fourmol +pair_style: coul/long 8.0 +pair_coeff: ! | + * * +extract: ! "" +natoms: 29 +init_vdwl: 0 +init_coul: 0 +init_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +init_forces: ! |2 + 1 -5.3448670515756946e-01 7.8599782106382812e-02 2.0710927588803751e-01 + 2 2.2178420089971082e-01 -2.7643402434627568e-01 -1.2760374351052742e-01 + 3 -3.4754319998885001e-02 -9.3504708496478690e-03 1.9886382422593211e-02 + 4 1.6445863380462616e-01 2.8359395290019698e-02 -7.8729303809635401e-02 + 5 1.6233641307706351e-01 7.5986707200382503e-02 -3.6930511107003808e-02 + 6 5.6637631370696451e-01 4.1893463304019041e-01 -6.7664491982745634e-01 + 7 -3.3948920528780069e-01 -3.9999223701116160e-01 4.0048374439634377e-01 + 8 -1.4238445302733072e-01 -6.2030995164738334e-01 3.3646022882523446e-01 + 9 1.8321468690702236e-01 3.2329505791288987e-01 5.5419174179294289e-02 + 10 -5.1536377515236292e-02 1.1099268040025226e-01 -1.4084559805296692e-02 + 11 -8.4444394935712291e-02 1.5159947723172223e-01 -3.9463118427389220e-02 + 12 4.5970202214672301e-01 -4.2545537704155284e-01 3.2406840753999723e-02 + 13 -1.5666599035798093e-01 1.1527633374087305e-01 2.7654374124323384e-02 + 14 -1.7363583497646881e-01 1.3581078235758284e-01 1.0662571297963025e-02 + 15 -1.3881062069365652e-01 8.5530348257713926e-02 -1.3048746581823758e-02 + 16 -3.3884433626020932e-01 4.3401859035700502e-01 5.3769217618752685e-01 + 17 1.3001440137507966e-01 -4.1589115651366521e-01 -7.9670451166464484e-01 + 18 7.5681379375335611e-01 1.5582935725479723e+00 -1.4210097554885777e+00 + 19 -2.8085336420242663e-01 -7.8741407964003718e-01 7.8245857403750418e-01 + 20 -4.0594967301158125e-01 -7.0553497589712044e-01 7.5613349420219689e-01 + 21 5.0704592271800275e-01 5.6580880704147107e-01 -1.1619399232386021e+00 + 22 -2.8704161808189710e-01 -1.3216031203060810e-01 5.8097825566381744e-01 + 23 -2.8642030339820157e-01 -3.0776190804563458e-01 5.5724240346862619e-01 + 24 8.9772331662676536e-02 1.7084621364125749e+00 -3.1646797639105334e-01 + 25 1.3203890191695800e-01 -6.8368673665866730e-01 2.4609923757704671e-01 + 26 -2.4575213176251201e-01 -9.4797999409036526e-01 8.5244090147042331e-02 + 27 -8.6290089809075665e-01 1.6205604497958011e+00 -9.3012639603990466e-01 + 28 5.6895188209221181e-01 -9.0851861726847494e-01 5.3413668936060954e-01 + 29 4.2146072269782930e-01 -7.9103891265223736e-01 4.4268595335975636e-01 +run_vdwl: 0 +run_coul: 0 +run_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_forces: ! |2 + 1 -5.3334348792473663e-01 7.8785708829614623e-02 2.0952494330848997e-01 + 2 2.2047697818092868e-01 -2.7713623100478413e-01 -1.2893818878633795e-01 + 3 -3.4736144178054582e-02 -9.3340960282083715e-03 1.9999043638795875e-02 + 4 1.6460652383725125e-01 2.8241875764049424e-02 -7.9113572796586790e-02 + 5 1.6215649863110154e-01 7.5978103359921431e-02 -3.7484057379720333e-02 + 6 5.6599278205644532e-01 4.1851641614579382e-01 -6.7992950478127434e-01 + 7 -3.3968790345085564e-01 -4.0048941901454138e-01 4.0256715056329251e-01 + 8 -1.4127588913092420e-01 -6.2017022889258322e-01 3.3993571378136456e-01 + 9 1.8227911587148210e-01 3.2295764963388313e-01 5.3201479166533922e-02 + 10 -5.1700413623535821e-02 1.1111482057473794e-01 -1.4551185576318685e-02 + 11 -8.4630638764449165e-02 1.5198576029820277e-01 -3.9867702658817644e-02 + 12 4.6027933614580008e-01 -4.2553026862869375e-01 3.4381287211854843e-02 + 13 -1.5686137135126832e-01 1.1537512460453701e-01 2.7055222353983506e-02 + 14 -1.7378447342619111e-01 1.3594753630000173e-01 1.0206866580498939e-02 + 15 -1.3885301533726085e-01 8.5409407767259818e-02 -1.3828540594015035e-02 + 16 -3.4001275168031081e-01 4.3481964910483151e-01 5.3551094197240323e-01 + 17 1.3095652292939247e-01 -4.1543488278945484e-01 -7.9439775989272843e-01 + 18 7.6130155207510231e-01 1.5641161174020948e+00 -1.4166082689671402e+00 + 19 -2.8201484020970297e-01 -7.8931009820541154e-01 7.8114406552076276e-01 + 20 -4.0864600217287589e-01 -7.0869378747084499e-01 7.5398290929506750e-01 + 21 5.0731879438820993e-01 5.5710526946109051e-01 -1.1569855994010214e+00 + 22 -2.8670662557005039e-01 -1.2787743295502346e-01 5.7883709816985718e-01 + 23 -2.8655446637042009e-01 -3.0420640641646041e-01 5.5485906877201041e-01 + 24 9.1000147200901771e-02 1.7036643907704361e+00 -3.1478809556214382e-01 + 25 1.3087682966252198e-01 -6.8159119768456733e-01 2.4475033518411687e-01 + 26 -2.4585864030573110e-01 -9.4550397751699744e-01 8.4357627318536146e-02 + 27 -8.6391407541084209e-01 1.6204449844939783e+00 -9.2544999434421571e-01 + 28 5.6947333589361271e-01 -9.0807662135609435e-01 5.3159257072970112e-01 + 29 4.2186232203445834e-01 -7.9110816654676352e-01 4.4003614717305051e-01 +... diff --git a/unittest/force-styles/tests/kspace-pppm_tilted.yaml b/unittest/force-styles/tests/kspace-pppm_tilted.yaml new file mode 100644 index 0000000000..cf1a7a2c87 --- /dev/null +++ b/unittest/force-styles/tests/kspace-pppm_tilted.yaml @@ -0,0 +1,92 @@ +--- +lammps_version: 30 Jul 2021 +date_generated: Tue Aug 24 15:57:51 2021 +epsilon: 1e-13 +skip_tests: gpu +prerequisites: ! | + atom full + pair coul/long + kspace pppm +pre_commands: ! "" +post_commands: ! | + pair_modify compute no + group none empty + change_box all triclinic + change_box none xy final 0.5 xz final 0.5 yz final 0.5 + kspace_style pppm 1.0e-6 + kspace_modify gewald 0.3 +input_file: in.fourmol +pair_style: coul/long 8.0 +pair_coeff: ! | + * * +extract: ! "" +natoms: 29 +init_vdwl: 0 +init_coul: 0 +init_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +init_forces: ! |2 + 1 -5.3455805973222437e-01 7.8698684976257607e-02 2.0711314888470955e-01 + 2 2.2184568573854779e-01 -2.7647431277628187e-01 -1.2757452052704132e-01 + 3 -3.4757340736885710e-02 -9.3470470522295339e-03 1.9885688602828643e-02 + 4 1.6445912101334906e-01 2.8345927313968042e-02 -7.8722927625643938e-02 + 5 1.6234688533111721e-01 7.5972054420001711e-02 -3.6936297075666272e-02 + 6 5.6653284543285287e-01 4.1888106452174662e-01 -6.7663104705782029e-01 + 7 -3.3961547966725153e-01 -4.0001344965273866e-01 4.0047632273598788e-01 + 8 -1.4242862568200385e-01 -6.2031296063117003e-01 3.3640454007119630e-01 + 9 1.8322344081844300e-01 3.2327686261589661e-01 5.5386729810616965e-02 + 10 -5.1553080010261633e-02 1.1100399113998416e-01 -1.4071507835405114e-02 + 11 -8.4457368938472652e-02 1.5161839580411990e-01 -3.9440958631538105e-02 + 12 4.5980547268228616e-01 -4.2545520083096022e-01 3.2346370702025180e-02 + 13 -1.5668051885818224e-01 1.1528021365610482e-01 2.7670519478048963e-02 + 14 -1.7366274753772379e-01 1.3580748800890222e-01 1.0678928186624024e-02 + 15 -1.3885054474562650e-01 8.5524833610521669e-02 -1.3032936810854641e-02 + 16 -3.3897150894267869e-01 4.3411449803827901e-01 5.3768221413168005e-01 + 17 1.3014158705307541e-01 -4.1604199493225014e-01 -7.9661148361636958e-01 + 18 7.5708876110784495e-01 1.5585543643937958e+00 -1.4210365830174345e+00 + 19 -2.8092848433130602e-01 -7.8754421733994284e-01 7.8241552040791995e-01 + 20 -4.0612757709741132e-01 -7.0559006327161899e-01 7.5613258856438037e-01 + 21 5.0705834349462331e-01 5.6563606920657128e-01 -1.1618762247785586e+00 + 22 -2.8713969353176505e-01 -1.3207924257384354e-01 5.8092858221716182e-01 + 23 -2.8635179770885089e-01 -3.0768005507572388e-01 5.5725013443463101e-01 + 24 8.9526815583228531e-02 1.7085267386261080e+00 -3.1637922752625725e-01 + 25 1.3221275453613066e-01 -6.8367421676295925e-01 2.4606100899682085e-01 + 26 -2.4566560537364829e-01 -9.4805075799955063e-01 8.5189439084190730e-02 + 27 -8.6309787765015977e-01 1.6208482668327251e+00 -9.3002361778513165e-01 + 28 5.6908530015070713e-01 -9.0863521385805213e-01 5.3409478726214277e-01 + 29 4.2151929760224643e-01 -7.9119072040766358e-01 4.4262080871675447e-01 +run_vdwl: 0 +run_coul: 0 +run_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_forces: ! |2 + 1 -5.3341524273838670e-01 7.8884674939725091e-02 2.0952884187592027e-01 + 2 2.2053862671009264e-01 -2.7717619362233042e-01 -1.2890890936582325e-01 + 3 -3.4739178886093409e-02 -9.3306643617397569e-03 1.9998343085423885e-02 + 4 1.6460700475024034e-01 2.8228421828984558e-02 -7.9107215740923997e-02 + 5 1.6216701187759877e-01 7.5963404417154726e-02 -3.7489825158728236e-02 + 6 5.6614970689446376e-01 4.1846264904575808e-01 -6.7991524653327151e-01 + 7 -3.3981435908481461e-01 -4.0051061086052664e-01 4.0255950152039277e-01 + 8 -1.4132007772975100e-01 -6.2017341508474122e-01 3.3987971621673863e-01 + 9 1.8228775562277319e-01 3.2293964093791572e-01 5.3169053903539536e-02 + 10 -5.1717127183107316e-02 1.1112616730977573e-01 -1.4538101134574682e-02 + 11 -8.4643572966643127e-02 1.5200466657141215e-01 -3.9845494278253207e-02 + 12 4.6038275088773778e-01 -4.2553018369271028e-01 3.4320674023104583e-02 + 13 -1.5687586888416111e-01 1.1537899385275338e-01 2.7071393350961193e-02 + 14 -1.7381133625143649e-01 1.3594429135543404e-01 1.0223314006551567e-02 + 15 -1.3889297621381996e-01 8.5403895543124345e-02 -1.3812667490434579e-02 + 16 -3.4014003160232759e-01 4.3491574681114664e-01 5.3550096704789363e-01 + 17 1.3108396775726161e-01 -4.1558591174484305e-01 -7.9430457925084896e-01 + 18 7.6157630236804819e-01 1.5643765431579519e+00 -1.4166351052972370e+00 + 19 -2.8208991751960732e-01 -7.8944028837125158e-01 7.8110106092889642e-01 + 20 -4.0882363546770967e-01 -7.0874851093129665e-01 7.5398203566194200e-01 + 21 5.0733201140702333e-01 5.5693234394333690e-01 -1.1569217174451907e+00 + 22 -2.8680524489422227e-01 -1.2779625227872668e-01 5.7878726247278034e-01 + 23 -2.8648626378267200e-01 -3.0412446280189631e-01 5.5486674848935513e-01 + 24 9.0753920598062088e-02 1.7037291068699667e+00 -3.1469859811934520e-01 + 25 1.3105114795772563e-01 -6.8157888628951457e-01 2.4471165738173106e-01 + 26 -2.4577186819945190e-01 -9.4557474632785432e-01 8.4302506574447683e-02 + 27 -8.6411178235841868e-01 1.6207327144466275e+00 -9.2534662609109775e-01 + 28 5.6960687175236380e-01 -9.0819316709272491e-01 5.3155039440194063e-01 + 29 4.2192140517923227e-01 -7.9125996757091022e-01 4.3997061496410916e-01 +... diff --git a/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml b/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml index 66404f39b5..219addb5f0 100644 --- a/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml +++ b/unittest/force-styles/tests/kspace-pppm_tip4p_ad.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:34 2021 -epsilon: 3e-13 +epsilon: 4e-13 prerequisites: ! | atom full pair tip4p/long diff --git a/unittest/force-styles/tests/manybody-pair-bop.yaml b/unittest/force-styles/tests/manybody-pair-bop.yaml index bc5d198aaf..8260b16d21 100644 --- a/unittest/force-styles/tests/manybody-pair-bop.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop.yaml @@ -1,7 +1,7 @@ --- lammps_version: 8 Apr 2021 date_generated: Wed May 5 11:50:15 2021 -epsilon: 2e-13 +epsilon: 5e-13 prerequisites: ! | pair bop pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-bop_save.yaml b/unittest/force-styles/tests/manybody-pair-bop_save.yaml index 9c8ca13067..e5699cf8b8 100644 --- a/unittest/force-styles/tests/manybody-pair-bop_save.yaml +++ b/unittest/force-styles/tests/manybody-pair-bop_save.yaml @@ -1,7 +1,7 @@ --- lammps_version: 8 Apr 2021 date_generated: Wed May 5 11:50:24 2021 -epsilon: 2e-14 +epsilon: 9e-13 prerequisites: ! | pair bop pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-drip.yaml b/unittest/force-styles/tests/manybody-pair-drip.yaml index e5d4915c4d..8fc2bb892b 100644 --- a/unittest/force-styles/tests/manybody-pair-drip.yaml +++ b/unittest/force-styles/tests/manybody-pair-drip.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:48 2021 -epsilon: 5e-14 +date_generated: Tue Aug 24 15:36:39 2021 +epsilon: 2e-13 skip_tests: single prerequisites: ! | pair drip @@ -16,110 +16,110 @@ pair_coeff: ! | * * drip C.drip C C C extract: ! "" natoms: 48 -init_vdwl: -1.1171061429439093 +init_vdwl: -1.1165820288113353 init_coul: 0 init_stress: ! |- - -6.9372049706365035e-01 -6.9064113154966333e-01 1.1515233668963607e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1.4292420626121039e-02 + -6.9202029395419495e-01 -6.8748326656871916e-01 1.1598469113436700e+00 -8.7520222366446450e-04 -7.4904268268328076e-03 -4.8018384975223698e-03 init_forces: ! |2 - 1 1.4969082430352958e-03 -3.2939836241196573e-05 -1.3240430862322900e-02 - 2 8.0767187286290179e-04 1.0588928659053852e-03 -3.1123566690577253e-02 - 3 -3.4497099855045673e-04 3.4248846132303140e-05 -1.0175437155229471e-02 - 4 -2.4589156252144417e-04 1.8156645561760292e-05 -2.9695125191752228e-02 - 5 1.4969082430352932e-03 -3.2939836241182343e-05 -1.3240430862323165e-02 - 6 8.0767187286288694e-04 1.0588928659049949e-03 -3.1123566690577420e-02 - 7 -3.4497099855038821e-04 3.4248846132523362e-05 -1.0175437155229110e-02 - 8 -2.4589156252142683e-04 1.8156645561707817e-05 -2.9695125191752388e-02 - 9 -1.3423014800966740e-04 7.4485503462573500e-08 -1.0127230298720345e-02 - 10 -1.2282979196216780e-04 -5.3179137282562149e-06 -2.9857221873835556e-02 - 11 1.3420646745295351e-04 7.2570324572774139e-08 -1.0127289412755367e-02 - 12 1.2281957667447806e-04 -5.2981576756526129e-06 -2.9857246714720800e-02 - 13 -1.3423014800966089e-04 7.4485503475472118e-08 -1.0127230298720606e-02 - 14 -1.2282979196215913e-04 -5.3179137286977698e-06 -2.9857221873835549e-02 - 15 1.3420646745295687e-04 7.2570324835217239e-08 -1.0127289412755180e-02 - 16 1.2281957667447502e-04 -5.2981576756378754e-06 -2.9857246714720957e-02 - 17 3.4500424726267094e-04 3.4247597717764226e-05 -1.0175497243327751e-02 - 18 2.4590943990438825e-04 1.8176873676577221e-05 -2.9695147824251051e-02 - 19 -1.4969178111888977e-03 -3.2939169475935731e-05 -1.3240431836380913e-02 - 20 -8.0767953495986997e-04 1.0588933379664879e-03 -3.1123564482199977e-02 - 21 3.4500424726266232e-04 3.4247597717770589e-05 -1.0175497243328002e-02 - 22 2.4590943990438212e-04 1.8176873676178533e-05 -2.9695147824251072e-02 - 23 -1.4969178111887745e-03 -3.2939169475980779e-05 -1.3240431836380712e-02 - 24 -8.0767953495988450e-04 1.0588933379664870e-03 -3.1123564482199943e-02 - 25 -3.4497099855045933e-04 -3.4248846132324567e-05 1.0175437155229457e-02 - 26 8.0767187286290309e-04 -1.0588928659053826e-03 3.1123566690577247e-02 - 27 1.4969082430351102e-03 3.2939836241083992e-05 1.3240430862322843e-02 - 28 -2.4589156252142509e-04 -1.8156645561688708e-05 2.9695125191752263e-02 - 29 -3.4497099855046193e-04 -3.4248846132538534e-05 1.0175437155229280e-02 - 30 8.0767187286257902e-04 -1.0588928659051909e-03 3.1123566690576712e-02 - 31 1.4969082430352915e-03 3.2939836241593784e-05 1.3240430862323165e-02 - 32 -2.4589156252143897e-04 -1.8156645561741183e-05 2.9695125191752519e-02 - 33 1.3420646745296197e-04 -7.2570324595813435e-08 1.0127289412755341e-02 - 34 -1.2282979196217170e-04 5.3179137282585121e-06 2.9857221873835549e-02 - 35 -1.3423014800966349e-04 -7.4485503448870201e-08 1.0127230298720332e-02 - 36 1.2281957667447611e-04 5.2981576756533134e-06 2.9857246714720946e-02 - 37 1.3420646745295709e-04 -7.2570324815599003e-08 1.0127289412755423e-02 - 38 -1.2282979196223502e-04 5.3179137282683716e-06 2.9857221873835008e-02 - 39 -1.3423014800966436e-04 -7.4485503047341829e-08 1.0127230298720473e-02 - 40 1.2281957667448912e-04 5.2981576756629069e-06 2.9857246714721068e-02 - 41 -1.4969178111890833e-03 3.2939169476025510e-05 1.3240431836380942e-02 - 42 2.4590943990438738e-04 -1.8176873676568727e-05 2.9695147824251211e-02 - 43 3.4500424726266921e-04 -3.4247597717747861e-05 1.0175497243327740e-02 - 44 -8.0767953495988342e-04 -1.0588933379665052e-03 3.1123564482200137e-02 - 45 -1.4969178111890772e-03 3.2939169475814605e-05 1.3240431836381151e-02 - 46 2.4590943990439947e-04 -1.8176873676638302e-05 2.9695147824250822e-02 - 47 3.4500424726267181e-04 -3.4247597717339300e-05 1.0175497243327872e-02 - 48 -8.0767953495988081e-04 -1.0588933379665191e-03 3.1123564482200175e-02 -run_vdwl: -1.117107802396835 + 1 1.4410960759987860e-03 -1.0169393511311969e-03 -1.4285790452588352e-02 + 2 3.4022682581723486e-04 1.2797267794660613e-03 -3.1898882299555655e-02 + 3 -2.6365196949846605e-04 2.0444656479657366e-04 -1.1310141731659772e-02 + 4 3.2407051817817667e-04 -4.6232566789062061e-04 -2.9910736659103317e-02 + 5 8.6245599980334670e-04 1.9925559001726770e-04 -1.2745556995400132e-02 + 6 5.1905954665549387e-04 1.1276332993411060e-03 -3.0823356931780860e-02 + 7 -1.6088212112039344e-04 1.4230630104907803e-04 -8.0118146476316210e-03 + 8 -4.5244202184603708e-04 -1.4652059326166248e-04 -3.0139505526382837e-02 + 9 -8.3793846695301086e-05 -4.1141009708683870e-04 -1.0952073086473545e-02 + 10 1.0558775462631573e-04 3.2338361212355486e-04 -3.0862434540746431e-02 + 11 6.9846394554382257e-05 1.7181288265826418e-05 -1.0563492234071459e-02 + 12 -8.0680668202737346e-04 -4.0664776842267906e-04 -2.9407396519018757e-02 + 13 4.1248090507395221e-04 -8.1127163583308737e-04 -1.1037445663309341e-02 + 14 2.3332834021886836e-04 5.5940029155014345e-04 -2.9697888304764254e-02 + 15 -4.4744269608917094e-04 -6.4403133698428692e-04 -1.0302570659537293e-02 + 16 1.0107877556045320e-04 -1.7601743406948410e-04 -3.0441022553442356e-02 + 17 7.8768348766012383e-04 -4.8291459018732613e-04 -1.0709636748495333e-02 + 18 7.5773135601624533e-04 -1.0604660666195195e-04 -2.9052190107973087e-02 + 19 -8.2398465651566956e-04 -5.1763577844063228e-04 -1.3883168800746705e-02 + 20 -2.6540769941738171e-04 1.4544086540562453e-03 -2.9616876954433820e-02 + 21 6.9059687932033500e-04 -6.1172176278914724e-04 -9.9930475935883847e-03 + 22 5.1903723762132471e-04 -1.5794695217515297e-04 -2.8872098166177262e-02 + 23 -1.2999619581249811e-03 5.3108588030229464e-04 -1.2422412311642437e-02 + 24 -3.2646002927880701e-04 1.5480656986689182e-03 -3.0724921923396969e-02 + 25 -4.4212417028449604e-04 -3.2702381810661659e-05 1.0257965385900172e-02 + 26 1.2029502887653701e-03 -6.6888137281991044e-04 3.1679674370803115e-02 + 27 1.1284078949731725e-03 -2.7744804554502567e-08 1.3174439787097793e-02 + 28 -7.2378810157200900e-04 2.4335522727010964e-04 2.9873966714653963e-02 + 29 -1.0532667049880620e-03 7.4516834828237087e-04 1.0732704837844071e-02 + 30 1.3915165126589146e-03 -1.4093630775334669e-03 3.0800252954615828e-02 + 31 1.5526924204556959e-03 3.4345958973841973e-04 1.3180996180850283e-02 + 32 -9.2849293773583576e-05 -3.6968402535136977e-04 3.0310755683442978e-02 + 33 7.8803390168056056e-04 6.3187665376786251e-04 1.1208481276473217e-02 + 34 -4.4157950916471657e-04 -5.9161318279014972e-05 3.0896928862652544e-02 + 35 1.4605341896907487e-06 5.5778782038553513e-04 1.0464193387876497e-02 + 36 7.5306447932736915e-04 6.4063420801843522e-04 2.9446521968998895e-02 + 37 -5.1528521366996614e-04 4.5022774275057587e-04 1.0102890474288698e-02 + 38 -2.3334594837893120e-04 5.5982996138683090e-04 2.9312847420603871e-02 + 39 -8.4030878956306652e-04 -8.2858897733969887e-04 9.9599841364338727e-03 + 40 3.1176074857063333e-04 1.5729382377064493e-04 2.9568116551467322e-02 + 41 -2.2702343316618858e-03 -1.0402600019059252e-04 1.2321255863902722e-02 + 42 -1.6832158820563115e-04 -3.1137531486982874e-04 3.0275446479194841e-02 + 43 5.5659858411658816e-05 1.9307504152509409e-04 1.1910098296920838e-02 + 44 -9.5047806768623015e-04 -6.2997063031185760e-05 3.0133790104729902e-02 + 45 -1.4273485464754289e-03 -8.2386789692773265e-04 1.1604494193079552e-02 + 46 3.2400797488582719e-04 2.8804516968589326e-05 2.9006167509805069e-02 + 47 4.4459915420986282e-04 2.0256445461834481e-04 1.0421995955857405e-02 + 48 -1.0286699191962320e-03 -1.5188666002277826e-03 3.1020493014426428e-02 +run_vdwl: -1.116583686929748 run_coul: 0 run_stress: ! |- - -6.9372331738514981e-01 -6.9064389597684106e-01 1.1514755915204005e+00 0.0000000000000000e+00 0.0000000000000000e+00 -1.4292266024218578e-02 + -6.9202313126699333e-01 -6.8748607721639632e-01 1.1597991092003139e+00 -8.7520711561815342e-04 -7.4903484534890319e-03 -4.8017742857855358e-03 run_forces: ! |2 - 1 1.4968783498999268e-03 -3.2942052376323016e-05 -1.3240066826206463e-02 - 2 8.0765258918550525e-04 1.0588876993623385e-03 -3.1122680612106914e-02 - 3 -3.4497601095719033e-04 3.4248722599748424e-05 -1.0175117216209249e-02 - 4 -2.4589406964898274e-04 1.8152777475380989e-05 -2.9694273916151235e-02 - 5 1.4968783498999624e-03 -3.2942052376244425e-05 -1.3240066826206844e-02 - 6 8.0765258918545808e-04 1.0588876993621239e-03 -3.1122680612107538e-02 - 7 -3.4497601095719900e-04 3.4248722599828465e-05 -1.0175117216209020e-02 - 8 -2.4589406964903478e-04 1.8152777475390449e-05 -2.9694273916151363e-02 - 9 -1.3423039571159017e-04 7.4352071961005858e-08 -1.0126910355491514e-02 - 10 -1.2282852371682442e-04 -5.3193547176900636e-06 -2.9856374341201718e-02 - 11 1.3420671579929917e-04 7.2436845184776077e-08 -1.0126969468728588e-02 - 12 1.2281830883230783e-04 -5.2995986749039537e-06 -2.9856399181457216e-02 - 13 -1.3423039571157673e-04 7.4352071584718248e-08 -1.0126910355491585e-02 - 14 -1.2282852371668521e-04 -5.3193547179922104e-06 -2.9856374341201371e-02 - 15 1.3420671579938970e-04 7.2436845150855372e-08 -1.0126969468727908e-02 - 16 1.2281830883232204e-04 -5.2995986749016624e-06 -2.9856399181457466e-02 - 17 3.4500925912102327e-04 3.4247474141055654e-05 -1.0175177303529336e-02 - 18 2.4591194664583894e-04 1.8173005537505662e-05 -2.9694296547973523e-02 - 19 -1.4968879181501723e-03 -3.2941385606868446e-05 -1.3240067800288987e-02 - 20 -8.0766025129906183e-04 1.0588881713794161e-03 -3.1122678403683279e-02 - 21 3.4500925912095290e-04 3.4247474141253548e-05 -1.0175177303529138e-02 - 22 2.4591194664620069e-04 1.8173005537513167e-05 -2.9694296547973627e-02 - 23 -1.4968879181501166e-03 -3.2941385606789733e-05 -1.3240067800288646e-02 - 24 -8.0766025129901347e-04 1.0588881713797244e-03 -3.1122678403683594e-02 - 25 -3.4497543410367832e-04 -3.4248542243049007e-05 1.0175095227569254e-02 - 26 8.0765525409005174e-04 -1.0588882853031821e-03 3.1122706902410268e-02 - 27 1.4968776819200879e-03 3.2942887158314040e-05 1.3240038417764373e-02 - 28 -2.4589307728119323e-04 -1.8153131107501511e-05 2.9694296702257997e-02 - 29 -3.4497543410356470e-04 -3.4248542242962311e-05 1.0175095227569283e-02 - 30 8.0765525408991665e-04 -1.0588882853032810e-03 3.1122706902410369e-02 - 31 1.4968776819200670e-03 3.2942887158584385e-05 1.3240038417764520e-02 - 32 -2.4589307728105619e-04 -1.8153131107580197e-05 2.9694296702258274e-02 - 33 1.3420649407712329e-04 -7.2457679971971299e-08 1.0126947778852728e-02 - 34 -1.2282857182875856e-04 5.3192999898934757e-06 2.9856397351700922e-02 - 35 -1.3423017399030691e-04 -7.4372916307303659e-08 1.0126888665729796e-02 - 36 1.2281835687551147e-04 5.2995439452943477e-06 2.9856422192021229e-02 - 37 1.3420649407688346e-04 -7.2457680016867857e-08 1.0126947778853273e-02 - 38 -1.2282857182861024e-04 5.3192999901346361e-06 2.9856397351700859e-02 - 39 -1.3423017399036286e-04 -7.4372916328267513e-08 1.0126888665730093e-02 - 40 1.2281835687550854e-04 5.2995439452834599e-06 2.9856422192021292e-02 - 41 -1.4968872501543050e-03 3.2942220392413755e-05 1.3240039391837519e-02 - 42 2.4591095432896623e-04 -1.8173359176526104e-05 2.9694319334136906e-02 - 43 3.4500868225182334e-04 -3.4247293770650532e-05 1.0175155314768796e-02 - 44 -8.0766291618553391e-04 -1.0588887573257195e-03 3.1122704693977713e-02 - 45 -1.4968872501544524e-03 3.2942220392554349e-05 1.3240039391837150e-02 - 46 2.4591095432885027e-04 -1.8173359176560751e-05 2.9694319334136628e-02 - 47 3.4500868225184405e-04 -3.4247293770696435e-05 1.0175155314768848e-02 - 48 -8.0766291618553099e-04 -1.0588887573256150e-03 3.1122704693978008e-02 + 1 1.4410673596325797e-03 -1.0169304521115965e-03 -1.4285401568186428e-02 + 2 3.4021335312064239e-04 1.2797191122651606e-03 -3.1897958840992731e-02 + 3 -2.6365414554435206e-04 2.0444568729883803e-04 -1.1309803039904094e-02 + 4 3.2406270803533865e-04 -4.6232160096735283e-04 -2.9909889579305883e-02 + 5 8.6243700250479213e-04 1.9924903099012974e-04 -1.2745204024321596e-02 + 6 5.1904688928447039e-04 1.1276312199052507e-03 -3.0822480729154136e-02 + 7 -1.6089060336456785e-04 1.4230793176456209e-04 -8.0115332340635770e-03 + 8 -4.5244256523595955e-04 -1.4652373014613116e-04 -3.0138640813371177e-02 + 9 -8.3793558681813027e-05 -4.1140467969865357e-04 -1.0951736791345751e-02 + 10 1.0558934928096841e-04 3.2337794650378108e-04 -3.0861548668457323e-02 + 11 6.9845541769924624e-05 1.7180670901979288e-05 -1.0563164513517073e-02 + 12 -8.0679481796061916e-04 -4.0664748662187143e-04 -2.9406560679161624e-02 + 13 4.1247302768956506e-04 -8.1126591131716001e-04 -1.1037106445845180e-02 + 14 2.3332396247183456e-04 5.5939100731725207e-04 -2.9697039899835066e-02 + 15 -4.4743716863518879e-04 -6.4402351400352417e-04 -1.0302248028000090e-02 + 16 1.0107676498898814e-04 -1.7601612323562735e-04 -3.0440160861088226e-02 + 17 7.8768398889356335e-04 -4.8290699580335434e-04 -1.0709307785601542e-02 + 18 7.5772587814272661e-04 -1.0604331840892354e-04 -2.9051355476222663e-02 + 19 -8.2396507652227567e-04 -5.1763481147044346e-04 -1.3882787481952484e-02 + 20 -2.6539902077711439e-04 1.4543922016699269e-03 -2.9616038510215568e-02 + 21 6.9059519132396775e-04 -6.1171669311730020e-04 -9.9927403128011426e-03 + 22 5.1903378657992805e-04 -1.5794713465069979e-04 -2.8871277173751864e-02 + 23 -1.2999304876387561e-03 5.3107732945463688e-04 -1.2422061766959291e-02 + 24 -3.2644539359692542e-04 1.5480516514320667e-03 -3.0724047265085791e-02 + 25 -4.4212891241347113e-04 -3.2697766181911145e-05 1.0257616370513183e-02 + 26 1.2029313214847238e-03 -6.6888291982682407e-04 3.1678775972923956e-02 + 27 1.1283890792386422e-03 -2.8542217957172600e-08 1.3174047524615399e-02 + 28 -7.2378412563897741e-04 2.4335495682349174e-04 2.9873149619175456e-02 + 29 -1.0532619377677580e-03 7.4515643613297378e-04 1.0732343526110863e-02 + 30 1.3914911640253280e-03 -1.4093576056224714e-03 3.0799402494171169e-02 + 31 1.5526628138436077e-03 3.4346152193312973e-04 1.3180608561349179e-02 + 32 -9.2853455508014825e-05 -3.6966978881082394e-04 3.0309911553159243e-02 + 33 7.8802353059772515e-04 6.3186818726301624e-04 1.1208113889006823e-02 + 34 -4.4157767037679690e-04 -5.9159130843379026e-05 3.0896068470685031e-02 + 35 1.4552473121265397e-06 5.5777693731219765e-04 1.0463857570582444e-02 + 36 7.5305807476735965e-04 6.4063119252587969e-04 2.9445714727166269e-02 + 37 -5.1527886711158206e-04 4.5022029011034236e-04 1.0102553591648427e-02 + 38 -2.3334071714133271e-04 5.5981947321851779e-04 2.9312019903716846e-02 + 39 -8.4029973392166224e-04 -8.2857530655882402e-04 9.9596391825485173e-03 + 40 3.1175727776466388e-04 1.5729483520098114e-04 2.9567298942710162e-02 + 41 -2.2701903109886260e-03 -1.0402124774515768e-04 1.2320885381156934e-02 + 42 -1.6831498396996131e-04 -3.1136792853859915e-04 3.0274601848989606e-02 + 43 5.5664724581996916e-05 1.9307476178885243e-04 1.1909723052594356e-02 + 44 -9.5046209166255765e-04 -6.3004473120715018e-05 3.0132966879057418e-02 + 45 -1.4273207846817208e-03 -8.2385448535969076e-04 1.1604140080847982e-02 + 46 3.2400780661911109e-04 2.8806285981541469e-05 2.9005364916792991e-02 + 47 4.4459996506777412e-04 2.0256574589517135e-04 1.0421645129745381e-02 + 48 -1.0286493798823708e-03 -1.5188527673106898e-03 3.1019644299872643e-02 ... diff --git a/unittest/force-styles/tests/manybody-pair-drip_real.yaml b/unittest/force-styles/tests/manybody-pair-drip_real.yaml index 3f680a8c96..bec2fb5f7b 100644 --- a/unittest/force-styles/tests/manybody-pair-drip_real.yaml +++ b/unittest/force-styles/tests/manybody-pair-drip_real.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:48 2021 -epsilon: 1e-13 +date_generated: Tue Aug 24 15:36:41 2021 +epsilon: 5e-13 skip_tests: single prerequisites: ! | pair drip @@ -17,110 +17,110 @@ pair_coeff: ! | * * drip C.drip C C C extract: ! "" natoms: 48 -init_vdwl: -25.761080947558458 +init_vdwl: -25.748994587923356 init_coul: 0 init_stress: ! |- - -1.5997575514840701e+01 -1.5926563655516432e+01 2.6554761026958538e+01 0.0000000000000000e+00 0.0000000000000000e+00 -3.2959106617730394e-01 + -1.5958367897725125e+01 -1.5853741555387963e+01 2.6746706531539260e+01 -2.0182643763721416e-02 -1.7273335487108957e-01 -1.1073303196221104e-01 init_forces: ! |2 - 1 3.4519525887018621e-02 -7.5961070769214878e-04 -3.0533160468170939e-01 - 2 1.8625356800076362e-02 2.4418650819961668e-02 -7.1772653472282411e-01 - 3 -7.9552206156518063e-03 7.8979719442743949e-04 -2.3465116711459008e-01 - 4 -5.6703944262123662e-03 4.1870221465274693e-04 -6.8478588954553776e-01 - 5 3.4519525887018870e-02 -7.5961070769172225e-04 -3.0533160468171572e-01 - 6 1.8625356800076116e-02 2.4418650819952412e-02 -7.1772653472282877e-01 - 7 -7.9552206156503213e-03 7.8979719443244851e-04 -2.3465116711458173e-01 - 8 -5.6703944262118111e-03 4.1870221465155517e-04 -6.8478588954554198e-01 - 9 -3.0954209054540674e-03 1.7176766023297568e-06 -2.3353949053792569e-01 - 10 -2.8325224362034315e-03 -1.2263401010803219e-04 -6.8852392802545803e-01 - 11 3.0948748188155822e-03 1.6735115258234307e-06 -2.3354085374002706e-01 - 12 2.8322868660610179e-03 -1.2217842468890391e-04 -6.8852450086990813e-01 - 13 -3.0954209054540466e-03 1.7176766026706842e-06 -2.3353949053793166e-01 - 14 -2.8325224362032025e-03 -1.2263401011821111e-04 -6.8852392802545703e-01 - 15 3.0948748188158390e-03 1.6735115316409009e-06 -2.3354085374002267e-01 - 16 2.8322868660610422e-03 -1.2217842468845727e-04 -6.8852450086991235e-01 - 17 7.9559873492091142e-03 7.8976840530281534e-04 -2.3465255277912508e-01 - 18 5.6708066884776521e-03 4.1916868608569068e-04 -6.8478641146338481e-01 - 19 -3.4519746533893940e-02 -7.5959533171951130e-04 -3.0533162714402262e-01 - 20 -1.8625533492238975e-02 2.4418661705949665e-02 -7.1772648379643234e-01 - 21 7.9559873492090170e-03 7.8976840530288451e-04 -2.3465255277913122e-01 - 22 5.6708066884775948e-03 4.1916868607656490e-04 -6.8478641146338504e-01 - 23 -3.4519746533890970e-02 -7.5959533171988253e-04 -3.0533162714401807e-01 - 24 -1.8625533492239343e-02 2.4418661705949762e-02 -7.1772648379643167e-01 - 25 -7.9552206156520144e-03 -7.8979719442783024e-04 2.3465116711458947e-01 - 26 1.8625356800076404e-02 -2.4418650819961502e-02 7.1772653472282488e-01 - 27 3.4519525887014679e-02 7.5961070768970737e-04 3.0533160468170817e-01 - 28 -5.6703944262120054e-03 -4.1870221465108506e-04 6.8478588954553898e-01 - 29 -7.9552206156520144e-03 -7.8979719443283481e-04 2.3465116711458581e-01 - 30 1.8625356800069229e-02 -2.4418650819957533e-02 7.1772653472281345e-01 - 31 3.4519525887018704e-02 7.5961070770124480e-04 3.0533160468171566e-01 - 32 -5.6703944262122274e-03 -4.1870221465243294e-04 6.8478588954554442e-01 - 33 3.0948748188157731e-03 -1.6735115261055401e-06 2.3354085374002662e-01 - 34 -2.8325224362035009e-03 1.2263401010814570e-04 6.8852392802545770e-01 - 35 -3.0954209054540674e-03 -1.7176766021075496e-06 2.3353949053792544e-01 - 36 2.8322868660609277e-03 1.2217842468872730e-04 6.8852450086991090e-01 - 37 3.0948748188157002e-03 -1.6735115312395288e-06 2.3354085374002845e-01 - 38 -2.8325224362050205e-03 1.2263401010865604e-04 6.8852392802544404e-01 - 39 -3.0954209054541784e-03 -1.7176765926834780e-06 2.3353949053792869e-01 - 40 2.8322868660613752e-03 1.2217842468919974e-04 6.8852450086991468e-01 - 41 -3.4519746533897999e-02 7.5959533172142307e-04 3.0533162714402334e-01 - 42 5.6708066884776503e-03 -4.1916868608571941e-04 6.8478641146338692e-01 - 43 7.9559873492091281e-03 -7.8976840530235466e-04 2.3465255277912495e-01 - 44 -1.8625533492239322e-02 -2.4418661705950095e-02 7.1772648379643567e-01 - 45 -3.4519746533897937e-02 7.5959533171621586e-04 3.0533162714402778e-01 - 46 5.6708066884779687e-03 -4.1916868608703228e-04 6.8478641146337782e-01 - 47 7.9559873492089893e-03 -7.8976840529313373e-04 2.3465255277912772e-01 - 48 -1.8625533492239322e-02 -2.4418661705950414e-02 7.1772648379643678e-01 -run_vdwl: -25.76108094759681 + 1 3.3232466674277615e-02 -2.3451179736789157e-02 -3.2943817073564596e-01 + 2 7.8458173878729071e-03 2.9511202104489435e-02 -7.3560573831413523e-01 + 3 -6.0799591615661869e-03 4.7146500253728817e-03 -2.6081807759988473e-01 + 4 7.4732440639032616e-03 -1.0661483718349234e-02 -6.8975800835334788e-01 + 5 1.9888708843808861e-02 4.5949432971171935e-03 -2.9391954162471828e-01 + 6 1.1969798109566981e-02 2.6003842953487285e-02 -7.1080353286982367e-01 + 7 -3.7100300373209133e-03 3.2816614283510343e-03 -1.8475684426062652e-01 + 8 -1.0433561414439643e-02 -3.3788453204195538e-03 -6.9503354402692197e-01 + 9 -1.9323321076154532e-03 -9.4873427029657786e-03 -2.5256081806220482e-01 + 10 2.4349115893603085e-03 7.4574036331723059e-03 -7.1170468398617626e-01 + 11 1.6106962040949510e-03 3.9620993993718555e-04 -2.4359993027492452e-01 + 12 -1.8605405024419774e-02 -9.3775207894519329e-03 -6.7815070838926095e-01 + 13 9.5120361230222328e-03 -1.8708369310438993e-02 -2.5452955655358278e-01 + 14 5.3806796227059278e-03 1.2900077833906291e-02 -6.8484960844854192e-01 + 15 -1.0318274217856395e-02 -1.4851716204061447e-02 -2.3758293552022253e-01 + 16 2.3309320566716786e-03 -4.0590586632136055e-03 -7.0198669220376253e-01 + 17 1.8164413663677100e-02 -1.1136275569829808e-02 -2.4697010301087788e-01 + 18 1.7473701064249236e-02 -2.4454929692114937e-03 -6.6995945354222997e-01 + 19 -1.9001538546827838e-02 -1.1936965232883413e-02 -3.2015349440489077e-01 + 20 -6.1204472573920671e-03 3.3539462032888240e-02 -6.8298144223469248e-01 + 21 1.5925543174813862e-02 -1.4106639685165670e-02 -2.3044516369127779e-01 + 22 1.1969283650991303e-02 -3.6423434300359558e-03 -6.6580643449394206e-01 + 23 -2.9977836433477532e-02 1.2247131965919100e-02 -2.8646764781083356e-01 + 24 -7.5283475017253083e-03 3.5699244899373796e-02 -7.0853356753567021e-01 + 25 -1.0195626092930038e-02 -7.5413487816127639e-04 2.3655431342185476e-01 + 26 2.7740694078638165e-02 -1.5424771673100995e-02 7.3055068313195015e-01 + 27 2.6021705554016006e-02 -6.3981042505711905e-07 3.0380981425791853e-01 + 28 -1.6690950981918112e-02 5.6119051428686253e-03 6.8891007324764719e-01 + 29 -2.4288908460445822e-02 1.7183991208814628e-02 2.4750206581563999e-01 + 30 3.2089134724480099e-02 -3.2500686308251155e-02 7.1027074247231392e-01 + 31 3.5805939643847373e-02 7.9203666986826932e-03 3.0396100829731115e-01 + 32 -2.1411556886809409e-03 -8.5251165811325441e-03 6.9898266666506625e-01 + 33 1.8172494403365477e-02 1.4571422536169575e-02 2.5847373169169469e-01 + 34 -1.0183065908488859e-02 -1.3642924790778152e-03 7.1250014198671274e-01 + 35 3.3680720247508678e-05 1.2862893363603918e-02 2.4131004436660192e-01 + 36 1.7366080325688205e-02 1.4773376545085223e-02 6.7905296274567539e-01 + 37 -1.1882759918811714e-02 1.0382498922859170e-02 2.3297820082396822e-01 + 38 -5.3810856765438425e-03 1.2909986256228958e-02 6.7597035427235896e-01 + 39 -1.9377982016849454e-02 -1.9107716712801780e-02 2.2968270221745701e-01 + 40 7.1893740186897287e-03 3.6272819304602882e-03 6.8185700057282317e-01 + 41 -5.2352850046770774e-02 -2.3988966746689333e-03 2.8413492459106704e-01 + 42 -3.8815882325739948e-03 -7.1804857059461717e-03 6.9816841703034993e-01 + 43 1.2835468922352423e-03 4.4524164557667254e-03 2.7465340537095984e-01 + 44 -2.1918546053303713e-02 -1.4527468588869409e-03 6.9490174326583898e-01 + 45 -3.2915441096075387e-02 -1.8998846006629343e-02 2.6760600695972642e-01 + 46 7.4718017812452665e-03 6.6424797497523528e-04 6.6889814716206641e-01 + 47 1.0252700581015179e-02 4.6712475313845240e-03 2.4033694841785191e-01 + 48 -2.3721693076450560e-02 -3.5025897659015641e-02 7.1534959916333785e-01 +run_vdwl: -25.748994587961594 run_coul: 0 run_stress: ! |- - -1.5997575514905400e+01 -1.5926563655580109e+01 2.6554761025857829e+01 0.0000000000000000e+00 0.0000000000000000e+00 -3.2959106617393824e-01 + -1.5958367897790582e+01 -1.5853741555452789e+01 2.6746706530436910e+01 -2.0182643763822727e-02 -1.7273335486937064e-01 -1.1073303196070017e-01 run_forces: ! |2 - 1 3.4519525886308772e-02 -7.5961070774262620e-04 -3.0533160467333686e-01 - 2 1.8625356799616053e-02 2.4418650819844623e-02 -7.1772653470240710e-01 - 3 -7.9552206157541827e-03 7.8979719442180435e-04 -2.3465116710721118e-01 - 4 -5.6703944262564421e-03 4.1870221456883055e-04 -6.8478588952590880e-01 - 5 3.4519525886310021e-02 -7.5961070774873795e-04 -3.0533160467333753e-01 - 6 1.8625356799618166e-02 2.4418650819839099e-02 -7.1772653470240300e-01 - 7 -7.9552206157587901e-03 7.8979719441955800e-04 -2.3465116710720937e-01 - 8 -5.6703944262596895e-03 4.1870221457031374e-04 -6.8478588952590624e-01 - 9 -3.0954209054729134e-03 1.7176766005387110e-06 -2.3353949053056158e-01 - 10 -2.8325224361802070e-03 -1.2263401013539680e-04 -6.8852392800592355e-01 - 11 3.0948748188260634e-03 1.6735115258329308e-06 -2.3354085373267006e-01 - 12 2.8322868660322353e-03 -1.2217842471453093e-04 -6.8852450085037853e-01 - 13 -3.0954209054753073e-03 1.7176766069530950e-06 -2.3353949053056008e-01 - 14 -2.8325224361808454e-03 -1.2263401013228948e-04 -6.8852392800592477e-01 - 15 3.0948748188205331e-03 1.6735115311816390e-06 -2.3354085373266414e-01 - 16 2.8322868660327627e-03 -1.2217842471338395e-04 -6.8852450085039274e-01 - 17 7.9559873493214514e-03 7.8976840529372907e-04 -2.3465255277175306e-01 - 18 5.6708066885325613e-03 4.1916868600858607e-04 -6.8478641144376085e-01 - 19 -3.4519746533186305e-02 -7.5959533177047444e-04 -3.0533162713566037e-01 - 20 -1.8625533491780335e-02 2.4418661705826062e-02 -7.1772648377602155e-01 - 21 7.9559873493208408e-03 7.8976840529406105e-04 -2.3465255277176264e-01 - 22 5.6708066885322672e-03 4.1916868600612250e-04 -6.8478641144375973e-01 - 23 -3.4519746533190690e-02 -7.5959533177689758e-04 -3.0533162713565520e-01 - 24 -1.8625533491779738e-02 2.4418661705826118e-02 -7.1772648377601034e-01 - 25 -7.9552206157391669e-03 -7.8979719442920414e-04 2.3465116710670758e-01 - 26 1.8625356799678291e-02 -2.4418650819855600e-02 7.1772653470301284e-01 - 27 3.4519525886291424e-02 7.5961070776537666e-04 3.0533160467268600e-01 - 28 -5.6703944262409822e-03 -4.1870221457090788e-04 6.8478588952643626e-01 - 29 -7.9552206157410682e-03 -7.8979719442770382e-04 2.3465116710671441e-01 - 30 1.8625356799682243e-02 -2.4418650819853061e-02 7.1772653470300518e-01 - 31 3.4519525886292479e-02 7.5961070776900104e-04 3.0533160467267750e-01 - 32 -5.6703944262390393e-03 -4.1870221457093217e-04 6.8478588952643404e-01 - 33 3.0948748188169527e-03 -1.6735115285445503e-06 2.3354085373217337e-01 - 34 -2.8325224361862578e-03 1.2263401013536189e-04 6.8852392800645301e-01 - 35 -3.0954209054732881e-03 -1.7176766016382667e-06 2.3353949053006548e-01 - 36 2.8322868660402949e-03 1.2217842471530459e-04 6.8852450085089545e-01 - 37 3.0948748188168972e-03 -1.6735115254575963e-06 2.3354085373216871e-01 - 38 -2.8325224361834475e-03 1.2263401013282052e-04 6.8852392800645179e-01 - 39 -3.0954209054684656e-03 -1.7176766061726881e-06 2.3353949053006878e-01 - 40 2.8322868660383624e-03 1.2217842471120666e-04 6.8852450085090100e-01 - 41 -3.4519746533171393e-02 7.5959533179549132e-04 3.0533162713500450e-01 - 42 5.6708066885105355e-03 -4.1916868600979897e-04 6.8478641144428143e-01 - 43 7.9559873493117838e-03 -7.8976840530148860e-04 2.3465255277124522e-01 - 44 -1.8625533491841401e-02 -2.4418661705844322e-02 7.1772648377662540e-01 - 45 -3.4519746533172420e-02 7.5959533179765766e-04 3.0533162713500039e-01 - 46 5.6708066885161846e-03 -4.1916868600924408e-04 6.8478641144429175e-01 - 47 7.9559873493104671e-03 -7.8976840529732212e-04 2.3465255277125016e-01 - 48 -1.8625533491844991e-02 -2.4418661705839853e-02 7.1772648377662085e-01 + 1 3.3232466673603925e-02 -2.3451179736581364e-02 -3.2943817072666159e-01 + 2 7.8458173875610767e-03 2.9511202104307844e-02 -7.3560573829285403e-01 + 3 -6.0799591616052390e-03 4.7146500253611758e-03 -2.6081807759204945e-01 + 4 7.4732440637195474e-03 -1.0661483718244682e-02 -6.8975800833382717e-01 + 5 1.9888708843375319e-02 4.5949432969627276e-03 -2.9391954161659561e-01 + 6 1.1969798109273027e-02 2.6003842953440198e-02 -7.1080353284963105e-01 + 7 -3.7100300375245698e-03 3.2816614283844234e-03 -1.8475684425413691e-01 + 8 -1.0433561414444806e-02 -3.3788453204890486e-03 -6.9503354400697570e-01 + 9 -1.9323321076097494e-03 -9.4873427028344722e-03 -2.5256081805444464e-01 + 10 2.4349115894006096e-03 7.4574036330466607e-03 -7.1170468396575204e-01 + 11 1.6106962040720110e-03 3.9620993991182238e-04 -2.4359993026735374e-01 + 12 -1.8605405024143186e-02 -9.3775207894465605e-03 -6.7815070836997315e-01 + 13 9.5120361228382758e-03 -1.8708369310301523e-02 -2.5452955654576032e-01 + 14 5.3806796226078812e-03 1.2900077833684159e-02 -6.8484960842898190e-01 + 15 -1.0318274217731294e-02 -1.4851716203887599e-02 -2.3758293551278534e-01 + 16 2.3309320566239217e-03 -4.0590586631889629e-03 -7.0198669218388887e-01 + 17 1.8164413663688182e-02 -1.1136275569662546e-02 -2.4697010300330244e-01 + 18 1.7473701064127156e-02 -2.4454929691368607e-03 -6.6995945352296271e-01 + 19 -1.9001538546371412e-02 -1.1936965232863280e-02 -3.2015349439609270e-01 + 20 -6.1204472571880350e-03 3.3539462032504894e-02 -6.8298144221533896e-01 + 21 1.5925543174786588e-02 -1.4106639685039014e-02 -2.3044516368419699e-01 + 22 1.1969283650911211e-02 -3.6423434300448931e-03 -6.6580643447502708e-01 + 23 -2.9977836432749601e-02 1.2247131965719723e-02 -2.8646764780275830e-01 + 24 -7.5283475013889463e-03 3.5699244899051213e-02 -7.0853356751550400e-01 + 25 -1.0195626093040311e-02 -7.5413487806321768e-04 2.3655431341379374e-01 + 26 2.7740694078188643e-02 -1.5424771673140200e-02 7.3055068311122062e-01 + 27 2.6021705553580521e-02 -6.3981043668670523e-07 3.0380981424887532e-01 + 28 -1.6690950981827740e-02 5.6119051428654473e-03 6.8891007322881070e-01 + 29 -2.4288908460331618e-02 1.7183991208536684e-02 2.4750206580730749e-01 + 30 3.2089134723898072e-02 -3.2500686308123847e-02 7.1027074245271349e-01 + 31 3.5805939643156814e-02 7.9203666987223836e-03 3.0396100828839323e-01 + 32 -2.1411556887768191e-03 -8.5251165808079149e-03 6.9898266664559761e-01 + 33 1.8172494403130901e-02 1.4571422535984015e-02 2.5847373168321763e-01 + 34 -1.0183065908438912e-02 -1.3642924790249356e-03 7.1250014196684597e-01 + 35 3.3680720125689456e-05 1.2862893363347519e-02 2.4131004435885933e-01 + 36 1.7366080325535500e-02 1.4773376545013242e-02 6.7905296272705584e-01 + 37 -1.1882759918671326e-02 1.0382498922691556e-02 2.3297820081621270e-01 + 38 -5.3810856764184706e-03 1.2909986255981252e-02 6.7597035425328478e-01 + 39 -1.9377982016639442e-02 -1.9107716712486199e-02 2.2968270220950934e-01 + 40 7.1893740186104935e-03 3.6272819304872779e-03 6.8185700055396836e-01 + 41 -5.2352850045758140e-02 -2.3988966745579934e-03 2.8413492458254475e-01 + 42 -3.8815882324230670e-03 -7.1804857057699081e-03 6.9816841701089072e-01 + 43 1.2835468923389926e-03 4.4524164557554063e-03 2.7465340536230420e-01 + 44 -2.1918546052938477e-02 -1.4527468590590654e-03 6.9490174324682552e-01 + 45 -3.2915441095437911e-02 -1.8998846006314036e-02 2.6760600695155001e-01 + 46 7.4718017812403677e-03 6.6424797501287390e-04 6.6889814714355988e-01 + 47 1.0252700581037237e-02 4.6712475314227018e-03 2.4033694840974448e-01 + 48 -2.3721693075972734e-02 -3.5025897658690686e-02 7.1534959914376572e-01 ... diff --git a/unittest/force-styles/tests/manybody-pair-edip_multi.yaml b/unittest/force-styles/tests/manybody-pair-edip_multi.yaml index d86aa02b3f..0f987836e1 100644 --- a/unittest/force-styles/tests/manybody-pair-edip_multi.yaml +++ b/unittest/force-styles/tests/manybody-pair-edip_multi.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:15 2021 -epsilon: 7.5e-14 +epsilon: 1.5e-13 prerequisites: ! | pair edip/multi pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn.yaml b/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn.yaml index 81f72ec0a9..ec91e147ad 100644 --- a/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn.yaml +++ b/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:49 2021 -epsilon: 5e-12 +date_generated: Tue Aug 24 15:36:42 2021 +epsilon: 5e-13 skip_tests: single prerequisites: ! | pair ilp/graphene/hbn @@ -16,110 +16,110 @@ pair_coeff: ! | * * ilp/graphene/hbn BNCH.ILP B N C extract: ! "" natoms: 48 -init_vdwl: -1.387500902597699 +init_vdwl: -1.38586930540158 init_coul: 0 init_stress: ! |- - -1.0950745163741815e+00 -1.0965448791525116e+00 -5.5691185658268150e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.1949269093120441e-03 + -1.0930001998423704e+00 -1.0932039710097909e+00 -5.4519530849503672e-01 -2.5389316033816024e-03 -8.2572847962160655e-03 1.5729186460755471e-02 init_forces: ! |2 - 1 2.0033364707962020e-03 3.2526065174565133e-18 -4.7626541030897668e-02 - 2 -1.1368359972830505e-05 9.1814113875668727e-05 4.2488212564737199e-02 - 3 -5.5278100417535583e-05 -1.1058862159352145e-17 -4.4732824814754067e-02 - 4 -2.3915922842134181e-04 2.2249364734195330e-06 4.0890453270282665e-02 - 5 2.0033364707962020e-03 4.1199682554449168e-18 -4.7626541030897619e-02 - 6 -1.1368359972813158e-05 9.1814113875680762e-05 4.2488212564737102e-02 - 7 -5.5278100417523006e-05 -3.7404974950749903e-17 -4.4732824814753921e-02 - 8 -2.3915922842133140e-04 2.2249364733897175e-06 4.0890453270282998e-02 - 9 -5.2020828171993284e-05 -2.0193265462542520e-18 -4.4737801821738435e-02 - 10 -1.2511640292790002e-04 -4.3335410390344704e-06 4.1581628715790360e-02 - 11 5.1983198952135928e-05 -1.1150341717655610e-17 -4.4737856331164172e-02 - 12 1.2512171341779051e-04 -4.3318158884542686e-06 4.1581659199143604e-02 - 13 -5.2020828171995019e-05 -1.0299920638612292e-18 -4.4737801821738400e-02 - 14 -1.2511640292792257e-04 -4.3335410390036926e-06 4.1581628715790221e-02 - 15 5.1983198952134085e-05 -2.2639496614212939e-17 -4.4737856331164047e-02 - 16 1.2512171341781285e-04 -4.3318158884359524e-06 4.1581659199143896e-02 - 17 5.5317942397928804e-05 -1.3694193416497087e-17 -4.4732879184470137e-02 - 18 2.3916128102602216e-04 2.2268062502434974e-06 4.0890470745578923e-02 - 19 -2.0033386835566994e-03 5.0537162006743762e-18 -4.7626540891187855e-02 - 20 1.1360996878247132e-05 9.1814258501936069e-05 4.2488199556680040e-02 - 21 5.5317942397930972e-05 2.0466433588032032e-18 -4.4732879184470033e-02 - 22 2.3916128102602656e-04 2.2268062502461309e-06 4.0890470745578937e-02 - 23 -2.0033386835567038e-03 -4.0058358597583202e-17 -4.7626540891187820e-02 - 24 1.1360996878233309e-05 9.1814258501946586e-05 4.2488199556680414e-02 - 25 -1.6486800709624230e-04 -1.8127313551345855e-05 -1.0796056549805585e-03 - 26 9.7415698381275641e-04 -8.3284301802344016e-04 5.3751455194570915e-03 - 27 1.0178111270105904e-03 7.4102890414775549e-04 -6.3746876686657586e-04 - 28 -1.2956932174262685e-04 1.5902377077926376e-05 5.3232551286718586e-03 - 29 -1.6486800709624447e-04 -1.8127313551316636e-05 -1.0796056549805698e-03 - 30 9.7415698381273170e-04 -8.3284301802343886e-04 5.3751455194570958e-03 - 31 1.0178111270106190e-03 7.4102890414773901e-04 -6.3746876686670770e-04 - 32 -1.2956932174261818e-04 1.5902377077917892e-05 5.3232551286718872e-03 - 33 9.2654152308404886e-05 4.0850279627708816e-06 -1.6053564303655610e-03 - 34 -8.4466761317455313e-05 2.6270005211736469e-07 4.7609191024683460e-03 - 35 -9.2670469782459453e-05 4.0708409869095536e-06 -1.6053645864696963e-03 - 36 8.4450760061533046e-05 2.4678792568258345e-07 4.7609196893467782e-03 - 37 9.2654152308405103e-05 4.0850279628000907e-06 -1.6053564303655061e-03 - 38 -8.4466761317482635e-05 2.6270005213547426e-07 4.7609191024683400e-03 - 39 -9.2670469782453165e-05 4.0708409868783421e-06 -1.6053645864697198e-03 - 40 8.4450760061528275e-05 2.4678792566386402e-07 4.7609196893469690e-03 - 41 -1.0178163233209149e-03 7.4102846801620556e-04 -6.3745882808595152e-04 - 42 1.2958970254336804e-04 1.5886756456806513e-05 5.3232663025057810e-03 - 43 1.6488952088059271e-04 -1.8113562707041957e-05 -1.0795875600957813e-03 - 44 -9.7416136335758238e-04 -8.3284272651813762e-04 5.3751561064124811e-03 - 45 -1.0178163233209125e-03 7.4102846801622031e-04 -6.3745882808583789e-04 - 46 1.2958970254337579e-04 1.5886756456791148e-05 5.3232663025058772e-03 - 47 1.6488952088058748e-04 -1.8113562707049496e-05 -1.0795875600958203e-03 - 48 -9.7416136335759366e-04 -8.3284272651814803e-04 5.3751561064124855e-03 -run_vdwl: -1.3875037702379507 + 1 2.4610339078490156e-03 -8.0941385855730190e-04 -4.8326320178295704e-02 + 2 -7.6823457808184028e-05 1.2178164101129890e-04 4.0491563547179248e-02 + 3 -2.7989019303446697e-04 -4.2818591562088177e-04 -4.5665324303695104e-02 + 4 -1.4655567762950333e-04 -8.6680976002445587e-05 4.2136499393241260e-02 + 5 1.6314412126618326e-03 7.5110836700830776e-04 -4.6536568012388584e-02 + 6 -8.8332355467278029e-05 7.5115350335386150e-05 4.2128877215948171e-02 + 7 3.1198948690565895e-04 -3.3541388806001166e-04 -4.2495615365868149e-02 + 8 -2.1805348015989552e-04 -1.3826488757541857e-05 4.0578899191401174e-02 + 9 -4.4904512524362701e-05 -4.1154090129608741e-04 -4.5855565210911935e-02 + 10 -1.2323451051768179e-04 8.6264442684110871e-05 4.0668676624147859e-02 + 11 -1.0854434805428821e-04 -3.7090492506527267e-04 -4.5942449788609993e-02 + 12 4.6983227876560727e-05 -5.2640770951859743e-06 4.1217227427237428e-02 + 13 6.2620754206681064e-04 -4.4911660756678990e-04 -4.5820603084748390e-02 + 14 -3.5471628020556159e-05 6.0296576111739782e-05 4.0459297609754974e-02 + 15 -6.4693600870479543e-04 -9.2841742831606920e-04 -4.4974490674305451e-02 + 16 1.3091534548570136e-05 6.5568167095355679e-06 4.1412981663374780e-02 + 17 3.5154915181880703e-04 -1.1634457578910866e-03 -4.5343907116033116e-02 + 18 3.5988934248684066e-04 -1.9967020478526597e-05 4.2526080539534605e-02 + 19 -5.1060958159006851e-04 -6.5235063390981158e-04 -4.9165535254196160e-02 + 20 8.3862359922141791e-05 1.8418236907131663e-04 4.4009996268400277e-02 + 21 2.7114492988966756e-04 -1.0607028804670161e-03 -4.3924470701810402e-02 + 22 2.5537051199923667e-04 -9.8456498670628683e-05 4.2964910239546426e-02 + 23 -1.7689370446294437e-03 6.9490491450984154e-04 -4.7088542968708194e-02 + 24 1.0581657686660245e-04 1.2486032149241973e-04 4.1999455527881133e-02 + 25 -5.8076747055472826e-04 2.0877090146123080e-04 -7.1819543429712997e-04 + 26 1.0058553084468674e-03 -2.7830702485256119e-04 7.6613217224462387e-03 + 27 6.8107690004202449e-04 1.0764595573614904e-04 -2.8530069000922906e-04 + 28 -4.9687080543206474e-04 4.6141640541676795e-04 3.6147002799277426e-03 + 29 -7.3540356657639467e-04 9.9589268765556765e-04 -3.2018443040131468e-04 + 30 1.4169363539265211e-03 -1.1084987800204032e-03 5.2281223130184844e-03 + 31 9.6010838366544608e-04 9.4102147965306401e-04 -1.6078876173775368e-03 + 32 -3.4281227905939068e-05 -1.0944024974507546e-04 5.6563897988656919e-03 + 33 3.7576300426288550e-05 5.7279170049296399e-04 1.9395320057938748e-04 + 34 -1.5735822500533968e-04 5.0778670318717329e-06 5.8734806295344310e-03 + 35 1.0275939445448298e-04 5.4063092113845333e-06 -1.3717905360514479e-03 + 36 7.0175855099543702e-04 6.8891472849395927e-04 3.8597118791517831e-03 + 37 -4.3947158571972661e-04 3.7526900909219170e-04 -1.7336967954020652e-03 + 38 -1.2587448373275328e-04 5.4296662277744255e-04 5.9243764669461383e-03 + 39 -5.7206916834739649e-04 -6.4282692313546411e-04 -2.4614647452408890e-03 + 40 2.8775914220648428e-04 4.1508757889834963e-04 3.6588005827141844e-03 + 41 -1.1942380066354095e-03 1.2095128528955136e-03 -2.0148238613329496e-03 + 42 -3.1598596308341767e-04 6.4011884378217544e-05 7.1660415833885143e-03 + 43 -3.8041449696108674e-04 5.9236844564084824e-04 4.6350641626885617e-04 + 44 -1.2292721527122721e-03 -1.3107003812311478e-04 4.2826039565963892e-03 + 45 -7.0593613957831982e-04 2.2874145949107236e-04 -2.3918845050906030e-03 + 46 1.7489891034240860e-04 3.7341072873999420e-04 4.4219325077152769e-03 + 47 4.1892602604155088e-04 5.9153899601868795e-04 5.3104446221308328e-04 + 48 -1.2897989650539343e-03 -1.3810855383878410e-03 4.9141702277601985e-03 +run_vdwl: -1.385872195382714 run_coul: 0 run_stress: ! |- - -1.0950798483072388e+00 -1.0965501776879543e+00 -5.5691866561084535e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.1949322419481606e-03 + -1.0930055687255709e+00 -1.0932093234223756e+00 -5.4520237057596543e-01 -2.5389055976560446e-03 -8.2571965021650887e-03 1.5728975928521384e-02 run_forces: ! |2 - 1 2.0033030003525137e-03 8.9435705391029130e-10 -4.7625968392020532e-02 - 2 -1.1367384359795837e-05 9.1815719224718032e-05 4.2487909883465465e-02 - 3 -5.5282089115551557e-05 -2.6135646989168017e-09 -4.4732313434801885e-02 - 4 -2.3915909829547773e-04 2.2249799837368439e-06 4.0890200928313990e-02 - 5 2.0033030003524860e-03 8.9435706106602564e-10 -4.7625968392020428e-02 - 6 -1.1367384359823613e-05 9.1815719224701660e-05 4.2487909883465430e-02 - 7 -5.5282089115578446e-05 -2.6135647671131183e-09 -4.4732313434801836e-02 - 8 -2.3915909829547773e-04 2.2249799837172199e-06 4.0890200928314566e-02 - 9 -5.2020641072548406e-05 6.7005638625767475e-10 -4.4737290402994602e-02 - 10 -1.2511670468712049e-04 -4.3337535831548628e-06 4.1581350530843775e-02 - 11 5.1983012539478048e-05 6.7012239660759799e-10 -4.4737344911317957e-02 - 12 1.2512201515433533e-04 -4.3320284013805789e-06 4.1581381013272169e-02 - 13 -5.2020641072554044e-05 6.7005629369391428e-10 -4.4737290402994609e-02 - 14 -1.2511670468714348e-04 -4.3337535831713291e-06 4.1581350530843830e-02 - 15 5.1983012539505370e-05 6.7012235105247202e-10 -4.4737344911317853e-02 - 16 1.2512201515432167e-04 -4.3320284013572685e-06 4.1581381013272294e-02 - 17 5.5321930482132663e-05 -2.6135608037222913e-09 -4.4732367803430914e-02 - 18 2.3916115092586794e-04 2.2268497947506605e-06 4.0890218403155591e-02 - 19 -2.0033052131855867e-03 8.9429471662265853e-10 -4.7625968252325866e-02 - 20 1.1360021262163687e-05 9.1815863853997803e-05 4.2487896875878589e-02 - 21 5.5321930482154889e-05 -2.6135608655374853e-09 -4.4732367803430817e-02 - 22 2.3916115092584907e-04 2.2268497947312516e-06 4.0890218403155654e-02 - 23 -2.0033052131855616e-03 8.9429479706876566e-10 -4.7625968252325804e-02 - 24 1.1360021262174096e-05 9.1815863853997342e-05 4.2487896875878825e-02 - 25 -1.6486945106528091e-04 -1.8126101379958718e-05 -1.0797429438547676e-03 - 26 9.7414016722233848e-04 -8.3283489942476445e-04 5.3750161101709729e-03 - 27 1.0177937442917731e-03 7.4101905540415944e-04 -6.3761022896437550e-04 - 28 -1.2957001720401498e-04 1.5902818724243767e-05 5.3231291183569798e-03 - 29 -1.6486945106529950e-04 -1.8126101379940937e-05 -1.0797429438548231e-03 - 30 9.7414016722235670e-04 -8.3283489942476228e-04 5.3750161101709625e-03 - 31 1.0177937442917692e-03 7.4101905540416161e-04 -6.3761022896433907e-04 - 32 -1.2957001720399937e-04 1.5902818724231570e-05 5.3231291183569417e-03 - 33 9.2652190820307180e-05 4.0847599754035413e-06 -1.6054772616410785e-03 - 34 -8.4465929960344556e-05 2.6265700116475746e-07 4.7608118750052195e-03 - 35 -9.2668507953961839e-05 4.0705731901608693e-06 -1.6054854176848882e-03 - 36 8.4449929025630626e-05 2.4674500177709956e-07 4.7608124618308432e-03 - 37 9.2652190820296772e-05 4.0847599754594472e-06 -1.6054772616411949e-03 - 38 -8.4465929960378383e-05 2.6265700123594889e-07 4.7608118750052542e-03 - 39 -9.2668507953971814e-05 4.0705731901478047e-06 -1.6054854176848756e-03 - 40 8.4449929025618483e-05 2.4674500176496539e-07 4.7608124618310956e-03 - 41 -1.0177989405882203e-03 7.4101861929748436e-04 -6.3760029049130570e-04 - 42 1.2959039767826896e-04 1.5887198241880077e-05 5.3231402917910302e-03 - 43 1.6489096449514255e-04 -1.8112350701529705e-05 -1.0797248493375658e-03 - 44 -9.7414454676205060e-04 -8.3283460790769116e-04 5.3750266967793276e-03 - 45 -1.0177989405881721e-03 7.4101861929751580e-04 -6.3760029049122590e-04 - 46 1.2959039767822169e-04 1.5887198241890099e-05 5.3231402917910502e-03 - 47 1.6489096449514865e-04 -1.8112350701541984e-05 -1.0797248493375228e-03 - 48 -9.7414454676203553e-04 -8.3283460790775058e-04 5.3750266967792192e-03 + 1 2.4609940069194088e-03 -8.0940157232910247e-04 -4.8325726970834988e-02 + 2 -7.6822848838547145e-05 1.2178328219749613e-04 4.0491291892786760e-02 + 3 -2.7988727505423236e-04 -4.2818132394118510e-04 -4.5664791886851373e-02 + 4 -1.4655494241735609e-04 -8.6680649376635584e-05 4.2136217440761937e-02 + 5 1.6314157154273569e-03 7.5109177962938900e-04 -4.6536021294724568e-02 + 6 -8.8331701994542403e-05 7.5117489176432426e-05 4.2128582280312542e-02 + 7 3.1198158197327059e-04 -3.3541096202997485e-04 -4.2495150569119976e-02 + 8 -2.1805403321291817e-04 -1.3827095570804907e-05 4.0578648564210895e-02 + 9 -4.4902850375367438e-05 -4.1153264699865012e-04 -4.5855023771171212e-02 + 10 -1.2323411017352900e-04 8.6264434948909476e-05 4.0668404690806285e-02 + 11 -1.0853721290544427e-04 -3.7090420095698014e-04 -4.5941911266724381e-02 + 12 4.6983413331934875e-05 -5.2641664381669891e-06 4.1216962896723150e-02 + 13 6.2619550238134179e-04 -4.4911367415724149e-04 -4.5820068049292902e-02 + 14 -3.5471795900222924e-05 6.0296345227544218e-05 4.0459040402743181e-02 + 15 -6.4692333287009476e-04 -9.2840440504242752e-04 -4.4973973956255839e-02 + 16 1.3091881904414094e-05 6.5566700471060033e-06 4.1412700547655577e-02 + 17 3.5154775899092324e-04 -1.1634232178762392e-03 -4.5343379769377648e-02 + 18 3.5988964364730208e-04 -1.9966661473108192e-05 4.2525807559503005e-02 + 19 -5.1060598395690773e-04 -6.5234194237526557e-04 -4.9164926688241531e-02 + 20 8.3862049523019723e-05 1.8418457418230890e-04 4.4009687490766621e-02 + 21 2.7114678744075095e-04 -1.0606899693139744e-03 -4.3923977143238875e-02 + 22 2.5537070627513553e-04 -9.8456189341286418e-05 4.2964626625974375e-02 + 23 -1.7689101402960281e-03 6.9489387637498791e-04 -4.7087985757714730e-02 + 24 1.0581628773364730e-04 1.2486060659532840e-04 4.1999172097783623e-02 + 25 -5.8076307908786276e-04 2.0876640447796849e-04 -7.1833852655823257e-04 + 26 1.0058383735703060e-03 -2.7830742425273818e-04 7.6611522529092535e-03 + 27 6.8106375490991321e-04 1.0764755411731127e-04 -2.8545056402054340e-04 + 28 -4.9686489809480823e-04 4.6140925013471001e-04 3.6145987053758238e-03 + 29 -7.3539529011730975e-04 9.9587775186411875e-04 -3.2033012451395705e-04 + 30 1.4169112871911462e-03 -1.1084870356386106e-03 5.2280008041790463e-03 + 31 9.6009292992426374e-04 9.4101463479531592e-04 -1.6080091845228125e-03 + 32 -3.4282276314532515e-05 -1.0943558732934332e-04 5.6562625510517073e-03 + 33 3.7577920134084604e-05 5.7278519005128127e-04 1.9379541278532380e-04 + 34 -1.5735846521140046e-04 5.0775739409873255e-06 5.8733503852292871e-03 + 35 1.0275573902186427e-04 5.4104173309866264e-06 -1.3719169525187674e-03 + 36 7.0174696432084545e-04 6.8890519718149224e-04 3.8596115083405613e-03 + 37 -4.3946717316729834e-04 3.7526593412663743e-04 -1.7338118741875162e-03 + 38 -1.2587116502840202e-04 5.4295618013077893e-04 5.9242533967379203e-03 + 39 -5.7206105243227078e-04 -6.4281579229026630e-04 -2.4615699421645025e-03 + 40 2.8775479574152420e-04 4.1508178729798107e-04 3.6587116047810363e-03 + 41 -1.1942225333102237e-03 1.2094954185316630e-03 -2.0149490846922040e-03 + 42 -3.1597810971585615e-04 6.4012288133276593e-05 7.1658710238005335e-03 + 43 -3.8040275175381421e-04 5.9235495429672857e-04 4.6334024424133464e-04 + 44 -1.2292519361513381e-03 -1.3107292145424741e-04 4.2824841677020263e-03 + 45 -7.0592870699901227e-04 2.2873758554906764e-04 -2.3920016760467832e-03 + 46 1.7490093749952047e-04 3.7340604342296136e-04 4.4218197134706944e-03 + 47 4.1892034467561773e-04 5.9152891234926929e-04 5.3087618174124781e-04 + 48 -1.2897747171583328e-03 -1.3810646979258219e-03 4.9140446103991871e-03 ... diff --git a/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn_notaper.yaml b/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn_notaper.yaml index f54aa4f85b..51d72dc40b 100644 --- a/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn_notaper.yaml +++ b/unittest/force-styles/tests/manybody-pair-ilp-graphene-hbn_notaper.yaml @@ -1,7 +1,7 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:49 2021 -epsilon: 5e-12 +date_generated: Tue Aug 24 15:36:45 2021 +epsilon: 9e-13 skip_tests: single prerequisites: ! | pair ilp/graphene/hbn @@ -17,110 +17,110 @@ pair_coeff: ! | * * ilp/graphene/hbn BNCH.ILP B N C extract: ! "" natoms: 48 -init_vdwl: -1.743417069575419 +init_vdwl: -1.7413582303398039 init_coul: 0 init_stress: ! |- - -1.4159677678324094e+00 -1.4175957592828763e+00 -8.2079275196077894e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.2386435158561861e-03 + -1.4134286921946488e+00 -1.4137999850717609e+00 -8.0828016569767047e-01 -2.6412849629299149e-03 -8.5490424515184647e-03 1.6336078227096977e-02 init_forces: ! |2 - 1 2.0850484065019883e-03 3.6862873864507151e-18 -5.0318618251118635e-02 - 2 -6.3446817540543932e-06 9.5024077809279612e-05 4.2760561141837801e-02 - 3 -4.9554482434026152e-05 -8.1315162936412833e-18 -4.7333694009245655e-02 - 4 -2.3873708476733480e-04 1.4944038076278483e-06 4.1104339963197040e-02 - 5 2.0850484065019900e-03 3.0357660829594124e-18 -5.0318618251118601e-02 - 6 -6.3446817540370459e-06 9.5024077809283949e-05 4.2760561141837863e-02 - 7 -4.9554482434004034e-05 -2.0003530082357557e-17 -4.7333694009245551e-02 - 8 -2.3873708476732872e-04 1.4944038076165726e-06 4.1104339963197123e-02 - 9 -5.1133673114476565e-05 -4.2825985813177425e-18 -4.7328374000982235e-02 - 10 -1.2855382161618828e-04 -3.5892733150040340e-06 4.1845863048816843e-02 - 11 5.1094314571888079e-05 -9.2394353886499081e-18 -4.7328430254607333e-02 - 12 1.2855900637380436e-04 -3.5874635791496971e-06 4.1845894619109855e-02 - 13 -5.1133673114468758e-05 5.4210108624275222e-20 -4.7328374000982200e-02 - 14 -1.2855382161621300e-04 -3.5892733149839627e-06 4.1845863048816802e-02 - 15 5.1094314571888079e-05 -1.8460236052460222e-17 -4.7328430254607312e-02 - 16 1.2855900637382496e-04 -3.5874635791107064e-06 4.1845894619109890e-02 - 17 4.9595925523595848e-05 -4.7802304378296440e-18 -4.7333750316999074e-02 - 18 2.3873932915433548e-04 1.4963296466885558e-06 4.1104357563481929e-02 - 19 -2.0850504910489491e-03 1.0522849122417783e-17 -5.0318618305247004e-02 - 20 6.3372526094387688e-06 9.5024193912500820e-05 4.2760547171829859e-02 - 21 4.9595925523599209e-05 1.0509561293057731e-18 -4.7333750316998997e-02 - 22 2.3873932915433646e-04 1.4963296466837175e-06 4.1104357563481873e-02 - 23 -2.0850504910489630e-03 -4.2831809164689798e-17 -5.0318618305246844e-02 - 24 6.3372526094248910e-06 9.5024193912522829e-05 4.2760547171829762e-02 - 25 -1.6288457344696859e-04 -1.8238152247257184e-05 9.5379191188832164e-05 - 26 1.0182995551939961e-03 -8.6641525713797730e-04 6.5970295316636436e-03 - 27 1.0604041695539059e-03 7.7139117932867849e-04 5.4135994220887943e-04 - 28 -1.2540699375438325e-04 1.6743748439636654e-05 6.5543328981639889e-03 - 29 -1.6288457344698247e-04 -1.8238152247225959e-05 9.5379191188821322e-05 - 30 1.0182995551939649e-03 -8.6641525713797123e-04 6.5970295316634528e-03 - 31 1.0604041695539443e-03 7.7139117932868467e-04 5.4135994220893408e-04 - 32 -1.2540699375435983e-04 1.6743748439636546e-05 6.5543328981640713e-03 - 33 9.3725416939480027e-05 3.9426681303011716e-06 -4.6805765375060782e-04 - 34 -8.5944868650094253e-05 -3.3863756950810271e-07 5.9498944235440096e-03 - 35 -9.3742626080580566e-05 3.9279108845123400e-06 -4.6806588898556445e-04 - 36 8.5927904006221408e-05 -3.5520455114131738e-07 5.9498948560586119e-03 - 37 9.3725416939479159e-05 3.9426681303317868e-06 -4.6805765375057583e-04 - 38 -8.5944868650128080e-05 -3.3863756950880066e-07 5.9498944235437754e-03 - 39 -9.3742626080576229e-05 3.9279108844955619e-06 -4.6806588898545658e-04 - 40 8.5927904006218372e-05 -3.5520455114406897e-07 5.9498948560586301e-03 - 41 -1.0604093518345942e-03 7.7139074370169154e-04 5.4137060014462714e-04 - 42 1.2542828980921278e-04 1.6727500981786547e-05 6.5543447221730429e-03 - 43 1.6290696486873053e-04 -1.8223830628457046e-05 9.5398084359375981e-05 - 44 -1.0183038866049599e-03 -8.6641493761418803e-04 6.5970409231580918e-03 - 45 -1.0604093518345931e-03 7.7139074370171051e-04 5.4137060014457867e-04 - 46 1.2542828980922080e-04 1.6727500981764446e-05 6.5543447221731157e-03 - 47 1.6290696486873449e-04 -1.8223830628478516e-05 9.5398084359388924e-05 - 48 -1.0183038866049608e-03 -8.6641493761419497e-04 6.5970409231580329e-03 -run_vdwl: -1.7434201284130086 + 1 2.5671506894731589e-03 -8.3786084034401720e-04 -5.1036081136598070e-02 + 2 -7.5079308172634036e-05 1.2466726713768431e-04 4.0679917300844255e-02 + 3 -2.8828548641257135e-04 -4.5271584742210630e-04 -4.8293609404927766e-02 + 4 -1.4406200819607178e-04 -9.0001621977869580e-05 4.2392989076184280e-02 + 5 1.7027760046386372e-03 7.8656972507755028e-04 -4.9200918526109132e-02 + 6 -8.7712879599942568e-05 7.9491090947944639e-05 4.2392682052601084e-02 + 7 3.3258301690107647e-04 -3.5343521878259120e-04 -4.5022284535523836e-02 + 8 -2.2002998670154778e-04 -1.7356100673202577e-05 4.0787466276355475e-02 + 9 -4.6124486891179102e-05 -4.2325496992418857e-04 -4.8476400478716812e-02 + 10 -1.2591075539270013e-04 9.1455894947501561e-05 4.0885563712970939e-02 + 11 -1.1121626521394328e-04 -3.9116263339664792e-04 -4.8561395234903652e-02 + 12 4.6266631092390905e-05 -5.2845610714268243e-06 4.1449898905742528e-02 + 13 6.5246777492991353e-04 -4.5488207212499997e-04 -4.8442632457694250e-02 + 14 -3.7624647384854049e-05 6.2159752780010906e-05 4.0689933230887272e-02 + 15 -6.7285426313034690e-04 -9.6735405502104742e-04 -4.7566236949345711e-02 + 16 1.3704135992268461e-05 7.1930314305085428e-06 4.1666168986186899e-02 + 17 3.5234574640921536e-04 -1.2108273358484576e-03 -4.7956687606570347e-02 + 18 3.6283524563443081e-04 -2.1752269825311187e-05 4.2842397977493833e-02 + 19 -5.3430456642273823e-04 -6.7700037087304395e-04 -5.1893923237905579e-02 + 20 8.0067959801897917e-05 1.9199369028371848e-04 4.4356830365229041e-02 + 21 2.7070606898295466e-04 -1.1057160681550810e-03 -4.6504111757274966e-02 + 22 2.5925181999668259e-04 -1.0296802574297572e-04 4.3289088562630709e-02 + 23 -1.8442144850956180e-03 7.2762916990287002e-04 -4.9761642545012238e-02 + 24 1.0565711266344427e-04 1.2749698548653304e-04 4.2248585111624319e-02 + 25 -5.9585941678375444e-04 2.1641115663733300e-04 4.7131750632772949e-04 + 26 1.0453876277010951e-03 -2.8662462788158621e-04 8.9672658900977250e-03 + 27 7.0591323191921676e-04 1.1127960120069355e-04 9.0379438337785147e-04 + 28 -5.0909483279438714e-04 4.8707390653000772e-04 4.7643452885263934e-03 + 29 -7.5339417220817361e-04 1.0345992260147568e-03 8.8882429050538610e-04 + 30 1.4754521501772330e-03 -1.1568947634004825e-03 6.4416485674728616e-03 + 31 9.9739315711739164e-04 9.7533261901202716e-04 -4.7434454092814583e-04 + 32 -2.3838748070060742e-05 -1.1304983014188410e-04 6.8987427167466562e-03 + 33 3.8361879230719041e-05 5.9152255209474951e-04 1.3986602688146547e-03 + 34 -1.5699650292389650e-04 2.9194139622446815e-06 7.0911508869187581e-03 + 35 1.1245649251074219e-04 5.8020176212730487e-06 -2.4336213107647281e-04 + 36 7.2964500568976475e-04 7.1816700068531782e-04 5.0077761904869190e-03 + 37 -4.6186238269460621e-04 3.9291682284746084e-04 -6.0313849816674985e-04 + 38 -1.2542641974595987e-04 5.6120140189761859e-04 7.1683129612172937e-03 + 39 -5.8579483766297603e-04 -6.7104614260792494e-04 -1.3611900696946619e-03 + 40 2.9992651288639509e-04 4.2930651464219362e-04 4.7876360010713475e-03 + 41 -1.2437725060055766e-03 1.2620406155116949e-03 -9.1037381589832982e-04 + 42 -3.3539848726949059e-04 6.6612059436303974e-05 8.4701991083487964e-03 + 43 -3.9978628743584353e-04 6.1521767436610152e-04 1.6982833241619140e-03 + 44 -1.2826808362133742e-03 -1.3921127049583705e-04 5.4675328860112962e-03 + 45 -7.3349603322586166e-04 2.4256895185880898e-04 -1.2875010419578902e-03 + 46 1.7217369575183144e-04 3.9114708549249091e-04 5.6131585227578709e-03 + 47 4.2507179882718263e-04 6.1626846104424152e-04 1.7649745339438007e-03 + 48 -1.3527731566796476e-03 -1.4406450631389688e-03 6.1106890827670301e-03 +run_vdwl: -1.7413613136648298 run_coul: 0 run_stress: ! |- - -1.4159735399871292e+00 -1.4176014949571309e+00 -8.2080149187142926e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.2386484789055200e-03 + -1.4134345040702818e+00 -1.4138057787629810e+00 -8.0828916748788793e-01 -2.6412564399016744e-03 -8.5489449819476510e-03 1.6335849121510891e-02 run_forces: ! |2 - 1 2.0850117908114097e-03 1.0161463491389217e-09 -5.0317981439628325e-02 - 2 -6.3437194577726987e-06 9.5025701239061859e-05 4.2760248404172425e-02 - 3 -4.9558828649647491e-05 -2.8627617254290035e-09 -4.7333123186150738e-02 - 4 -2.3873691985811830e-04 1.4944553106552229e-06 4.1104081968794406e-02 - 5 2.0850117908114453e-03 1.0161464421634681e-09 -5.0317981439628387e-02 - 6 -6.3437194577657598e-06 9.5025701239022950e-05 4.2760248404172314e-02 - 7 -4.9558828649683053e-05 -2.8627618450165031e-09 -4.7333123186150801e-02 - 8 -2.3873691985809662e-04 1.4944553106461156e-06 4.1104081968794330e-02 - 9 -5.1133422593300278e-05 7.5547760714921204e-10 -4.7327803360874096e-02 - 10 -1.2855412188890643e-04 -3.5895010384140685e-06 4.1845576403891582e-02 - 11 5.1094064803271807e-05 7.5555079194951369e-10 -4.7327859613308917e-02 - 12 1.2855930662305235e-04 -3.5876912710547494e-06 4.1845607973177879e-02 - 13 -5.1133422593287268e-05 7.5547762723405729e-10 -4.7327803360874242e-02 - 14 -1.2855412188890339e-04 -3.5895010383977919e-06 4.1845576403891596e-02 - 15 5.1094064803272566e-05 7.5555075467328774e-10 -4.7327859613308966e-02 - 16 1.2855930662306232e-04 -3.5876912710024113e-06 4.1845607973177948e-02 - 17 4.9600271065325580e-05 -2.8627573902157001e-09 -4.7333179492726606e-02 - 18 2.3873916427060956e-04 1.4963811844738990e-06 4.1104099568595440e-02 - 19 -2.0850138754365875e-03 1.0160778065162400e-09 -5.0317981493768628e-02 - 20 6.3362903110811795e-06 9.5025817345494392e-05 4.2760234434687100e-02 - 21 4.9600271065314522e-05 -2.8627574752175739e-09 -4.7333179492726564e-02 - 22 2.3873916427059666e-04 1.4963811844658860e-06 4.1104099568595440e-02 - 23 -2.0850138754366235e-03 1.0160777921810544e-09 -5.0317981493768635e-02 - 24 6.3362903110742406e-06 9.5025817345493959e-05 4.2760234434687017e-02 - 25 -1.6288606984034650e-04 -1.8236722175475704e-05 9.5216967993063707e-05 - 26 1.0182812312861281e-03 -8.6640626373293709e-04 6.5968711299294047e-03 - 27 1.0603851126650126e-03 7.7138037180120864e-04 5.4119317677753243e-04 - 28 -1.2540771098643044e-04 1.6744137902604281e-05 6.5541778235511557e-03 - 29 -1.6288606984038928e-04 -1.8236722175416289e-05 9.5216967993082789e-05 - 30 1.0182812312861922e-03 -8.6640626373294402e-04 6.5968711299294082e-03 - 31 1.0603851126649892e-03 7.7138037180129147e-04 5.4119317677749253e-04 - 32 -1.2540771098645993e-04 1.6744137902621953e-05 6.5541778235512944e-03 - 33 9.3723257649716975e-05 3.9423316345507744e-06 -4.6820173818218168e-04 - 34 -8.5943962571135429e-05 -3.3866278074822816e-07 5.9497600753296263e-03 - 35 -9.3740466418232955e-05 3.9275746001192263e-06 -4.6820997335027752e-04 - 36 8.5926998277192305e-05 -3.5522961929919531e-07 5.9497605077923395e-03 - 37 9.3723257649690628e-05 3.9423316345445131e-06 -4.6820173818211392e-04 - 38 -8.5943962571131960e-05 -3.3866278074772671e-07 5.9497600753297061e-03 - 39 -9.3740466418205850e-05 3.9275746001722167e-06 -4.6820997335035645e-04 - 40 8.5926998277160646e-05 -3.5522961930283416e-07 5.9497605077923222e-03 - 41 -1.0603902949286239e-03 7.7137993620434483e-04 5.4120383437409529e-04 - 42 1.2542900668491156e-04 1.6727890598687433e-05 6.5541896471255070e-03 - 43 1.6290846087229721e-04 -1.8222400738173032e-05 9.5235860757960438e-05 - 44 -1.0182855626908293e-03 -8.6640594419860580e-04 6.5968825210400628e-03 - 45 -1.0603902949286009e-03 7.7137993620434917e-04 5.4120383437400075e-04 - 46 1.2542900668490961e-04 1.6727890598721233e-05 6.5541896471255886e-03 - 47 1.6290846087231749e-04 -1.8222400738211376e-05 9.5235860757975237e-05 - 48 -1.0182855626908007e-03 -8.6640594419857295e-04 6.5968825210402865e-03 + 1 2.5671069317156946e-03 -8.3784748622451677e-04 -5.1035422353424897e-02 + 2 -7.5078660431280697e-05 1.2466894068441879e-04 4.0679640015975134e-02 + 3 -2.8828222070861930e-04 -4.5271063068668852e-04 -4.8293016009692991e-02 + 4 -1.4406124862828204e-04 -9.0001239249681299e-05 4.2392698375035044e-02 + 5 1.7027479618599520e-03 7.8655155527332680e-04 -4.9200309431395639e-02 + 6 -8.7712151111431111e-05 7.9493272325145201e-05 4.2392377826466342e-02 + 7 3.3257433268158495e-04 -3.5343190630449746e-04 -4.5021763970252524e-02 + 8 -2.2003052260134021e-04 -1.7356654735586603e-05 4.0787210168996092e-02 + 9 -4.6122628526387623e-05 -4.2324611616067641e-04 -4.8475797684687988e-02 + 10 -1.2591030160492974e-04 9.1455808782197882e-05 4.0885285111349159e-02 + 11 -1.1120852050748912e-04 -3.9116166997766016e-04 -4.8560795739075201e-02 + 12 4.6266856592107244e-05 -5.2847075459255751e-06 4.1449627520166392e-02 + 13 6.5245464520849363e-04 -4.5487894789080158e-04 -4.8442036485576837e-02 + 14 -3.7624862825607827e-05 6.2159419287636660e-05 4.0689669960074649e-02 + 15 -6.7284046211318015e-04 -9.6733976598340171e-04 -4.7565660766662930e-02 + 16 1.3704563115169745e-05 7.1929183212948243e-06 4.1665879631313046e-02 + 17 3.5234429785830821e-04 -1.2108026434225379e-03 -4.7956099842218117e-02 + 18 3.6283539800015707e-04 -2.1751834977917593e-05 4.2842115834581848e-02 + 19 -5.3430067459146475e-04 -6.7699076712118898e-04 -5.1893248195074890e-02 + 20 8.0067631436594490e-05 1.9199577717410272e-04 4.4356509251295417e-02 + 21 2.7070817748155987e-04 -1.1057017890780325e-03 -4.6503559959193794e-02 + 22 2.5925191776026096e-04 -1.0296760159363033e-04 4.3288794705141333e-02 + 23 -1.8441850074936330e-03 7.2761697736138198e-04 -4.9761022378471902e-02 + 24 1.0565676776159950e-04 1.2749723476606362e-04 4.2248293219115704e-02 + 25 -5.9585451021696182e-04 2.1640639607864025e-04 4.7114874751477080e-04 + 26 1.0453692437877231e-03 -2.8662506725380277e-04 8.9670633005856336e-03 + 27 7.0589906505207555e-04 1.1128140868864322e-04 9.0361854811791056e-04 + 28 -5.0908832361770510e-04 4.8706590396432539e-04 4.7642176528582547e-03 + 29 -7.5338509261032660e-04 1.0345829810439421e-03 8.8865240545560505e-04 + 30 1.4754248973631234e-03 -1.1568817076731742e-03 6.4414985161040036e-03 + 31 9.9737630177424786e-04 9.7532502560874047e-04 -4.7448946945127454e-04 + 32 -2.3839900990695571e-05 -1.1304495074488221e-04 6.8985860488112805e-03 + 33 3.8363508295354183e-05 5.9151530177011056e-04 1.3984758350279918e-03 + 34 -1.5699679563740878e-04 2.9191691751159093e-06 7.0909914856595929e-03 + 35 1.1245238949755777e-04 5.8063509827796967e-06 -2.4351202431714138e-04 + 36 7.2963238396686701e-04 7.1815661636541093e-04 5.0076498433107557e-03 + 37 -4.6185741822893714e-04 3.9291330387253819e-04 -6.0327630742922826e-04 + 38 -1.2542291741247241e-04 5.6119015898891159e-04 7.1681606949559294e-03 + 39 -5.8578599337169536e-04 -6.7103392539062581e-04 -1.3613169389676742e-03 + 40 2.9992166808446435e-04 4.2930027852655433e-04 4.7875220868096729e-03 + 41 -1.2437554051579060e-03 1.2620214208313983e-03 -9.1052192567291036e-04 + 42 -3.3538993566218202e-04 6.6612328072330551e-05 8.4699959588109205e-03 + 43 -3.9977362536516620e-04 6.1520314872321510e-04 1.6980894994330193e-03 + 44 -1.2826587463211528e-03 -1.3921416264003162e-04 5.4673856596931985e-03 + 45 -7.3348779583301917e-04 2.4256471430180029e-04 -1.2876405242036421e-03 + 46 1.7217585843614476e-04 3.9114182832181052e-04 5.6130185122816581e-03 + 47 4.2506556290596465e-04 6.1625753588710557e-04 1.7647784184589349e-03 + 48 -1.3527466390657683e-03 -1.4406222005236080e-03 6.1105351723711654e-03 ... diff --git a/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full.yaml b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full.yaml index a166d66af1..aa14a037d9 100644 --- a/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full.yaml +++ b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full.yaml @@ -1,6 +1,6 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:49 2021 +date_generated: Tue Aug 24 15:36:47 2021 epsilon: 5e-12 skip_tests: single prerequisites: ! | @@ -17,110 +17,110 @@ pair_coeff: ! | * * kolmogorov/crespi/full CH_taper.KC C C C extract: ! "" natoms: 48 -init_vdwl: -1.2500397419624312 +init_vdwl: -1.2504009944747907 init_coul: 0 init_stress: ! |- - -1.0004429195951223e+00 -1.0032930381066463e+00 4.3070815061895146e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.7133324489474716e-02 + -9.9937588621335804e-01 -1.0000549664406271e+00 4.2993515475088256e-01 -1.0321402621276921e-03 -2.6508652354193526e-02 3.5775561054487807e-03 init_forces: ! |2 - 1 2.8687289997477317e-03 -7.8062556418956319e-18 3.6613830361686965e-02 - 2 1.3226962450822509e-03 1.2611200091842689e-03 -6.4703224388507563e-02 - 3 -3.4774444393605684e-04 -1.3010426069826053e-17 3.8050724789394384e-02 - 4 -3.4400661847007637e-04 3.0925839103697773e-05 -6.5875665183461635e-02 - 5 2.8687289997477005e-03 -1.5612511283791264e-17 3.6613830361687000e-02 - 6 1.3226962450822808e-03 1.2611200091843045e-03 -6.4703224388507549e-02 - 7 -3.4774444393598919e-04 -5.2150124496552763e-17 3.8050724789394412e-02 - 8 -3.4400661847007550e-04 3.0925839103693002e-05 -6.5875665183461662e-02 - 9 -1.2644907900887740e-04 -8.1315162936412833e-18 3.8649557617062728e-02 - 10 -1.1324543171146572e-04 -5.6284413155996182e-06 -6.5027903599930381e-02 - 11 1.2639947077019444e-04 -2.2215980140585789e-17 3.8649533308935571e-02 - 12 1.1322659571519420e-04 -5.6051326608156769e-06 -6.5027878367048986e-02 - 13 -1.2644907900885008e-04 2.3256136599814070e-17 3.8649557617062749e-02 - 14 -1.1324543171150085e-04 -5.6284413155611291e-06 -6.5027903599930395e-02 - 15 1.2639947077014381e-04 -7.0749273952362690e-17 3.8649533308935564e-02 - 16 1.1322659571522879e-04 -5.6051326608175471e-06 -6.5027878367048930e-02 - 17 3.4780347512676035e-04 3.1573153108904045e-19 3.8050688506524509e-02 - 18 3.4403466466237793e-04 3.0949865189355873e-05 -6.5875656847228403e-02 - 19 -2.8687384226996960e-03 1.2450087305437732e-17 3.6613818386944344e-02 - 20 -1.3227054552782821e-03 1.2611207266151373e-03 -6.4703241285155699e-02 - 21 3.4780347512675867e-04 2.4633623930286376e-17 3.8050688506524544e-02 - 22 3.4403466466237533e-04 3.0949865189391902e-05 -6.5875656847228389e-02 - 23 -2.8687384226997285e-03 -1.2114236094873442e-16 3.6613818386944393e-02 - 24 -1.3227054552782968e-03 1.2611207266151575e-03 -6.4703241285155685e-02 - 25 -3.4774444393599700e-04 -9.2157184661267877e-18 -3.8050724789394322e-02 - 26 1.3226962450822511e-03 -1.2611200091842659e-03 6.4703224388507466e-02 - 27 2.8687289997476766e-03 -2.1250362580715887e-17 -3.6613830361686889e-02 - 28 -3.4400661847007550e-04 -3.0925839103686985e-05 6.5875665183461676e-02 - 29 -3.4774444393599092e-04 3.0357660829594124e-17 -3.8050724789394301e-02 - 30 1.3226962450822149e-03 -1.2611200091842295e-03 6.4703224388507424e-02 - 31 2.8687289997477408e-03 -3.0791341698588326e-17 -3.6613830361686910e-02 - 32 -3.4400661847004514e-04 -3.0925839103694330e-05 6.5875665183461649e-02 - 33 1.2639947077014197e-04 1.9363173174233306e-17 -3.8649533308935488e-02 - 34 -1.1324543171148133e-04 5.6284413156027252e-06 6.5027903599930423e-02 - 35 -1.2644907900888000e-04 -9.8391347153059527e-18 -3.8649557617062437e-02 - 36 1.1322659571522738e-04 5.6051326608073988e-06 6.5027878367048986e-02 - 37 1.2639947077014413e-04 4.6109085516735093e-17 -3.8649533308935564e-02 - 38 -1.1324543171150865e-04 5.6284413156129404e-06 6.5027903599930312e-02 - 39 -1.2644907900887783e-04 -5.0401848493419887e-17 -3.8649557617062492e-02 - 40 1.1322659571519420e-04 5.6051326607950474e-06 6.5027878367048930e-02 - 41 -2.8687384226997710e-03 4.7556214837339464e-17 -3.6613818386944108e-02 - 42 3.4403466466238080e-04 -3.0949865189344834e-05 6.5875656847228375e-02 - 43 3.4780347512678995e-04 2.7966275061258421e-17 -3.8050688506524606e-02 - 44 -1.3227054552783079e-03 -1.2611207266151391e-03 6.4703241285155699e-02 - 45 -2.8687384226997693e-03 3.0234814582462649e-17 -3.6613818386944066e-02 - 46 3.4403466466241371e-04 -3.0949865189357960e-05 6.5875656847228403e-02 - 47 3.4780347512675510e-04 -4.1431557823760033e-17 -3.8050688506524565e-02 - 48 -1.3227054552782990e-03 -1.2611207266151820e-03 6.4703241285155616e-02 -run_vdwl: -1.250048655581655 + 1 3.6741977296817214e-03 -1.0229641033089357e-03 3.6050598286323773e-02 + 2 1.1228048505955328e-03 1.6260001235216366e-03 -6.9915514494061512e-02 + 3 -8.0263804389515536e-04 -7.8054142409220465e-04 3.7423752203911045e-02 + 4 5.2905890482453886e-04 -2.6660891986977193e-05 -6.2949951679195801e-02 + 5 2.3747397845779541e-03 1.1069918417071542e-03 3.5749378944516262e-02 + 6 2.1361390761049817e-03 1.5311822673314498e-03 -6.5538703818661767e-02 + 7 4.1113944201536749e-04 -7.4226696363606254e-04 3.7231357029322766e-02 + 8 -3.6293069921929100e-04 -4.1792920591827683e-04 -6.7041988117625240e-02 + 9 -6.7567684541213792e-05 -5.4683858871309163e-04 3.8584447182734363e-02 + 10 8.3703032725978383e-04 3.1274393347030375e-04 -6.7426207981870295e-02 + 11 7.6972254238782717e-05 -7.5635616799940618e-04 4.0304172540280687e-02 + 12 9.1949774781644789e-04 7.9375688632077012e-05 -6.4417122131659177e-02 + 13 8.6168104672523869e-04 -4.5216546396937169e-04 3.9667089495175389e-02 + 14 1.5404866318924348e-04 9.5701680799534607e-04 -6.7437367157563669e-02 + 15 -9.5143336291351262e-04 -1.5478931364188030e-03 3.8652043624424468e-02 + 16 5.0932423595171044e-05 6.6343349270142626e-04 -6.4978708477968702e-02 + 17 5.9845840464981047e-04 -1.6803578425037512e-03 3.8517765052240409e-02 + 18 1.0027251103784654e-03 3.6389809344473028e-04 -6.3081650255180893e-02 + 19 -6.8469130631403172e-04 -1.0012004014665335e-03 3.8200820830772898e-02 + 20 -9.0597154181006534e-04 1.5072901036096238e-03 -6.0431599283672394e-02 + 21 6.2502601715616851e-04 -1.6298948749282841e-03 3.5552400201000957e-02 + 22 1.0610150451927157e-05 6.5523853057832904e-04 -6.1624211674849522e-02 + 23 -2.6858239463745156e-03 9.7704990029999690e-04 3.6806526274162810e-02 + 24 -9.7990355040882275e-04 -2.6364878660689443e-04 -6.4804496163587397e-02 + 25 -9.9178318725343714e-04 -2.9791597396435637e-06 -3.8560242214034937e-02 + 26 1.4063694267467438e-03 -1.7645058974936640e-04 6.9272929106935568e-02 + 27 1.4040917079447780e-03 -1.5354287269199992e-03 -3.6863862200675189e-02 + 28 -7.9589073250701907e-04 7.6684151630055151e-05 6.1787433330410840e-02 + 29 -1.3454048099355946e-03 1.7192801435465354e-03 -3.9047318157065580e-02 + 30 1.0800716705062206e-03 -2.1759013252742438e-03 6.5488372519033194e-02 + 31 2.5828460888672328e-03 6.3668525788806475e-04 -3.6248438099394334e-02 + 32 -1.7422793202447918e-04 3.9801240577118889e-04 6.7293933186886992e-02 + 33 4.9336990699592976e-04 1.7399247540870930e-03 -3.9361750124123948e-02 + 34 -7.0861968784997897e-04 -1.0779297898309275e-04 6.6982337220476265e-02 + 35 7.3393673410456720e-04 6.6256971526147061e-04 -3.7789967198382235e-02 + 36 -1.1649777508201484e-03 7.6734390873931936e-05 6.2960301164193919e-02 + 37 -1.7492911968589838e-03 1.2667558142713635e-03 -3.8885908384449192e-02 + 38 3.3065638747931028e-04 9.3136542389919894e-05 6.8503220023298464e-02 + 39 -1.4038652077725464e-03 -1.2146648711443984e-03 -3.7920985454243078e-02 + 40 1.0445094111275711e-03 -3.3348687744225403e-04 6.2323823114510714e-02 + 41 -3.8543227776677144e-03 5.9241129713389306e-04 -3.5401989313202945e-02 + 42 -6.4426504417376641e-04 -3.4647462137221609e-04 6.7581618654938044e-02 + 43 -3.3609683042563269e-04 -1.2920027086862771e-04 -3.9165813804050230e-02 + 44 -1.3121828793557890e-03 -2.3790845828507482e-04 6.1419902010626644e-02 + 45 -2.3567677369656322e-03 -7.9567726510944639e-04 -3.4159081403384459e-02 + 46 1.0801227073635948e-03 8.6900071217663384e-05 6.2655301167539201e-02 + 47 4.9418643058574477e-04 8.6815716220649253e-04 -3.9577211407235038e-02 + 48 -1.7565664958955529e-03 -7.2789493132733958e-05 6.3620565832423606e-02 +run_vdwl: -1.2504098739729748 run_coul: 0 run_stress: ! |- - -1.0004370065912216e+00 -1.0032870501278353e+00 4.3059909389948547e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.7133053394138682e-02 + -9.9936987513863307e-01 -1.0000490662171573e+00 4.2982659200235462e-01 -1.0322429741975237e-03 -2.6508476134144317e-02 3.5778284842948815e-03 run_forces: ! |2 - 1 2.8687040337510585e-03 -2.1727982419360303e-08 3.6613767230361242e-02 - 2 1.3226761216838419e-03 1.2611192610103965e-03 -6.4700278384581700e-02 - 3 -3.4774048959829596e-04 -6.5329695842506266e-09 3.8050693623452148e-02 - 4 -3.4399690449135600e-04 3.0931288630288282e-05 -6.5872679966618428e-02 - 5 2.8687040337509414e-03 -2.1727982416324537e-08 3.6613767230361215e-02 - 6 1.3226761216838328e-03 1.2611192610103637e-03 -6.4700278384581755e-02 - 7 -3.4774048959831157e-04 -6.5329697417852023e-09 3.8050693623452293e-02 - 8 -3.4399690449132131e-04 3.0931288630341516e-05 -6.5872679966618358e-02 - 9 -1.2644870195377845e-04 -9.8156702533244537e-11 3.8649526065561227e-02 - 10 -1.1324486560407342e-04 -5.6284938931148765e-06 -6.5024950822206537e-02 - 11 1.2639909409585960e-04 -9.8445711624968110e-11 3.8649501756815911e-02 - 12 1.1322602979076438e-04 -5.6051853390437709e-06 -6.5024925590218899e-02 - 13 -1.2644870195375113e-04 -9.8156632886807482e-11 3.8649526065561317e-02 - 14 -1.1324486560405911e-04 -5.6284938930792740e-06 -6.5024950822206565e-02 - 15 1.2639909409583455e-04 -9.8445744733791953e-11 3.8649501756815870e-02 - 16 1.1322602979075462e-04 -5.6051853390539302e-06 -6.5024925590218899e-02 - 17 3.4779952031141985e-04 -6.5333858894565295e-09 3.8050657339932729e-02 - 18 3.4402495029270961e-04 3.0955314710129699e-05 -6.5872671630637689e-02 - 19 -2.8687134566054494e-03 -2.1728110080698652e-08 3.6613755255587549e-02 - 20 -1.3226853316725558e-03 1.2611199785361846e-03 -6.4700295280588876e-02 - 21 3.4779952031157007e-04 -6.5333859204723350e-09 3.8050657339932889e-02 - 22 3.4402495029267491e-04 3.0955314710011826e-05 -6.5872671630637619e-02 - 23 -2.8687134566054233e-03 -2.1728109989627787e-08 3.6613755255587500e-02 - 24 -1.3226853316725203e-03 1.2611199785360946e-03 -6.4700295280588946e-02 - 25 -3.4774026620067611e-04 5.4788299566664936e-09 -3.8050694958508775e-02 - 26 1.3226758258096682e-03 -1.2611202352806649e-03 6.4700279759489457e-02 - 27 2.8687023920407370e-03 2.3305742741057400e-08 -3.6613767021966469e-02 - 28 -3.4399811208785710e-04 -3.0930750484966575e-05 6.5872680514205861e-02 - 29 -3.4774026620052866e-04 5.4788301344756499e-09 -3.8050694958508983e-02 - 30 1.3226758258096626e-03 -1.2611202352806358e-03 6.4700279759489457e-02 - 31 2.8687023920407314e-03 2.3305742749297337e-08 -3.6613767021966427e-02 - 32 -3.4399811208790654e-04 -3.0930750484980141e-05 6.5872680514205958e-02 - 33 1.2639885814274838e-04 1.7430860588435232e-10 -3.8649502722412493e-02 - 34 -1.1324494267667476e-04 5.6283305711724153e-06 6.5024950991958153e-02 - 35 -1.2644846597469278e-04 1.7397032093721936e-10 -3.8649527031188770e-02 - 36 1.1322610689165884e-04 5.6050219889952428e-06 6.5024925759978203e-02 - 37 1.2639885814283360e-04 1.7430877254486095e-10 -3.8649502722412549e-02 - 38 -1.1324494267669341e-04 5.6283305709431489e-06 6.5024950991958139e-02 - 39 -1.2644846597468064e-04 1.7397049817716951e-10 -3.8649527031188825e-02 - 40 1.1322610689166047e-04 5.6050219889600113e-06 6.5024925759978369e-02 - 41 -2.8687118148861238e-03 2.3305846951219172e-08 -3.6613755047197015e-02 - 42 3.4402615788549601e-04 -3.0954776578351879e-05 6.5872672178240693e-02 - 43 3.4779929687850922e-04 5.4792724940850910e-09 -3.8050658674962379e-02 - 44 -1.3226850358229400e-03 -1.2611209527917432e-03 6.4700296655504905e-02 - 45 -2.8687118148861242e-03 2.3305846874457658e-08 -3.6613755047197084e-02 - 46 3.4402615788544478e-04 -3.0954776578295039e-05 6.5872672178240735e-02 - 47 3.4779929687843897e-04 5.4792724213126788e-09 -3.8050658674962212e-02 - 48 -1.3226850358228897e-03 -1.2611209527918239e-03 6.4700296655504780e-02 + 1 3.6741691975029581e-03 -1.0229871421580526e-03 3.6050530025906281e-02 + 2 1.1227921193014082e-03 1.6259870341875716e-03 -6.9912188310138110e-02 + 3 -8.0262575686418976e-04 -7.8053695949266487e-04 3.7423704515313912e-02 + 4 5.2905609847367537e-04 -2.6654395328295035e-05 -6.2947184182195678e-02 + 5 2.3747095488121481e-03 1.1069587035628763e-03 3.5749325846115995e-02 + 6 2.1361000566259124e-03 1.5311732714813019e-03 -6.5535708962713768e-02 + 7 4.1113889781728766e-04 -7.4226829646699757e-04 3.7231368457459980e-02 + 8 -3.6291731806742042e-04 -4.1791164880922887e-04 -6.7038918951433712e-02 + 9 -6.7570474513034638e-05 -5.4684426183841022e-04 3.8584411326469885e-02 + 10 8.3701125613325168e-04 3.1273073770282704e-04 -6.7423081498739421e-02 + 11 7.6985684709962783e-05 -7.5635817928419767e-04 4.0304124898807213e-02 + 12 9.1947304797009217e-04 7.9374425705052294e-05 -6.4414254216165437e-02 + 13 8.6167203749816642e-04 -4.5216714840892042e-04 3.9667029244414849e-02 + 14 1.5405060318326655e-04 9.5699770497460778e-04 -6.7434226234504804e-02 + 15 -9.5142546122452449e-04 -1.5478963169718038e-03 3.8652019177077342e-02 + 16 5.0932976574468488e-05 6.6341353598349106e-04 -6.4975798284669775e-02 + 17 5.9847070987311389e-04 -1.6803298615155474e-03 3.8517725818853210e-02 + 18 1.0027116328843830e-03 3.6388996787454462e-04 -6.3078763161296847e-02 + 19 -6.8469943409668914e-04 -1.0012195649349563e-03 3.8200747700365557e-02 + 20 -9.0595079384803796e-04 1.5072945474581172e-03 -6.0428934099631557e-02 + 21 6.2503299746955962e-04 -1.6298743741651773e-03 3.5552390276823172e-02 + 22 1.0606855899034941e-05 6.5522241344806334e-04 -6.1621482978662948e-02 + 23 -2.6857930199209968e-03 9.7701501877829632e-04 3.6806463415713003e-02 + 24 -9.7988402432926049e-04 -2.6360905898699876e-04 -6.4801592934849550e-02 + 25 -9.9177650514132264e-04 -2.9749741115472732e-06 -3.8560199992301730e-02 + 26 1.4063438489595912e-03 -1.7647086111514335e-04 6.9269634056662671e-02 + 27 1.4040902799584685e-03 -1.5353807665690793e-03 -3.6863805708285076e-02 + 28 -7.9587897165075278e-04 7.6677410178542700e-05 6.1784694067447098e-02 + 29 -1.3454017096032000e-03 1.7192795631010469e-03 -3.9047278683656546e-02 + 30 1.0800553143186507e-03 -2.1758812931223781e-03 6.5485374935756790e-02 + 31 2.5828271383404027e-03 6.3671302339979655e-04 -3.6248380958934713e-02 + 32 -1.7422254069942482e-04 3.9799290238358865e-04 6.7290850944434030e-02 + 33 4.9335647587368282e-04 1.7399008987367872e-03 -3.9361699297976421e-02 + 34 -7.0861028763521093e-04 -1.0778449734119870e-04 6.6979221310754469e-02 + 35 7.3392150247315055e-04 6.6257276139929078e-04 -3.7789954535635037e-02 + 36 -1.1649443522892947e-03 7.6740700646779947e-05 6.2957470236494062e-02 + 37 -1.7492708489133450e-03 1.2667448756481490e-03 -3.8885868512193354e-02 + 38 3.3064351263846579e-04 9.3140678084776377e-05 6.8500054487413836e-02 + 39 -1.4038546084894550e-03 -1.2146451215997596e-03 -3.7920961219836492e-02 + 40 1.0444893111192185e-03 -3.3346895357722788e-04 6.2320981380163128e-02 + 41 -3.8542779561979933e-03 5.9241274013200327e-04 -3.5401941575416832e-02 + 42 -6.4426220276000610e-04 -3.4646934457282738e-04 6.7578620533114572e-02 + 43 -3.3610005890149277e-04 -1.2917556683196676e-04 -3.9165759975059451e-02 + 44 -1.3121716243135058e-03 -2.3792084909504211e-04 6.1417223055191830e-02 + 45 -2.3567498071797215e-03 -7.9565006404630695e-04 -3.4159038131169342e-02 + 46 1.0801093023979562e-03 8.6901137417266978e-05 6.2652553436780320e-02 + 47 4.9417543987152854e-04 8.6816115997776389e-04 -3.9577178203993348e-02 + 48 -1.7565380900407569e-03 -7.2815711919122815e-05 6.3617681461928394e-02 ... diff --git a/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full_notaper.yaml b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full_notaper.yaml index 8049df3f76..dfa6249013 100644 --- a/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full_notaper.yaml +++ b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_full_notaper.yaml @@ -1,6 +1,6 @@ --- lammps_version: 30 Jul 2021 -date_generated: Tue Aug 17 15:09:50 2021 +date_generated: Tue Aug 24 15:36:49 2021 epsilon: 5e-12 skip_tests: single prerequisites: ! | @@ -17,110 +17,110 @@ pair_coeff: ! | * * kolmogorov/crespi/full CH.KC C C C extract: ! "" natoms: 48 -init_vdwl: -1.2319861234762621 +init_vdwl: -1.23233116008364 init_coul: 0 init_stress: ! |- - -1.1008420461559216e+00 -1.1059574121005133e+00 1.9501897055379741e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.5182584087439038e-02 + -1.0998026814576654e+00 -1.1029768921651573e+00 1.9227618627869217e-01 -8.9391891437776237e-04 -2.6573328510275926e-02 4.9220093399077770e-03 init_forces: ! |2 - 1 2.7578315641555162e-03 -3.0357660829594124e-18 4.1533172062176493e-02 - 2 1.2588944124766973e-03 1.1188632453424979e-03 -6.5272327121384435e-02 - 3 -2.7478683204608390e-04 -8.0230960763927328e-18 4.2197936430518210e-02 - 4 -2.9454797299274370e-04 2.5016995713589751e-05 -6.6888523602123898e-02 - 5 2.7578315641554889e-03 -1.5178830414797062e-17 4.1533172062176521e-02 - 6 1.2588944124767164e-03 1.1188632453425370e-03 -6.5272327121384408e-02 - 7 -2.7478683204601537e-04 -5.8221656662471588e-17 4.2197936430518279e-02 - 8 -2.9454797299274544e-04 2.5016995713579072e-05 -6.6888523602123925e-02 - 9 -9.9550461818177349e-05 -4.5672016515951874e-18 4.2881244934310968e-02 - 10 -8.9376686817712898e-05 -3.9953386427702976e-06 -6.5900411970681708e-02 - 11 9.9502582131880363e-05 -1.8143445730187113e-17 4.2881235234728650e-02 - 12 8.9358399770402756e-05 -3.9749130157838919e-06 -6.5900379165394929e-02 - 13 -9.9550461818153496e-05 2.3418766925686896e-17 4.2881244934310996e-02 - 14 -8.9376686817732847e-05 -3.9953386427169006e-06 -6.5900411970681708e-02 - 15 9.9502582131827562e-05 -7.7708496647004022e-17 4.2881235234728796e-02 - 16 8.9358399770424440e-05 -3.9749130157734564e-06 -6.5900379165394957e-02 - 17 2.7484214272895964e-04 -4.4452289071905682e-18 4.2197913495242940e-02 - 18 2.9457391733397659e-04 2.5037988057733265e-05 -6.6888509865507970e-02 - 19 -2.7578389951520565e-03 1.2809996898682004e-17 4.1533158826483590e-02 - 20 -1.2589020697706256e-03 1.1188638120596694e-03 -6.5272346190055328e-02 - 21 2.7484214272896311e-04 2.3479753297889205e-17 4.2197913495243079e-02 - 22 2.9457391733397653e-04 2.5037988057775138e-05 -6.6888509865507970e-02 - 23 -2.7578389951520709e-03 -1.2185643619304939e-16 4.1533158826483604e-02 - 24 -1.2589020697706512e-03 1.1188638120596733e-03 -6.5272346190055328e-02 - 25 -2.7478683204603272e-04 -1.2468324983583301e-18 -4.2197936430518238e-02 - 26 1.2588944124767121e-03 -1.1188632453425023e-03 6.5272327121384421e-02 - 27 2.7578315641554356e-03 -2.6020852139652106e-17 -4.1533172062176479e-02 - 28 -2.9454797299273850e-04 -2.5016995713583283e-05 6.6888523602123814e-02 - 29 -2.7478683204602925e-04 3.7892865928368380e-17 -4.2197936430518307e-02 - 30 1.2588944124766739e-03 -1.1188632453424724e-03 6.5272327121384463e-02 - 31 2.7578315641555275e-03 -4.0115480381963664e-17 -4.1533172062176452e-02 - 32 -2.9454797299271942e-04 -2.5016995713586458e-05 6.6888523602123898e-02 - 33 9.9502582131834392e-05 -3.7269449679189215e-20 -4.2881235234728567e-02 - 34 -8.9376686817722005e-05 3.9953386427603932e-06 6.5900411970681694e-02 - 35 -9.9550461818180818e-05 -1.3674499900473425e-17 -4.2881244934310996e-02 - 36 8.9358399770429102e-05 3.9749130157800633e-06 6.5900379165395040e-02 - 37 9.9502582131827453e-05 5.1780818131549888e-17 -4.2881235234728608e-02 - 38 -8.9376686817744123e-05 3.9953386427840043e-06 6.5900411970681763e-02 - 39 -9.9550461818177349e-05 -5.0740661672321608e-17 -4.2881244934311093e-02 - 40 8.9358399770403624e-05 3.9749130157660754e-06 6.5900379165395012e-02 - 41 -2.7578389951520938e-03 4.5756190415085270e-17 -4.1533158826483570e-02 - 42 2.9457391733397973e-04 -2.5037988057731659e-05 6.6888509865507983e-02 - 43 2.7484214272898382e-04 2.2246473326686944e-17 -4.2197913495242927e-02 - 44 -1.2589020697706568e-03 -1.1188638120596731e-03 6.5272346190055355e-02 - 45 -2.7578389951520886e-03 4.0782412948808019e-17 -4.1533158826483549e-02 - 46 2.9457391733400050e-04 -2.5037988057726919e-05 6.6888509865508053e-02 - 47 2.7484214272895785e-04 -3.1658915194813543e-17 -4.2197913495243017e-02 - 48 -1.2589020697706581e-03 -1.1188638120597041e-03 6.5272346190055328e-02 -run_vdwl: -1.23199571764252 + 1 3.6704505238833174e-03 -8.5656009736481448e-04 4.1191444583741792e-02 + 2 1.1686304633146372e-03 1.4729584018140481e-03 -7.1255303478677687e-02 + 3 -7.9006214430815506e-04 -8.9702261327957169e-04 4.1814552815387790e-02 + 4 5.0813941535022590e-04 7.5226549440562398e-05 -6.3436246326155160e-02 + 5 2.4094086316230620e-03 1.1493012829934986e-03 4.0583005477936335e-02 + 6 2.1422294207205303e-03 1.3655176116431427e-03 -6.6330437867913400e-02 + 7 4.8857202733681212e-04 -8.3890161524717316e-04 4.1010122743153174e-02 + 8 -2.6253592699607576e-04 -3.7449972132109170e-04 -6.8110534561197797e-02 + 9 -4.5618889139013158e-05 -4.8612181125458771e-04 4.2947567128669664e-02 + 10 8.4898584328510539e-04 2.5723125827342269e-04 -6.8511442790721785e-02 + 11 7.8987470721455393e-05 -8.1846109260194741e-04 4.4565180655765813e-02 + 12 1.0719941499454150e-03 1.5887178976417405e-04 -6.5290607843250886e-02 + 13 8.2976868796629660e-04 -2.7228777351535232e-04 4.4027286825985064e-02 + 14 1.2641799120364366e-04 8.4753137008232666e-04 -6.8776483710975236e-02 + 15 -9.3971909503349734e-04 -1.5103202526082864e-03 4.2886036167252596e-02 + 16 8.7567786967665388e-05 7.2956204355222173e-04 -6.5669769617765258e-02 + 17 4.3432017477567058e-04 -1.6965612487661948e-03 4.2744452842837566e-02 + 18 8.3941353084066473e-04 4.0493293883253476e-04 -6.3871438029649660e-02 + 19 -5.4381320918428999e-04 -9.7030380412054819e-04 4.3185603252586670e-02 + 20 -9.1930073722010328e-04 1.2861790483301410e-03 -6.0621042107391755e-02 + 21 4.7840221336411441e-04 -1.6393514669338562e-03 3.9777134110375104e-02 + 22 -7.9771913123767644e-05 7.4546176337635236e-04 -6.2148844940719448e-02 + 23 -2.6104288591186618e-03 9.2017355376193273e-04 4.1537243526647463e-02 + 24 -1.0255308653845333e-03 -5.4502867569371401e-04 -6.5373495496634057e-02 + 25 -9.4960140784434511e-04 -1.7019717784014579e-05 -4.2697506345307210e-02 + 26 1.2344722560936336e-03 -3.8349946011568149e-05 7.0636093375678902e-02 + 27 1.2428953995717636e-03 -1.6532144426257725e-03 -4.1748374073562071e-02 + 28 -6.5888091276410186e-04 6.9803078036718467e-05 6.2023125313055351e-02 + 29 -1.1714493859076639e-03 1.6597167563551329e-03 -4.3224957906713900e-02 + 30 8.9057038012172948e-04 -1.9959394520495783e-03 6.6249589884535359e-02 + 31 2.4328395299393108e-03 6.2211658698696536e-04 -4.1255680072499357e-02 + 32 -1.2886977697624180e-04 4.9707075886967940e-04 6.8385848619119949e-02 + 33 3.1108062630869678e-04 1.7256636914627522e-03 -4.3713256703242123e-02 + 34 -6.1682250345716956e-04 -1.0668475351233773e-04 6.7987777588143339e-02 + 35 7.8440122828677501e-04 5.7128161368852229e-04 -4.2120516004724093e-02 + 36 -1.3214342195871380e-03 -2.8705014290814758e-05 6.3580066381277237e-02 + 37 -1.7646996651863847e-03 1.2578520157736357e-03 -4.3118574062115451e-02 + 38 4.1583190169441463e-04 -3.0503217005470453e-05 7.0105349729387395e-02 + 39 -1.3062783065386561e-03 -1.1031484516492020e-03 -4.2166922219325394e-02 + 40 1.0305890899256890e-03 -3.4586178800178024e-04 6.2921201933323206e-02 + 41 -3.6508576993639027e-03 6.6871723181689390e-04 -4.0240881680364514e-02 + 42 -6.4043946608870108e-04 -2.6284729289265075e-04 6.8674098703166320e-02 + 43 -3.9082881164995934e-04 -2.2938708144633622e-04 -4.3609890368044239e-02 + 44 -1.2383724658718181e-03 -2.7315617816773988e-04 6.1613431116180284e-02 + 45 -2.2137967458001860e-03 -6.5794077112197777e-04 -3.8836095682756616e-02 + 46 1.0465055526229891e-03 1.4402940837347089e-04 6.3327626322980932e-02 + 47 3.9583157938213030e-04 8.6660222810260945e-04 -4.3627560931968463e-02 + 48 -1.6991928687015354e-03 1.5237729793566654e-04 6.3982023724488440e-02 +run_vdwl: -1.2323407220805949 run_coul: 0 run_stress: ! |- - -1.1008368563459114e+00 -1.1059521765455493e+00 1.9490358494782456e-01 0.0000000000000000e+00 0.0000000000000000e+00 -1.5182325192586004e-02 + -1.0997973993429271e+00 -1.1029717427552215e+00 1.9216131055165983e-01 -8.9401661692762907e-04 -2.6573168774115911e-02 4.9223159479302100e-03 run_forces: ! |2 - 1 2.7578115049012742e-03 -1.9626239461520076e-08 4.1533149398200540e-02 - 2 1.2588780003755895e-03 1.1188632817004094e-03 -6.5269251575709356e-02 - 3 -2.7478278369621328e-04 -8.0919896562527821e-09 4.2197938643984578e-02 - 4 -2.9453830408723066e-04 2.5020943380932455e-05 -6.6885376194640786e-02 - 5 2.7578115049012399e-03 -1.9626239401238435e-08 4.1533149398200533e-02 - 6 1.2588780003755804e-03 1.1188632817005241e-03 -6.5269251575709369e-02 - 7 -2.7478278369620027e-04 -8.0919897266175031e-09 4.2197938643984703e-02 - 8 -2.9453830408726275e-04 2.5020943380984985e-05 -6.6885376194640717e-02 - 9 -9.9547742435301782e-05 5.3780414950783170e-10 4.2881247142594836e-02 - 10 -8.9376031411733843e-05 -3.9945836714521966e-06 -6.5897312884941883e-02 - 11 9.9499863028555701e-05 5.3758629572208002e-10 4.2881237442533686e-02 - 12 8.9357744478893550e-05 -3.9741580967872346e-06 -6.5897280081132562e-02 - 13 -9.9547742435326502e-05 5.3780415244873009e-10 4.2881247142594815e-02 - 14 -8.9376031411742083e-05 -3.9945836714029874e-06 -6.5897312884941855e-02 - 15 9.9499863028584324e-05 5.3758624475780164e-10 4.2881237442533790e-02 - 16 8.9357744478909922e-05 -3.9741580967885712e-06 -6.5897280081132506e-02 - 17 2.7483809396297375e-04 -8.0923733428147151e-09 4.2197915708206225e-02 - 18 2.9456424811194113e-04 2.5041935720938094e-05 -6.6885362458577291e-02 - 19 -2.7578189357608937e-03 -1.9626405105166717e-08 4.1533136162484115e-02 - 20 -1.2588856574676647e-03 1.1188638484657578e-03 -6.5269270643456764e-02 - 21 2.7483809396295635e-04 -8.0923732598465674e-09 4.2197915708206198e-02 - 22 2.9456424811196807e-04 2.5041935720825544e-05 -6.6885362458577347e-02 - 23 -2.7578189357608239e-03 -1.9626405201000025e-08 4.1533136162484163e-02 - 24 -1.2588856574676222e-03 1.1188638484657888e-03 -6.5269270643456764e-02 - 25 -2.7478267042781689e-04 7.1340099726084627e-09 -4.2197938717095443e-02 - 26 1.2588775889140107e-03 -1.1188640762445925e-03 6.5269251688086116e-02 - 27 2.7578100488037834e-03 2.0885614337388253e-08 -4.1533148778323065e-02 - 28 -2.9453931478136321e-04 -2.5020438627362798e-05 6.6885376801770646e-02 - 29 -2.7478267042784551e-04 7.1340098782286636e-09 -4.2197938717095346e-02 - 30 1.2588775889140823e-03 -1.1188640762446068e-03 6.5269251688086075e-02 - 31 2.7578100488038111e-03 2.0885614449061077e-08 -4.1533148778323238e-02 - 32 -2.9453931478134934e-04 -2.5020438627452736e-05 6.6885376801770674e-02 - 33 9.9499775923898881e-05 -4.3747681398428797e-10 -4.2881238156016258e-02 - 34 -8.9376188707950260e-05 3.9944719903915248e-06 6.5897312332129893e-02 - 35 -9.9547655306991140e-05 -4.3773580745386231e-10 -4.2881247856090716e-02 - 36 8.9357901801402086e-05 3.9740463921778550e-06 6.5897279528304625e-02 - 37 9.9499775923880232e-05 -4.3747670817970846e-10 -4.2881238156016264e-02 - 38 -8.9376188707982352e-05 3.9944719903545984e-06 6.5897312332129851e-02 - 39 -9.9547655306996777e-05 -4.3773581847206689e-10 -4.2881247856090876e-02 - 40 8.9357901801374873e-05 3.9740463922260334e-06 6.5897279528304431e-02 - 41 -2.7578174796584810e-03 2.0885758518950235e-08 -4.1533135542592893e-02 - 42 2.9456525880115910e-04 -2.5041430978732462e-05 6.6885363065714659e-02 - 43 2.7483798066595783e-04 7.1344129854552851e-09 -4.2197915781289633e-02 - 44 -1.2588852460277825e-03 -1.1188646429977976e-03 6.5269270755856881e-02 - 45 -2.7578174796584042e-03 2.0885758549338389e-08 -4.1533135542592900e-02 - 46 2.9456525880111129e-04 -2.5041430978583333e-05 6.6885363065714618e-02 - 47 2.7483798066597242e-04 7.1344129112194118e-09 -4.2197915781289751e-02 - 48 -1.2588852460277678e-03 -1.1188646429978574e-03 6.5269270755856937e-02 + 1 3.6704277244667587e-03 -8.5658919117837212e-04 4.1191414175853695e-02 + 2 1.1686230931329173e-03 1.4729477662173724e-03 -7.1251760016220855e-02 + 3 -7.9004790339973381e-04 -8.9701338917496677e-04 4.1814539913402199e-02 + 4 5.0813591144889536e-04 7.5231239227128272e-05 -6.3433381263633765e-02 + 5 2.4093859320673192e-03 1.1492652204168237e-03 4.0582992641865316e-02 + 6 2.1421973197266243e-03 1.3655087332524118e-03 -6.6327289076912474e-02 + 7 4.8857125455762339e-04 -8.3890475839157330e-04 4.1010166991166115e-02 + 8 -2.6252293235319059e-04 -3.7448328717136416e-04 -6.8107296512654250e-02 + 9 -4.5617528947323408e-05 -4.8612919830625729e-04 4.2947563969449536e-02 + 10 8.4896568728670208e-04 2.5721668905168501e-04 -6.8508143024552937e-02 + 11 7.9002820038977370e-05 -8.1846278515754147e-04 4.4565168058603076e-02 + 12 1.0719661316084715e-03 1.5886888950254413e-04 -6.5287603573858155e-02 + 13 8.2976049917073613e-04 -2.7229626113208568e-04 4.4027260160056078e-02 + 14 1.2641994946759787e-04 8.4751320391575997e-04 -6.8773136978292557e-02 + 15 -9.3970695971524315e-04 -1.5103229550957231e-03 4.2886045691579347e-02 + 16 8.7570546763918677e-05 7.2954145458750382e-04 -6.5666736342869625e-02 + 17 4.3433078264718412e-04 -1.6965377983918077e-03 4.2744447240288586e-02 + 18 8.3939793364319669e-04 4.0492250115430891e-04 -6.3868398606238774e-02 + 19 -5.4383027722561142e-04 -9.7031407104404479e-04 4.3185570539974218e-02 + 20 -9.1928268785672915e-04 1.2861824709901476e-03 -6.0618292140364884e-02 + 21 4.7841090009416107e-04 -1.6393339301988938e-03 3.9777162973257008e-02 + 22 -7.9775883020756261e-05 7.4544527532379964e-04 -6.2146004596023145e-02 + 23 -2.6104093087951697e-03 9.2014438370599939e-04 4.1537221494509453e-02 + 24 -1.0255151864740422e-03 -5.4498519956392951e-04 -6.5370473552257946e-02 + 25 -9.4959169309045575e-04 -1.7018039012474395e-05 -4.2697496256975970e-02 + 26 1.2344495867245694e-03 -3.8370673380269758e-05 7.0632582403421879e-02 + 27 1.2428967009875331e-03 -1.6531608659394025e-03 -4.1748358234908044e-02 + 28 -6.5886686581895400e-04 6.9797448177834955e-05 6.2020287126584923e-02 + 29 -1.1714497050630706e-03 1.6597133714093197e-03 -4.3224947348511476e-02 + 30 8.9055962568533814e-04 -1.9959187617719560e-03 6.6246440342255547e-02 + 31 2.4328239392956154e-03 6.2214569312400931e-04 -4.1255663018001446e-02 + 32 -1.2886455296015837e-04 4.9705269314680080e-04 6.8382596224289494e-02 + 33 3.1106849764848282e-04 1.7256403450447376e-03 -4.3713239720373692e-02 + 34 -6.1681221359189548e-04 -1.0667622773528310e-04 6.7984487100161320e-02 + 35 7.8438614052878846e-04 5.7129184828285566e-04 -4.2120541014401894e-02 + 36 -1.3214010734594332e-03 -2.8698936855300100e-05 6.3577101615876680e-02 + 37 -1.7646787377185969e-03 1.2578426248841964e-03 -4.3118570210133822e-02 + 38 4.1581902109396034e-04 -3.0496800609577946e-05 7.0101977339004792e-02 + 39 -1.3062650414300365e-03 -1.1031265382733892e-03 -4.2166930126020727e-02 + 40 1.0305669350427777e-03 -3.4584238149556665e-04 6.2918234998817421e-02 + 41 -3.6508263792337666e-03 6.6871501711911641e-04 -4.0240875457830505e-02 + 42 -6.4043563425334902e-04 -2.6284078549004705e-04 6.8670949820558838e-02 + 43 -3.9082998872544492e-04 -2.2936260697189366e-04 -4.3609870908952908e-02 + 44 -1.2383631333186497e-03 -2.7316999371132289e-04 6.1610666172108003e-02 + 45 -2.2137870003022661e-03 -6.5791927225205161e-04 -3.8836093285544354e-02 + 46 1.0464904451784837e-03 1.4403449019820825e-04 6.3324762440917018e-02 + 47 3.9582054731925130e-04 8.6660577748977786e-04 -4.3627558648003627e-02 + 48 -1.6991672388720820e-03 1.5234757208263419e-04 6.3979020479536977e-02 ... diff --git a/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_z.yaml b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_z.yaml new file mode 100644 index 0000000000..e59d9851ea --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-kolmogorov_crespi_z.yaml @@ -0,0 +1,126 @@ +--- +lammps_version: 30 Jul 2021 +date_generated: Wed Aug 25 07:14:32 2021 +epsilon: 5e-13 +skip_tests: single +prerequisites: ! | + pair kolmogorov/crespi/z + atom full +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on + comm_modify cutoff 16.0 +post_commands: ! "" +input_file: in.bilayer +pair_style: hybrid/overlay kolmogorov/crespi/z 16.0 +pair_coeff: ! | + * * kolmogorov/crespi/z CC.KC C C C +extract: ! "" +natoms: 48 +init_vdwl: 198.0484319961999 +init_coul: 0 +init_stress: ! |2- + 9.0644144509597231e+02 8.9737534362016413e+02 7.8864194018366904e-02 1.3395398220874608e+01 -4.9535241455594091e-02 -4.1528134881522460e-02 +init_forces: ! |2 + 1 5.3348343168299364e+00 2.3256189721350444e+00 5.9504392386259146e-02 + 2 4.7785621527530342e+00 -4.8710602042279216e-01 -5.4545469377135704e-02 + 3 -1.1168915294289388e+00 -2.2258126428430529e+00 7.6694447112156047e-04 + 4 -8.7376468728230750e-01 9.4368851040723767e-01 -6.5035584323277940e-02 + 5 4.5198005903247083e+00 4.1074740900536115e+00 -8.7371673089977342e-03 + 6 5.4375288146880560e+00 -5.1433571466681745e+00 3.9305504185418012e-02 + 7 1.2208890790894600e+00 -8.1641085765920174e-01 -1.3352360017193796e-01 + 8 5.1272116716286398e-01 9.4573486892721448e-01 -2.3098407688269464e-02 + 9 -1.2245959963594422e+00 -2.0770946714225141e-01 6.9969480853388305e-02 + 10 -8.8885237560966313e-01 -2.0499261472624675e-01 -3.4810693026357802e-02 + 11 1.9468399313314946e+00 -1.4601851313728398e+00 1.7461147245031688e-01 + 12 -1.2551831833489862e+00 1.4409985043171267e+00 -4.8786671942592785e-02 + 13 1.7962484655931472e+00 4.6873536554649775e-01 1.2159470710170561e-01 + 14 6.6355426847723775e-01 7.5459771250948848e-01 -6.4703184753148332e-02 + 15 -1.8330891813231542e+00 -9.6544971678660785e-01 9.2874061497501575e-02 + 16 1.6495997243364415e+00 9.4316823200447530e-01 -8.2500788376204837e-02 + 17 -4.0551683248019244e-01 -1.3309232404571960e+00 1.3977808129699970e-01 + 18 -2.5936966695670343e+00 1.4487734047563544e-02 -3.5274782552890943e-01 + 19 -2.1849314733348804e+00 1.4963776468245567e+00 2.9708567327927388e-01 + 20 -5.3746957562109285e+00 -6.5377450284914451e-01 -2.0449521917474445e-01 + 21 1.3965321100494394e+00 -1.8059816967447822e+00 7.3098332187937036e-03 + 22 1.4817298761363022e+00 1.9756480967446886e+00 -1.8178328755798240e-01 + 23 -6.8319886477141365e+00 2.4816632014983186e+00 8.2288261378643118e-02 + 24 -6.1503292584983935e+00 -2.5975546507901619e+00 -7.7747869600525793e-02 + 25 -4.0689924035772707e-01 -6.9766837313218799e-01 5.4064280156258457e-04 + 26 5.4964695690187284e+00 4.4599199628874597e+00 -1.5558133808590582e-01 + 27 2.9588537182133194e+00 -4.4726792744060955e+00 -1.2562457242223085e-01 + 28 1.8598345487845340e+00 4.2753662763121908e-01 2.8228562141788732e-01 + 29 -1.4276121634554422e+00 1.7279605732811201e-01 -1.6954267562027564e-01 + 30 6.8063069498886151e+00 3.3265237574791175e+00 -1.1164523995449715e-02 + 31 3.3330705409412462e+00 -2.3935228868743899e+00 5.4308072787988736e-02 + 32 6.5570509945031452e-01 -2.4020200255842300e-01 1.2488157505501848e-03 + 33 -1.0518824551221366e+00 9.2103155336168557e-02 -1.3403035827576482e-01 + 34 1.7482905720327369e+00 -6.9882734694619375e-01 8.5963700326871298e-02 + 35 -4.7864899070045958e-01 5.5517876373522757e-01 -9.8516598579710055e-02 + 36 4.6225124648585708e-01 -7.6767830527676009e-02 2.3141667885030026e-01 + 37 -1.6763571363729157e+00 -2.6966956770052142e-01 -7.9944027029069206e-02 + 38 1.5531744170606854e+00 1.3208552831167166e+00 -4.3997039333437564e-02 + 39 -1.9055815073324109e+00 -1.2428954744396123e+00 2.1923526204960873e-02 + 40 9.2892557021092592e-01 8.5429365461048679e-01 2.1536217788766898e-01 + 41 -6.6580658991677408e+00 -2.3642327420628977e+00 2.0651675580736870e-01 + 42 1.0367950245250726e+00 -1.7458171945604464e-01 -3.8087724538496348e-02 + 43 -1.5035413732329261e+00 -4.8083649653131499e-01 -1.8931363891155159e-01 + 44 -3.4795302876086018e+00 4.7781264447100362e+00 1.5372288335058557e-01 + 45 -5.4074323973878604e+00 -5.2594483396748704e+00 8.3974349281692146e-02 + 46 2.0992650359812742e-01 1.2850079800303573e+00 8.8048698665581765e-02 + 47 9.4179948121221568e-01 -2.7853182799762966e-01 -2.4469757628271135e-01 + 48 -4.0011566962981933e+00 1.3785869488895595e+00 1.1261550665224510e-01 +run_vdwl: 198.00550676651036 +run_coul: 0 +run_stress: ! |2- + 9.0585872912972786e+02 8.9758748110647025e+02 7.8698273590959100e-02 1.3075281480044731e+01 -4.8004210940133248e-02 -4.0161387221796921e-02 +run_forces: ! |2 + 1 5.2047926052306615e+00 2.2473762345413713e+00 5.9584161887120422e-02 + 2 4.6851084413822441e+00 -4.5109570909076058e-01 -5.4631713906825148e-02 + 3 -1.0871364193814106e+00 -2.1758176996411080e+00 7.4359782647119219e-04 + 4 -8.4326816249892556e-01 9.1320184255414583e-01 -6.5081754962167560e-02 + 5 4.4077640872864858e+00 3.9987715974360869e+00 -8.8927779586276609e-03 + 6 5.2961853754680419e+00 -5.0091995670577543e+00 3.9531346151420128e-02 + 7 1.2232813384076739e+00 -7.8791514344192659e-01 -1.3366520068056503e-01 + 8 5.1780217527319117e-01 9.1100972674650826e-01 -2.3201828250186143e-02 + 9 -1.1995203432218362e+00 -2.1003683620550301e-01 7.0101271966858530e-02 + 10 -8.7081374776204634e-01 -1.9805140233706198e-01 -3.4922611021479207e-02 + 11 1.9105397974468521e+00 -1.4293028888308517e+00 1.7510054284391999e-01 + 12 -1.2360348257379639e+00 1.4116741818791763e+00 -4.8939093649939924e-02 + 13 1.7652214835045452e+00 4.7399251700912959e-01 1.2178382298739600e-01 + 14 6.5330363946844416e-01 7.3889002333158638e-01 -6.4786848085368900e-02 + 15 -1.8124305214064478e+00 -9.4915083795291133e-01 9.3101630312107816e-02 + 16 1.6219108447222075e+00 9.2796174511555340e-01 -8.2700791251682795e-02 + 17 -4.1251544698973341e-01 -1.2922662476541500e+00 1.4011406917661748e-01 + 18 -2.5570034807038446e+00 -4.9200132308853534e-03 -3.5347516590234479e-01 + 19 -2.1351583321036722e+00 1.4356976393975065e+00 2.9769355899243943e-01 + 20 -5.2454589471468500e+00 -6.0532361400571932e-01 -2.0491595935035967e-01 + 21 1.3537552322457542e+00 -1.7532382249360461e+00 7.5188508574378556e-03 + 22 1.4365722918861625e+00 1.9257045388296903e+00 -1.8217267708850063e-01 + 23 -6.6590997631958242e+00 2.3878062837927017e+00 8.2628510513121659e-02 + 24 -6.0126039818523171e+00 -2.5069716481174056e+00 -7.7863657685253315e-02 + 25 -3.8051133644700968e-01 -7.0070235165347861e-01 6.3129746853828397e-04 + 26 5.3520470921524552e+00 4.3283909827095890e+00 -1.5518428255682115e-01 + 27 2.8762473085047304e+00 -4.3529586341691164e+00 -1.2555733763592616e-01 + 28 1.8354657954975644e+00 4.3104037769018572e-01 2.8279096525716740e-01 + 29 -1.3746974494369300e+00 1.6368530839773068e-01 -1.6993837598648334e-01 + 30 6.6309050826647642e+00 3.2230008065601901e+00 -1.0765163657435461e-02 + 31 3.2562153401168414e+00 -2.3137944305780080e+00 5.4413474745743338e-02 + 32 6.5301371153639831e-01 -2.2920387673350820e-01 1.1847629503530972e-03 + 33 -1.0254564068259704e+00 9.4758329916654144e-02 -1.3435237894415628e-01 + 34 1.7199891938475140e+00 -6.8641678832453279e-01 8.6197024462564678e-02 + 35 -4.6383967769379036e-01 5.3907891364408822e-01 -9.8916740573149739e-02 + 36 4.5126364328583846e-01 -7.4609604284228470e-02 2.3187673050533439e-01 + 37 -1.6486423085242807e+00 -2.6734336022719585e-01 -8.0108728515440458e-02 + 38 1.5213997908194694e+00 1.2977726934903238e+00 -4.4040408696588443e-02 + 39 -1.8716947574176781e+00 -1.2174414924135113e+00 2.1972664763825492e-02 + 40 9.0881764590515479e-01 8.3247720986674256e-01 2.1574041468876645e-01 + 41 -6.4955140525184083e+00 -2.2774843374359843e+00 2.0620960628596371e-01 + 42 9.9538467078611481e-01 -1.6108870456182192e-01 -3.8291833141328536e-02 + 43 -1.4869366470437115e+00 -4.8493272764325579e-01 -1.8970248367384740e-01 + 44 -3.3928896765296992e+00 4.6562783524005944e+00 1.5372779614991433e-01 + 45 -5.2554020392703000e+00 -5.1162888483334887e+00 8.3656017747003500e-02 + 46 1.8331941409439106e-01 1.2759666131041416e+00 8.8227595664385206e-02 + 47 9.1776164643045643e-01 -2.8051166092520152e-01 -2.4525920026234527e-01 + 48 -3.9114393242553431e+00 1.3215307313717093e+00 1.1283729923235016e-01 +... diff --git a/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml new file mode 100644 index 0000000000..b2792314db --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-lebedeva_z.yaml @@ -0,0 +1,126 @@ +--- +lammps_version: 30 Jul 2021 +date_generated: Wed Aug 25 07:37:07 2021 +epsilon: 1e-13 +skip_tests: single +prerequisites: ! | + pair lebedeva/z + atom full +pre_commands: ! | + variable newton_pair delete + variable newton_pair index on + comm_modify cutoff 16.0 +post_commands: ! "" +input_file: in.bilayer +pair_style: hybrid/overlay lebedeva/z 16.0 +pair_coeff: ! | + * * lebedeva/z CC.Lebedeva C C C +extract: ! "" +natoms: 48 +init_vdwl: 2360.887727742073 +init_coul: 0 +init_stress: ! |2- + 7.1534438224572805e+03 7.1506071494705675e+03 1.2432957453131402e-01 6.0801570724187187e+01 -4.2416974189084528e-01 -4.1193916014148946e-01 +init_forces: ! |2 + 1 2.1495840130577207e+01 1.0830550834363393e+01 1.8137935918334763e-01 + 2 2.0432731679228027e+01 -2.9803402182512952e+00 2.9547234413851053e-01 + 3 -4.8985060153967197e+00 -9.7128366215365034e+00 -6.9787959311850667e-01 + 4 -3.6336312277240337e+00 4.1491536645549818e+00 -2.2535747714880212e-02 + 5 1.8637039516057627e+01 1.8350545450408632e+01 -8.4963587797541951e-01 + 6 2.1978509714772208e+01 -2.2896971858809632e+01 1.5851082487276531e+00 + 7 5.7882981559251903e+00 -3.2747398381846722e+00 -2.6785186626013253e+00 + 8 2.8011201872602243e+00 4.0130567460874573e+00 6.5391174106545358e-01 + 9 -5.5183912180745445e+00 -6.4520286657390269e-01 3.3999108034370462e-01 + 10 -3.5784163550133425e+00 -1.3312366585172366e+00 5.1839410343883674e-01 + 11 8.0095778679754766e+00 -6.4486468807024986e+00 1.9129315188663290e+00 + 12 -4.6638820420353078e+00 6.2807012948457972e+00 2.3504043197356642e-01 + 13 7.6647668430934512e+00 1.9936538042703436e+00 1.1077257631646276e+00 + 14 3.1311603921764752e+00 3.1681317810687362e+00 8.1724855683560527e-02 + 15 -7.4177741005960760e+00 -3.6505902172992770e+00 6.7596130715178948e-01 + 16 6.6349798189248572e+00 4.0113344780571598e+00 -2.4779218479758697e-01 + 17 -2.2003527625519665e+00 -5.7933643791213587e+00 1.3743201013525028e+00 + 18 -1.1422558611501209e+01 -8.5134419415816898e-02 -4.2438172886105301e+00 + 19 -8.9840415627894235e+00 7.7367145470319567e+00 3.6142925031041941e+00 + 20 -2.2423164044595801e+01 -3.3938768287238785e+00 -2.0489354166661800e+00 + 21 5.9629731843596563e+00 -6.9343942521608160e+00 -5.8664287078268817e-01 + 22 5.9735322471575731e+00 8.0207062046718356e+00 -1.7623238911668899e+00 + 23 -2.8380233720233623e+01 1.0629383056285256e+01 5.5374728115562033e-01 + 24 -2.5388637572879826e+01 -1.2036571731634098e+01 -1.6563407517598749e-01 + 25 -1.1960099659227481e+00 -2.9857363969328112e+00 7.0740379131610465e-01 + 26 2.1855105137482354e+01 1.9266727846260551e+01 -3.2075250208177759e+00 + 27 1.1983637463605305e+01 -1.9312471189040942e+01 -1.0914235916432231e+00 + 28 7.9838045946520513e+00 1.7083340737692789e+00 3.2133634689936934e+00 + 29 -5.4044069600908227e+00 7.9664368305733579e-01 -1.8142413401046531e+00 + 30 2.7745905271455314e+01 1.3837114040403961e+01 -1.0723560560378711e+00 + 31 1.4134615358350846e+01 -1.1778617115530899e+01 1.4851182928657196e+00 + 32 2.7028435497781427e+00 -9.1442329169715875e-01 -9.9390439365278682e-01 + 33 -4.2985646797249810e+00 -3.5098056165265207e-02 -1.2995310686118902e+00 + 34 8.0623725935775532e+00 -3.1802252812619694e+00 2.5059613168559131e-01 + 35 -2.0609840526644319e+00 2.4635581697784499e+00 -7.6644502196185194e-01 + 36 1.3862350630299518e+00 -8.1449634234505619e-01 2.4775330435834246e+00 + 37 -6.9582179612899253e+00 -8.6615786847650111e-01 -4.7949410796544534e-01 + 38 6.1801653738680029e+00 5.9380560495578978e+00 -1.7084039437786178e+00 + 39 -8.1244143916555842e+00 -5.2662515652224942e+00 1.0469396716401302e+00 + 40 3.9250266079613696e+00 3.5329495713403900e+00 2.2118775484068798e+00 + 41 -2.6931455570294290e+01 -9.9358510179082646e+00 3.5881896941421649e+00 + 42 3.7477747246379050e+00 -5.9755802511749734e-01 -1.5638895204839454e+00 + 43 -6.3748444831369673e+00 -1.5247249006280454e+00 -2.0982562793122876e+00 + 44 -1.4267039472778967e+01 2.0748902403760514e+01 1.2889303111832842e+00 + 45 -2.1335389998564661e+01 -2.2000115281198475e+01 1.8418216646303314e+00 + 46 1.9531801570887555e-01 5.1858679287942744e+00 3.7725144324396798e-01 + 47 4.4311536448901796e+00 -1.5561076109049006e+00 -2.9395615603743455e+00 + 48 -1.7383570366990149e+01 7.2896550849931154e+00 7.1972181231369481e-01 +run_vdwl: 2360.161327097515 +run_coul: 0 +run_stress: ! |2- + 7.1445643663484225e+03 7.1567044663163206e+03 1.4212147439906483e-01 5.5300304683013415e+01 -3.8306950064604117e-01 -3.7050895704103859e-01 +run_forces: ! |2 + 1 1.9420842377589814e+01 9.5013325689417290e+00 1.7609721453381699e-01 + 2 1.8737496812823327e+01 -2.3387226029304533e+00 2.8921104855356095e-01 + 3 -4.3186299346546519e+00 -8.7512311086837755e+00 -7.1766066501390724e-01 + 4 -3.1319003905903462e+00 3.5590072460392959e+00 -1.7526561412397581e-02 + 5 1.6792199910926755e+01 1.6365454560952386e+01 -8.7014653085458926e-01 + 6 1.9846363618686624e+01 -2.0547191727012070e+01 1.6401889500191840e+00 + 7 5.7060815032621450e+00 -2.7308400499434482e+00 -2.7349933966093021e+00 + 8 2.7832474870715203e+00 3.3541698848498811e+00 6.7444512159616843e-01 + 9 -5.0369085795409738e+00 -7.1557268283779596e-01 3.3931051877154195e-01 + 10 -3.2587873527306841e+00 -1.1421718240221135e+00 5.2120602713186126e-01 + 11 7.3473632320692364e+00 -5.8522771304925305e+00 1.9694215885096660e+00 + 12 -4.3709295021800614e+00 5.7558282413702671e+00 2.2798139296144487e-01 + 13 7.1157033827049156e+00 2.0708755120774378e+00 1.1223248028420918e+00 + 14 2.9354573009373257e+00 2.8768154160414960e+00 8.8449732870980000e-02 + 15 -7.0770925041064343e+00 -3.3845374889571276e+00 6.9850724887806404e-01 + 16 6.1301527532850457e+00 3.7577496751492410e+00 -2.6446269330583860e-01 + 17 -2.2230286618405661e+00 -5.0347473778524323e+00 1.4239799728780795e+00 + 18 -1.0680153318678943e+01 -4.6261341933955091e-01 -4.3648787425781155e+00 + 19 -8.1293677902039505e+00 6.5848221071033120e+00 3.7145536094962806e+00 + 20 -2.0282191094695960e+01 -2.6088565663707506e+00 -2.1059479066196873e+00 + 21 5.2175784187354264e+00 -6.0117971841792297e+00 -5.7199203340714710e-01 + 22 5.1792796776909444e+00 7.1430799174956237e+00 -1.8047321470174762e+00 + 23 -2.5542280937496248e+01 9.1486765335424298e+00 5.6899803320652897e-01 + 24 -2.3159629396461831e+01 -1.0537329911456288e+01 -1.7599965042786367e-01 + 25 -8.2943513848947825e-01 -3.0608845039274488e+00 7.4559253728086750e-01 + 26 1.9714500510226785e+01 1.7065989119046563e+01 -3.2695187340288125e+00 + 27 1.0655560826908285e+01 -1.7250583198713180e+01 -1.1064618206558723e+00 + 28 7.5120916165120573e+00 1.8342454816641347e+00 3.2947715166978280e+00 + 29 -4.5511588873314359e+00 5.4714534489459932e-01 -1.8543163433849958e+00 + 30 2.5056830873002568e+01 1.2224500875079812e+01 -1.0900210710668765e+00 + 31 1.2755552118209442e+01 -1.0312275039533361e+01 1.5249935384025117e+00 + 32 2.6130622723957986e+00 -6.6120078334970622e-01 -1.0317112350634094e+00 + 33 -3.8349355209272096e+00 1.7846636245871572e-05 -1.3306890346164337e+00 + 34 7.5576490353003374e+00 -2.9269687180604316e+00 2.6493636248773594e-01 + 35 -1.8356473512671103e+00 2.1374316961831799e+00 -8.1710932703289629e-01 + 36 1.2276849720950831e+00 -7.3662599658881855e-01 2.5433673098673775e+00 + 37 -6.5245701545521069e+00 -8.9514389622931190e-01 -4.9304572868283220e-01 + 38 5.6884643265805819e+00 5.5229894692236927e+00 -1.7348379610509388e+00 + 39 -7.5364203867882367e+00 -4.7990902146466885e+00 1.0719307064205941e+00 + 40 3.6004916907143132e+00 3.1260993214823030e+00 2.2699993659629172e+00 + 41 -2.4399724005125218e+01 -8.5963646372860989e+00 3.6630925900218325e+00 + 42 3.0786439237296608e+00 -2.9358018340297787e-01 -1.6007207650212871e+00 + 43 -6.0460115568958637e+00 -1.6664688787351791e+00 -2.1504955263884811e+00 + 44 -1.2868653460795150e+01 1.8641178885202173e+01 1.3109589266412400e+00 + 45 -1.9113266617394892e+01 -1.9622611791991883e+01 1.8639264872259769e+00 + 46 -1.6835385400618069e-01 5.0741627690987547e+00 3.9265433469144118e-01 + 47 3.9981010581382925e+00 -1.6376840923679119e+00 -3.0166184775741640e+00 + 48 -1.5751323302842609e+01 6.2857985368367890e+00 7.2298741386372622e-01 +... diff --git a/unittest/force-styles/tests/manybody-pair-mliap_so3.yaml b/unittest/force-styles/tests/manybody-pair-mliap_so3.yaml index cee70bc484..86fc0ac545 100644 --- a/unittest/force-styles/tests/manybody-pair-mliap_so3.yaml +++ b/unittest/force-styles/tests/manybody-pair-mliap_so3.yaml @@ -1,7 +1,7 @@ --- lammps_version: 27 May 2021 date_generated: Sun Jun 13 17:44:07 2021 -epsilon: 5e-13 +epsilon: 2.5e-11 skip_tests: prerequisites: ! | pair mliap diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml index 7d68718aae..cccc15256b 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_sw.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:17 2021 -epsilon: 1e-14 +epsilon: 1.5e-13 prerequisites: ! | pair polymorphic pre_commands: ! | diff --git a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml index 735ed0eaf9..0b12fd084c 100644 --- a/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml +++ b/unittest/force-styles/tests/manybody-pair-polymorphic_tersoff.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:09:17 2021 -epsilon: 1e-14 +epsilon: 1e-13 prerequisites: ! | pair polymorphic pre_commands: ! | diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml index 4667f63a75..1cc2cc5dec 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_long_cs.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:40 2021 -epsilon: 5e-14 +epsilon: 5e-13 prerequisites: ! | atom full pair buck/coul/long/cs diff --git a/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml b/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml index fed44214d8..25c4381ba5 100644 --- a/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_coul_table_cs.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 -epsilon: 5e-14 +epsilon: 5e-13 prerequisites: ! | atom full pair buck/coul/long/cs diff --git a/unittest/force-styles/tests/mol-pair-buck_mdf.yaml b/unittest/force-styles/tests/mol-pair-buck_mdf.yaml index 8f284c910c..7feefb9f51 100644 --- a/unittest/force-styles/tests/mol-pair-buck_mdf.yaml +++ b/unittest/force-styles/tests/mol-pair-buck_mdf.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:41 2021 -epsilon: 5e-14 +epsilon: 1e-13 prerequisites: ! | atom full pair buck/mdf diff --git a/unittest/force-styles/tests/mol-pair-cosine_squared.yaml b/unittest/force-styles/tests/mol-pair-cosine_squared.yaml index ee6faf6235..f787f65e84 100644 --- a/unittest/force-styles/tests/mol-pair-cosine_squared.yaml +++ b/unittest/force-styles/tests/mol-pair-cosine_squared.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:42 2021 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair cosine/squared diff --git a/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml index 20b467b728..27a1343e67 100644 --- a/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_cut_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:42 2021 -epsilon: 5e-14 +epsilon: 5e-13 prerequisites: ! | atom full pair hybrid/overlay diff --git a/unittest/force-styles/tests/mol-pair-coul_diel.yaml b/unittest/force-styles/tests/mol-pair-coul_diel.yaml index a417ee09bf..dfd541d659 100644 --- a/unittest/force-styles/tests/mol-pair-coul_diel.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_diel.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:42 2021 -epsilon: 1e-13 +epsilon: 2e-13 prerequisites: ! | atom full pair coul/diel diff --git a/unittest/force-styles/tests/mol-pair-coul_shield.yaml b/unittest/force-styles/tests/mol-pair-coul_shield.yaml index fa64e7d0cb..5b40743ea8 100644 --- a/unittest/force-styles/tests/mol-pair-coul_shield.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_shield.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:43 2021 -epsilon: 2.5e-13 +epsilon: 2.5e-12 prerequisites: ! | atom full pair coul/shield diff --git a/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml b/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml index d08bbf4c86..ea587bff0b 100644 --- a/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-coul_slater_cut.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:43 2021 -epsilon: 1e-13 +epsilon: 2e-13 prerequisites: ! | atom full pair coul/slater/cut diff --git a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml index c590c10dc7..68f23ae526 100644 --- a/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml +++ b/unittest/force-styles/tests/mol-pair-hybrid-overlay.yaml @@ -1,7 +1,7 @@ --- lammps_version: 8 Apr 2021 date_generated: Mon Apr 19 08:49:07 2021 -epsilon: 1.5e-13 +epsilon: 5e-13 prerequisites: ! | atom full pair lj/cut diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml index d9bd7786ba..f43a232db4 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_charmm_implicit.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:45 2021 -epsilon: 2.5e-13 +epsilon: 5e-13 prerequisites: ! | atom full pair lj/charmm/coul/charmm/implicit diff --git a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml index 0d956e0d3e..955d36491b 100644 --- a/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_charmm_coul_long_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:45 2021 -epsilon: 5e-13 +epsilon: 2.5e-12 prerequisites: ! | atom full pair lj/charmm/coul/long/soft diff --git a/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml index 75bf587fe9..c4bd4c2890 100644 --- a/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_class2_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:47 2021 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair lj/class2/soft diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml index 0dc745ca26..763470b674 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_cs.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:48 2021 -epsilon: 1e-13 +epsilon: 2e-13 prerequisites: ! | atom full pair lj/cut/coul/long/cs diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml index acd3ea4ce0..db9f33fa87 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_long_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:48 2021 -epsilon: 5e-13 +epsilon: 2.5e-12 prerequisites: ! | atom full pair lj/cut/coul/long/soft diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml index a02cad3f1b..7e0505220e 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_coul_msm.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:48 2021 -epsilon: 7e-14 +epsilon: 7.5e-14 skip_tests: gpu prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml index 77567c0a76..aaa232079c 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:49 2021 -epsilon: 5e-14 +epsilon: 7.5e-14 prerequisites: ! | atom full pair lj/cut/soft diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml index 027c91970e..e126838215 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:50 2021 -epsilon: 1e-13 +epsilon: 2.5e-13 prerequisites: ! | atom full pair lj/cut/tip4p/long/soft diff --git a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml index d09ccd2a68..fc31ce334c 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_long.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_long.yaml @@ -1,7 +1,7 @@ --- lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:57 2021 -epsilon: 2.5e-13 +epsilon: 5e-13 prerequisites: ! | atom full pair tip4p/long