Skip to content

Commit

Permalink
Fixed issue with spaces in bin paths
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwilter committed Nov 14, 2023
1 parent 05443ad commit 1c7597b
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 175 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
@@ -1,6 +1,5 @@
{
"git.enableCommitSigning": true,
"python.envFile": "${workspaceFolder}/.env",
"python.testing.pytestArgs": ["tests", "-v", "-c", "/dev/null"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
Expand Down
2 changes: 1 addition & 1 deletion acpype/__init__.py
Expand Up @@ -55,4 +55,4 @@
# from https://packaging.python.org/guides/single-sourcing-package-version/
# using option 2
# updated automatically via pre-commit git-hook
__version__ = "2023.11.2"
__version__ = "2023.11.14"
20 changes: 10 additions & 10 deletions acpype/topol.py
Expand Up @@ -407,7 +407,7 @@ def guessCharge(self):
self.printWarn("no charge value given, trying to guess one...")
mol2FileForGuessCharge = self.inputFile
if self.ext == ".pdb":
cmd = f"{self.obabelExe} -ipdb {self.inputFile} -omol2 -O {self.baseName}.mol2"
cmd = f"'{self.obabelExe}' -ipdb '{self.inputFile}' -omol2 -O '{self.baseName}.mol2'"
self.printDebug(f"guessCharge: {cmd}")
out = _getoutput(cmd)
self.printDebug(out)
Expand All @@ -418,7 +418,7 @@ def guessCharge(self):
if in_mol == "mol":
in_mol = "mdl"

cmd = f"{self.acExe} -dr no -i {mol2FileForGuessCharge} -fi {in_mol} -o tmp -fo mol2 -c gas -pf n"
cmd = f"'{self.acExe}' -dr no -i '{mol2FileForGuessCharge}' -fi {in_mol} -o tmp -fo mol2 -c gas -pf n"

logger(self.level).debug(while_replace(cmd))

Expand Down Expand Up @@ -479,7 +479,7 @@ def setResNameCheckCoords(self):
else:
if exten == "mol":
exten = "mdl"
cmd = f"{self.acExe} -dr no -i {self.inputFile} -fi {exten} -o tmp -fo ac -pf y"
cmd = f"'{self.acExe}' -dr no -i '{self.inputFile}' -fi {exten} -o tmp -fo ac -pf y"
self.printDebug(cmd)
out = _getoutput(cmd)
if not out.isspace():
Expand Down Expand Up @@ -685,7 +685,7 @@ def readMol2TotalCharge(self, mol2File):
"""Reads the charges in given mol2 file and returns the total."""
charge = 0.0
ll = []
cmd = f"{self.acExe} -dr no -i {mol2File} -fi mol2 -o tmp -fo mol2 -c wc -cf tmp.crg -pf n"
cmd = f"'{self.acExe}' -dr no -i '{mol2File}' -fi mol2 -o tmp -fo mol2 -c wc -cf tmp.crg -pf n"

self.printDebug(cmd)

Expand Down Expand Up @@ -840,7 +840,7 @@ def execAntechamber(self, chargeType=None, atomType=None) -> bool:
if exten == "mol":
exten = "mdl"

cmd = "{} -dr no -i {} -fi {} -o {} -fo mol2 {} -nc {} -m {} -s 2 -df {} -at {} -pf n {}".format(
cmd = "'{}' -dr no -i '{}' -fi {} -o '{}' -fo mol2 {} -nc {} -m {} -s 2 -df {} -at {} -pf n {}".format(
self.acExe,
self.inputFile,
exten,
Expand Down Expand Up @@ -947,7 +947,7 @@ def execTleap(self):
fp.write(tleapScpt)
fp.close()

cmd = "%s -f tleap.in" % self.tleapExe
cmd = f"'{self.tleapExe}' -f tleap.in"

if self.checkXyzAndTopFiles() and not self.force:
self.printMess("Topologies files already present... doing nothing")
Expand Down Expand Up @@ -1000,7 +1000,7 @@ def locateDat(self, aFile):
def execParmchk(self):
"""Execute parmchk."""
self.makeDir()
cmd = f"{self.parmchkExe} -i {self.acMol2FileName} -f mol2 -o {self.acFrcmodFileName}"
cmd = f"'{self.parmchkExe}' -i '{self.acMol2FileName}' -f mol2 -o '{self.acFrcmodFileName}'"

if "amber" in self.atomType:
gaffFile = self.locateDat(self.gaffDatfile)
Expand All @@ -1012,7 +1012,7 @@ def execParmchk(self):
# parm99gaffff99SBparmbsc0File = parmMerge(parm99gaffff99SBFile, frcmodparmbsc0, frcmod = True)
# parm10file = self.locateDat('parm10.dat') # PARM99 + frcmod.ff99SB + frcmod.parmbsc0 in AmberTools 1.4

cmd += f" -p {parmGaffffxxSBFile}" # Ignoring BSC0
cmd += f" -p '{parmGaffffxxSBFile}'" # Ignoring BSC0
elif "gaff2" in self.atomType:
cmd += " -s 2"

Expand Down Expand Up @@ -1075,7 +1075,7 @@ def execObabel(self):
"""Execute obabel."""
self.makeDir()

cmd = f"{self.obabelExe} -ipdb {self.inputFile} -omol2 -O {self.baseName}.mol2"
cmd = f"'{self.obabelExe}' -ipdb '{self.inputFile}' -omol2 -O '{self.baseName}.mol2'"
self.printDebug(cmd)
self.obabelLog = _getoutput(cmd)
self.ext = ".mol2"
Expand Down Expand Up @@ -1698,7 +1698,7 @@ def writeCharmmTopolFiles(self):
self.getResidueLabel()
res = self.resName

cmd = f"{self.acExe} -dr no -i {self.acMol2FileName} -fi mol2 -o {self.charmmBase} \
cmd = f"'{self.acExe}' -dr no -i '{self.acMol2FileName}' -fi mol2 -o '{self.charmmBase}' \
-fo charmm -s 2 -at {at} -pf n -rn {res}"

self.printDebug(cmd)
Expand Down

0 comments on commit 1c7597b

Please sign in to comment.