Skip to content

Commit

Permalink
Merge pull request lammps#4291 from lammps/extend-verlet-split
Browse files Browse the repository at this point in the history
Add error checks to verlet/split for unsupported KSpace methods
  • Loading branch information
akohlmey authored Aug 22, 2024
2 parents f36e097 + c8b485a commit 9e314b6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion doc/src/run_style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ only if the OPENMP package was included. See the :doc:`Build package
<Build_package>` page for more info.

Run style *verlet/split* is not compatible with kspace styles from
the INTEL package and it is not compatible with any TIP4P styles.
the INTEL package and it is not compatible with any tip4p, dipole,
or spin kspace styles.

Whenever using rRESPA, the user should experiment with trade-offs in
speed and accuracy for their system, and verify that they are
Expand Down
25 changes: 17 additions & 8 deletions src/REPLICA/verlet_split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,23 @@ void VerletSplit::init()
if (!force->kspace && comm->me == 0)
error->warning(FLERR,"A KSpace style must be defined with verlet/split");

if (force->kspace_match("/tip4p",0)) tip4p_flag = 1;
else tip4p_flag = 0;
// error for as-yet unsupported verlet/split KSpace options

// currently TIP4P does not work with verlet/split, so generate error
// see Axel email on this, also other TIP4P notes below
int errflag = 0;
if (!atom->q_flag) errflag = 1;
if (force->kspace->tip4pflag) errflag = 1;
if (force->kspace->dipoleflag) errflag = 1;
if (force->kspace->spinflag) errflag = 1;

if (tip4p_flag) error->all(FLERR,"Verlet/split does not yet support TIP4P");
if (errflag)
error->all(FLERR,"Verlet/split cannot (yet) be used with kpace style {}", force->kspace_style);

// partial support for TIP4P, see where this flag is used below

tip4pflag = force->kspace->tip4pflag;

// invoke parent Verlet init

Verlet::init();
}

Expand Down Expand Up @@ -402,7 +411,7 @@ void VerletSplit::run(int n)

// TIP4P PPPM puts forces on ghost atoms, so must reverse_comm()

if (tip4p_flag && force->newton) {
if (tip4pflag && force->newton) {
comm->reverse_comm();
timer->stamp(Timer::COMM);
}
Expand Down Expand Up @@ -485,7 +494,7 @@ void VerletSplit::rk_setup()
// could do this by calling r2k_comm() here and not again from run()
// except that forward_comm() in r2k_comm() is wrong

if (tip4p_flag) {
if (tip4pflag) {
//r2k_comm();
MPI_Gatherv(atom->type,n,MPI_INT,atom->type,qsize,qdisp,MPI_INT,0,block);
MPI_Gatherv(atom->tag,n,MPI_LMP_TAGINT,
Expand Down Expand Up @@ -543,7 +552,7 @@ void VerletSplit::r2k_comm()

// for TIP4P, Kspace partition needs to update its ghost atoms

if (tip4p_flag && !master) {
if (tip4pflag && !master) {
timer->stamp();
comm->forward_comm();
timer->stamp(Timer::COMM);
Expand Down
3 changes: 2 additions & 1 deletion src/REPLICA/verlet_split.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class VerletSplit : public Verlet {
int ratio; // ratio of Rspace procs to Kspace procs
int *qsize, *qdisp, *xsize, *xdisp; // MPI gather/scatter params for block comm
MPI_Comm block; // communicator within one block
int tip4p_flag; // 1 if PPPM/tip4p so do extra comm

int tip4pflag; // 1 if Kspace method sets tip4pflag

double **f_kspace; // copy of Kspace forces on Rspace procs
int maxatom;
Expand Down
2 changes: 1 addition & 1 deletion src/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,7 @@ void *Atom::extract(const char *name)
return (void *) eff_plastic_strain_rate;
if (strcmp(name, "damage") == 0) return (void *) damage;

// DPD-REACT pakage
// DPD-REACT package

if (strcmp(name,"dpdTheta") == 0) return (void *) dpdTheta;

Expand Down

0 comments on commit 9e314b6

Please sign in to comment.