Merge pull request #1850 from lammps/kspace-bugfix

move two_charge_force calc to occur at init, not constructor, fix small bug in pair style extep
This commit is contained in:
Axel Kohlmeyer
2020-01-22 12:38:33 -05:00
committed by GitHub
12 changed files with 59 additions and 10 deletions

View File

@ -210,6 +210,10 @@ void PPPMKokkos<DeviceType>::init()
error->all(FLERR,str);
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -112,6 +112,10 @@ void Ewald::init()
"and slab correction");
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -76,10 +76,10 @@ void EwaldDipole::init()
if (dipoleflag && q2)
error->all(FLERR,"Cannot (yet) use charges with Kspace style EwaldDipole");
triclinic_check();
// no triclinic ewald dipole (yet)
triclinic_check();
triclinic = domain->triclinic;
if (triclinic)
error->all(FLERR,"Cannot (yet) use EwaldDipole with triclinic box");
@ -100,6 +100,10 @@ void EwaldDipole::init()
error->all(FLERR,"Incorrect boundaries with slab EwaldDipole");
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -70,10 +70,10 @@ void EwaldDipoleSpin::init()
spinflag = atom->sp?1:0;
triclinic_check();
// no triclinic ewald spin (yet)
triclinic_check();
triclinic = domain->triclinic;
if (triclinic)
error->all(FLERR,"Cannot (yet) use EwaldDipoleSpin with triclinic box");
@ -94,6 +94,10 @@ void EwaldDipoleSpin::init()
error->all(FLERR,"Incorrect boundaries with slab EwaldDipoleSpin");
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
pair_check();

View File

@ -181,6 +181,10 @@ void MSM::init()
error->all(FLERR,"Cannot (yet) use single precision with MSM "
"(remove -DFFT_SINGLE from Makefile and re-compile)");
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -225,6 +225,10 @@ void PPPM::init()
error->all(FLERR,str);
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -149,6 +149,10 @@ void PPPMDipole::init()
error->all(FLERR,str);
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -129,6 +129,10 @@ void PPPMDipoleSpin::init()
error->all(FLERR,str);
}
// compute two charge force
two_charge();
// extract short-range Coulombic cutoff from pair style
triclinic = domain->triclinic;

View File

@ -259,7 +259,10 @@ void PPPMDisp::init()
if (logfile) fprintf(logfile,"PPPMDisp initialization ...\n");
}
// error check
triclinic_check();
if (domain->dimension == 2)
error->all(FLERR,"Cannot use PPPMDisp with 2d simulation");
if (comm->style != 0)
@ -280,6 +283,10 @@ void PPPMDisp::init()
error->all(FLERR,str);
}
// compute two charge force
two_charge();
// free all arrays previously allocated
deallocate();

View File

@ -719,8 +719,8 @@ void PairExTeP::read_file(char *file)
words = new char*[params_per_line+1];
// intialize F_corr_data to all zeros
for (int iel=0;iel<atom->ntypes;iel++)
for (int jel=0;jel<atom->ntypes;jel++)
for (int iel=0;iel<nelements;iel++)
for (int jel=0;jel<nelements;jel++)
for (int in=0;in<4;in++)
for (int jn=0;jn<4;jn++)
for (int ivar=0;ivar<3;ivar++)

View File

@ -39,7 +39,8 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp)
virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0;
triclinic_support = 1;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag =
dipoleflag = spinflag = 0;
compute_flag = 1;
group_group_enable = 0;
stagger_flag = 0;
@ -78,9 +79,6 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp)
accuracy_absolute = -1.0;
accuracy_real_6 = -1.0;
accuracy_kspace_6 = -1.0;
two_charge_force = force->qqr2e *
(force->qelectron * force->qelectron) /
(force->angstrom * force->angstrom);
neighrequest_flag = 1;
mixflag = 0;
@ -158,6 +156,17 @@ KSpace::~KSpace()
memory->destroy(dgcons);
}
/* ----------------------------------------------------------------------
calculate this in init() so that units are finalized
------------------------------------------------------------------------- */
void KSpace::two_charge()
{
two_charge_force = force->qqr2e *
(force->qelectron * force->qelectron) /
(force->angstrom * force->angstrom);
}
/* ---------------------------------------------------------------------- */
void KSpace::triclinic_check()

View File

@ -95,6 +95,7 @@ class KSpace : protected Pointers {
KSpace(class LAMMPS *);
virtual ~KSpace();
void two_charge();
void triclinic_check();
void modify_params(int, char **);
void *extract(const char *);