add proper r-RESPA support for fix cmap

This commit is contained in:
Axel Kohlmeyer
2021-03-30 07:36:53 -04:00
parent ea105a3c9a
commit 3041561383
3 changed files with 18 additions and 6 deletions

View File

@ -127,6 +127,11 @@ the :doc:`run <run>` command.
The forces due to this fix are imposed during an energy minimization,
invoked by the :doc:`minimize <minimize>` command.
The :doc:`fix_modify <fix_modify>` *respa* option is supported by this
fix. This allows to set at which level of the :doc:`r-RESPA
<run_style>` integrator the fix is adding its forces. Default is the
outermost level.
.. note::
If you want the potential energy associated with the CMAP terms

View File

@ -81,6 +81,8 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) :
extvector = 1;
wd_header = 1;
wd_section = 1;
respa_level_support = 1;
ilevel_respa = 0;
MPI_Comm_rank(world,&me);
MPI_Comm_size(world,&nprocs);
@ -182,6 +184,11 @@ void FixCMAP::init()
// define newton_bond here in case restart file was read (not data file)
newton_bond = force->newton_bond;
if (utils::strmatch(update->integrate_style,"^respa")) {
ilevel_respa = ((Respa *) update->integrate)->nlevels-1;
if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa);
}
}
/* --------------------------------------------------------------------- */
@ -190,12 +197,12 @@ void FixCMAP::setup(int vflag)
{
pre_neighbor();
if (strstr(update->integrate_style,"verlet"))
if (utils::strmatch(update->integrate_style,"^verlet"))
post_force(vflag);
else {
((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1);
post_force_respa(vflag,nlevels_respa-1,0);
((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1);
((Respa *) update->integrate)->copy_flevel_f(ilevel_respa);
post_force_respa(vflag,ilevel_respa,0);
((Respa *) update->integrate)->copy_f_flevel(ilevel_respa);
}
}
@ -596,7 +603,7 @@ void FixCMAP::post_force(int vflag)
void FixCMAP::post_force_respa(int vflag, int ilevel, int /*iloop*/)
{
if (ilevel == nlevels_respa-1) post_force(vflag);
if (ilevel == ilevel_respa) post_force(vflag);
}
/* ---------------------------------------------------------------------- */

View File

@ -67,7 +67,7 @@ class FixCMAP : public Fix {
private:
int nprocs,me;
int newton_bond,eflag_caller;
int ctype,nlevels_respa;
int ctype,ilevel_respa;
int ncrosstermtypes,crossterm_per_atom,maxcrossterm;
int ncrosstermlist;
bigint ncmap;