def get_formula_dict(self): """returns formula as dictionary that can be passed to functions in periodic_table""" ret = PT.formula_dict(self.symbol) if self.free_valency + self.explicit_hydrogens > 0: ret['H'] = self.free_valency + self.explicit_hydrogens return ret
def get_formula_dict( self): """returns formula as dictionary that can be passed to functions in periodic_table""" ret = PT.formula_dict( self.symbol) if self.free_valency + self.explicit_hydrogens > 0: ret['H'] = self.free_valency + self.explicit_hydrogens return ret
def read_sum_layer( self): if "." in self.layers[1]: raise oasa_not_implemented_error( "INChI", "multiple compound systems are not supported by the library") form = pt.formula_dict( self.layers[1]) processed_hs = 0 #for diborane and similar compounds we must process some Hs here j = 0 for k in form.sorted_keys(): for i in range( form[k]): if k == 'H': # we want to process only the Hs that are not in the h-layer if processed_hs >= form[k] - self.hs_in_hydrogen_layer: continue else: processed_hs += 1 j += 1 a = self.structure.create_vertex() a.symbol = k self.structure.add_vertex( a) a.properties_['inchi_number'] = j
def read_sum_layer(self): if "." in self.layers[1]: raise oasa_not_implemented_error( "INChI", "multiple compound systems are not supported by the library") form = pt.formula_dict(self.layers[1]) processed_hs = 0 #for diborane and similar compounds we must process some Hs here j = 0 for k in form.sorted_keys(): for i in range(form[k]): if k == 'H': # we want to process only the Hs that are not in the h-layer if processed_hs >= form[k] - self.hs_in_hydrogen_layer: continue else: processed_hs += 1 j += 1 a = self.structure.create_vertex() a.symbol = k self.structure.add_vertex(a) a.properties_['inchi_number'] = j
def get_formula_dict(self): """returns a formula dict as defined in the periodic_table.py::formula_dict""" comp = PT.formula_dict() for a in self.atoms: comp += a.get_formula_dict() return comp
def get_formula_dict( self): """returns a formula dict as defined in the periodic_table.py::formula_dict""" comp = PT.formula_dict() for a in self.atoms: comp += a.get_formula_dict() return comp