Skip to content

Commit

Permalink
refactor OpenMMSimulation to use minimalist type
Browse files Browse the repository at this point in the history
closes #31
  • Loading branch information
axsk committed Sep 10, 2024
1 parent 22620ca commit bd2ef58
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 207 deletions.
Empty file added src/precompile.jl
Empty file.
6 changes: 3 additions & 3 deletions src/simulators/mopenmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def singlerun(i):
except OpenMMException as e:
print("Error integrating trajectory", e)
return get_numpy_state(c, withmomenta).fill(np.nan)

x = get_numpy_state(c, withmomenta)
return x

Expand All @@ -34,7 +34,7 @@ def trajectory(sim, x0, stepsize, steps, saveevery, mmthreads, withmomenta):
trajectory[0] = x0

c = newcontext(sim.context, mmthreads)

set_numpy_state(c, x0, withmomenta)
c.getIntegrator().setStepSize(stepsize)

Expand Down Expand Up @@ -123,7 +123,7 @@ def set_numpy_state(context, x, withmomenta):
context.setPositions(x)
context.setVelocitiesToTemperature(context.getIntegrator().getTemperature())

def set_random_velocities(context, mmthreads):
def set_random_velocities(context):
context.setVelocitiesToTemperature(context.getIntegrator().getTemperature())
v = context.getState(getVelocities=True).getVelocities(asNumpy=True).value_in_unit(nanometer/picosecond).flatten()
return v
Expand Down
Loading

0 comments on commit bd2ef58

Please sign in to comment.