From 46f6b6eb53dcb82b2066db1488e84644e57c8fbe Mon Sep 17 00:00:00 2001 From: jwtoney Date: Fri, 22 Sep 2023 11:09:03 -0400 Subject: [PATCH 1/2] Added argument to generate_full_complex_coulomb_autocorrelations() --- molSimplify/Informatics/autocorrelation.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/molSimplify/Informatics/autocorrelation.py b/molSimplify/Informatics/autocorrelation.py index 1c169a32..5a0463df 100644 --- a/molSimplify/Informatics/autocorrelation.py +++ b/molSimplify/Informatics/autocorrelation.py @@ -368,8 +368,8 @@ def deltametric_catoms(mol, prop_vec, orig, d, oct=True, catoms=None): return (result_vector) -def full_autocorrelation(mol, prop, d, oct=oct, modifier=False, use_dist=False): - w = construct_property_vector(mol, prop, oct=oct, modifier=modifier) +def full_autocorrelation(mol, prop, d, oct=oct, modifier=False, use_dist=False, transition_metals_only=True): + w = construct_property_vector(mol, prop, oct=oct, modifier=modifier, transition_metals_only=transition_metals_only) index_set = list(range(0, mol.natoms)) autocorrelation_vector = np.zeros(d + 1) for centers in index_set: @@ -632,7 +632,7 @@ def layer_density_in_3D(mol, prop_vec, orig, d, oct=True): return result_vector -def construct_property_vector(mol: mol3D, prop: str, oct=True, modifier=False): +def construct_property_vector(mol: mol3D, prop: str, oct=True, modifier=False, transition_metals_only=True): # # assigns the value of property # # for atom i (zero index) in mol # # to position i in returned vector @@ -727,7 +727,7 @@ def construct_property_vector(mol: mol3D, prop: str, oct=True, modifier=False): done = True elif prop == 'num_bonds': for i, atom in enumerate(mol.getAtoms()): - if not atom.ismetal(): + if not atom.ismetal(transition_metals_only): w[i] = globs.bondsdict()[atom.symbol()] else: w[i] = len(mol.getBondedAtomsSmart(i, oct=oct)) @@ -1751,7 +1751,7 @@ def generate_full_complex_autocorrelations(mol, loud, def generate_full_complex_coulomb_autocorrelations(mol, loud, depth=3, oct=True, flag_name=False, modifier=False, - use_dist=False): + use_dist=False, transition_metals_only=True): result = list() colnames = [] # allowed_strings = ['ident', 'topology', 'bondvalence', 'valenceelectron', 'bondvalence_devi', 'bodavrg', 'bodstd', @@ -1762,7 +1762,8 @@ def generate_full_complex_coulomb_autocorrelations(mol, loud, for ii, properties in enumerate(allowed_strings): metal_ac = full_autocorrelation(mol, properties, depth, oct=oct, modifier=modifier, - use_dist=use_dist) + use_dist=use_dist, + transition_metals_only=transition_metals_only) this_colnames = [] for i in range(0, depth + 1): this_colnames.append(labels_strings[ii] + '-' + str(i)) From 0f30b4a915782cc9ebafc57f8ebea31c49cb26ea Mon Sep 17 00:00:00 2001 From: Ralf Meyer Date: Fri, 22 Sep 2023 12:01:40 -0400 Subject: [PATCH 2/2] Remove state from atom3d.ismetal() --- molSimplify/Classes/atom3D.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/molSimplify/Classes/atom3D.py b/molSimplify/Classes/atom3D.py index a707edbe..e1b05600 100644 --- a/molSimplify/Classes/atom3D.py +++ b/molSimplify/Classes/atom3D.py @@ -49,8 +49,6 @@ def __init__(self, Sym='C', xyz=None, name=False, partialcharge=None, Tfactor=0, self.name = name else: self.name = Sym - # flag for metal - self.metal = None # Coordinates if xyz is None: @@ -159,12 +157,7 @@ def ismetal(self, transition_metals_only=True): metal : bool Bool for whether or not an atom is a metal. """ - if self.metal is None: - if self.sym in globalvars().metalslist(transition_metals_only=transition_metals_only): - self.metal = True - else: - self.metal = False - return self.metal + return self.sym in globalvars().metalslist(transition_metals_only=transition_metals_only) def setcoords(self, xyz): """ Set coordinates of an atom3D class to a new location.