Exemplo n.º 1
0
def test_insulator_kpt_density(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt,
                                   xc=Xc.pbe, vbm_cbm=[0, 0.5])
    actual = opts.structure_kpoints_options["kpt_density"]
    expected = defaults.insulator_kpoint_density
    assert actual == expected

    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt,
                                   xc=Xc.pbe, band_gap=1.0)
    actual = opts.structure_kpoints_options["kpt_density"]
    expected = defaults.insulator_kpoint_density
    assert actual == expected

    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt,
                                   xc=Xc.pbe, vbm_cbm=[0, 0.5],
                                   kpt_density=100)
    assert opts.structure_kpoints_options["kpt_density"] == 100
Exemplo n.º 2
0
def test_integration(tmpdir):
    tmpdir.chdir()
    lattice = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
    coords = [[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]
    structure = Structure(lattice=lattice, species=["Mn", "O"], coords=coords)
    input_options = CategorizedInputOptions(structure=structure,
                                            task=Task.structure_opt,
                                            xc=Xc.pbe)

    input_set = VaspInputFiles(input_options)
    input_set.create_input_files(Path.cwd())
Exemplo n.º 3
0
def test_no_options(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe)

    structure_kpoints_keys = set(opts.structure_kpoints_options.keys())
    assert structure_kpoints_keys == {"initial_structure", "task"}

    potcar_keys = set(opts.potcar_options.keys())
    assert potcar_keys == {"xc"}

    incar_settings_keys = set(opts.incar_settings_options.keys())
    assert incar_settings_keys == {'xc', 'task'}
Exemplo n.º 4
0
def make_atom_vasp_set(potcar_set: PotcarSet, xc: Xc):
    for element in PotcarSet.mp_relax_set.potcar_dict().keys():
        Path(element).mkdir()
        structure = Structure(Lattice.cubic(10),
                              coords=[[0.5] * 3],
                              species=[element])
        input_options = CategorizedInputOptions(structure,
                                                task=Task.cluster_opt,
                                                xc=xc,
                                                potcar_set=potcar_set)
        vasp_input_files = VaspInputFiles(input_options,
                                          overridden_incar_settings={
                                              "ISPIN": 2,
                                              "NUPDOWN": nupdown[element],
                                              "NELM": 300
                                          })
        vasp_input_files.create_input_files(dirname=Path(element))
Exemplo n.º 5
0
    def __init__(self, args: Namespace):
        self.args = args
        self._file_transfers = None

        try:
            self._prior_info = PriorInfo.load_yaml()
        except FileNotFoundError:
            self._prior_info = PriorInfo()
        task = Task.cluster_opt if self._prior_info.is_cluster else args.task

        options = CategorizedInputOptions(
            structure=self._structure(),
            task=task,
            xc=args.xc,
            kpt_density=args.kpt_density,
            overridden_potcar=self._overridden_potcar(),
            **self._option_kwargs())

        vif = VaspInputFiles(options, self._overridden_incar_settings())
        vif.create_input_files(Path.cwd())
        if self._file_transfers:
            self._file_transfers.transfer()
Exemplo n.º 6
0
def test_defect_kpt_density(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.defect, xc=Xc.pbe)
    actual = opts.structure_kpoints_options["kpt_density"]
    expected = defaults.defect_kpoint_density
    assert actual == expected
Exemplo n.º 7
0
def test_initial_structure(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe,
                                   charge=100.0)

    assert opts.initial_structure == sc_structure
Exemplo n.º 8
0
def test_incar_settings_options(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe,
                                   charge=100.0)

    assert opts.incar_settings_options["charge"] == 100.0
Exemplo n.º 9
0
def test_potcar_options(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe,
                                   overridden_potcar={"A": "B"})

    assert opts.potcar_options["overridden_potcar"] == {"A": "B"}
Exemplo n.º 10
0
def test_structure_kpoints_options(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe,
                                   kpt_density=100)

    assert opts.structure_kpoints_options["kpt_density"] == 100
Exemplo n.º 11
0
def test_raise_error(sc_structure):
    with pytest.raises(ViseInputOptionsError):
        CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe,
                                fake_option="")
Exemplo n.º 12
0
def test_initial_structures(sc_structure):
    opts = CategorizedInputOptions(sc_structure, task=Task.structure_opt, xc=Xc.pbe)
    assert str(opts.initial_structure.composition) == "H1"