"""Define VASP implementations of MPMorph flows.For information about the current flows, contact:- Bryant Li (@BryantLi-BLI)- Aaron Kaplan (@esoteric-ephemera)- Max Gallant (@mcgalcode)"""from__future__importannotationsimportmathfromdataclassesimportdataclass,fieldfromtypingimportTYPE_CHECKINGfromjobflowimportResponsefromatomate2.common.flows.mpmorphimport(EquilibriumVolumeMaker,FastQuenchMaker,MPMorphMDMaker,SlowQuenchMaker,)fromatomate2.vasp.flows.mdimportMultiMDMakerfromatomate2.vasp.jobs.mpmorphimport(BaseMPMorphMDMaker,FastQuenchVaspMaker,SlowQuenchVaspMaker,)fromatomate2.vasp.powerupsimportupdate_user_incar_settingsifTYPE_CHECKING:fromjobflowimportMakerfromtyping_extensionsimportSelffromatomate2.vasp.jobs.baseimportBaseVaspMakerfromatomate2.vasp.jobs.mdimportMDMaker
[docs]@dataclassclassMPMorphVaspMDMaker(MPMorphMDMaker):"""Base MPMorph flow for amorphous solid equilibration using VASP. This flow uses NVT molecular dynamics to: (1 - optional) Determine the equilibrium volume of an amorphous structure via EOS fit. (2 - optional) Quench the equilibrium volume structure from a higher temperature down to a lower desired "production" temperature. (3) Run a production, longer-time MD run in NVT. The production run can be broken up into smaller steps to ensure the simulation does not hit wall time limits. Check atomate2.common.flows.mpmorph for MPMorphMDMaker Parameters ---------- name : str Name of the flows produced by this maker. equilibrium_volume_maker : EquilibriumVolumeMaker MDMaker to generate the equilibrium volumer searcher; inherits from EquilibriumVolumeMaker and MDMaker (VASP) quench_maker : SlowQuenchMaker or FastQuenchMaker or None SlowQuenchMaker - MDMaker that quenches structure from high to low temperature FastQuenchMaker - DoubleRelaxMaker + Static that "quenches" structure at 0K production_md_maker : BaseMPMorphMDMaker MDMaker to generate the production run(s); inherits from MDMaker (VASP) or MultiMDMaker """name:str="MP Morph VASP MD Maker"equilibrium_volume_maker:EquilibriumVolumeMaker=field(default_factory=lambda:EquilibriumVolumeMaker(md_maker=BaseMPMorphMDMaker()))production_md_maker:MDMaker|MultiMDMaker=field(default_factory=BaseMPMorphMDMaker)
[docs]@classmethoddeffrom_temperature_and_steps(# type: ignore[override]cls,temperature:float,n_steps_convergence:int=5000,n_steps_production:int=10000,end_temp:float|None=None,md_maker:Maker=BaseMPMorphMDMaker,n_steps_per_production_run:int|None=None,quench_maker:FastQuenchMaker|SlowQuenchMaker|None=None,)->Self:""" Create VASP MPMorph flow from a temperature and number of steps. Parameters ---------- temperature : float The (starting) temperature n_steps_convergence : int = 5000 The number of steps used in MD runs for equilibrating structures. n_steps_production : int = 10000 The number of steps used in MD production runs. end_temp : float or None If a float, the temperature to ramp down to in the production run. If None (default), set to `temperature`. base_md_maker : Maker The Maker used to start MD runs. n_steps_per_production_run : int or None (default) If an int, the number of steps to use per production run, using MultiMDMaker to orchestrate chained production runs. quench_maker : SlowQuenchMaker or FastQuenchMaker or None SlowQuenchMaker - MDMaker that quenches structure from high to low temperature FastQuenchMaker - DoubleRelaxMaker + Static that "quenches" structure at 0K """end_temp=end_temportemperatureconv_md_maker=update_user_incar_settings(flow=md_maker(),incar_updates={"TEBEG":temperature,"TEEND":temperature,"NSW":n_steps_convergence,},)conv_md_maker=conv_md_maker.update_kwargs(update={"name":"Convergence MPMorph VASP MD Maker"})equilibrium_volume_maker=EquilibriumVolumeMaker(name="MP Morph VASP Equilibrium Volume Maker",md_maker=conv_md_maker)ifn_steps_per_production_runisNone:n_steps_per_production_run=n_steps_productionn_production_runs=1else:n_production_runs=math.ceil(n_steps_production/n_steps_per_production_run)production_md_maker=update_user_incar_settings(flow=md_maker(),incar_updates={"TEBEG":temperature,"TEEND":temperature,"NSW":n_steps_per_production_run,},)production_md_maker=production_md_maker.update_kwargs(update={"name":"Production MPMorph VASP MD Maker"})ifn_production_runs>1:production_md_maker=Response(replace=MultiMDMaker(name="Production MPMorph VASP MultiMD Maker",md_makers=[production_md_makerfor_inrange(n_production_runs)],))returncls(name="MP Morph VASP MD Maker",equilibrium_volume_maker=equilibrium_volume_maker,production_md_maker=production_md_maker,quench_maker=quench_maker,)
[docs]@dataclassclassMPMorphSlowQuenchVaspMDMaker(MPMorphVaspMDMaker):"""VASP MPMorph flow plus slow quench. Calculates the equilibrium volume of a structure at a given temperature. A convergence fitting for the volume and finally a production run at a given temperature. Check atomate2.common.flows.mpmorph for MPMorphMDMaker Parameters ---------- name : str Name of the flows produced by this maker. equilibrium_volume_maker : EquilibriumVolumeMaker MDMaker to generate the equilibrium volumer searcher; inherits from EquilibriumVolumeMaker and MDMaker (VASP) production_md_maker : BaseMPMorphMDMaker MDMaker to generate the production run(s); inherits from MDMaker (VASP) or MultiMDMaker. quench_maker : SlowQuenchVaspMaker SlowQuenchVaspMaker - MDMaker that quenches structure from high to low temperature in piece-wise ('stepwise') AIMD runs. Check atomate2.vasp.jobs.mpmorph for SlowQuenchVaspMaker. """name:str="MP Morph VASP MD Maker Slow Quench"equilibrium_volume_maker:EquilibriumVolumeMaker=field(default_factory=lambda:EquilibriumVolumeMaker(md_maker=BaseMPMorphMDMaker()))production_md_maker:MDMaker=field(default_factory=BaseMPMorphMDMaker)quench_maker:SlowQuenchVaspMaker=field(default_factory=lambda:SlowQuenchVaspMaker(BaseMPMorphMDMaker(name="Slow Quench VASP Maker"),quench_n_steps=1000,quench_temperature_step=500,quench_end_temperature=500,quench_start_temperature=3000,descent_method="stepwise",))
[docs]@dataclassclassMPMorphFastQuenchVaspMDMaker(MPMorphVaspMDMaker):""" VASP MPMorph flow including multiple production runs and slow quench. Calculates the equilibrium volume of a structure at a given temperature. A convergence fitting for the volume and finally a production run at a given temperature. Runs a "Fast Quench" at 0K using a double relaxation plus static. Check atomate2.common.flows.mpmorph for MPMorphMDMaker Parameters ---------- name : str Name of the flows produced by this maker. equilibrium_volume_maker : EquilibriumVolumeMaker MDMaker to generate the equilibrium volumer searcher; inherits from EquilibriumVolumeMaker and MDMaker (VASP) production_md_maker : BaseMPMorphMDMaker MDMaker to generate the production run(s); inherits from MDMaker (VASP) or MultiMDMaker. quench_maker : FastQuenchVaspMaker FastQuenchVaspMaker - MDMaker that quenches structure from high temperature to 0K. Check atomate2.vasp.jobs.mpmorph for FastQuenchVaspMaker. """name:str="MP Morph VASP MD Maker Fast Quench"equilibrium_volume_maker:EquilibriumVolumeMaker=field(default_factory=lambda:EquilibriumVolumeMaker(md_maker=BaseMPMorphMDMaker()))production_md_maker:MDMaker=field(default_factory=BaseMPMorphMDMaker)quench_maker:BaseVaspMaker=field(default_factory=FastQuenchVaspMaker)