Skip to content

Commit

Permalink
SD: Rename integrator and thermostat
Browse files Browse the repository at this point in the history
Disambiguate Stokesian Dynamics from Steepest Descent.
  • Loading branch information
jngrad committed Jul 4, 2020
1 parent 4fc322c commit b9dc8d0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion samples/dancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
system.cell_system.skin = 0.4
system.periodicity = [False, False, False]

system.integrator.set_sd(
system.integrator.set_stokesian_dynamics(
viscosity=1.0, radii={0: 1.0}, device=sd_device,
approximation_method=sd_method)

Expand Down
2 changes: 1 addition & 1 deletion src/python/espressomd/integrate.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ cdef class IntegratorHandle:
"""
self._integrator = BrownianDynamics()

def set_sd(self, *args, **kwargs):
def set_stokesian_dynamics(self, *args, **kwargs):
"""
Set the integration method to Stokesian Dynamics (:class:`StokesianDynamics`).
Expand Down
5 changes: 2 additions & 3 deletions src/python/espressomd/thermostat.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ cdef class Thermostat:
act_on_virtual=thmst["act_on_virtual"],
seed=thmst["seed"])
if thmst["type"] == "SD":
self.set_sd(kT=thmst["kT"],
seed=thmst["seed"])
self.set_stokesian(kT=thmst["kT"], seed=thmst["seed"])

def get_ts(self):
return thermo_switch
Expand Down Expand Up @@ -710,7 +709,7 @@ cdef class Thermostat:
mpi_bcast_parameter(FIELD_TEMPERATURE)

IF STOKESIAN_DYNAMICS:
def set_sd(self, kT=None, seed=None):
def set_stokesian(self, kT=None, seed=None):
"""
Sets the SD thermostat with required parameters.
Expand Down
14 changes: 7 additions & 7 deletions testsuite/python/save_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
system.thermostat.set_dpd(kT=1.0, seed=42)
elif 'THERM.SDM' in modes and (has_features('STOKESIAN_DYNAMICS') or has_features('STOKESIAN_DYNAMICS_GPU')):
system.periodicity = [0, 0, 0]
system.thermostat.set_sd(kT=1.0, seed=42)
system.thermostat.set_stokesian(kT=1.0, seed=42)
# set integrator
if 'INT.NPT' in modes and has_features('NPT'):
system.integrator.set_isotropic_npt(ext_pressure=2.0, piston=0.01,
Expand All @@ -169,14 +169,14 @@
system.integrator.set_brownian_dynamics()
elif 'INT.SDM.CPU' in modes and has_features('STOKESIAN_DYNAMICS'):
system.periodicity = [0, 0, 0]
system.integrator.set_sd(approximation_method='ft', viscosity=0.5,
device='cpu', radii={0: 1.5},
pair_mobility=False, self_mobility=True)
system.integrator.set_stokesian_dynamics(
approximation_method='ft', device='cpu', viscosity=0.5,
radii={0: 1.5}, pair_mobility=False, self_mobility=True)
elif 'INT.SDM.GPU' in modes and has_features('STOKESIAN_DYNAMICS_GPU') and espressomd.gpu_available():
system.periodicity = [0, 0, 0]
system.integrator.set_sd(approximation_method='fts', viscosity=2.0,
device='gpu', radii={0: 1.0},
pair_mobility=True, self_mobility=False)
system.integrator.set_stokesian_dynamics(
approximation_method='fts', device='gpu', viscosity=2.0,
radii={0: 1.0}, pair_mobility=True, self_mobility=False)
# set minimization
if 'MINIMIZATION' in modes:
steepest_descent(system, f_max=1, gamma=10, max_steps=0,
Expand Down
26 changes: 12 additions & 14 deletions testsuite/python/stokesian_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,21 @@ def setUp(self):
self.system.time_step = 1.0
self.system.cell_system.skin = 0.4

# unset SD integrator so we can test whether set_sd() fails.
# set_nvt() is the only way to ensure that integ_switch is
# unset SD integrator so we can test whether set_stokesian_dynamics()
# fails. set_nvt() is the only way to ensure that integ_switch is
# set to a different value than INTEG_METHOD_SD
self.system.integrator.set_nvt()

def pbc_checks(self):
self.system.periodicity = [0, 0, 1]
with self.assertRaises(Exception):
self.system.integrator.set_sd(viscosity=1.0,
device=self.device,
radii={0: 1.0})
self.system.integrator.set_stokesian_dynamics(
viscosity=1.0, device=self.device, radii={0: 1.0})

self.system.periodicity = [0, 0, 0]
self.system.integrator.set_sd(viscosity=1.0,
device=self.device,
radii={0: 1.0})
self.system.integrator.set_stokesian_dynamics(
viscosity=1.0, device=self.device, radii={0: 1.0})

with self.assertRaises(Exception):
self.system.periodicity = [0, 1, 0]

Expand All @@ -78,7 +77,7 @@ def falling_spheres(self, time_step, l_factor, t_factor,
self.system.part.add(pos=[0 * l_factor, 0, 0], rotation=[1, 1, 1])
self.system.part.add(pos=[7 * l_factor, 0, 0], rotation=[1, 1, 1])

self.system.integrator.set_sd(
self.system.integrator.set_stokesian_dynamics(
viscosity=1.0 / (t_factor * l_factor),
device=self.device, radii={0: 1.0 * l_factor},
approximation_method=sd_method)
Expand Down Expand Up @@ -146,10 +145,9 @@ def setUp(self):
self.system.part.add(pos=[0, 0, 0], rotation=[1, 1, 1])

def check(self):
self.system.integrator.set_sd(viscosity=self.eta,
device=self.device,
radii={0: self.R})
self.system.thermostat.set_sd(kT=self.kT, seed=42)
self.system.integrator.set_stokesian_dynamics(
viscosity=self.eta, device=self.device, radii={0: self.R})
self.system.thermostat.set_stokesian(kT=self.kT, seed=42)

intsteps = int(100000 / self.system.time_step)
pos = np.empty([intsteps + 1, 3])
Expand Down Expand Up @@ -202,4 +200,4 @@ def check(self):
def tearDown(self):
self.system.constraints.clear()
self.system.part.clear()
self.system.thermostat.set_sd(kT=0)
self.system.thermostat.set_stokesian(kT=0)

0 comments on commit b9dc8d0

Please sign in to comment.