Skip to content

Commit

Permalink
adjusting VASP/jobs settings (#200)
Browse files Browse the repository at this point in the history
* increased NSW and NELM default values for the relaxmakers

* adjusted test rela data files

* adjusting unit test with new NSW and NELM values

* adjusting unit test with new NSW and NELM values

* job names in phonon workflow will always be overwritten by autoplex default name

* adjust test job names

* adjust test job names

* overwrite job names to autoplex default for tight relax and static

* adjust test job names
  • Loading branch information
QuantumChemist authored Nov 6, 2024
1 parent fdbee8e commit e879a46
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 74 deletions.
13 changes: 13 additions & 0 deletions autoplex/auto/phonons/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ def dft_phonopy_gen_data(
"LVTOT": False, # Do not write LOCPOT file
"LORBIT": 0, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR
"LOPTICS": False, # No PCDAT file
"NSW": 200,
"NELM": 500,
# to be removed
"NPAR": 4,
}
Expand Down Expand Up @@ -384,6 +386,11 @@ def dft_phonopy_gen_data(
)
)

# always set autoplex default as job name
phonon_displacement_maker.name = "dft phonon static"
phonon_bulk_relax_maker.name = "tight relax"
phonon_static_energy_maker.name = "static"

for displacement in displacements:
dft_phonons = DFTPhononMaker(
symprec=symprec,
Expand Down Expand Up @@ -507,12 +514,18 @@ def dft_random_gen_data(
"LVTOT": False, # Do not write LOCPOT file
"LORBIT": 0, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR
"LOPTICS": False, # No PCDAT file
"NSW": 200,
"NELM": 500,
# to be removed
"NPAR": 4,
}
),
)

# always set autoplex default as job name
displacement_maker.name = "dft rattle static"
rattled_bulk_relax_maker.name = "tight relax"

