diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 863d09e4ac..4b5894cd2e 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -98,6 +98,7 @@ OPT. * :doc:`manifoldforce ` * :doc:`meso/move ` * :doc:`momentum (k) ` + * :doc:`momentum/chunk ` * :doc:`move ` * :doc:`mscg ` * :doc:`msst ` diff --git a/doc/src/bond_style.rst b/doc/src/bond_style.rst index 52cc761da1..64fdeb95c9 100644 --- a/doc/src/bond_style.rst +++ b/doc/src/bond_style.rst @@ -98,6 +98,7 @@ accelerated styles exist. * :doc:`oxdna2/fene ` - same as oxdna but used with different pair styles * :doc:`oxrna2/fene ` - modified FENE bond suitable for RNA modeling * :doc:`quartic ` - breakable quartic bond +* :doc:`special ` - enable special bond exclusions for 1-5 pairs and beyond * :doc:`table ` - tabulated by bond length ---------- diff --git a/doc/src/fix.rst b/doc/src/fix.rst index d0fe0574da..3528645317 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -241,6 +241,7 @@ accelerated styles exist. * :doc:`manifoldforce ` - restrain atoms to a manifold during minimization * :doc:`meso/move ` - move mesoscopic SPH/SDPD particles in a prescribed fashion * :doc:`momentum ` - zero the linear and/or angular momentum of a group of atoms +* :doc:`momentum/chunk ` - zero the linear and/or angular momentum of a chunk of atoms * :doc:`move ` - move atoms in a prescribed fashion * :doc:`mscg ` - apply MSCG method for force-matching to generate coarse grain models * :doc:`msst ` - multi-scale shock technique (MSST) integration diff --git a/doc/src/fix_momentum.rst b/doc/src/fix_momentum.rst index 4e11859446..dbf599f29c 100644 --- a/doc/src/fix_momentum.rst +++ b/doc/src/fix_momentum.rst @@ -6,6 +6,9 @@ fix momentum command fix momentum/kk command ======================= +fix momentum/chunk command +========================== + Syntax """""" @@ -16,6 +19,16 @@ Syntax * ID, group-ID are documented in :doc:`fix ` command * momentum = style name of this fix command * N = adjust the momentum every this many timesteps + one or more keyword/value pairs may be appended +* keyword = *linear* or *angular* or *rescale* + + fix ID group-ID momentum/chunk N chunkID keyword values ... + +* ID, group-ID are documented in :doc:`fix ` command +* momentum/chunk = style name of this fix command +* N = adjust the momentum per chunk every this many timesteps +* chunkID = ID of :doc:`compute chunk/atom ` command + one or more keyword/value pairs may be appended * keyword = *linear* or *angular* or *rescale* @@ -24,9 +37,6 @@ Syntax *linear* values = xflag yflag zflag xflag,yflag,zflag = 0/1 to exclude/include each dimension *angular* values = none - - .. parsed-literal:: - *rescale* values = none Examples @@ -37,19 +47,22 @@ Examples fix 1 all momentum 1 linear 1 1 0 fix 1 all momentum 1 linear 1 1 1 rescale fix 1 all momentum 100 linear 1 1 1 angular + fix 1 all momentum/chunk 100 molchunk linear 1 1 1 angular Description """"""""""" -Zero the linear and/or angular momentum of the group of atoms every N -timesteps by adjusting the velocities of the atoms. One (or both) of -the *linear* or *angular* keywords must be specified. +Fix momentum zeroes the linear and/or angular momentum of the group of +atoms every N timesteps by adjusting the velocities of the atoms. +Fix momentum/chunk works equivalently, but operates on a per-chunk basis. + +One (or both) of the *linear* or *angular* keywords **must** be specified. If the *linear* keyword is used, the linear momentum is zeroed by -subtracting the center-of-mass velocity of the group from each atom. -This does not change the relative velocity of any pair of atoms. One -or more dimensions can be excluded from this operation by setting the -corresponding flag to 0. +subtracting the center-of-mass velocity of the group or chunk from each +atom. This does not change the relative velocity of any pair of atoms. +One or more dimensions can be excluded from this operation by setting +the corresponding flag to 0. If the *angular* keyword is used, the angular momentum is zeroed by subtracting a rotational component from each atom. @@ -60,7 +73,7 @@ to random perturbations (e.g. :doc:`fix langevin ` thermostatting). The *rescale* keyword enables conserving the kinetic energy of the group -of atoms by rescaling the velocities after the momentum was removed. +or chunk of atoms by rescaling the velocities after the momentum was removed. Note that the :doc:`velocity ` command can be used to create initial velocities with zero aggregate linear and/or angular momentum. @@ -71,15 +84,21 @@ initial velocities with zero aggregate linear and/or angular momentum. **Restart, fix_modify, output, run start/stop, minimize info:** -No information about this fix is written to :doc:`binary restart files `. None of the :doc:`fix_modify ` options -are relevant to this fix. No global or per-atom quantities are stored -by this fix for access by various :doc:`output commands `. +No information about this fix is written to :doc:`binary restart files +`. None of the :doc:`fix_modify ` options are +relevant to this fix. No global or per-atom quantities are stored by +this fix for access by various :doc:`output commands `. No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +the :doc:`run ` command. This fix is not invoked during +:doc:`energy minimization `. Restrictions """""""""""" - none + +Fix momentum/chunk is part of the USER-MISC package. It is only enabled +if LAMMPS was built with that package. See the :doc:`Build package +` doc page for more info. + Related commands """""""""""""""" diff --git a/src/USER-MISC/README b/src/USER-MISC/README index e085676711..d0f1266a93 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -59,6 +59,7 @@ fix gle, Michele Ceriotti (EPFL Lausanne), michele.ceriotti at gmail.com, 24 Nov fix grem, David Stelter, dstelter@bu.edu, 22 Nov 16 fix imd, Axel Kohlmeyer, akohlmey at gmail.com, 9 Nov 2009 fix ipi, Michele Ceriotti (EPFL Lausanne), michele.ceriotti at gmail.com, 24 Nov 2014 +fix momentum/chunk, Jiang Xiao (Hong Kong Polytechnic University), polyu-xiao.jiang at connect.polyu.hk, 19 Aug 2020 fix npt/cauchy, R. E. Miller (Carleton University), F. Pavia and S. Pattamatta, 12 Jan 2020 fix nvk, Efrem Braun (UC Berkeley), efrem.braun at gmail.com, https://github.com/lammps/lammps/pull/310 fix orient/eco Adrian A. Schratt and Volker Mohles (Ruhr-Uni Bochum), volker.mohles at rub.de, 6 Jun 2020 diff --git a/src/USER-MISC/fix_momentum_chunk.cpp b/src/USER-MISC/fix_momentum_chunk.cpp new file mode 100644 index 0000000000..fe6c2f5bea --- /dev/null +++ b/src/USER-MISC/fix_momentum_chunk.cpp @@ -0,0 +1,293 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "fix_momentum_chunk.h" +#include +#include +#include +#include "atom.h" +#include "compute.h" +#include "compute_chunk_atom.h" +#include "compute_com_chunk.h" +#include "domain.h" +#include "group.h" +#include "error.h" +#include "force.h" +#include "modify.h" +#include "fmt/format.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- + Contributing author: Jiang Xiao (Hong Kong Polytechnic University) +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- */ + +FixMomentumChunk::FixMomentumChunk(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), + cchunk(nullptr), ccom(nullptr), cvcm(nullptr), comega(nullptr) +{ + if (narg < 5) error->all(FLERR,"Illegal fix momentum/chunk command"); + + nevery = force->inumeric(FLERR,arg[3]); + if (nevery <= 0) error->all(FLERR,"Illegal fix momentum/chunk command"); + + id_chunk = arg[4]; + int icompute = modify->find_compute(id_chunk); + if (icompute < 0) + error->all(FLERR,"Chunk/atom compute does not exist for fix momentum/chunk"); + + id_com.clear(); + id_vcm.clear(); + id_omega.clear(); + + linear = angular = rescale = 0; + + int iarg = 5; + while (iarg < narg) { + if (strcmp(arg[iarg],"linear") == 0) { + if (iarg+4 > narg) error->all(FLERR,"Illegal fix momentum command"); + linear = 1; + xflag = force->inumeric(FLERR,arg[iarg+1]); + yflag = force->inumeric(FLERR,arg[iarg+2]); + zflag = force->inumeric(FLERR,arg[iarg+3]); + iarg += 4; + } else if (strcmp(arg[iarg],"angular") == 0) { + angular = 1; + iarg += 1; + } else if (strcmp(arg[iarg],"rescale") == 0) { + rescale = 1; + iarg += 1; + } else error->all(FLERR,"Illegal fix momentum/chunk command"); + } + + if (linear == 0 && angular == 0) + error->all(FLERR,"Illegal fix momentum/chunk command"); + + if (linear) + if (xflag < 0 || xflag > 1 || yflag < 0 || yflag > 1 || + zflag < 0 || zflag > 1) + error->all(FLERR,"Illegal fix momentum/chunk command"); + + dynamic_group_allow = 0; +} + +FixMomentumChunk::~FixMomentumChunk() +{ + if (!id_com.empty()) modify->delete_compute(id_com); + if (!id_vcm.empty()) modify->delete_compute(id_vcm); + if (!id_omega.empty()) modify->delete_compute(id_omega); +} + +/* ---------------------------------------------------------------------- */ + +int FixMomentumChunk::setmask() +{ + int mask = 0; + mask |= END_OF_STEP; + mask |= POST_RUN; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixMomentumChunk::init() +{ + // current indices for idchunk and idcom + + int icompute = modify->find_compute(id_chunk); + if (icompute < 0) + error->all(FLERR,"Chunk/atom compute does not exist for fix momentum/chunk"); + cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + if (strcmp(cchunk->style,"chunk/atom") != 0) + error->all(FLERR,"Fix momentum/chunk does not use chunk/atom compute"); + + // create computes dependent on chunks + + id_com = id + id_chunk + "_com"; + icompute = modify->find_compute(id_com); + if (icompute >= 0) modify->delete_compute(id_com); + auto cmd = fmt::format("{} {} com/chunk {}",id_com,group->names[igroup],id_chunk); + modify->add_compute(cmd); + icompute = modify->find_compute(id_com); + ccom = (ComputeCOMChunk *) modify->compute[icompute]; + + id_vcm = id + id_chunk + "_vcm"; + icompute = modify->find_compute(id_vcm); + if (icompute >= 0) modify->delete_compute(id_vcm); + cmd = fmt::format("{} {} vcm/chunk {}",id_vcm,group->names[igroup],id_chunk); + modify->add_compute(cmd); + icompute = modify->find_compute(id_vcm); + cvcm = modify->compute[icompute]; + + id_omega = id + id_chunk + "_omega"; + icompute = modify->find_compute(id_omega); + if (icompute >= 0) modify->delete_compute(id_omega); + cmd = fmt::format("{} {} omega/chunk {}",id_omega,group->names[igroup],id_chunk); + modify->add_compute(cmd); + icompute = modify->find_compute(id_omega); + comega = modify->compute[icompute]; +} + +/* ---------------------------------------------------------------------- */ + +void FixMomentumChunk::end_of_step() +{ + // calculate per-chunk properties. + // this will also trigger a compute/update of the chunks if needed. + + ccom->compute_array(); + cvcm->compute_array(); + comega->compute_array(); + + nchunk = cchunk->nchunk; + int *ichunk = cchunk->ichunk; + double **com = ccom->array; + double **vcm = cvcm->array; + double **omega = comega->array; + + + // apply removing translational and rotational velocity from atoms in each chunk + + double **v = atom->v; + int *mask = atom->mask; + const int nlocal = atom->nlocal; + + // compute per-chunk kinetic energy before momentum removal, if needed + + double *ke_chunk_old,*ke_chunk_new,*ke_chunk_local,*factor; + if (rescale) { + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + ke_chunk_old = new double[nchunk]; + ke_chunk_local = new double[nchunk]; + memset(ke_chunk_local,0,nchunk*sizeof(double)); + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int m = ichunk[i]-1; + if (m < 0) continue; + + if (rmass) + ke_chunk_local[m] += rmass[i] * + (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); + else + ke_chunk_local[m] += mass[type[i]] * + (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); + } + } + MPI_Allreduce(ke_chunk_local,ke_chunk_old,nchunk,MPI_DOUBLE,MPI_SUM,world); + } + + if (linear) { + + // adjust velocities by vcm to zero linear momentum + // only adjust a component if flag is set + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int m = ichunk[i]-1; + if (m < 0) continue; + if (xflag) v[i][0] -= vcm[m][0]; + if (yflag) v[i][1] -= vcm[m][1]; + if (zflag) v[i][2] -= vcm[m][2]; + } + } + } + + if (angular) { + + // adjust velocities to zero omega + // vnew_i = v_i - w x r_i + // must use unwrapped coords to compute r_i correctly + + double **x = atom->x; + imageint *image = atom->image; + double dx,dy,dz; + double unwrap[3]; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int m = ichunk[i]-1; + if (m < 0) continue; + domain->unmap(x[i],image[i],unwrap); + dx = unwrap[0] - com[m][0]; + dy = unwrap[1] - com[m][1]; + dz = unwrap[2] - com[m][2]; + v[i][0] -= omega[m][1]*dz - omega[m][2]*dy; + v[i][1] -= omega[m][2]*dx - omega[m][0]*dz; + v[i][2] -= omega[m][0]*dy - omega[m][1]*dx; + } + } + } + + // compute kinetic energy after momentum removal, if needed + + if (rescale) { + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + ke_chunk_new = new double[nchunk]; + factor = new double[nchunk]; + memset(ke_chunk_local,0,nchunk*sizeof(double)); + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int m = ichunk[i]-1; + if (m < 0) continue; + + if (rmass) + ke_chunk_local[m] += rmass[i] * + (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); + else + ke_chunk_local[m] += mass[type[i]] * + (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); + } + } + MPI_Allreduce(ke_chunk_local,ke_chunk_new,nchunk,MPI_DOUBLE,MPI_SUM,world); + + // get scaling factors + + for (int m = 0; m < nchunk; ++m) + factor[m] = (ke_chunk_new[0] > 0.0) ? sqrt(ke_chunk_old[m]/ke_chunk_new[m]) : 1.0; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + int m = ichunk[i]-1; + if (m < 0) continue; + v[i][0] *= factor[m]; + v[i][1] *= factor[m]; + v[i][2] *= factor[m]; + } + } + delete[] factor; + delete[] ke_chunk_local; + delete[] ke_chunk_old; + delete[] ke_chunk_new; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixMomentumChunk::post_run() +{ + modify->delete_compute(id_com); + modify->delete_compute(id_vcm); + modify->delete_compute(id_omega); + id_com.clear(); + id_vcm.clear(); + id_omega.clear(); +} diff --git a/src/USER-MISC/fix_momentum_chunk.h b/src/USER-MISC/fix_momentum_chunk.h new file mode 100644 index 0000000000..5e056f2494 --- /dev/null +++ b/src/USER-MISC/fix_momentum_chunk.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(momentum/chunk,FixMomentumChunk) + +#else + +#ifndef LMP_FIX_MOMENTUM_CHUNK_H +#define LMP_FIX_MOMENTUM_CHUNK_H + +#include "fix.h" +#include + +namespace LAMMPS_NS { + +class FixMomentumChunk : public Fix { + public: + FixMomentumChunk(class LAMMPS *, int, char **); + virtual ~FixMomentumChunk(); + int setmask(); + void init(); + void end_of_step(); + void post_run(); + + protected: + std::string id_chunk,id_com,id_vcm,id_omega; + int nchunk,linear,angular,rescale; + int xflag,yflag,zflag; + + class ComputeChunkAtom *cchunk; + class Compute *ccom,*cvcm,*comega; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Fix momentum group has no atoms + +Self-explanatory. + +*/ diff --git a/src/modify.cpp b/src/modify.cpp index 2d5dc4db8b..96335946ae 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -1193,7 +1193,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) for (int icompute = 0; icompute < ncompute; icompute++) if (strcmp(arg[0],compute[icompute]->id) == 0) - error->all(FLERR,"Reuse of compute ID"); + error->all(FLERR,fmt::format("Reuse of compute ID '{}'",arg[0])); // extend Compute list if necessary diff --git a/unittest/force-styles/test_fix_timestep.cpp b/unittest/force-styles/test_fix_timestep.cpp index 0ffb197f17..e5920199f9 100644 --- a/unittest/force-styles/test_fix_timestep.cpp +++ b/unittest/force-styles/test_fix_timestep.cpp @@ -516,9 +516,11 @@ TEST(FixTimestep, plain) std::cerr << "global_data, rmass, verlet: " << stats << std::endl; } - // rigid fixes need work to test properly with r-RESPA + // rigid fixes need work to test properly with r-RESPA. + // fix nve/limit cannot work with r-RESPA ifix = lmp->modify->find_fix("test"); - if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid")) { + if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") + && !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) { if (!verbose) ::testing::internal::CaptureStdout(); cleanup_lammps(lmp, test_config); diff --git a/unittest/force-styles/tests/fix-timestep-momentum.yaml b/unittest/force-styles/tests/fix-timestep-momentum.yaml new file mode 100644 index 0000000000..5b82c54496 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-momentum.yaml @@ -0,0 +1,74 @@ +--- +lammps_version: 21 Jul 2020 +date_generated: Wed Aug 19 14:56:05 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + fix momentum +pre_commands: ! "" +post_commands: ! | + fix move all nve + fix test solute momentum 4 linear 1 1 1 angular rescale +input_file: in.fourmol +natoms: 29 +run_pos: ! |2 + 1 -2.7092515033692477e-01 2.4909547171567490e+00 -1.6650992918211599e-01 + 2 3.0954549988676433e-01 2.9611416290394881e+00 -8.5411950217716393e-01 + 3 -7.0431792995848175e-01 1.2303187570596474e+00 -6.2754011103355645e-01 + 4 -1.5821522818499767e+00 1.4835219381658982e+00 -1.2536248061435553e+00 + 5 -9.0753313494283860e-01 9.2610421400699017e-01 3.9972148655336559e-01 + 6 2.4810270293053555e-01 2.8310251552593213e-01 -1.2313122853456071e+00 + 7 3.4128930295285081e-01 -2.2476292538227062e-02 -2.5291651920281844e+00 + 8 1.1741971987803124e+00 -4.8867181447314112e-01 -6.3781284375079017e-01 + 9 1.3798402136907204e+00 -2.5291599400215098e-01 2.8360404837916814e-01 + 10 2.0510248340781456e+00 -1.4603119912874782e+00 -9.8334408772854798e-01 + 11 1.7878340499906251e+00 -1.9919672711077894e+00 -1.8892624915574769e+00 + 12 3.0061739654045461e+00 -4.8983606213249270e-01 -1.6231114207152253e+00 + 13 4.0514549483020454e+00 -8.9161510285045298e-01 -1.6399533074575032e+00 + 14 2.6065958826476647e+00 -4.1746861259418605e-01 -2.6633228782182292e+00 + 15 2.9692844634545099e+00 5.5445862375426869e-01 -1.2339555368349708e+00 + 16 2.6747143873239354e+00 -2.4124125103945868e+00 -2.3678910780687939e-02 + 17 2.2152990283697127e+00 -2.0900254002918404e+00 1.1961127110799876e+00 + 18 2.1369701704387509e+00 3.0158507413735784e+00 -3.5179348337521246e+00 + 19 1.5355837136110213e+00 2.6255292355378788e+00 -4.2353987779926685e+00 + 20 2.7727573005692370e+00 3.6923910449614499e+00 -3.9330842459148463e+00 + 21 4.9040128073223732e+00 -4.0752348173024746e+00 -3.6210314709907143e+00 + 22 4.3582355554441348e+00 -4.2126119427289934e+00 -4.4612844196315846e+00 + 23 5.7439382849310530e+00 -3.5821957939278879e+00 -3.8766361295938432e+00 + 24 2.0689243582345447e+00 3.1513346907260744e+00 3.1550389754879204e+00 + 25 1.3045351331408428e+00 3.2665125705799474e+00 2.5111855257430324e+00 + 26 2.5809237402709839e+00 4.0117602605482086e+00 3.2212060529094253e+00 + 27 -1.9611343130335042e+00 -4.3563411931330958e+00 2.1098293115499511e+00 + 28 -2.7473562684512465e+00 -4.0200819932376648e+00 1.5830052163432808e+00 + 29 -1.3126000191361060e+00 -3.5962518039478280e+00 2.2746342468735210e+00 +run_vel: ! |2 + 1 7.7005442506551877e-03 1.6254943208678482e-02 5.2391698406439582e-03 + 2 4.9551716496531390e-03 5.0854323247987695e-03 -8.9320618875762662e-04 + 3 -8.5622241438673939e-03 -1.3158926269051859e-02 -3.8634909838605675e-03 + 4 -4.1063467058791185e-03 -6.7914727352814137e-03 -8.7233097556554398e-04 + 5 -1.1357391107616042e-02 -1.0307731333056340e-02 -2.6620008997986443e-03 + 6 -3.9891343495354357e-02 4.6788381459479139e-02 3.7259878616184190e-02 + 7 7.6440155294794422e-04 -9.9578168202591223e-03 -5.1503981227747637e-02 + 8 7.7481602383358290e-03 -3.3909462811272393e-03 3.4578349442072526e-02 + 9 1.3519497393498418e-03 3.5673054551750251e-03 1.5111979253235670e-02 + 10 2.9149953529739807e-02 -2.9154244515251084e-02 -1.5125050483704399e-02 + 11 -4.7527059304964623e-03 -3.5292468331570128e-03 -2.5486863981522955e-03 + 12 2.1428332421376153e-03 -5.0254211758299884e-05 -2.9856095438332143e-03 + 13 2.6677223913325137e-03 6.2221432827748654e-03 -7.4731632349203420e-04 + 14 3.4241029250251733e-03 -5.3700577020918414e-03 -3.8703343879204050e-03 + 15 -2.0991482435032353e-03 -5.6230508996015878e-03 6.5404618732815469e-03 + 16 1.8692958611369770e-02 -1.3262292808347639e-02 -4.5881360301899522e-02 + 17 -1.2955019770133578e-02 9.5253088675540769e-03 3.7093990195146913e-02 + 18 -8.0065786143888450e-04 -8.6270469849956098e-04 -1.4483041677008143e-03 + 19 1.2452390909960223e-03 -2.5061097108460230e-03 7.2998630856396024e-03 + 20 3.5930060275390276e-03 3.6938860325705287e-03 3.2322732637322096e-03 + 21 -1.4689220309278663e-03 -2.7352131892528189e-04 7.0581623729667694e-04 + 22 -7.0694199253179147e-03 -4.2577148934110857e-03 2.8079117556050300e-04 + 23 6.0446963126470979e-03 -1.4000131627188064e-03 2.5819754838770485e-03 + 24 3.1926365427529342e-04 -9.9445665072252177e-04 1.4999998574684873e-04 + 25 1.3789751822613832e-04 -4.4335895024089156e-03 -8.1808136833231562e-04 + 26 2.0485904030163515e-03 2.7813358630790546e-03 4.3245727163037546e-03 + 27 4.5604121009814566e-04 -1.0305522934457038e-03 2.1188057606121659e-04 + 28 -6.2544520858826367e-03 1.4127711184825813e-03 -1.8429821888491355e-03 + 29 6.4110631499494420e-04 3.1273432734981381e-03 3.7253671097253116e-03 +... diff --git a/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml new file mode 100644 index 0000000000..f568a9b082 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-momentum_chunk.yaml @@ -0,0 +1,75 @@ +--- +lammps_version: 21 Jul 2020 +date_generated: Wed Aug 19 15:06:58 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + fix momentum/chunk +pre_commands: ! "" +post_commands: ! | + fix move all nve + compute chunk all chunk/atom molecule + fix test solvent momentum/chunk 4 chunk linear 1 1 1 angular rescale +input_file: in.fourmol +natoms: 29 +run_pos: ! |2 + 1 -2.7045559776940059e-01 2.4912159905942945e+00 -1.6695851787754792e-01 + 2 3.1004029573983188e-01 2.9612354631105791e+00 -8.5466363036594983e-01 + 3 -7.0398551402051845e-01 1.2305509955829790e+00 -6.2777526943157458e-01 + 4 -1.5818159336498527e+00 1.4837407818931581e+00 -1.2538710836059535e+00 + 5 -9.0719763672748088e-01 9.2652103885793269e-01 3.9954210488439806e-01 + 6 2.4831720522392728e-01 2.8313021495830565e-01 -1.2314233331566868e+00 + 7 3.4143527642025906e-01 -2.2646551012341816e-02 -2.5292291415057555e+00 + 8 1.1743552228927270e+00 -4.8863228567364331e-01 -6.3783432909342697e-01 + 9 1.3800524229492390e+00 -2.5274721030435859e-01 2.8353985887000682e-01 + 10 2.0510765220351503e+00 -1.4604063740164097e+00 -9.8323745079722358e-01 + 11 1.7878031944362351e+00 -1.9921863272879650e+00 -1.8890602447585003e+00 + 12 3.0063007039363794e+00 -4.9013350498506214e-01 -1.6231898107164899e+00 + 13 4.0515402959203435e+00 -8.9202011605777409e-01 -1.6400005529900739e+00 + 14 2.6066963345537824e+00 -4.1789253965268658e-01 -2.6634003608790460e+00 + 15 2.9695287185713339e+00 5.5422613165265810e-01 -1.2342022021788850e+00 + 16 2.6747029695037829e+00 -2.4124119054379340e+00 -2.3435746114550009e-02 + 17 2.2153577785238219e+00 -2.0897985186931010e+00 1.1963150794533741e+00 + 18 2.1366105970627123e+00 3.0161599580510399e+00 -3.5187457033771303e+00 + 19 1.5347324041794299e+00 2.6269830802828062e+00 -4.2364139965880332e+00 + 20 2.7733999524106205e+00 3.6919554439456537e+00 -3.9335794185327781e+00 + 21 4.9054080935531896e+00 -4.0749170558994008e+00 -3.6221798333564097e+00 + 22 4.3598334200959119e+00 -4.2110652924725507e+00 -4.4627584709128509e+00 + 23 5.7436581434986254e+00 -3.5782602539408330e+00 -3.8762571951349565e+00 + 24 2.0680638887755789e+00 3.1522780027243096e+00 3.1544857033001050e+00 + 25 1.3029441343422379e+00 3.2687312534589186e+00 2.5117363129771140e+00 + 26 2.5824876294880181e+00 4.0113970037463691e+00 3.2187565531279607e+00 + 27 -1.9611343130357228e+00 -4.3563411931359752e+00 2.1098293115523705e+00 + 28 -2.7473562684513411e+00 -4.0200819932379330e+00 1.5830052163433954e+00 + 29 -1.3126000191360072e+00 -3.5962518039483111e+00 2.2746342468737759e+00 +run_vel: ! |2 + 1 8.1705743682217672e-03 1.6516406260336319e-02 4.7902265526728180e-03 + 2 5.4501493470307926e-03 5.1791699444061756e-03 -1.4372931390219934e-03 + 3 -8.2298293123878579e-03 -1.2926551614512290e-02 -4.0984180762662524e-03 + 4 -3.7699042588338477e-03 -6.5722892093522259e-03 -1.1184640351803122e-03 + 5 -1.1021961003142667e-02 -9.8906780902275216e-03 -2.8410737807552959e-03 + 6 -3.9676663245182972e-02 4.6817061399691134e-02 3.7148492025503965e-02 + 7 9.1033955088063920e-04 -1.0128524318392149e-02 -5.1568251854024527e-02 + 8 7.9064711503765879e-03 -3.3507255030852494e-03 3.4557098539932794e-02 + 9 1.5644176092493192e-03 3.7365546094037198e-03 1.5047408819177203e-02 + 10 2.9201446758876440e-02 -2.9249578700648277e-02 -1.5018077360191942e-02 + 11 -4.7835961770116330e-03 -3.7481384912218460e-03 -2.3464104010745344e-03 + 12 2.2696451917719684e-03 -3.4774159319509286e-04 -3.0640769620418336e-03 + 13 2.7531740485974765e-03 5.8171061891998613e-03 -7.9467453244699132e-04 + 14 3.5246182353144665e-03 -5.7939995507701909e-03 -3.9478431158352766e-03 + 15 -1.8547943638585198e-03 -5.8554729933366269e-03 6.2938485145085385e-03 + 16 1.8681499911911231e-02 -1.3262466144640238e-02 -4.5638651340895918e-02 + 17 -1.2896269995828089e-02 9.7527665190860428e-03 3.7296535378544979e-02 + 18 -1.1597964643950771e-03 -5.5275601117699602e-04 -2.2596898317004273e-03 + 19 3.9437769178642850e-04 -1.0524992231078548e-03 6.2843375981024080e-03 + 20 4.2354440002654982e-03 3.2590603306157590e-03 2.7361770536408364e-03 + 21 -7.3166083961043220e-05 4.3153693824293766e-05 -4.4291122723026888e-04 + 22 -5.4710524890446760e-03 -2.7110168901437028e-03 -1.1941441295444857e-03 + 23 5.7631260838904861e-03 2.5387505366123607e-03 2.9622129851031927e-03 + 24 -5.4151131048706092e-04 -5.0897084827800265e-05 -4.0258550718128802e-04 + 25 -1.4539138931934654e-03 -2.2135919688303011e-03 -2.6583939032311793e-04 + 26 3.6155869873532292e-03 2.4167693664445132e-03 1.8729309544673661e-03 + 27 4.5604120293354369e-04 -1.0305523026922869e-03 2.1188058381354328e-04 + 28 -6.2544520861855194e-03 1.4127711176146755e-03 -1.8429821884794262e-03 + 29 6.4110631527495069e-04 3.1273432719001841e-03 3.7253671105393661e-03 +... diff --git a/unittest/force-styles/tests/fix-timestep-nve_limit.yaml b/unittest/force-styles/tests/fix-timestep-nve_limit.yaml new file mode 100644 index 0000000000..b95f4a9846 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-nve_limit.yaml @@ -0,0 +1,74 @@ +--- +lammps_version: 21 Jul 2020 +date_generated: Wed Aug 19 14:50:41 202 +epsilon: 1e-14 +prerequisites: ! | + atom full + fix nve/limit +pre_commands: ! "" +post_commands: ! | + fix test solute nve/limit 0.01 +input_file: in.fourmol +natoms: 29 +global_scalar: 28 +run_pos: ! |2 + 1 -2.7045476575499366e-01 2.4912156638184872e+00 -1.6695941488254973e-01 + 2 3.1004030422415141e-01 2.9612354905349978e+00 -8.5466361481353093e-01 + 3 -7.0393594490108291e-01 1.2305008035255922e+00 -6.2781378812906086e-01 + 4 -1.5818172998763622e+00 1.4837434420964457e+00 -1.2538679649106050e+00 + 5 -9.0719528441302533e-01 9.2651829277376818e-01 3.9954165679702447e-01 + 6 2.6056670101218099e-01 2.6826291314228440e-01 -1.2454131423495634e+00 + 7 3.4131519586188186e-01 -2.1332927950157451e-02 -2.5226710871848397e+00 + 8 1.1745681001086989e+00 -4.8880555510768764e-01 -6.3767047336122595e-01 + 9 1.3800388768125751e+00 -2.5273044808068107e-01 2.8354022342291846e-01 + 10 2.0507159009620417e+00 -1.4600439328150543e+00 -9.8304531314454335e-01 + 11 1.7878036263333670e+00 -1.9921873120582470e+00 -1.8890597602487673e+00 + 12 3.0063008847742978e+00 -4.9013357181531525e-01 -1.6231896519255256e+00 + 13 4.0515402963264480e+00 -8.9202011521631330e-01 -1.6400005533730235e+00 + 14 2.6066963318242546e+00 -4.1789254044594215e-01 -2.6634003594740165e+00 + 15 2.9695287180539580e+00 5.5422613133929632e-01 -1.2342022026084725e+00 + 16 2.6727695955669715e+00 -2.4110327589195606e+00 -1.8648828555045269e-02 + 17 2.2153515531266841e+00 -2.0897945109627245e+00 1.1963278183531210e+00 + 18 2.1384791188033843e+00 3.0177261773770208e+00 -3.5160827596876225e+00 + 19 1.5349125211132961e+00 2.6315969880333707e+00 -4.2472859440220647e+00 + 20 2.7641167828863153e+00 3.6833419064000221e+00 -3.9380850623312638e+00 + 21 4.9064454390208301e+00 -4.0751205255383196e+00 -3.6215576073601046e+00 + 22 4.3687453488627543e+00 -4.2054270536772504e+00 -4.4651491269372565e+00 + 23 5.7374928154769504e+00 -3.5763355905184966e+00 -3.8820297194230728e+00 + 24 2.0684115301174013e+00 3.1518221747664397e+00 3.1554242678474576e+00 + 25 1.2998381073113014e+00 3.2755513587518097e+00 2.5092990173114837e+00 + 26 2.5807438597688113e+00 4.0120175892854135e+00 3.2133398379059099e+00 + 27 -1.9613581876744359e+00 -4.3556300596085160e+00 2.1101467673534788e+00 + 28 -2.7406520384725965e+00 -4.0207251278130975e+00 1.5828689861678511e+00 + 29 -1.3108232656499081e+00 -3.5992986322410760e+00 2.2680459788743503e+00 +run_vel: ! |2 + 1 8.1732003057504062e-03 1.6514828420489739e-02 4.7872115825042917e-03 + 2 5.4501984055902123e-03 5.1793290501538332e-03 -1.4372006388551327e-03 + 3 -8.0610739455692880e-03 -1.3095521561394886e-02 -4.2266823695085408e-03 + 4 -3.7739182466966399e-03 -6.5640956178167256e-03 -1.1086873700633861e-03 + 5 -1.1014317623957239e-02 -9.8992879261119594e-03 -2.8426784786513113e-03 + 6 -2.2746202359584897e-02 2.6501461285527265e-02 1.9500841724102939e-02 + 7 7.1795466366918702e-04 -7.6899595133329566e-03 -3.9247280973135144e-02 + 8 8.5447554616147666e-03 -3.8712033854644231e-03 3.5042706956272054e-02 + 9 1.5218732877891332e-03 3.7909074575394179e-03 1.5051828340156633e-02 + 10 2.6568059693981929e-02 -2.6610736060597027e-02 -1.3638435775786530e-02 + 11 -4.7814685417362354e-03 -3.7519869862352338e-03 -2.3422093312329933e-03 + 12 2.2701033959982354e-03 -3.4790952380024665e-04 -3.0630012321413635e-03 + 13 2.7530737198003781e-03 5.8168334149720693e-03 -7.9452451180343049e-04 + 14 3.5246400957674416e-03 -5.7940527015023580e-03 -3.9478518870560801e-03 + 15 -1.8545510957970676e-03 -5.8553785322346154e-03 6.2936138897817578e-03 + 16 1.4662001099180024e-02 -1.0397429516967713e-02 -3.5734005977602519e-02 + 17 -1.2697780981636615e-02 9.5993773334601788e-03 3.6696298354905482e-02 + 18 -6.0936815808025862e-04 -9.3774557532468582e-04 -3.3558072507805731e-04 + 19 -6.9919768291957119e-04 -3.6060777270430031e-03 4.2833405289822791e-03 + 20 4.7777805013736515e-03 5.1003745845520452e-03 1.8002873923729241e-03 + 21 -9.5568188553430398e-04 1.6594630943762931e-04 -1.8199788009966615e-04 + 22 -3.3137518957653462e-03 -2.8683968287936054e-03 3.6384389958326871e-03 + 23 2.4209481134686401e-04 -4.5457709985051130e-03 2.7663581642115042e-03 + 24 2.5447450568861086e-04 4.8412447786110117e-04 -4.8021914527341357e-04 + 25 4.3722771097312743e-03 -4.5184411669545515e-03 2.5200952006556795e-03 + 26 -1.9250110555001179e-03 -3.0342169883610837e-03 3.5062814567984532e-03 + 27 -2.6510179146429716e-04 3.6306203629019116e-04 -5.6235585400647747e-04 + 28 -2.3068708109787484e-04 -8.5663070212203200e-04 2.1302563179109169e-03 + 29 -2.5054744388303732e-03 -1.6773997805290820e-04 2.8436699761004796e-03 +...