コード例 #1
0
ファイル: atom.py プロジェクト: caiyingchun/OASA
 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
コード例 #2
0
ファイル: atom.py プロジェクト: Robot-Will/OASA
 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
コード例 #3
0
ファイル: inchi.py プロジェクト: Robot-Will/OASA
  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
コード例 #4
0
ファイル: inchi.py プロジェクト: caiyingchun/OASA
    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
コード例 #5
0
ファイル: molecule.py プロジェクト: caiyingchun/OASA
 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
コード例 #6
0
ファイル: molecule.py プロジェクト: Robot-Will/OASA
 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