Skip to content

Commit

Permalink
remove volumed_constrained option from Walker since this is not actua…
Browse files Browse the repository at this point in the history
…lly supported by i-PI
  • Loading branch information
svandenhaute committed Dec 19, 2024
1 parent 8b8d41f commit 669f50a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
10 changes: 2 additions & 8 deletions psiflow/sampling/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,14 @@ def setup_motion(walker: Walker, fix_com: bool) -> ET.Element:
else:
dynamics.append(thermostat)
elif walker.npt:
if walker.volume_constrained:
mode = "nst"
else:
mode = "npt"
mode = "npt"
dynamics = ET.Element("dynamics", mode=mode)
dynamics.append(timestep_element)
if walker.pimd:
dynamics.append(thermostat_pimd)
else:
dynamics.append(thermostat)
if walker.volume_constrained:
mode = "anisotropic"
else:
mode = "flexible"
mode = "flexible"
barostat = ET.Element("barostat", mode=mode)
tau = ET.Element("tau", units="femtosecond")
tau.text = "200"
Expand Down
3 changes: 0 additions & 3 deletions psiflow/sampling/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Walker:
state: Union[Geometry, AppFuture, None]
temperature: Optional[float]
pressure: Optional[float]
volume_constrained: bool
nbeads: int
timestep: float
coupling: Optional[Coupling]
Expand All @@ -63,7 +62,6 @@ def __init__(
state: Union[Geometry, AppFuture, None] = None,
temperature: Optional[float] = 300,
pressure: Optional[float] = None,
volume_constrained: bool = False,
nbeads: int = 1,
timestep: float = 0.5,
metadynamics: Optional[Metadynamics] = None,
Expand All @@ -82,7 +80,6 @@ def __init__(

self.temperature = temperature
self.pressure = pressure
self.volume_constrained = volume_constrained
self.nbeads = nbeads
self.timestep = timestep

Expand Down
19 changes: 0 additions & 19 deletions tests/test_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,25 +295,6 @@ def test_npt(dataset):
output.state.result().cell,
)

walker = Walker(
dataset[0],
einstein,
temperature=600,
pressure=0,
volume_constrained=True,
)
output = sample([walker], steps=30)[0]
# cell should have changed, but not the volume
assert not np.allclose(
walker.start.result().cell,
output.state.result().cell,
)
# volume actually does change with barostat mode='nst' (?)
# assert np.allclose(
# np.linalg.det(walker.start.result().cell),
# np.linalg.det(output.state.result().cell),
# )


def test_reset(dataset):
einstein = EinsteinCrystal(dataset[0], force_constant=0.1)
Expand Down

0 comments on commit 669f50a

Please sign in to comment.