Skip to content

Add pre optimization steps to phonon workflow #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1f59ad6
jfr docs extension
QuantumChemist Jan 21, 2025
2efdd60
Merge branch 'autoatml:main' into main
QuantumChemist Jan 30, 2025
a79f320
move Maker defaults to complete_dft_vs_ml wf def
QuantumChemist Jan 30, 2025
114469f
set phonon_static_energy to None
QuantumChemist Jan 30, 2025
51dc902
remove commented out code
QuantumChemist Jan 30, 2025
6992917
removed all dft_static... ref paths from fixture in auto phonon flow …
QuantumChemist Jan 30, 2025
fa2c6c3
set static_energy_maker default in DFTPhononMaker to None
QuantumChemist Jan 30, 2025
2917b49
set static_energy_maker default in MLPhononMaker to None
QuantumChemist Jan 30, 2025
ca8eeaf
removed dft_static... in ref paths and static_energy_maker from fixtu…
QuantumChemist Jan 30, 2025
397f53b
set phonon_static_energy_maker default to None in CompleteDFTvsMLBenc…
QuantumChemist Jan 30, 2025
5c7adca
Merge branch 'main' into main
QuantumChemist Feb 5, 2025
0c2f24d
Merge branch 'autoatml:main' into main
QuantumChemist Feb 5, 2025
0aca329
Merge branch 'autoatml:main' into main
QuantumChemist Feb 6, 2025
f631dd8
keep dosctrings consistent
QuantumChemist Feb 6, 2025
3a42406
set NEP static maker to None
QuantumChemist Feb 6, 2025
2324b8a
remove commented out lines from pyproject.toml
QuantumChemist Feb 6, 2025
f931fe0
remove bc print
QuantumChemist Feb 7, 2025
52b5575
Merge branch 'autoatml:main' into main
QuantumChemist Mar 11, 2025
2065ef6
allow bulk relax maker to be none
JaGeo Apr 6, 2025
6630dd3
add a pre optimization
JaGeo Apr 6, 2025
933b324
Merge branch 'main' into add_pre_opt
JaGeo Apr 6, 2025
20edb52
pre-commit auto-fixes
pre-commit-ci[bot] Apr 6, 2025
de7f83d
add a pre optimization
JaGeo Apr 6, 2025
47a6d12
add a pre optimization
JaGeo Apr 6, 2025
bb29eb7
add a pre optimization
JaGeo Apr 6, 2025
62e338d
pre-commit auto-fixes
pre-commit-ci[bot] Apr 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 23 additions & 30 deletions src/autoplex/auto/phonons/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker):
The total number of randomly displaced structures to be generated.
displacement_maker: BaseVaspMaker
Maker used for a static calculation for a supercell.
pre_relax_maker: BaseVaspMaker
Maker used for the bulk relax unit cell calculation
before the phonon_relax_maker or rattled_relax_maker.
phonon_bulk_relax_maker: BaseVaspMaker
Maker used for the bulk relax unit cell calculation.
rattled_bulk_relax_maker: BaseVaspMaker
Expand Down Expand Up @@ -181,7 +184,7 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker):
add_dft_rattled_struct: bool = True
add_rss_struct: bool = False
displacement_maker: BaseVaspMaker = None
phonon_bulk_relax_maker: BaseVaspMaker | None = field(
pre_relax_maker: BaseVaspMaker | None = field(
default_factory=lambda: DoubleRelaxMaker.from_relax_maker(
TightRelaxMaker(
name="dft tight relax",
Expand Down Expand Up @@ -210,32 +213,9 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker):
)
)
)
phonon_bulk_relax_maker: BaseVaspMaker | None = None
phonon_static_energy_maker: BaseVaspMaker | None = None

rattled_bulk_relax_maker: BaseVaspMaker | None = field(
default_factory=lambda: TightRelaxMaker(
run_vasp_kwargs={"handlers": {}},
input_set_generator=TightRelaxSetGenerator(
user_incar_settings={
"ALGO": "Normal",
"ISPIN": 1,
"LAECHG": False,
"ISYM": 0, # to be changed
"ISMEAR": 0,
"SIGMA": 0.05, # to be changed back
"LCHARG": False, # Do not write the CHGCAR file
"LWAVE": False, # Do not write the WAVECAR file
"LVTOT": False, # Do not write LOCPOT file
"LORBIT": None, # 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,
}
),
)
)
rattled_bulk_relax_maker: BaseVaspMaker | None = None
isolated_atom_maker: IsoAtomStaticMaker | None = None
n_structures: int = 10
displacements: list[float] = field(default_factory=lambda: [0.01])
Expand Down Expand Up @@ -342,16 +322,22 @@ def make(
),
default_hyperparameters["GAP"]["soap"],
)
# add an optional pre-optimization step here

for structure, mp_id in zip(structure_list, mp_ids):
if self.pre_relax_maker is not None:
pre_relax_job = self.pre_relax_maker.make(structure)
flows.append(pre_relax_job)
new_structure = pre_relax_job.output.structure
pre_relax_job.name = "dft tight relax"
else:
new_structure = structure
self.supercell_settings.setdefault(mp_id, {})
logging.warning(
"Currently, "
"the same supercell settings for single-atom displaced and rattled supercells are used."
)
supercell_matrix_job = reduce_supercell_size_job(
structure=structure,
structure=new_structure,
min_length=self.supercell_settings.get("min_length", 15),
max_length=self.supercell_settings.get("max_length", 20),
fallback_min_length=self.supercell_settings.get(
Expand All @@ -371,7 +357,7 @@ def make(

if self.add_dft_rattled_struct:
add_dft_ratt = self.add_dft_rattled(
structure=structure,
structure=new_structure,
mp_id=mp_id,
displacement_maker=self.displacement_maker,
rattled_bulk_relax_maker=self.rattled_bulk_relax_maker,
Expand Down Expand Up @@ -399,7 +385,7 @@ def make(
fit_input.update({mp_id: add_dft_ratt.output})
if self.add_dft_phonon_struct:
add_dft_phon = self.add_dft_phonons(
structure=structure,
structure=new_structure,
mp_id=mp_id,
displacements=self.displacements,
symprec=self.symprec,
Expand Down Expand Up @@ -465,6 +451,13 @@ def make(
for ibenchmark_structure, benchmark_structure in enumerate(
benchmark_structures
):
# To make sure that the structure is optimized
if (
self.pre_relax_maker is not None
and self.phonon_bulk_relax_maker is None
):
self.phonon_bulk_relax_maker = self.pre_relax_maker

# hard coded at the moment as other displacements
# are not treated correctly in benchmark part
complete_bm = complete_benchmark(
Expand Down
Loading