Skip to content

Commit

Permalink
Update openmmdlsetup.py
Browse files Browse the repository at this point in the history
Adjusted with the moval of the script generation
  • Loading branch information
talagayev authored Aug 9, 2024
1 parent 8984b4e commit 505c4bb
Showing 1 changed file with 16 additions and 139 deletions.
155 changes: 16 additions & 139 deletions openmmdl/openmmdl_setup/openmmdlsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import webbrowser
import zipfile

from openmmdl.openmmdl_setup.setup_options import SimulationOptionsConfigurator
from openmmdl.openmmdl_setup.setup_options import SetupOptionsConfigurator
from openmmdl.openmmdl_setup.configfile_creator import ConfigCreator


Expand Down Expand Up @@ -260,35 +260,10 @@ def downloadAmberBashScript():

def configureDefaultAmberOptions():
"""Select default options based on the file format and force field."""
# Ligand
session["nmLig"] = ""
session["spLig"] = ""
session["lig_ff"] = "gaff2"
session["charge_value"] = "0"
session["charge_method"] = "bcc"

# Receptor
session["prot_ff"] = "ff19SB"
session["dna_ff"] = "OL15"
session["rna_ff"] = "OL3"
session["carbo_ff"] = "GLYCAM_06j"

# AddWaterMembrane
session["addType"] = "addWater"
session["boxType"] = "cube"
session["dist"] = "10"

session["lipid_tp"] = "POPC"
session["other_lipid_tp_input"] = "POPC:TOPC"
session["lipid_ratio"] = "1:1"
session["lipid_ff"] = "lipid21"
session["dist2Border"] = "15"
session["padDist"] = "17"

session["water_ff"] = "opc"
session["pos_ion"] = "Na+"
session["neg_ion"] = "Cl-"
session["ionConc"] = "0.15"

simulation_configurator = SetupOptionsConfigurator(session)

simulation_configurator.configureDefaultAmberOptions()


def createAmberBashScript():
Expand Down Expand Up @@ -1031,123 +1006,25 @@ def configureDefaultOptions():
"""Select default options based on the file format and force field."""

# Initialize the configurator with the session
simulation_configurator = SimulationOptionsConfigurator(session)
simulation_configurator = SetupOptionsConfigurator(session)

simulation_configurator.configure_default_options()

def createScript():
script = []
config_creator = ConfigCreator(session, uploadedFiles)

# If we are creating this script for internal use to run a simulation directly, add extra code at the top
# to set the working directory and redirect stdout to the pipe.
# Header

script.append(
"# This script was generated by OpenMMDL Setup on %s.\n"
% datetime.date.today()
)
script.append(
"""
,-----. .-------. .-''-. ,---. .--.,---. ,---.,---. ,---. ______ .---.
.' .-, '. \ _(`)_ \ .'_ _ \ | \ | || \ / || \ / || _ `''. | ,_|
/ ,-.| \ _ \ | (_ o._)| / ( ` ) '| , \ | || , \/ , || , \/ , || _ | ) _ \,-./ )
; \ '_ / | :| (_,_) /. (_ o _) || |\_ \| || |\_ /| || |\_ /| ||( ''_' ) |\ '_ '`)
| _`,/ \ _/ || '-.-' | (_,_)___|| _( )_\ || _( )_/ | || _( )_/ | || . (_) `. | > (_) )
: ( '\_/ \ ;| | ' \ .---.| (_ o _) || (_ o _) | || (_ o _) | ||(_ ._) '( . .-'
\ `"/ \ ) / | | \ `-' /| (_,_)\ || (_,_) | || (_,_) | || (_.\.' / `-'`-'|___
'. \_/``".' / ) \ / | | | || | | || | | || .' | \
'-----' `---' `'-..-' '--' '--''--' '--''--' '--''-----'` `--------`
"""
)

script.append(
"""
__ __ ___ __ ___ ___
/ ` / \ |\ | |__ | / _` |__ | | |__
\__, \__/ | \| | | \__> | | |___ |___
"""
)
# Input files
script.append("\n# Input Files")
fileType = session["fileType"]
if fileType == "pdb":
script.append("""############# Ligand and Protein Data ###################""")
script.append(
"""######## Add the Ligand SDF File and Protein PDB File in the Folder with the Script ######### \n"""
)
pdbType = session["pdbType"]
if pdbType == "pdb":
script.append('input_file_type = "pdb"')
script.append('protein = "%s"' % uploadedFiles["file"][0][1])
if session["sdfFile"] != "":
script.append("ligand = '%s'" % session["sdfFile"])
script.append('ligand_name = "UNK"')
script.append("minimization = %s" % session["ligandMinimization"])
script.append("smallMoleculeForceField = '%s'" % session["smallMoleculeForceField"])
script.append("sanitization = %s" % session["ligandSanitization"])
water = session["waterModel"]
elif fileType == "amber":
script.append(
"""####### Add the Amber Files in the Folder with this Script ####### \n"""
)
# amber_files related variables
if session["has_files"] == "yes":
script.append('input_file_type = "amber"')
script.append("prmtop_file = '%s'" % uploadedFiles["prmtopFile"][0][1])
script.append('inpcrd_file = "%s"' % uploadedFiles["inpcrdFile"][0][1])

# ligand related variables
if session["nmLig"] == True:
nmLigName = session["nmLigName"] # e.g. 'UNL'
else:
nmLigName = None

if session["spLig"] == True: # success
spLigName = session["spLigName"] # e.g. 'HEME'
else:
spLigName = None

elif session["has_files"] == "no":
script.append("prmtop_file = 'system.%s.prmtop'" % session["water_ff"])
script.append("inpcrd_file = 'system.%s.inpcrd' " % session["water_ff"])

# ligand related variables
if session["nmLig"] == True:
nmLigFileName = uploadedFiles["nmLigFile"][0][1] # e.g. '8QY.pdb'
nmLigName = extractLigName(
nmLigFileName
) # e.g '8QY' or 'UNL' # resname in topology
else:
nmLigFileName = None
nmLigName = None

if session["spLig"] == True: # success
spLigFileName = uploadedFiles["spLigFile"][0][1]
spLigName = extractLigName(spLigFileName)
else:
spLigFileName = None
spLigName = None

## Feed prmtop_file and inpcrd_file to OpenMM Reader
script.append("prmtop = AmberPrmtopFile(prmtop_file)")
script.append("inpcrd = AmberInpcrdFile(inpcrd_file)")

config_creator = ConfigCreator(session)
config_creator.add_forcefield_and_water_model_configuration(script)

if fileType == "pdb":
script.append(
"""\n############# Forcefield, Water and Membrane Model Selection ###################\n"""
)
script.append("forcefield = '%s'" % session["forcefield"])
if water != "None":
script.append("water = '%s'" % water)
else:
script.append("water = %s" % water)

config_creator.add_openmmdl_ascii_art_logo(script)

config_creator.add_ascii_config_art(script)

################################## IF CLEANING WAS PERFORMED ##############################################
###########################################################################################################
###########################################################################################################
config_creator.add_pdb_input_files_configuration(script)

config_creator.add_amber_file_configuration(script)

config_creator.add_forcefield_and_water_model_configuration(script)


config_creator.add_solvent_configuration(script)
Expand Down

0 comments on commit 505c4bb

Please sign in to comment.