Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
- added comments
- removed "run log.py" text following recent changes
- minor changes to optimisation.py
  • Loading branch information
ABrethome committed Sep 24, 2018
1 parent 75b64a2 commit 3d89f6e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion wsterimol/filter_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Filter impossible structures after being generated via Pymol.
# Plausible structures can be visualized from visualize.py
# Use in Pymol command prompt:
# run log.py
# run wSterimol.py
# run sterimoltools.py
# run setup.py
# run filter_gen.py
Expand Down
4 changes: 1 addition & 3 deletions wsterimol/filter_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

# Filter optimised structures generated from Mopac or Gaussian
# Use in Pymol command prompt:
# run log.py
# run wSterimol.py
# run sterimoltools.py
# run setup.py
# run filter_opt.py
# filter_opt (directory, verbose, setup_path)
# example:


def filter_opt(directory = "temp", setup_path = "default", verbose = "False"):
# If the directory exists
Expand Down
2 changes: 1 addition & 1 deletion wsterimol/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Generate possible conformer structures via Pymol
# Use in Pymol command prompt:
# run log.py
# run wSterimol.py
# run setup.py
# run generate.py
# generate [dihedral 1, .. ], (directory, setup_path, verbose, force)
Expand Down
11 changes: 7 additions & 4 deletions wsterimol/optimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

# Optimisation of the structures via Pymol with MOPAC
# Use in Pymol command prompt:
# run log.py
# run wSterimol.py
# run sterimoltools.py
# run setup.py
# run optimisation.py
# optimisation (directory, walltime, verbose, setup_path)
# example: optimisation conformers

def optimisation(directory = "temp", walltime = 300, verbose = "False", setup_path = "default"):
def optimisation(directory = "temp", walltime = 300, verbose = "False", setup_path = "default", silentmode = "True"):
# If the directory exists
if os.path.exists(directory):
# Log generation
Expand All @@ -33,6 +33,9 @@ def optimisation(directory = "temp", walltime = 300, verbose = "False", setup_pa
#verbose
if verbose.lower() in ['true', '1', 't', 'y', 'yes']: verbose = True
else: verbose = False
#silentmode
if silentmode.lower() in ['true', '1', 't', 'y', 'yes']: silentmode = True
else: silentmode = False
# Retrieve all the files in the directory
files = [f for f in listdir(directory) if isfile(join(directory, f))]
if len(files) > 0:
Expand All @@ -56,7 +59,7 @@ def optimisation(directory = "temp", walltime = 300, verbose = "False", setup_pa
log.write("\n-------------------------\nJob starts [%s]" % join(directory, filename), verbose)
# calculate the energy
startupinfo = None
if platform.system() == "Windows":
if platform.system() == "Windows" and silentmode == True:
# Prevent .exe window from popping up in Windows
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW
Expand Down Expand Up @@ -93,7 +96,7 @@ def optimisation(directory = "temp", walltime = 300, verbose = "False", setup_pa
log.write("\n-------------------------\nJob starts [%s]" % join(directory, filename), verbose)
# calculate the energy
startupinfo = None
if platform.system() == "Windows":
if platform.system() == "Windows" and silentmode == True:
# Prevent .exe window from popping up in Windows
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW
Expand Down
2 changes: 1 addition & 1 deletion wsterimol/prepare_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Prepare structures via Pymol for Mopac or Gaussian
# Use in Pymol command prompt:
# run log.py
# run wSterimol.py
# run sterimoltools.py
# run setup.py
# run prepare_file.py
Expand Down
14 changes: 7 additions & 7 deletions wsterimol/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ class Setup:
def __init__(self, log, path = "default", exe = "default"):
#default values
self.software = "MOPAC" # Mopac by default
self.loaded = True # good by default
self.exe = "C:\PROGRA~1\MOPAC\MOPAC2016.exe" #default install for Mopac in Windows
self.loaded = True # good by default, then might get wrong
self.exe = "C:\PROGRA~1\MOPAC\MOPAC2016.exe" #default install for MOPAC in Windows
self.SE = "PM6-DH2" # default force field
self.charge = "0" # uncharged
self.scf = "" # optimisation
self.rmsd_cutoff = 0.1 # Angstroms
self.memories = "8"
self.procsshared = "8"
self.memories = "8"
self.procsshared = "8"
self.leveloftheory = "wb97xd/6-31g(d)"
self.spin = "1"
self.RJCT = 0.50
self.singlepointcalculation = ""
self.singlepointcalculation = "" #none
self.Temperature = 298
self.energywindow_cutoff = []
self.energywindow_cutoff = [] # none
self.print_cutoff = 5.0
self.angle_count = 5
self.radii = "cpk"
Expand Down Expand Up @@ -61,7 +61,7 @@ def __init__(self, log, path = "default", exe = "default"):
log.write("Warning: Specified path to executable doesn't exist. Use setup.ini value.")
if not os.path.exists(config[1]):
self.loaded = False
log.write("Error: Specified path to executable in self.ini doesn't exist. [%s]" % config[1])
log.write("Error: Specified path to executable in setup.ini doesn't exist. [%s]" % config[1])
return
self.exe = config[1]
elif config[0] == "SEMI_EMPIRICAL":
Expand Down
3 changes: 1 addition & 2 deletions wsterimol/sterimol.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

# Generate the Sterimol parameters from the optimised structures
# Use in Pymol command prompt:
# run log.py
# run sterimoltools.py
# run wSterimol.py
# run setup.py
# run sterimoltools.py
# run sterimol.py
Expand Down
7 changes: 5 additions & 2 deletions wsterimol/weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def weight(setup_path = "default", verbose = "False"):
output.write("** For non-commercial use only Version %.2f **\n" % version)
output.write("*******************************************************************************\n")
output.write("** Developed by: **\n")
output.write("** Alex Brethome - University of Oxford **\n")
output.write("** Alexandre Brethome - University of Oxford **\n")
output.write("** Robert Paton - Colorado State University (patonlab.com) **\n")
output.write("** If you use wSterimol, please acknowledge: Brethome, A.; Fletcher, S. P.; **\n")
output.write("** If you use wSterimol, please acknowledge:Brethome, A. V.; Fletcher, S. P.;**\n")
output.write("** Paton, R. S. submitted 2018 **\n")
output.write("*******************************************************************************\n")
output.write("** ____ ______ ____ ___ ____ __ ___ ____ __ **\n")
Expand Down Expand Up @@ -166,6 +166,9 @@ def weight(setup_path = "default", verbose = "False"):
output.write("** %7.2f %7.2f %7.2f **\n" % (L1_weighted,B1_weighted,B5_weighted))
output.write("** **\n")
output.write("*******************************************************************************\n")
# log update showing results
log.write(" wL (A) wB1 (A) wB5 (A) \n")
log.write(" %7.2f %7.2f %7.2f \n" % (L1_weighted,B1_weighted,B5_weighted))
# calculate min max for each different energy windows
for k in range(len(setup.energywindow_cutoff)):
output.write("\n\n*******************************************************************************\n")
Expand Down

0 comments on commit 3d89f6e

Please sign in to comment.