port thread-safe temperature biasing from LAMMPS-ICMS

This commit is contained in:
Axel Kohlmeyer
2017-05-16 18:15:13 -04:00
parent 06c151421c
commit d2810f9f83
23 changed files with 256 additions and 12 deletions

View File

@ -185,6 +185,26 @@ void ComputeTempPartial::remove_bias(int i, double *v)
}
}
/* ----------------------------------------------------------------------
remove velocity bias from atom I to leave thermal velocity
------------------------------------------------------------------------- */
void ComputeTempPartial::remove_bias_thr(int i, double *v, double *b)
{
if (!xflag) {
b[0] = v[0];
v[0] = 0.0;
}
if (!yflag) {
b[1] = v[1];
v[1] = 0.0;
}
if (!zflag) {
b[2] = v[2];
v[2] = 0.0;
}
}
/* ----------------------------------------------------------------------
remove velocity bias from all atoms to leave thermal velocity
------------------------------------------------------------------------- */
@ -262,6 +282,18 @@ void ComputeTempPartial::restore_bias(int i, double *v)
if (!zflag) v[2] += vbias[2];
}
/* ----------------------------------------------------------------------
add back in velocity bias to atom I removed by remove_bias_thr()
assume remove_bias_thr() was previously called with the same buffer b
------------------------------------------------------------------------- */
void ComputeTempPartial::restore_bias_thr(int i, double *v, double *b)
{
if (!xflag) v[0] += b[0];
if (!yflag) v[1] += b[1];
if (!zflag) v[2] += b[2];
}
/* ----------------------------------------------------------------------
add back in velocity bias to all atoms removed by remove_bias_all()
assume remove_bias_all() was previously called