Skip to content

Commit

Permalink
Add distatomtype_pairs option.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgt16-LANL committed Jul 12, 2024
1 parent 5b63269 commit edac426
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 19 deletions.
28 changes: 16 additions & 12 deletions architector/complex_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,23 @@ def compute_conformer_efficacy(self,conformerList,rot_vals,ligand):
best_val = np.inf
bestConformer = conformerList[0]
assembled = False
for i,conformer in enumerate(conformerList):# Try and use XTB
for i,conformer in enumerate(conformerList): # Try and use XTB
tmp_molecule = io_molecule.convert_io_molecule(self.initMol)
tmp_molecule.append_ligand({'ase_atoms':conformer,'bo_dict':ligand.BO_dict,
'atom_types':ligand.atom_types,
'ca_metal_dist_constraints':ligand.ca_metal_dist_constraints})
tmp_molecule.append_ligand({'ase_atoms': conformer,
'bo_dict': ligand.BO_dict,
'atom_types': ligand.atom_types,
'ca_metal_dist_constraints':
ligand.ca_metal_dist_constraints})
if self.parameters['debug']:
print(tmp_molecule.write_mol2('cool{}.mol2'.format(i),writestring=True))
out_eval = CalcExecutor(tmp_molecule,assembly=True,
print(tmp_molecule.write_mol2('cool{}.mol2'.format(i),
writestring=True))
out_eval = CalcExecutor(tmp_molecule, assembly=True,
parameters=self.parameters,
init_sanity_check=True)
if out_eval.successful:
Eval = out_eval.energy*(1/rot_vals[i]) # Bias to lower rotational loss values
if Eval < best_val and out_eval.successful:
# Bias to lower rotational loss values
Eval = out_eval.energy*(1/rot_vals[i])
if Eval < best_val and out_eval.successful:
assembled = True
bestConformer = conformer
best_val = Eval
Expand Down Expand Up @@ -473,7 +477,7 @@ def complex_driver(inputDict1):
newligDict[key] = oldligclass
ligandDict = newligDict
else: # Generate from scratch
ligandDict = {} #
ligandDict = {} #

coreCoordList = core_geo_class.geometry_dict[coreType]

Expand All @@ -484,9 +488,9 @@ def complex_driver(inputDict1):
)
if inputDict['parameters']['debug']:
print('Assigned LigCons ->')
print('LigLists:', all_liglists)
print('LigLists:', all_liglists)
print('coreCoordList:', coreCoordList)
print('Unique Symmetries:',total_unique_symmetries)
print('Unique Symmetries:', total_unique_symmetries)

