Skip to content

Commit

Permalink
Backport fix from PR #125. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Jul 3, 2023
1 parent f466c8d commit 605e2d1
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
max-parallel: 9
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]
platform:
- { name: "windows", os: "windows-latest", shell: "pwsh" }
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
Expand All @@ -22,14 +22,14 @@ jobs:
# Exclude all but the latest Python from all but Linux
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.8"
python-version: "3.9"
- platform: { name: "windows", os: "windows-latest", shell: "pwsh" }
python-version: "3.8"
python-version: "3.9"
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.9"
python-version: "3.10"
- platform: { name: "windows", os: "windows-latest", shell: "pwsh" }
python-version: "3.9"
python-version: "3.10"
environment:
name: biosimspace-build
defaults:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
max-parallel: 9
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]
platform:
- { name: "windows", os: "windows-latest", shell: "pwsh" }
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
Expand All @@ -22,14 +22,14 @@ jobs:
# but Linux
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.8"
python-version: "3.9"
- platform: { name: "windows", os: "windows-latest", shell: "pwsh" }
python-version: "3.8"
python-version: "3.9"
- platform:
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
python-version: "3.9"
python-version: "3.10"
- platform: { name: "windows", os: "windows-latest", shell: "pwsh" }
python-version: "3.9"
python-version: "3.10"
environment:
name: biosimspace-build
defaults:
Expand Down
13 changes: 9 additions & 4 deletions python/BioSimSpace/Process/_gromacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,15 @@ def _generate_config(self):
"""Generate GROMACS configuration file strings."""

# Check whether the system contains periodic box information.
# For now, well not attempt to generate a box if the system property
# is missing. If no box is present, we'll assume a non-periodic simulation.
if "space" in self._system._sire_object.propertyKeys():
has_box = True
space_prop = self._property_map.get("space", "space")
if space_prop in self._system._sire_object.propertyKeys():
try:
# Make sure that we have a periodic box. The system will now have
# a default cartesian space.
box = self._system._sire_object.property(space_prop)
has_box = box.isPeriodic()
except:
has_box = False
else:
_warnings.warn("No simulation box found. Assuming gas phase simulation.")
has_box = False
Expand Down
10 changes: 7 additions & 3 deletions python/BioSimSpace/Process/_openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,14 @@ def _generate_config(self):
prop = self._property_map.get("space", "space")

# Check whether the system contains periodic box information.
# For now, we'll not attempt to generate a box if the system property
# is missing. If no box is present, we'll assume a non-periodic simulation.
if prop in self._system._sire_object.propertyKeys():
has_box = True
try:
# Make sure that we have a periodic box. The system will now have
# a default cartesian space.
box = self._system._sire_object.property(prop)
has_box = box.isPeriodic()
except:
has_box = False
else:
_warnings.warn("No simulation box found. Assuming gas phase simulation.")
has_box = False
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 @@ -285,7 +285,13 @@ def _generate_config(self):
# For now, we'll not attempt to generate a box if the system property
# is missing. If no box is present, we'll assume a non-periodic simulation.
if prop in self._system._sire_object.propertyKeys():
has_box = True
try:
# Make sure that we have a periodic box. The system will now have
# a default cartesian space.
box = self._system._sire_object.property(prop)
has_box = box.isPeriodic()
except:
has_box = False
else:
_warnings.warn("No simulation box found. Assuming gas phase simulation.")
has_box = False
Expand Down
8 changes: 7 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/Protocol/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ def __init__(self, system, protocol, explicit_dummies=False):
def _has_box(self):
"""Return whether the current system has a box."""
if "space" in self.system._sire_object.propertyKeys():
has_box = True
try:
# Make sure that we have a periodic box. The system will now have
# a default cartesian space.
box = self.system._sire_object.property("space")
has_box = box.isPeriodic()
except:
has_box = False
else:
_warnings.warn("No simulation box found. Assuming gas phase simulation.")
has_box = False
Expand Down
12 changes: 10 additions & 2 deletions python/BioSimSpace/_Config/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ def hasBox(self):
"""
space_prop = self._property_map.get("space", "space")
if space_prop in self._system._sire_object.propertyKeys():
return True
try:
# Make sure that we have a periodic box. The system will now have
# a default cartesian space.
box = self._system._sire_object.property(space_prop)
has_box = box.isPeriodic()
except:
has_box = False
else:
has_box = False
_warnings.warn("No simulation box found. Assuming gas phase simulation.")
return False

return has_box

def hasWater(self):
"""
Expand Down

0 comments on commit 605e2d1

Please sign in to comment.