Skip to content

Commit

Permalink
Update_solv_workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mgt16-LANL committed Oct 18, 2024
1 parent 8403c56 commit 20fde70
Show file tree
Hide file tree
Showing 4 changed files with 1,360 additions and 641 deletions.
19 changes: 9 additions & 10 deletions architector/io_obabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# Imports
import ase
import itertools
from ase.io import read
from ase import units
import numpy as np
Expand All @@ -20,8 +19,8 @@
from pynauty import Graph as pnGraph
from pynauty import canon_label

# ob.obErrorLog.SetOutputLevel(0) # Set warnings to only critical.
ob.obErrorLog.StopLogging() # Turn off ALL openbabel logging.
# ob.obErrorLog.SetOutputLevel(0) # Set warnings to only critical.

warnings.filterwarnings('ignore') # Supress warnings.

Expand Down Expand Up @@ -442,27 +441,27 @@ def generate_obmol_conformers(structure, rmsd_cutoff=0.4, conf_cutoff=3000,
_, anums, graph = get_OBMol_coords_anums_graph(obmol, return_coords=False,
get_types=False)
syms = [io_ptable.elements[x] for x in anums]
act_inds = [i for i,x in enumerate(syms) if x in io_ptable.actinides]
swapped=False
act_inds = [i for i, x in enumerate(syms) if x in io_ptable.actinides]
swapped = False
if len(act_inds) > 0:
an_symbols = [syms[x] for x in act_inds]
ln_symbols = [io_ptable.lanthanides[io_ptable.actinides.index(x)] for x in an_symbols]
j = 0
for i, atom in enumerate(ob.OBMolAtomIter(obmol)):
if i in act_inds:
atom.SetAtomicNum(io_ptable.elements.index(ln_symbols[j]))
j+=1
swapped=True
j += 1
swapped = True
mmff94_ok = check_mmff_okay(obmol)
if mmff94_ok:
FF = ob.OBForceField.FindForceField("MMFF94")
FF.Setup(obmol) # Make sure setup works OK
FF.Setup(obmol) # Make sure setup works OK
else:
FF = ob.OBForceField.FindForceField("UFF")
FF.Setup(obmol) # Make sure setup works OK
FF.Setup(obmol) # Make sure setup works OK
if fix_m_neighbors:
mets = [i for i,x in enumerate(syms) if x in io_ptable.all_metals]
if len(mets) == 1: # Freeze metal and neighbor positions - relax ligands
mets = [i for i, x in enumerate(syms) if x in io_ptable.all_metals]
if len(mets) == 1: # Freeze metal and neighbor positions - relax ligands
frozen_atoms = [mets[0]+1] + (np.nonzero(np.ravel(graph[mets[0]]))[0] + 1).tolist()
constr = ob.OBFFConstraints()
for j in frozen_atoms:
Expand Down
1,965 changes: 1,337 additions & 628 deletions development/solubility_dev/Soldb_workflow_dev.ipynb

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions development/solubility_dev/gbsa_opt.txt

This file was deleted.

15 changes: 14 additions & 1 deletion development/solubility_dev/xtb_solvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@


def read_solv_params(file):
"""XTB output parser for solvent parameters
Parameters
----------
file : str
file to load
Returns
-------
outdict : dict
dictionary of output
"""
with open(file, "r") as file1:
lines = file1.readlines()
solvent_area_start_key = "generalized Born model for continuum solvation"
Expand Down Expand Up @@ -93,7 +105,8 @@ def xtb_solv_params(structure, solvent="water"):
xtbPath, int(mol_charge), int(uhf), solvent
)

sub.run(execStr, shell=True, check=True)
sub.run(execStr, shell=True, check=True,
stderr=sub.DEVNULL, stdout=sub.DEVNULL)

# Read conformers from file
result_dict = read_solv_params("output.xtb")
Expand Down

0 comments on commit 20fde70

Please sign in to comment.