Add nve respa testcase for python/move
This commit is contained in:
@ -521,8 +521,7 @@ TEST(FixTimestep, plain)
|
|||||||
// fix python/move implementation is missing library interface access to Repsa::step
|
// fix python/move implementation is missing library interface access to Repsa::step
|
||||||
ifix = lmp->modify->find_fix("test");
|
ifix = lmp->modify->find_fix("test");
|
||||||
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") &&
|
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") &&
|
||||||
!utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit") &&
|
!utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")
|
||||||
!utils::strmatch(lmp->modify->fix[ifix]->style, "^python/move")
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class NVE(LAMMPSFixMove):
|
|||||||
def __init__(self, ptr, group_name="all"):
|
def __init__(self, ptr, group_name="all"):
|
||||||
super(NVE, self).__init__(ptr)
|
super(NVE, self).__init__(ptr)
|
||||||
assert(self.group_name == "all")
|
assert(self.group_name == "all")
|
||||||
|
self._step_respa = None
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
dt = self.lmp.extract_global("dt")
|
dt = self.lmp.extract_global("dt")
|
||||||
@ -42,6 +43,12 @@ class NVE(LAMMPSFixMove):
|
|||||||
self.dtv = dt
|
self.dtv = dt
|
||||||
self.dtf = 0.5 * dt * ftm2v
|
self.dtf = 0.5 * dt * ftm2v
|
||||||
|
|
||||||
|
@property
|
||||||
|
def step_respa(self):
|
||||||
|
if not self._step_respa:
|
||||||
|
self._step_respa = self.lmp.extract_global("respa_dt")
|
||||||
|
return self._step_respa
|
||||||
|
|
||||||
def initial_integrate(self, vflag):
|
def initial_integrate(self, vflag):
|
||||||
nlocal = self.lmp.extract_global("nlocal")
|
nlocal = self.lmp.extract_global("nlocal")
|
||||||
mass = self.lmp.extract_atom("mass")
|
mass = self.lmp.extract_atom("mass")
|
||||||
@ -72,4 +79,26 @@ class NVE(LAMMPSFixMove):
|
|||||||
v[i][1] += dtfm * f[i][1]
|
v[i][1] += dtfm * f[i][1]
|
||||||
v[i][2] += dtfm * f[i][2]
|
v[i][2] += dtfm * f[i][2]
|
||||||
|
|
||||||
|
def initial_integrate_respa(self, vflag, ilevel, iloop):
|
||||||
|
ftm2v = self.lmp.extract_global("ftm2v")
|
||||||
|
self.dtv = self.step_respa[ilevel]
|
||||||
|
self.dtf = 0.5 * self.step_respa[ilevel] * ftm2v
|
||||||
|
|
||||||
|
# innermost level - NVE update of v and x
|
||||||
|
# all other levels - NVE update of v
|
||||||
|
|
||||||
|
if ilevel == 0:
|
||||||
|
self.initial_integrate(vflag)
|
||||||
|
else:
|
||||||
|
self.final_integrate()
|
||||||
|
|
||||||
|
def final_integrate_respa(self, ilevel, iloop):
|
||||||
|
ftm2v = self.lmp.extract_global("ftm2v")
|
||||||
|
self.dtf = 0.5 * self.step_respa[ilevel] * ftm2v
|
||||||
|
self.final_integrate()
|
||||||
|
|
||||||
|
def reset_dt(self):
|
||||||
|
dt = self.lmp.extract_global("dt")
|
||||||
|
ftm2v = self.lmp.extract_global("ftm2v")
|
||||||
|
self.dtv = dt;
|
||||||
|
self.dtf = 0.5 * dt * ftm2v;
|
||||||
|
|||||||
Reference in New Issue
Block a user