more thorough checks on valid numbers when computing box/virial related properties

This commit is contained in:
Axel Kohlmeyer
2016-08-01 11:52:07 -04:00
parent a8f40013b7
commit ef2f16a240
3 changed files with 27 additions and 0 deletions

View File

@ -232,18 +232,27 @@ void Ewald::setup()
kzmax = 1;
err = rms(kxmax,xprd,natoms,q2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kxmax++;
err = rms(kxmax,xprd,natoms,q2);
}
err = rms(kymax,yprd,natoms,q2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kymax++;
err = rms(kymax,yprd,natoms,q2);
}
err = rms(kzmax,zprd_slab,natoms,q2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kzmax++;
err = rms(kzmax,zprd_slab,natoms,q2);

View File

@ -247,21 +247,33 @@ void EwaldDisp::setup()
int kxmax = 1;
int kymax = 1;
int kzmax = 1;
err = rms(kxmax,domain->h[0],natoms,q2,b2,M2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kxmax++;
err = rms(kxmax,domain->h[0],natoms,q2,b2,M2);
}
err = rms(kymax,domain->h[1],natoms,q2,b2,M2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kymax++;
err = rms(kymax,domain->h[1],natoms,q2,b2,M2);
}
err = rms(kzmax,domain->h[2]*slab_volfactor,natoms,q2,b2,M2);
if (!ISFINITE(err))
error->all(FLERR,"Non-numeric box dimensions - simulation unstable");
while (err > accuracy) {
kzmax++;
err = rms(kzmax,domain->h[2]*slab_volfactor,natoms,q2,b2,M2);
}
nbox = MAX(kxmax,kymax);
nbox = MAX(nbox,kzmax);
double gsqxmx = unit[0]*unit[0]*kxmax*kxmax;

View File

@ -1013,12 +1013,18 @@ void FixNH::couple()
p_current[2] = tensor[2];
}
if (!ISFINITE(p_current[0]) || !ISFINITE(p_current[1]) || !ISFINITE(p_current[2]))
error->all(FLERR,"Non-numeric pressure - simulation unstable");
// switch order from xy-xz-yz to Voigt
if (pstyle == TRICLINIC) {
p_current[3] = tensor[5];
p_current[4] = tensor[4];
p_current[5] = tensor[3];
if (!ISFINITE(p_current[3]) || !ISFINITE(p_current[4]) || !ISFINITE(p_current[5]))
error->all(FLERR,"Non-numeric pressure - simulation unstable");
}
}