Skip to content

Commit

Permalink
🛠️ [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 25, 2023
1 parent f99cb3c commit c83fe0f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion protex/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def __init__(
self.residues: list[Residue] = self._set_initial_states()
self.boxlength: openmm.Quantity = (
simulation.context.getState().getPeriodicBoxVectors()[0][0] # NOTE: supports only cubic boxes and nVT -> changed in update.py to get at every step for npT
)
)

def dump(self, fname: str) -> None:
"""Pickle the current ProtexSystem object.
Expand Down
5 changes: 2 additions & 3 deletions protex/testsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from openmm import (
Context,
DrudeNoseHooverIntegrator,
MonteCarloBarostat,
OpenMMException,
Platform,
XmlSerializer,
MonteCarloBarostat

)
from openmm.app import (
PME,
Expand All @@ -21,7 +20,7 @@
HBonds,
Simulation,
)
from openmm.unit import angstroms, kelvin, picoseconds, atmosphere
from openmm.unit import angstroms, atmosphere, kelvin, picoseconds
except ImportError:
import simtk.openmm as mm
from simtk.openmm import (
Expand Down
9 changes: 4 additions & 5 deletions protex/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,16 @@ def _update(self, candidates: list[tuple], nr_of_steps: int) -> None:
initial_e = state.getPotentialEnergy()
if np.isnan(initial_e._value):
raise RuntimeError(f"Energy is {initial_e}")

# get the boxlength depending on ensemble
if self.ionic_liquid.ensemble == "nVT":
self.boxl_vec = (
self.ionic_liquid.boxlength
) # changed to store boxl as quantity in system class
elif self.ionic_liquid.ensemble == "npT":
self.boxl_vec = self.ionic_liquid.simulation.context.getState().getPeriodicBoxVectors()[0][0]
self.boxl_vec = self.ionic_liquid.simulation.context.getState().getPeriodicBoxVectors()[0][0]
self.boxl = self.boxl_vec.value_in_unit(nanometers)

logger.info("Start changing states ...")
assert nr_of_steps > 1, "Use an update step number of at least 2."
for lamb in np.linspace(0, 1, nr_of_steps):
Expand Down Expand Up @@ -710,14 +710,13 @@ def update(self, nr_of_steps: int = 2) -> list[tuple[Residue, Residue]]:
list[tuple[Residue, Residue]]
A list with all the updated residue tuples
"""

# get the boxlength depending on ensemble
if self.ionic_liquid.ensemble == "nVT":
self.boxl_vec = (
self.ionic_liquid.boxlength
) # changed to store boxl as quantity in system class
elif self.ionic_liquid.ensemble == "npT":
self.boxl_vec = self.ionic_liquid.simulation.context.getState().getPeriodicBoxVectors()[0][0]
self.boxl_vec = self.ionic_liquid.simulation.context.getState().getPeriodicBoxVectors()[0][0]
self.boxl = self.boxl_vec.value_in_unit(nanometers)
print(f"{self.boxl=}")

Expand Down

0 comments on commit c83fe0f

Please sign in to comment.