fin_time1 = time.time()
symmetry_preprocess_time = fin_time1 - int_time1
Expand Down Expand Up @@ -624,7 +628,7 @@ def build_complex_driver(inputDict1):
# Iterate through all structures and check/remove duplicate structures.
# Remove extra classes that we don't need to persist
del inputDict['core_geo_class']
del inputDict['parameters']['ase_db']
del inputDict['parameters']['ase_db']
for ind, i in enumerate(order):
iscopy = False
if (ind > 0) and (not inputDict['parameters'][
Expand Down
33 changes: 26 additions & 7 deletions architector/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def add_bonds(view_ats,
labelsize=12,
distvisradius=0.3,
distatompairs=None,
distatomtype_pairs=None,
distcolor='black',
distskin=0.3,
distopacity=0.85,
Expand Down Expand Up @@ -107,6 +108,9 @@ def add_bonds(view_ats,
distatompairs : list,
Atom pairs to view distances.
e.g. [[0,1],[1,2]] will show only distances between a0 and a1, and a1 and a2, by default None
distatomtype_pairs: list,
Atom type pairs to view distances.
Give multiple sets of atom types to give distnaces [['Fe','O]] should give all fe-o distances...
distcolor : str,
color of drawn distance vectors, by default 'black'
distopacity: float,
Expand All @@ -125,7 +129,8 @@ def add_bonds(view_ats,
skin=distskin,
ref_ind=vis_distances,
radius=distradius,
atom_pairs=distatompairs)
atom_pairs=distatompairs,
atom_type_pairs=distatomtype_pairs)
visited = list()
count = 0
for i,row in bondsdf.iterrows():
Expand Down Expand Up @@ -166,12 +171,19 @@ def add_bonds(view_ats,
'fontColor':"white",'inFront':'true'},viewer=viewer)



def view_structures(structures, w=200, h=200, columns=4, representation='ball_stick', labelsize=12,
labels=False, labelinds=None, labelatoms=False, vector=None, sphere_scale=0.3, stick_scale=0.25,
metal_scale=0.75, modes=None, trajectory=False, interval=200, vis_distances=None,
distvisradius=0.3, distcolor='black', distopacity=0.85, distskin=0.3, distradius=None,
distlabelposit=1.0, distatompairs=None, stack=False, stack_align=True, hydrogens=True):
def view_structures(structures,
w=200, h=200,
columns=4, representation='ball_stick', labelsize=12,
labels=False, labelinds=None,
labelatoms=False, vector=None,
sphere_scale=0.3, stick_scale=0.25,
metal_scale=0.75, modes=None, trajectory=False,
interval=200, vis_distances=None,
distvisradius=0.3, distcolor='black',
distopacity=0.85, distskin=0.3, distradius=None,
distlabelposit=1.0, distatompairs=None,
distatomtype_pairs=None,
stack=False, stack_align=True, hydrogens=True):
"""view_structures
Jupyter-notebook-based visualization of molecular structures.
Expand Down Expand Up @@ -252,6 +264,9 @@ def view_structures(structures, w=200, h=200, columns=4, representation='ball_st
distatompairs : list,
Atom pairs to view distances.
e.g. [[0,1],[1,2]] will show only distances between a0 and a1, and a1 and a2, by default None
distatomtype_pairs : list,
Atom type pairs to view distances.
e.g. [['Fe','O'],['Fe','N']] will give distances between all Fe-O and all Fe-N distances, by default None
stack : bool,
Stack all the images in a single viewer, default False.
stack_align : bool,
Expand Down Expand Up @@ -357,6 +372,7 @@ def view_structures(structures, w=200, h=200, columns=4, representation='ball_st
distradius=distradius,
distlabelposit=distlabelposit,
distatompairs=distatompairs,
distatomtype_pairs=distatomtype_pairs,
vis_distances=vis_distances)
view_ats.zoomTo()
view_ats.show()
Expand Down Expand Up @@ -491,6 +507,7 @@ def view_structures(structures, w=200, h=200, columns=4, representation='ball_st
distradius=distradius,
distlabelposit=distlabelposit,
distatompairs=distatompairs,
distatomtype_pairs=distatomtype_pairs,
labelsize=labelsize, vis_distances=vis_distances, viewer=(x,y))
view_ats.zoomTo(viewer=(x,y))
if y+1 < columns: # Fill in columns
Expand Down Expand Up @@ -533,6 +550,7 @@ def view_structures(structures, w=200, h=200, columns=4, representation='ball_st
distradius=distradius,
distlabelposit=distlabelposit,
distatompairs=distatompairs,
distatomtype_pairs=distatomtype_pairs,
labelsize=labelsize, vis_distances=vis_distances)
view_ats.zoomTo()
view_ats.animate({'interval':interval,'loop':'forward'}) # Infinite repetition
Expand Down Expand Up @@ -576,6 +594,7 @@ def view_structures(structures, w=200, h=200, columns=4, representation='ball_st
distradius=distradius,
distlabelposit=distlabelposit,
distatompairs=distatompairs,
distatomtype_pairs=distatomtype_pairs,
labelsize=labelsize, vis_distances=vis_distances)
view_ats.zoomTo()
view_ats.show()
Expand Down

0 comments on commit edac426

Please sign in to comment.