Skip to content

Commit

Permalink
Merge pull request #40 from nxtloveev3/main
Browse files Browse the repository at this point in the history
Updated Autosolvate, incorporating parameter suggestion and validation options for users
  • Loading branch information
ffangliu committed Feb 28, 2024
2 parents 502bde4 + 1d2cba0 commit 8c0a7ac
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions autosolvate/autosolvate.py
@@ -1,7 +1,7 @@
from openbabel import pybel
import getopt, sys, os
from openbabel import openbabel as ob
import subprocess
import subprocess
import pkg_resources
from autosolvate.globs import keywords_avail, available_qm_programs, available_charge_methods
from autosolvate.resp_classes.resp_factory import resp_factory
Expand Down Expand Up @@ -628,7 +628,7 @@ def startboxgen(argumentList):
related to structure and force field parameter generation.
Command line option definitions
-n, --solutename IUPAC name for solute
-n, --solutename initialize suggestion for box parameter for a given solute's name
-m, --main solute xyz file
-s, --solvent name of solvent (water, methanol, chloroform, nma)
-o, --output prefix of the output file names
Expand All @@ -644,7 +644,7 @@ def startboxgen(argumentList):
-t, --closeness Solute-solvent closeness setting, for acetonitrile tolerance parameter in packmol in Å, for water, methanol, nma, chloroform the scaling factor in tleap, setting to 'automated' will automatically set this parameter based on solvent.
-l, --solventoff path to the custom solvent .off library file. Required if the user want to use some custom solvent other than the 5 solvents contained in AutoSolvate (TIP3P water, methanol, NMA, chloroform, MeCN)
-p, --solventfrcmod path to the custom solvent .frcmod file. Required if the user wants to use some custom solvent other than the 5 solvents contained in AutoSolvate.
-v, --validation option to run validation step
-v, --validation option to run validation step for given solute's name
-h, --help short usage description
Returns
Expand Down Expand Up @@ -678,7 +678,7 @@ def startboxgen(argumentList):
for currentArgument, currentValue in arguments:
if currentArgument in ("-h", "--help"):
print('Usage: autosolvate boxgen [OPTIONS]')
print(' -n, --solutename IUPAC name for solute')
print(' -n, --solutename initialize suggested parameter for given solute')
print(' -v, --validation verify validity of input parameters')
print(' -m, --main solute xyz file')
print(' -s, --solvent name of solvent')
Expand All @@ -696,21 +696,20 @@ def startboxgen(argumentList):
print(' -l, --solventoff path to the custom solvent .off library file')
print(' -D, --rundir running directory where temporary files are stored')
print(' -p, --solventfrcmod path to the custom solvent .frcmod file')
print(' -v, --validation option to run validation step')
print(' -v, --validation option to run validation step for given solute')
print(' -h, --help short usage description')
exit()
exit()
elif currentArgument in ("-n", "--solutename"):
print("Solute:", currentValue)
solutename=str(currentValue)
sol=PubChemAPI(solutename)
info=sol.getinfo()
info=sol.get_info()
solutexyz=str(info[3])
slu_netcharge = info[2]
solS=Solute(info[0], info[1], info[2], info[3])
print("Suggested xyz structure from PubChem is located at: ", solutexyz=str(info[3]))
print("Suggested solute net charge is ", info[2])
print("Suggested solute spin multiplicity is ", solS.get_spin_multiplicity())
print("Suggested charge method is/are", solS.get_methods())
print("Suggested solvent box length is ", solS.get_box_length())
cube_size = solS.get_box_length()
slu_spinmult = solS.get_spin_multiplicity()
charge_method = solS.get_methods()[0]
elif currentArgument in ("-m", "--main"):
print ("Main/solutexyz", currentValue)
solutexyz=str(currentValue)
Expand Down Expand Up @@ -757,12 +756,14 @@ def startboxgen(argumentList):
print("Custom solvent .frcmmod file path:", currentValue)
solvent_frcmod = currentValue
elif currentArgument in ("-v", "--validation"):
sol=PubChemAPI(solutename)
info=sol.getinfo()
sol=PubChemAPI(currentArgument)
info=sol.get_info()
solS=Solute(info[0], info[1], info[2], info[3])
mult_suggest = solS.get_spin_multiplicity() % 2
mult_given = slu_spinmult % 2
if slu_netcharge != info[2]:
raise Exception("Incorrect solute net charge given, please double check your value or use suggestion function enabled by -n or --solutename")
if slu_spinmult != solS.get_spin_multiplicity():
if mult_suggest != mult_given:
raise Exception("Incorrect solute spin multiplicity given, please double check your value or use suggestion function enabled by -n or --solutename")
if charge_method not in solS.get_methods():
raise Exception("Incorrect charge method given, please double check your value or use suggestion function enabled by -n or --solutename")
Expand Down

0 comments on commit 8c0a7ac

Please sign in to comment.