Skip to content

Commit 12ca1bd

Browse files
committed
Backport fixes from PR #400. [ci skip]
1 parent 3ebc80f commit 12ca1bd

File tree

4 files changed

+8
-104
lines changed

4 files changed

+8
-104
lines changed

python/BioSimSpace/Parameters/_parameters.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -534,57 +534,6 @@ def _parameterise_openff(
534534
"must be in your PATH."
535535
) from None
536536

537-
# Check the Antechamber version. Open Force Field requires Antechamber >= 22.0.
538-
try:
539-
# Antechamber returns an exit code of 1 when requesting version information.
540-
# As such, we wrap the call within a try-except block in case it fails.
541-
542-
import shlex as _shlex
543-
import subprocess as _subprocess
544-
545-
# Generate the command-line string. (Antechamber must be in the PATH,
546-
# so no need to use AMBERHOME.
547-
command = "antechamber -v"
548-
549-
# Run the command as a subprocess.
550-
proc = _subprocess.run(
551-
_Utils.command_split(command),
552-
shell=False,
553-
text=True,
554-
stdout=_subprocess.PIPE,
555-
stderr=_subprocess.STDOUT,
556-
)
557-
558-
# Get stdout and split into lines.
559-
lines = proc.stdout.split("\n")
560-
561-
# If present, version information is on line 1.
562-
string = lines[1]
563-
564-
# Delete the welcome message.
565-
string = string.replace("Welcome to antechamber", "")
566-
567-
# Extract the version and convert to float.
568-
version = float(string.split(":")[0])
569-
570-
# The version is okay, enable Open Force Field support.
571-
if version >= 22:
572-
is_compatible = True
573-
# Disable Open Force Field support.
574-
else:
575-
is_compatible = False
576-
577-
del _shlex
578-
del _subprocess
579-
580-
# Something went wrong, disable Open Force Field support.
581-
except:
582-
is_compatible = False
583-
raise
584-
585-
if not is_compatible:
586-
raise _IncompatibleError(f"'{forcefield}' requires Antechamber >= 22.0")
587-
588537
# Validate arguments.
589538

590539
if not isinstance(molecule, (_Molecule, str)):

python/BioSimSpace/Sandpit/Exscientia/Parameters/_parameters.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -534,57 +534,6 @@ def _parameterise_openff(
534534
"must be in your PATH."
535535
) from None
536536

537-
# Check the Antechamber version. Open Force Field requires Antechamber >= 22.0.
538-
try:
539-
# Antechamber returns an exit code of 1 when requesting version information.
540-
# As such, we wrap the call within a try-except block in case it fails.
541-
542-
import shlex as _shlex
543-
import subprocess as _subprocess
544-
545-
# Generate the command-line string. (Antechamber must be in the PATH,
546-
# so no need to use AMBERHOME.
547-
command = "antechamber -v"
548-
549-
# Run the command as a subprocess.
550-
proc = _subprocess.run(
551-
_Utils.command_split(command),
552-
shell=False,
553-
text=True,
554-
stdout=_subprocess.PIPE,
555-
stderr=_subprocess.STDOUT,
556-
)
557-
558-
# Get stdout and split into lines.
559-
lines = proc.stdout.split("\n")
560-
561-
# If present, version information is on line 1.
562-
string = lines[1]
563-
564-
# Delete the welcome message.
565-
string = string.replace("Welcome to antechamber", "")
566-
567-
# Extract the version and convert to float.
568-
version = float(string.split(":")[0])
569-
570-
# The version is okay, enable Open Force Field support.
571-
if version >= 22:
572-
is_compatible = True
573-
# Disable Open Force Field support.
574-
else:
575-
is_compatible = False
576-
577-
del _shlex
578-
del _subprocess
579-
580-
# Something went wrong, disable Open Force Field support.
581-
except:
582-
is_compatible = False
583-
raise
584-
585-
if not is_compatible:
586-
raise _IncompatibleError(f"'{forcefield}' requires Antechamber >= 22.0")
587-
588537
# Validate arguments.
589538

590539
if not isinstance(molecule, (_Molecule, str)):

tests/Parameters/test_parameters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def test_smiles_stereo():
169169
assert rdmol0_smiles == rdmol1_smiles
170170

171171

172+
# This test is currently skipped since it fails with AnteChamber verssion
173+
# 24.0 and above and there is no way to query the version number from
174+
# the command-line. (The version output has been removed.)
172175
@pytest.mark.skipif(
173-
has_antechamber is False or has_tleap is False,
176+
True or has_antechamber is False or has_tleap is False,
174177
reason="Requires AmberTools/antechamber and tLEaP to be installed.",
175178
)
176179
def test_acdoctor():

tests/Sandpit/Exscientia/Parameters/test_parameters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,11 @@ def test_smiles_stereo():
174174
assert rdmol0_smiles == rdmol1_smiles
175175

176176

177+
# This test is currently skipped since it fails with AnteChamber verssion
178+
# 24.0 and above and there is no way to query the version number from
179+
# the command-line. (The version output has been removed.)
177180
@pytest.mark.skipif(
178-
has_antechamber is False or has_tleap is False,
181+
True or has_antechamber is False or has_tleap is False,
179182
reason="Requires AmberTools/antechamber and tLEaP to be installed.",
180183
)
181184
def test_acdoctor():

0 commit comments

Comments
 (0)