Ejemplo n.º 1
0
 def __init__(self, composition, energy, correction=0.0, parameters=None, data=None):
     """
     Args:
         composition:
             Composition of the entry. For flexibility, this can take the form
             of a {symbol: amt} dictionary as well the standard pymatgen
             Composition object.
         energy:
             Energy of the entry. Usually the final calculated energy from
             VASP or other electronic structure codes.
         correction:
             A correction to be applied to the energy. This is used to modify
             the energy for certain analyses. Defaults to 0.0.
         parameters:
             An optional dict of parameters associated with the entry. Defaults
             to None.
         data:
             An optional dict of any additional data associated with 
             the entry. Defaults to None
     """
     if not isinstance(composition, Composition):
         comp = Composition.from_dict(composition)
     else:
         comp = composition
     super(ComputedEntry, self).__init__(comp, energy)
     self.correction = correction
     self.parameters = parameters if parameters else {}
     self.data = data if data else {}
Ejemplo n.º 2
0
 def test_to_dict(self):
     c = Composition.from_dict({'Fe': 4, 'O': 6})
     d = c.to_dict
     correct_dict = {'Fe': 4.0, 'O': 6.0}
     self.assertEqual(d['Fe'], correct_dict['Fe'])
     self.assertEqual(d['O'], correct_dict['O'])
     correct_dict = {'Fe': 2.0, 'O': 3.0}
     d = c.to_reduced_dict
     self.assertEqual(d['Fe'], correct_dict['Fe'])
     self.assertEqual(d['O'], correct_dict['O'])
Ejemplo n.º 3
0
 def test_from_dict(self):
     sym_dict = {"Fe":6, "O" :8}
     self.assertEqual(Composition.from_dict(sym_dict).reduced_formula, "Fe3O4", "Creation form sym_amount dictionary failed!")