def test_from_string(): """Test reading from string.""" test_str = 'TRUE = .True\nFALSE=.f.' incar_io = IncarIo() incar_io.read_string(test_str) incar_dict = incar_io.get_dict() assert incar_dict.pop('true') is True assert incar_dict.pop('false') is False assert not incar_dict
def test_read_incar(): """Read an INCAR file and test that some of the keys are read correctly.""" incar_path = data_path('phonondb', 'INCAR') incar_io = IncarIo(file_path=incar_path) incar_dict = incar_io.get_dict() assert incar_dict['prec'] == 'Accurate' assert incar_dict['ibrion'] == -1 assert incar_dict['encut'] == 359.7399 assert incar_dict['lreal'] is False
def test_example_incar(): """Read a pathological case of an INCAR file (top level example from VASP docs).""" incar_path = data_path('incar_set', 'INCAR.copper_srf') incar_io = IncarIo(file_path=incar_path) incar_dict = incar_io.get_dict() assert incar_dict['system'] == 'Copper surface calculation' assert incar_dict['istart'] == 0 assert isinstance(incar_dict['istart'], int) assert incar_dict['encut'] == 200.01 assert isinstance(incar_dict['encut'], float) assert incar_dict['bmix'] == 2.0 assert isinstance(incar_dict['bmix'], float) assert incar_dict['nelmin'] == 0 assert incar_dict['nelmdl'] == 3