Exemplo n.º 1
0
def test_manual_energy_adjustment():
    ea = ManualEnergyAdjustment(10)
    assert ea.name == "Manual energy adjustment"
    assert ea.value == 10
    assert ea.explain == "Manual energy adjustment (10.000 eV)"
    ead = ea.as_dict()
    ea2 = ManualEnergyAdjustment.from_dict(ead)
    assert str(ead) == str(ea2.as_dict())
Exemplo n.º 2
0
 def test_normalize_energy_adjustments(self):
     ealist = [ManualEnergyAdjustment(5),
               ConstantEnergyAdjustment(5),
               CompositionEnergyAdjustment(1, 5, uncertainty_per_atom=0, name="Na"),
               TemperatureEnergyAdjustment(0.005, 100, 10, uncertainty_per_degK=0)
               ]
     entry = ComputedEntry("Na5Cl5", 6.9, energy_adjustments=ealist)
     assert entry.correction == 20
     entry.normalize()
     assert entry.correction == 4
     for ea in entry.energy_adjustments:
         assert ea.value == 1
Exemplo n.º 3
0
    def test_normalize_not_in_place(self):
        ealist = [
            ManualEnergyAdjustment(5),
            ConstantEnergyAdjustment(5),
            CompositionEnergyAdjustment(1, 5, uncertainty_per_atom=0, name="Na"),
            TemperatureEnergyAdjustment(0.005, 100, 10, uncertainty_per_deg=0),
        ]
        entry = ComputedEntry("Na5Cl5", 6.9, energy_adjustments=ealist)

        normed_entry = entry.normalize(inplace=False)
        entry.normalize()

        self.assertEqual(normed_entry.as_dict(), entry.as_dict())
Exemplo n.º 4
0
def test_manual_energy_adjustment():
    ea = ManualEnergyAdjustment(10)
    assert ea.name == "Manual energy adjustment"
    assert ea.value == 10
    assert ea.description == "Manual energy adjustment (10.000 eV)"