Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix None pressure failing unit conversion #463

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions openff/evaluator/protocols/openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def _evaluate_energies(
temperature = to_openmm(thermodynamic_state.temperature)
beta = 1.0 / (openmm_unit.BOLTZMANN_CONSTANT_kB * temperature)

pressure = to_openmm(thermodynamic_state.pressure)
if thermodynamic_state.pressure is None:
pressure = None
else:
pressure = to_openmm(thermodynamic_state.pressure)

for frame_index in range(trajectory.n_frames):

Expand Down Expand Up @@ -486,11 +489,12 @@ def _execute(self, directory, available_resources):
temperature = self.thermodynamic_state.temperature
openmm_temperature = to_openmm(temperature)

pressure = (
None if self.ensemble == Ensemble.NVT else self.thermodynamic_state.pressure
)

openmm_pressure = to_openmm(pressure)
if self.ensemble == Ensemble.NVT:
pressure = None
openmm_pressure = None
else:
pressure = self.thermodynamic_state.pressure
openmm_pressure = to_openmm(pressure)

if openmm_temperature is None:

Expand Down