def test_namelist_to_str(): pwig = PwxInputGenerator( crystal_structure=al_fcc_struct, calculation_presets="scf", custom_sett_dict={"pseudo_dir": pseudo_dir}, ) control = "\n".join(al_fcc_scf_in.splitlines()[:7]) assert pwig._namelist_to_str("control") == control electrons = "\n".join(al_fcc_scf_in.splitlines()[17:20]) assert pwig._namelist_to_str("electrons") == electrons
def test_control_namelist_to_str(): # control namelist without pseudo, settings: error pwig = PwxInputGenerator(crystal_structure=feo_struct) pwig.specify_potentials = True with pytest.raises(PwxInputGeneratorError): pwig._namelist_to_str("control") # specify_potentials = False: no error pwig.specify_potentials = False nl = pwig._namelist_to_str("control") assert nl == "&CONTROL\n/" # with no pseudo, with settings pwig.custom_sett_dict.update({"calculation": "scf"}) nl = pwig._namelist_to_str("control") assert nl == '&CONTROL\n calculation = "scf"\n/' # specify_potentials = True: throw error pwig.specify_potentials = True with pytest.raises(PwxInputGeneratorError): pwig._namelist_to_str("control") # normal functionality pwig.custom_sett_dict.update({"pseudo_dir": pseudo_dir}) pwig.calculation_presets = "scf" control = "\n".join(feo_scf_in.splitlines()[:7]) assert pwig._namelist_to_str("control") == control