Relax a structure in a multi-step process for increased computational efficiency.
This is all done in a single compute job. Settings are such that they are compatible
with the QMOF Database.
-
A "pre-relaxation" with BFGSLineSearch to resolve very high forces.
-
Position relaxation with default ENCUT and coarse k-point grid.
-
Optional: volume relaxation with coarse k-point grid.
-
Double relaxation using production-quality settings.
-
Static calculation.
Parameters:
-
atoms
(Atoms
)
–
-
relax_cell
(bool
, default:
True
)
–
True if a volume relaxation should be performed. False if only the
positions should be updated.
-
run_prerelax
(bool
, default:
True
)
–
If True, a pre-relax will be carried out with BFGSLineSearch.
Recommended if starting from hypothetical structures or materials with
very high starting forces.
-
copy_files
(SourceDirectory | dict[SourceDirectory, Filenames] | None
, default:
None
)
–
Files to copy (and decompress) from source to the runtime directory.
-
**calc_kwargs
–
Custom kwargs for the calculator. Set a value to None
to remove
a pre-existing key entirely. Applies for all jobs.
Returns:
-
QMOFRelaxSchema
–
Dictionary of results. See the type-hint for the data structure.
Source code in quacc/recipes/vasp/qmof.py
| @job
def qmof_relax_job(
atoms: Atoms,
relax_cell: bool = True,
run_prerelax: bool = True,
copy_files: SourceDirectory | dict[SourceDirectory, Filenames] | None = None,
**calc_kwargs,
) -> QMOFRelaxSchema:
"""
Relax a structure in a multi-step process for increased computational efficiency.
This is all done in a single compute job. Settings are such that they are compatible
with the QMOF Database.
1. A "pre-relaxation" with BFGSLineSearch to resolve very high forces.
2. Position relaxation with default ENCUT and coarse k-point grid.
3. Optional: volume relaxation with coarse k-point grid.
4. Double relaxation using production-quality settings.
5. Static calculation.
Parameters
----------
atoms
Atoms object
relax_cell
True if a volume relaxation should be performed. False if only the
positions should be updated.
run_prerelax
If True, a pre-relax will be carried out with BFGSLineSearch.
Recommended if starting from hypothetical structures or materials with
very high starting forces.
copy_files
Files to copy (and decompress) from source to the runtime directory.
**calc_kwargs
Custom kwargs for the calculator. Set a value to `None` to remove
a pre-existing key entirely. Applies for all jobs.
Returns
-------
QMOFRelaxSchema
Dictionary of results. See the type-hint for the data structure.
"""
copy_files = None
# 1. Pre-relaxation
if run_prerelax:
summary1 = _prerelax(atoms, **calc_kwargs)
atoms = summary1["atoms"]
copy_files = {summary1["dir_name"]: ["WAVECAR*"]}
# 2. Position relaxation (loose)
summary2 = _loose_relax_positions(atoms, copy_files=copy_files, **calc_kwargs)
atoms = summary2["atoms"]
copy_files = {summary2["dir_name"]: ["WAVECAR*"]}
# 3. Optional: Volume relaxation (loose)
if relax_cell:
summary3 = _loose_relax_cell(atoms, copy_files=copy_files, **calc_kwargs)
atoms = summary3["atoms"]
copy_files = {summary3["dir_name"]: ["WAVECAR*"]}
# 4. Double Relaxation
# This is done for two reasons: a) because it can
# resolve repadding issues when dV is large; b) because we can use LREAL =
# Auto for the first relaxation and the default LREAL for the second.
summary4 = _double_relax(
atoms, relax_cell=relax_cell, copy_files=copy_files, **calc_kwargs
)
atoms = summary4[-1]["atoms"]
copy_files = {summary4[-1]["dir_name"]: ["WAVECAR*"]}
# 5. Static Calculation
summary5 = _static(atoms, copy_files=copy_files, **calc_kwargs)
summary5["prerelax_lowacc"] = summary1 if run_prerelax else None
summary5["position_relax_lowacc"] = summary2
summary5["volume_relax_lowacc"] = summary3 if relax_cell else None
summary5["double_relax"] = summary4
return summary5
|