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

Miscellaneous fixes #335

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions examples/hoomd-blue/spectral_abf/Butane-SpectralABF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,7 @@
"A = result[\"free_energy\"]\n",
"# Alternatively:\n",
"# fes_fn = result[\"fes_fn\"]\n",
"# A = fes_fn(mesh)\n",
"A = A.max() - A"
"# A = fes_fn(mesh)"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion examples/hoomd-blue/spectral_abf/Butane-SpectralABF.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ A = result["free_energy"]
# Alternatively:
# fes_fn = result["fes_fn"]
# A = fes_fn(mesh)
A = A.max() - A
```

```python colab={"base_uri": "https://localhost:8080/", "height": 302} id="7_d_XfVLLkbI" outputId="e35db259-31f8-4a3b-b1fa-7e91a8a5c88a"
Expand Down
3 changes: 1 addition & 2 deletions examples/hoomd-blue/spectral_abf/butane.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def get_args(argv):
("time-steps", "t", int, 5e5, "Number of simulation steps"),
]
parser = argparse.ArgumentParser(description="Example script to run SpectralABF")
for (name, short, T, val, doc) in available_args:
for name, short, T, val, doc in available_args:
parser.add_argument("--" + name, "-" + short, type=T, default=T(val), help=doc)

return parser.parse_args(argv)
Expand All @@ -283,7 +283,6 @@ def main(argv=[]):
mesh = result["mesh"]
fes_fn = result["fes_fn"]
A = fes_fn(mesh)
A = A.max() - A

# plot the free energy
fig, ax = plt.subplots()
Expand Down
1 change: 0 additions & 1 deletion examples/hoomd3/spectral_abf/butane.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ def main(argv=[]):
mesh = result["mesh"]
fes_fn = result["fes_fn"]
A = fes_fn(mesh)
A = A.max() - A

# plot the free energy
fig, ax = plt.subplots()
Expand Down
1 change: 0 additions & 1 deletion examples/openmm/spectral_abf/ADP_SpectralABF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@
"# mesh = result[\"mesh\"]\n",
"# fes_fn = result[\"fes_fn\"]\n",
"# A = fes_fn(mesh)\n",
"A = A.max() - A\n",
"A = A.reshape(grid.shape)"
]
},
Expand Down
1 change: 0 additions & 1 deletion examples/openmm/spectral_abf/ADP_SpectralABF.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ A = result["free_energy"]
# mesh = result["mesh"]
# fes_fn = result["fes_fn"]
# A = fes_fn(mesh)
A = A.max() - A
A = A.reshape(grid.shape)
```

Expand Down
3 changes: 1 addition & 2 deletions examples/openmm/spectral_abf/alanine-dipeptide.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_args(argv):
("time-steps", "t", int, 5e5, "Number of simulation steps"),
]
parser = argparse.ArgumentParser(description="Example script to run Spectral ABF")
for (name, short, T, val, doc) in available_args:
for name, short, T, val, doc in available_args:
parser.add_argument("--" + name, "-" + short, type=T, default=T(val), help=doc)
return parser.parse_args(argv)

Expand Down Expand Up @@ -108,7 +108,6 @@ def main(argv=[]):

# Set min free energy to zero
A = fes_fn(xi)
A = A.max() - A
A = A.reshape(plot_grid.shape)

# plot and save free energy to a PNG file
Expand Down
5 changes: 2 additions & 3 deletions pysages/backends/openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ def bias(snapshot, state, sync_backend):
"""Adds the computed bias to the forces."""
if state.bias is None:
return
biases = adapt(state.bias)
# Forces may be computed asynchronously on the GPU, so we need to
# synchronize them before applying the bias.
sync_backend()
biases = adapt(state.bias)
forces = view(snapshot.forces)
biases = view(biases.block_until_ready())
forces += biases
forces += view(biases.block_until_ready())
sync_forces()

def dimensionality():
Expand Down
Loading