Skip to content

Commit

Permalink
Optimise by avoiding duplication of water topology check.
Browse files Browse the repository at this point in the history
[ref #22] [ref #148]
  • Loading branch information
lohedges committed Aug 2, 2023
1 parent 92a815c commit a702a6b
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 11 deletions.
4 changes: 3 additions & 1 deletion python/BioSimSpace/Process/_amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ def _setup(self):
# PRM file (topology).
try:
file = _os.path.splitext(self._top_file)[0]
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file, system, "prm7", match_water=False, property_map=self._property_map
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down
8 changes: 6 additions & 2 deletions python/BioSimSpace/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,15 @@ def _setup(self):

# GRO87 file.
file = _os.path.splitext(self._gro_file)[0]
_IO.saveMolecules(file, system, "gro87", property_map=self._property_map)
_IO.saveMolecules(
file, system, "gro87", match_water=False, property_map=self._property_map
)

# TOP file.
file = _os.path.splitext(self._top_file)[0]
_IO.saveMolecules(file, system, "grotop", property_map=self._property_map)
_IO.saveMolecules(
file, system, "grotop", match_water=False, property_map=self._property_map
)

# Create the binary input file name.
self._tpr_file = "%s/%s.tpr" % (self._work_dir, self._name)
Expand Down
4 changes: 3 additions & 1 deletion python/BioSimSpace/Process/_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ def _setup(self):
# PRM file (topology).
try:
file = _os.path.splitext(self._top_file)[0]
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file, system, "prm7", match_water=False, property_map=self._property_map
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down
4 changes: 3 additions & 1 deletion python/BioSimSpace/Process/_somd.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ def _setup(self):

# PRM file (topology).
try:
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file, system, "prm7", match_water=False, property_map=self._property_map
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down
8 changes: 7 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Process/_amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,13 @@ def _write_system(self, system, coord_file=None, topol_file=None, ref_file=None)
if topol_file is not None:
try:
file = _os.path.splitext(topol_file)[0]
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"prm7",
match_waters=False,
property_map=self._property_map,
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down
24 changes: 21 additions & 3 deletions python/BioSimSpace/Sandpit/Exscientia/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,35 @@ def _write_system(self, system, coord_file=None, topol_file=None, ref_file=None)
# GRO87 coordinate files.
if coord_file is not None:
file = _os.path.splitext(coord_file)[0]
_IO.saveMolecules(file, system, "gro87", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"gro87",
match_waters=False,
property_map=self._property_map,
)

# GRO87 reference files.
if ref_file is not None:
file = _os.path.splitext(ref_file)[0]
_IO.saveMolecules(file, system, "gro87", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"gro87",
match_waters=False,
property_map=self._property_map,
)

# TOP file.
if topol_file is not None:
file = _os.path.splitext(topol_file)[0]
_IO.saveMolecules(file, system, "grotop", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"grotop",
match_waters=False,
property_map=self._property_map,
)

# Write the restraint to the topology file
if self._restraint:
Expand Down
8 changes: 7 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Process/_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,13 @@ def _setup(self):
# PRM file (topology).
try:
file = _os.path.splitext(self._top_file)[0]
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"prm7",
match_waters=False,
property_map=self._property_map,
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down
8 changes: 7 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Process/_somd.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,13 @@ def _setup(self):
# PRM file (topology).
try:
file = _os.path.splitext(self._top_file)[0]
_IO.saveMolecules(file, system, "prm7", property_map=self._property_map)
_IO.saveMolecules(
file,
system,
"prm7",
match_waters=False,
property_map=self._property_map,
)
except Exception as e:
msg = "Failed to write system to 'PRM7' format."
if _isVerbose():
Expand Down

0 comments on commit a702a6b

Please sign in to comment.