Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:

# Python formatting and linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.15.4
hooks:
# Run the formatter
- id: ruff-format
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ pip install -e .
> [!Note]
> Pixi does not run conda post-link scripts, so the `ocl-icd-system`
> symlink needed for OpenCL won't be created automatically. After
> creating the environment, run the following once to fix this:
> creating the environment (or after a pixi update), run the following
> to fix this:
>
> ```bash
> pixi shell
> ln -s /etc/OpenCL/vendors "${CONDA_PREFIX}/etc/OpenCL/vendors/ocl-icd-system"
> ln -sfn /etc/OpenCL/vendors "${CONDA_PREFIX}/etc/OpenCL/vendors/ocl-icd-system"
> ```

### Testing
Expand Down
2 changes: 1 addition & 1 deletion src/somd2/config/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ def gcmc_radius(self, gcmc_radius):
gcmc_r = _sr.u(gcmc_radius)
except:
raise ValueError(
"Unable to parse 'gcmc_radius' " f"as a Sire GeneralUnit: {gcmc_radius}"
f"Unable to parse 'gcmc_radius' as a Sire GeneralUnit: {gcmc_radius}"
)

if not gcmc_r.has_same_units(angstrom):
Expand Down
2 changes: 1 addition & 1 deletion src/somd2/io/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def dataframe_to_parquet(df, metadata, filepath=None, filename=None):
table = table.replace_schema_metadata(combined_meta)
if filename is None:
if "lambda" in metadata and "temperature" in metadata:
filename = f"Lam_{metadata['lambda'].replace('.','')[:5]}_T_{metadata['temperature']}.parquet"
filename = f"Lam_{metadata['lambda'].replace('.', '')[:5]}_T_{metadata['temperature']}.parquet"
else:
filename = "output.parquet"
if not filename.endswith(".parquet"):
Expand Down
4 changes: 2 additions & 2 deletions src/somd2/runner/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,8 +1985,8 @@ def _save_energy_components(self, index, context):
state = new_context.getState(getEnergy=True, groups={i})
name = f.getName()
name_len = len(name)
header += f"{f.getName():>{name_len+2}}"
record += f"{state.getPotentialEnergy().value_in_unit(openmm.unit.kilocalories_per_mole):>{name_len+2}.2f}"
header += f"{f.getName():>{name_len + 2}}"
record += f"{state.getPotentialEnergy().value_in_unit(openmm.unit.kilocalories_per_mole):>{name_len + 2}.2f}"

# Write to file.
if self._nrg_sample == 0:
Expand Down
11 changes: 4 additions & 7 deletions src/somd2/runner/_repex.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def run(self):

# Perform the replica exchange simulation.
for i in range(cycles):
_logger.info(f"Running dynamics for cycle {i+1} of {cycles}")
_logger.info(f"Running dynamics for cycle {i + 1} of {cycles}")

# Log the states. This is the replica index for the state (positions
# and velocities) used to seed each replica for the current cycle.
Expand Down Expand Up @@ -1283,11 +1283,8 @@ def _run_block(
gcmc_sampler.write_ghost_residues()

# Get the energy at each lambda value.
energies = (
dynamics._d.energy_trajectory()
.to_pandas(to_alchemlyb=True, energy_unit="kcal/mol")
.iloc[-1, :]
.to_numpy()
energies = _np.array(
[e.value() for e in list(dynamics.current_energies().values())[2:]]
)

except Exception as e:
Expand Down Expand Up @@ -1681,7 +1678,7 @@ def _checkpoint(self, index, lambdas, block, num_blocks, is_final_block=False):
dynamics._d._sire_mols.delete_all_frames()

_logger.info(
f"Finished block {block+1} of {self._start_block + num_blocks} "
f"Finished block {block + 1} of {self._start_block + num_blocks} "
f"for {_lam_sym} = {lam:.5f}"
)

Expand Down
6 changes: 3 additions & 3 deletions src/somd2/runner/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
except:
pass
raise RuntimeError(
f"Dynamics block {block+1} for {_lam_sym} = {lambda_value:.5f} failed: {e}"
f"Dynamics block {block + 1} for {_lam_sym} = {lambda_value:.5f} failed: {e}"
)

# Checkpoint.
Expand Down Expand Up @@ -809,7 +809,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
dynamics._d._sire_mols.delete_all_frames()

_logger.info(
f"Finished block {block+1} of {self._start_block + num_blocks} "
f"Finished block {block + 1} of {self._start_block + num_blocks} "
f"for {_lam_sym} = {lambda_value:.5f}"
)

Expand Down Expand Up @@ -884,7 +884,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
dynamics._d._sire_mols.delete_all_frames()

_logger.info(
f"Finished block {block+1} of {self._start_block + num_blocks} "
f"Finished block {block + 1} of {self._start_block + num_blocks} "
f"for {_lam_sym} = {lambda_value:.5f}"
)

Expand Down