Skip to content

Commit ebbd4a2

Browse files
authored
Merge pull request #88 from OpenBioSim/fix_87
Fix issue #87
2 parents c5ad571 + 9693902 commit ebbd4a2

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/somd2/runner/_base.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,27 +1562,6 @@ def _checkpoint(
15621562

15631563
from somd2 import __version__, _sire_version, _sire_revisionid
15641564

1565-
# Save the end-state GCMC topologies for trajectory analysis and visualisation.
1566-
if self._config.gcmc:
1567-
# Only save for first block.
1568-
if block == 0:
1569-
mols0 = _sr.morph.link_to_reference(system)
1570-
mols1 = _sr.morph.link_to_perturbed(system)
1571-
1572-
# Save to AMBER format.
1573-
_sr.save(mols0, self._filenames["topology0"])
1574-
_sr.save(mols1, self._filenames["topology1"])
1575-
1576-
# Save to PDB format.
1577-
_sr.save(
1578-
mols0,
1579-
self._filenames["topology0"].replace(".prm7", ".pdb"),
1580-
)
1581-
_sr.save(
1582-
mols1,
1583-
self._filenames["topology1"].replace(".prm7", ".pdb"),
1584-
)
1585-
15861565
# Get the lambda value.
15871566
lam = self._lambda_values[index]
15881567

@@ -1608,6 +1587,27 @@ def _checkpoint(
16081587
metadata["lambda_grad"] = lambda_grad
16091588

16101589
if is_final_block:
1590+
# Save the end-state GCMC topologies for trajectory analysis and visualisation.
1591+
# This topology contains additional water molecules that are used for GCMC
1592+
# insertion moves.
1593+
if self._config.gcmc:
1594+
mols0 = _sr.morph.link_to_reference(system)
1595+
mols1 = _sr.morph.link_to_perturbed(system)
1596+
1597+
# Save to AMBER format.
1598+
_sr.save(mols0, self._filenames["topology0"])
1599+
_sr.save(mols1, self._filenames["topology1"])
1600+
1601+
# Save to PDB format.
1602+
_sr.save(
1603+
mols0,
1604+
self._filenames["topology0"].replace(".prm7", ".pdb"),
1605+
)
1606+
_sr.save(
1607+
mols1,
1608+
self._filenames["topology1"].replace(".prm7", ".pdb"),
1609+
)
1610+
16111611
# Assemble and save the final trajectory.
16121612
if self._config.save_trajectories:
16131613
# Save the final trajectory chunk to file.

0 commit comments

Comments
 (0)