# TODO: decide if we should remove the additional response here as well
# looks like only the output is changing
random_datagen = RandomStructuresDataGenerator(
Expand Down
84 changes: 41 additions & 43 deletions tests/auto/test_auto_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,48 +1182,46 @@ def test_workflow_with_different_makers(
from jobflow import run_locally

ref_paths = {
"test_bulk_rattled_maker_mp-22905": "dft_ml_data_generation/tight_relax_ISPIN2/",
"test_bulk_phonon_maker_mp-22905": "dft_ml_data_generation/tight_relax_ISPIN2/",
"tight relax_mp-22905": "dft_ml_data_generation/tight_relax_ISPIN2/",
# it's not a DoubleRelaxMaker in the test
"test_phonon_static_energy_maker_mp-22905": "dft_ml_data_generation/tight_relax_ISPIN2/",
"static_mp-22905": "dft_ml_data_generation/tight_relax_ISPIN2/",
"Cl-stat_iso_atom": "Cl_iso_atoms_ISMEAR1/Cl-statisoatom/",
"Li-stat_iso_atom": "Li_iso_atoms_ISMEAR1/Li-statisoatom/",
"test_displacement_maker 1/2_mp-22905": "dft_ml_data_generation/phonon_static_1_ISPIN2/",
"test_displacement_maker 2/2_mp-22905": "dft_ml_data_generation/phonon_static_2_ISPIN2/",
"test_displacement_maker 1/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"test_displacement_maker 2/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"test_displacement_maker 3/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"test_displacement_maker 4/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"test_displacement_maker 5/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"test_displacement_maker 6/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"test_displacement_maker 7/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"test_displacement_maker 8/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"test_displacement_maker 9/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"test_displacement_maker 10/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
"test_displacement_maker 11/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
"test_displacement_maker 12/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
"dft phonon static 1/2_mp-22905": "dft_ml_data_generation/phonon_static_1_ISPIN2/",
"dft phonon static 2/2_mp-22905": "dft_ml_data_generation/phonon_static_2_ISPIN2/",
"dft rattle static 1/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"dft rattle static 2/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"dft rattle static 3/12_mp-22905": "dft_ml_data_generation/rand_static_1_ISPIN2/",
"dft rattle static 4/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"dft rattle static 5/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"dft rattle static 6/12_mp-22905": "dft_ml_data_generation/rand_static_4_ISPIN2/",
"dft rattle static 7/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"dft rattle static 8/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"dft rattle static 9/12_mp-22905": "dft_ml_data_generation/rand_static_8_ISPIN2/",
"dft rattle static 10/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
"dft rattle static 11/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
"dft rattle static 12/12_mp-22905": "dft_ml_data_generation/rand_static_12_ISPIN2/",
}

fake_run_vasp_kwargs = {
"test_bulk_rattled_maker_mp-22905": {"incar_settings": ["ISPIN"]},
"test_bulk_phonon_maker_mp-22905": {"incar_settings": ["ISPIN"]},
"test_phonon_static_energy_maker_mp-22905": {"incar_settings": ["ISPIN"]},
"tight relax_mp-22905": {"incar_settings": ["ISPIN"]},
"static_mp-22905": {"incar_settings": ["ISPIN"]},
"Cl-stat_iso_atom": {"incar_settings": ["ISMEAR"]},
"Li-stat_iso_atom": {"incar_settings": ["ISMEAR"]},
"test_displacement_maker 1/2_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 2/2_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 1/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 2/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 3/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 4/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 5/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 6/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 7/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 8/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 9/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 10/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 11/12_mp-22905": {"incar_settings": ["ISPIN"]},
"test_displacement_maker 12/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft phonon static 1/2_mp-22905": {"incar_settings": ["ISPIN"]},
"dft phonon static 2/2_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 1/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 2/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 3/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 4/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 5/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 6/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 7/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 8/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 9/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 10/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 11/12_mp-22905": {"incar_settings": ["ISPIN"]},
"dft rattle static 12/12_mp-22905": {"incar_settings": ["ISPIN"]},
}

path_to_struct = vasp_test_dir / "dft_ml_data_generation" / "POSCAR"
Expand All @@ -1240,20 +1238,20 @@ def test_workflow_with_different_makers(
name="test_iso_atom_maker", # this will always be overwritten by "{specie}-stat_iso_atom"
input_set_generator=test_iso_atom_static_input_set,
)
test_phonon_displacement_maker = TightDFTStaticMaker(
name="test_displacement_maker",
test_displacement_maker = TightDFTStaticMaker(
name="test_displacement_maker", # overwritten by autoplex default
input_set_generator=test_iso_atom_static_input_set
)
test_rattled_bulk_relax_maker = TightRelaxMaker(
name="test_bulk_rattled_maker",
name="test_bulk_rattled_maker", # overwritten by autoplex default
input_set_generator=test_iso_atom_static_input_set,
)
test_phonon_bulk_relax_maker = TightRelaxMaker(
name="test_bulk_phonon_maker",
name="test_bulk_phonon_maker", # overwritten by autoplex default
input_set_generator=test_iso_atom_static_input_set,
)
test_phonon_static_energy_maker = StaticMaker(
name="test_phonon_static_energy_maker",
name="test_phonon_static_energy_maker", # overwritten by autoplex default
input_set_generator=test_iso_atom_static_input_set,
)
test_different_makers_wf = CompleteDFTvsMLBenchmarkWorkflow(
Expand All @@ -1262,7 +1260,7 @@ def test_workflow_with_different_makers(
supercell_settings={"min_length": 8, "min_atoms": 20},
displacements=[0.01],
volume_custom_scale_factors=[0.975, 0.975, 0.975, 1.0, 1.0, 1.0, 1.025, 1.025, 1.025, 1.05, 1.05, 1.05],
displacement_maker=test_phonon_displacement_maker,
displacement_maker=test_displacement_maker,
phonon_bulk_relax_maker=test_phonon_bulk_relax_maker,
phonon_static_energy_maker=test_phonon_static_energy_maker,
rattled_bulk_relax_maker=test_rattled_bulk_relax_maker,
Expand All @@ -1288,9 +1286,9 @@ def test_workflow_with_different_makers(
store=memory_jobstore,
)

assert "test_phonon_static_energy_maker" in str(responses)
assert "test_bulk_phonon_maker" in str(responses)
assert "test_bulk_rattled_maker" in str(responses)
assert "test_phonon_static_energy_maker" not in str(responses)
assert "test_bulk_phonon_maker" not in str(responses)
assert "test_bulk_rattled_maker" not in str(responses)


def test_phonon_dft_ml_data_generation_flow(
Expand Down
32 changes: 17 additions & 15 deletions tests/auto/test_auto_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def relax_maker():
"LVTOT": False, # Do not write LOCPOT file
"LORBIT": 0, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR
"LOPTICS": False, # No PCDAT file
"NSW": 200,
"NELM": 500,
# to be removed
"NPAR": 4,
}
Expand All @@ -51,11 +53,11 @@ def ref_paths():
"tight relax 1": "dft_ml_data_generation/tight_relax_1/",
"tight relax 2": "dft_ml_data_generation/tight_relax_2/",
"static": "dft_ml_data_generation/static/",
"dft static 1/2": "dft_ml_data_generation/phonon_static_1/",
"dft static 2/2": "dft_ml_data_generation/phonon_static_2/",
"dft static 1/3": "dft_ml_data_generation/rand_static_1/",
"dft static 2/3": "dft_ml_data_generation/rand_static_2/",
"dft static 3/3": "dft_ml_data_generation/rand_static_3/",
"dft phonon static 1/2": "dft_ml_data_generation/phonon_static_1/",
"dft phonon static 2/2": "dft_ml_data_generation/phonon_static_2/",
"dft rattle static 1/3": "dft_ml_data_generation/rand_static_1/",
"dft rattle static 2/3": "dft_ml_data_generation/rand_static_2/",
"dft rattle static 3/3": "dft_ml_data_generation/rand_static_3/",
}


Expand All @@ -65,11 +67,11 @@ def ref_paths_check_sc_mat():
"tight relax 1": "dft_ml_data_generation/tight_relax_1/",
"tight relax 2": "dft_ml_data_generation/tight_relax_2/",
"static": "dft_ml_data_generation/static/",
"dft static 1/2": "dft_ml_data_generation/phonon_static_1_sc_mat/",
"dft static 2/2": "dft_ml_data_generation/phonon_static_2_sc_mat/",
"dft static 1/3": "dft_ml_data_generation/rand_static_1_sc_mat/",
"dft static 2/3": "dft_ml_data_generation/rand_static_2_sc_mat/",
"dft static 3/3": "dft_ml_data_generation/rand_static_3_sc_mat/",
"dft phonon static 1/2": "dft_ml_data_generation/phonon_static_1_sc_mat/",
"dft phonon static 2/2": "dft_ml_data_generation/phonon_static_2_sc_mat/",
"dft rattle static 1/3": "dft_ml_data_generation/rand_static_1_sc_mat/",
"dft rattle static 2/3": "dft_ml_data_generation/rand_static_2_sc_mat/",
"dft rattle static 3/3": "dft_ml_data_generation/rand_static_3_sc_mat/",
}


Expand All @@ -78,17 +80,17 @@ def fake_run_vasp_kwargs():
return {
"tight relax 1": {"incar_settings": ["NSW", "ISMEAR"]},
"tight relax 2": {"incar_settings": ["NSW", "ISMEAR"]},
"dft static 1/2": {"incar_settings": ["NSW"]},
"dft static 2/2": {"incar_settings": ["NSW"]},
"dft static 1/3": {
"dft phonon static 1/2": {"incar_settings": ["NSW"]},
"dft phonon static 2/2": {"incar_settings": ["NSW"]},
"dft rattle static 1/3": {
"incar_settings": ["NSW"],
"check_inputs": ["incar", "poscar", "kpoints", "potcar"],
},
"dft static 2/3": {
"dft rattle static 2/3": {
"incar_settings": ["NSW"],
"check_inputs": ["incar", "poscar", "kpoints", "potcar"],
},
"dft static 3/3": {
"dft rattle static 3/3": {
"incar_settings": ["NSW"],
"check_inputs": ["incar", "poscar", "kpoints", "potcar"],
},
Expand Down
48 changes: 36 additions & 12 deletions tests/data/test_datagen_flows.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
from __future__ import annotations

import os

from atomate2.vasp.powerups import update_user_incar_settings
from atomate2.common.schemas.phonons import PhononBSDOSDoc
from pymatgen.core.structure import Structure
from atomate2.forcefields.jobs import (
GAPRelaxMaker,
GAPStaticMaker,

)

from autoplex.data.common.flows import GenerateTrainingDataForTesting
from autoplex.data.phonons.flows import IsoAtomMaker, RandomStructuresDataGenerator, MLPhononMaker

from atomate2.vasp.jobs.core import TightRelaxMaker
from atomate2.vasp.sets.core import TightRelaxSetGenerator
import pytest

@pytest.fixture(scope="class")
def relax_maker():
return TightRelaxMaker(
run_vasp_kwargs={"handlers": {}},
input_set_generator=TightRelaxSetGenerator(
user_incar_settings={
"ISPIN": 1,
"LAECHG": False,
"ISMEAR": 0,
"ENCUT": 700,
"ISYM": 0,
"SIGMA": 0.05,
"LCHARG": False, # Do not write the CHGCAR file
"LWAVE": False, # Do not write the WAVECAR file
"LVTOT": False, # Do not write LOCPOT file
"LORBIT": 0, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR
"LOPTICS": False, # No PCDAT file
"NSW": 200,
"NELM": 500,
# to be removed
"NPAR": 4,
}
),
)

def test_ml_phonon_maker(test_dir, clean_dir, memory_jobstore):
from jobflow import run_locally
Expand Down Expand Up @@ -43,7 +67,7 @@ def test_ml_phonon_maker(test_dir, clean_dir, memory_jobstore):
assert isinstance(ml_phonon_bs_doc, PhononBSDOSDoc)


def test_data_generation_distort_type_0(vasp_test_dir, mock_vasp, clean_dir):
def test_data_generation_distort_type_0(vasp_test_dir, mock_vasp, relax_maker, clean_dir):
from jobflow import run_locally

path_to_struct = vasp_test_dir / "dft_ml_data_generation" / "POSCAR"
Expand All @@ -64,7 +88,7 @@ def test_data_generation_distort_type_0(vasp_test_dir, mock_vasp, clean_dir):
"check_inputs": ["incar", "kpoints", "potcar"],
},
}
data_gen_dt_0 = RandomStructuresDataGenerator(distort_type=0).make(
data_gen_dt_0 = RandomStructuresDataGenerator(distort_type=0, bulk_relax_maker=relax_maker).make(
structure=structure,
mp_id=test_mpid,
volume_custom_scale_factors=[1.0],
Expand All @@ -84,7 +108,7 @@ def test_data_generation_distort_type_0(vasp_test_dir, mock_vasp, clean_dir):
assert responses[data_gen_dt_0.output[0].uuid][1].replace.jobs[inx].name == name


def test_data_generation_distort_type_1(vasp_test_dir, mock_vasp, clean_dir):
def test_data_generation_distort_type_1(vasp_test_dir, mock_vasp, relax_maker, clean_dir):
from jobflow import run_locally

path_to_struct = vasp_test_dir / "dft_ml_data_generation" / "POSCAR"
Expand Down Expand Up @@ -150,7 +174,7 @@ def test_data_generation_distort_type_1(vasp_test_dir, mock_vasp, clean_dir):
"check_inputs": ["incar", "potcar"],
},
}
data_gen_dt_1 = RandomStructuresDataGenerator(n_structures=3, distort_type=1).make(
data_gen_dt_1 = RandomStructuresDataGenerator(n_structures=3, distort_type=1, bulk_relax_maker=relax_maker).make(
structure=structure,
mp_id=test_mpid,
volume_custom_scale_factors=[1.0],
Expand All @@ -172,7 +196,7 @@ def test_data_generation_distort_type_1(vasp_test_dir, mock_vasp, clean_dir):
assert responses[data_gen_dt_1.output[0].uuid][1].replace.jobs[inx].name == name


def test_data_generation_distort_type_2(vasp_test_dir, mock_vasp, clean_dir):
def test_data_generation_distort_type_2(vasp_test_dir, mock_vasp, relax_maker, clean_dir):
from jobflow import run_locally

path_to_struct = vasp_test_dir / "dft_ml_data_generation" / "POSCAR"
Expand All @@ -198,7 +222,7 @@ def test_data_generation_distort_type_2(vasp_test_dir, mock_vasp, clean_dir):
"check_inputs": ["incar", "potcar"],
},
}
data_gen_dt_2 = RandomStructuresDataGenerator(distort_type=2).make(
data_gen_dt_2 = RandomStructuresDataGenerator(distort_type=2, bulk_relax_maker=relax_maker).make(
structure=structure,
mp_id=test_mpid,
volume_custom_scale_factors=[
Expand All @@ -222,7 +246,7 @@ def test_data_generation_distort_type_2(vasp_test_dir, mock_vasp, clean_dir):
assert responses[data_gen_dt_2.output[0].uuid][1].replace.jobs[inx].name == name


def test_data_generation_volume_range(vasp_test_dir, mock_vasp, clean_dir):
def test_data_generation_volume_range(vasp_test_dir, mock_vasp, relax_maker, clean_dir):
from jobflow import run_locally

path_to_struct = vasp_test_dir / "dft_ml_data_generation" / "POSCAR"
Expand Down Expand Up @@ -258,7 +282,7 @@ def test_data_generation_volume_range(vasp_test_dir, mock_vasp, clean_dir):
"check_inputs": ["incar", "potcar"],
},
}
data_gen_vol = RandomStructuresDataGenerator(distort_type=0).make(
data_gen_vol = RandomStructuresDataGenerator(distort_type=0, bulk_relax_maker=relax_maker).make(
structure=structure,
mp_id=test_mpid,
volume_custom_scale_factors=[0.975, 1.0, 1.025, 1.05],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ LORBIT = 11
LREAL = False
LVTOT = True
LWAVE = False
NELM = 200
NELM = 500
NPAR = 4
NSW = 99
NSW = 200
PREC = Accurate
SIGMA = 0.2
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ LORBIT = 11
LREAL = False
LVTOT = True
LWAVE = False
NELM = 200
NELM = 500
NPAR = 4
NSW = 99
NSW = 200
PREC = Accurate
SIGMA = 0.05s

0 comments on commit e879a46

Please sign in to comment.