Skip to content

Commit

Permalink
new function get_molecular_mass
Browse files Browse the repository at this point in the history
  • Loading branch information
gianmarco-terrones committed May 9, 2024
1 parent ba0ef66 commit 3b2f7af
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions molSimplify/Classes/mol3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,10 @@ def getAtoms(self):
"""
Get all atoms within a molecule.
Parameters
----------
None
Returns
-------
atom_list : list
Expand Down Expand Up @@ -3543,7 +3547,7 @@ def writexyz(self, filename, symbsonly=False, ignoreX=False,

def writemxyz(self, mol, filename):
"""
Write standard XYZ file with two molecules
Write standard XYZ file with two molecules.
Parameters
----------
Expand Down Expand Up @@ -4463,7 +4467,7 @@ def IsOct(self, init_mol=None, dict_check=False,
skip=False, flag_deleteH=True,
silent=False, use_atom_specific_cutoffs=True):
"""
Main geometry check method for octahedral structures
Main geometry check method for octahedral structures.
Parameters
----------
Expand Down Expand Up @@ -4595,7 +4599,7 @@ def IsStructure(self, init_mol=None, dict_check=False,
flag_catoms=False, catoms_arr=None, debug=False,
skip=False, flag_deleteH=True):
"""
Main geometry check method for square pyramidal structures
Main geometry check method for square pyramidal structures.
Parameters
----------
Expand Down Expand Up @@ -4948,7 +4952,7 @@ def get_fcs(self, strict_cutoff=False, catom_list=None, max6=True):

def get_bo_dict_from_inds(self, inds):
"""
Recreate bo_dict with correct indices
Recreate bo_dict with correct indices.
Parameters
----------
Expand Down Expand Up @@ -5594,7 +5598,7 @@ def get_geometry_type(self, dict_check=False, angle_ref=False,
trigonal bipyramidal(5), square pyramidal(5, one-empty-site),
octahedral(6), pentagonal bipyramidal(7))
uses hapticity truncated first coordination shell.
Uses hapticity truncated first coordination shell.
Does not require the input of num_coord.
Parameters
Expand Down Expand Up @@ -5693,7 +5697,7 @@ def get_geometry_type_distance(
"""
Get the type of the geometry (available options in globalvars all_geometries).
uses hapticity truncated first coordination shell.
Uses hapticity truncated first coordination shell.
Does not require the input of num_coord.
Parameters
Expand Down Expand Up @@ -5855,7 +5859,7 @@ def get_features(self, lac=True, force_generate=False, eq_sym=False,
use_dist=False, NumB=False, Gval=False, size_normalize=False,
alleq=False, strict_cutoff=False, catom_list=None, MRdiag_dict={}, depth=3):
"""
Get geo-based RAC features for this complex (if octahedral)
Get geo-based RAC features for this complex (if octahedral).
Parameters
----------
Expand Down Expand Up @@ -5977,7 +5981,7 @@ def convexhull(self):
'ERROR: Convex hull calculation failed. Structure will be inaccurate.\n')
self.hull = hull

def numRings(self, index):
def num_rings(self, index):
"""
Computes the number of simple rings an atom is in.
Expand Down Expand Up @@ -6012,3 +6016,26 @@ def numRings(self, index):
myNumRings += 1

return myNumRings

def get_molecular_mass(self):
"""
Computes the molecular mass of a mol3D.
Parameters
----------
None
Returns
-------
mol_mass : float
The molecular mass.
"""

globs = globalvars()
amassdict = globs.amass()

mol_mass = 0
for i in self.atoms:
mol_mass += amassdict[i.symbol()][0] # atomic mass

return mol_mass

0 comments on commit 3b2f7af

Please sign in to comment.