Example #1
0
def test_composition_energies_yaml_roundtrip(composition_energies, tmpdir):
    expected_text = """Cl1:
  energy: 12.0
  source: f
H1:
  energy: 0.0
  source: a
H4O2:
  energy: -4.0
  source: c
O1:
  energy: 1.0
  source: b
O2Cl1:
  energy: 3.0
  source: e
O2Cl2:
  energy: 6.0
  source: d
"""
    assert_yaml_roundtrip(composition_energies,
                          tmpdir,
                          expected_text,
                          compare_dict=False,
                          compare_items=False)
Example #2
0
def test_yaml_roundtrip(unitcell, tmpdir):
    expected_text = """system: MgAl2O4
vbm: -1.5053
cbm: 5.1
ele_dielectric_const:
- - 1.0
  - 2.0
  - 3.0
- - 4.0
  - 5.0
  - 6.0
- - 7.0
  - 8.0
  - 9.0
ion_dielectric_const:
- - 10.0
  - 20.0
  - 30.0
- - 40.0
  - 50.0
  - 60.0
- - 70.0
  - 80.0
  - 90.0
"""
    assert_yaml_roundtrip(unitcell, tmpdir, expected_text)
Example #3
0
def test_energy_yaml2(defect_energy_info2, tmpdir):
    expected_text = """name: hole polaron
charge: 1
formation_energy: 0.0
atom_io:
energy_corrections:
  no correction: 0.0
is_shallow: """
    assert_yaml_roundtrip(defect_energy_info2, tmpdir, expected_text)
Example #4
0
def test_std_energies(standard_energies, tmpdir):
    expected_text = """Mg: 1.0
O: 2.0
"""
    assert_yaml_roundtrip(standard_energies,
                          tmpdir,
                          expected_text,
                          compare_dict=False,
                          compare_items=False)
Example #5
0
def test_relative_energies_yaml(relative_energies, tmpdir):
    expected_text = """MgAlO2: -1.0
MgO2: -3.0
"""
    assert_yaml_roundtrip(relative_energies,
                          tmpdir,
                          expected_text,
                          compare_dict=False,
                          compare_items=False)
Example #6
0
def test_energy_yaml(defect_energy_info, tmpdir):
    expected_text = """name: Va_O1
charge: 1
formation_energy: 1.0
atom_io:
  O: -1
energy_corrections:
  1st order: 1.0
  alignment: 2.0
is_shallow: False"""
    assert_yaml_roundtrip(defect_energy_info, tmpdir, expected_text)
Example #7
0
def test_target_vertices(target_vertices, tmpdir):
    print(tmpdir)
    tmpdir.chdir()
    expected_text = """target: MgO2
A:
  chem_pot:
    Al: -1.0
    Mg: 0.0
    O: -4.5
  competing_phases:
  - Mg
  impurity_phases:
  - MgAlO2
B:
  chem_pot:
    Al: -1.0
    Mg: -9.0
    O: 0.0
  competing_phases:
  - O
  impurity_phases:
  - MgAlO2
"""
    assert_yaml_roundtrip(target_vertices, tmpdir, expected_text)