Ejemplo n.º 1
0
def test_parse_poscar_silly_write(fresh_aiida_env, vasp_structure, tmpdir):
    """
    Parse (read, write) a reference POSCAR with silly elemental names.

    Using the PoscarParser and compare the result to a reference structure.

    """

    parser = PoscarParser(data=vasp_structure)
    result = parser.get_quantity('poscar-structure', {})
    names = result['poscar-structure'].get_site_kindnames()
    assert names == ['Hamburger', 'Pizza']
    symbols = result['poscar-structure'].get_symbols_set()
    assert symbols == set(['As', 'In'])

    temp_file = str(tmpdir.join('POSCAR'))
    parser.write(temp_file)

    parser = PoscarParser(file_path=temp_file)
    result_reparse = parser.structure

    names = result_reparse.get_site_kindnames()
    assert names == ['Hamburger', 'Pizza']
    symbols = result_reparse.get_symbols_set()
    assert symbols == set(['X', 'X'])
Ejemplo n.º 2
0
def test_parse_poscar_undercase(fresh_aiida_env, vasp_structure, tmpdir):
    """
    Parse a reference POSCAR.

    With potential elemental names using the PoscarParser and compare
    the result to a reference structure.

    """

    parser = PoscarParser(data=vasp_structure)
    result = parser.get_quantity('poscar-structure', {})
    names = result['poscar-structure'].get_site_kindnames()
    assert names == ['In', 'As', 'As', 'In_d', 'In_d', 'As']
    symbols = result['poscar-structure'].get_symbols_set()
    assert symbols == set(['As', 'In'])
    temp_file = str(tmpdir.join('POSCAR'))
    parser.write(temp_file)
    parser = PoscarParser(file_path=temp_file)
    result_reparse = parser.structure
    names = result_reparse.get_site_kindnames()
    assert names == ['In', 'As', 'As', 'In_d', 'In_d', 'As']
    symbols = result_reparse.get_symbols_set()
    assert symbols == set(['As', 'In'])