From 7a03bcf1fb21f0f72ec52aa753361714060ef1e2 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Tue, 22 Oct 2024 13:09:15 +0200 Subject: [PATCH 1/3] minor fixes --- docs/user/flows/flows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user/flows/flows.md b/docs/user/flows/flows.md index 62cd0c64..11ca110a 100644 --- a/docs/user/flows/flows.md +++ b/docs/user/flows/flows.md @@ -12,7 +12,7 @@ This tutorial will demonstrate how to use `autoplex` with its default setup and The complete workflow of `autoplex` involves the data generation (including the execution of VASP calculations), -the fitting of the machine-learned interatomic potential (MLIP) and the benchmark to the DFT results. +the fitting of the machine-learned interatomic potential (MLIP) and the benchmark to the DFT results. ### Before running the workflow @@ -42,7 +42,7 @@ check_supercells(structure_list, mpids, min_length=18, max_length=25, fallback_m `check_supercells` will list all structures that should likely be excluded. However, please carefully check yourself as your local memory requirements might be different. Remove all structures which you cannot treat computationally -(e.g., structures with lattice parameters larger than 25 Angstrom or more than 500 atoms) +(e.g., structures with lattice parameters larger than 25 Å or more than 500 atoms). ## Now start the workflow From bf70912c3ee1406b4fbad25cd9a3ec0f128c895b Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Tue, 22 Oct 2024 13:09:52 +0200 Subject: [PATCH 2/3] added how to change VASP makers --- docs/user/generation/data.md | 53 ++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/docs/user/generation/data.md b/docs/user/generation/data.md index 366b1702..54a57a64 100644 --- a/docs/user/generation/data.md +++ b/docs/user/generation/data.md @@ -100,19 +100,26 @@ that can be used to construct customized randomized structures workflows. ## VASP settings -For the single-atom displaced as well as the randomized structures the [TightDFTStaticMaker](#autoplex.data.phonons.flows.TightDFTStaticMaker) (for huge single-atom -displaced supercells with lattice parameters > 18 Å the [TightDFTStaticMakerBigSupercells](#autoplex.data.phonons.flows.TightDFTStaticMakerBigSupercells)) is used to set up the -VASP calculation input and settings. PBEsol is the default GGA functional. +This part will show you how you can adjust the different Makers for the VASP calculations in the workflow. -The `TightDFTStaticMaker` settings can be overridden by +For the single-atom displaced as well as the rattled structures the `autoplex` [TightDFTStaticMaker](#autoplex.data.phonons.flows.TightDFTStaticMaker) is +used to set up the VASP calculation input and settings. PBEsol is the default GGA functional. For the VASP calculation +of the isolated atoms' energies, `autoplex` also provides its own [IsoAtomStaticMaker](#autoplex.data.phonons.flows.IsoAtomStaticMaker). +For the VASP geometry relaxation and static calculations of the unit cells as prerequisite calculations for generating +the single-atom displaced as well as the rattled supercells, +we rely on the [atomate2](https://materialsproject.github.io/atomate2/user/codes/vasp.html#list-of-vasp-workflows) +Makers `StaticMaker`, `TightRelaxMaker` in combination with the `StaticSetGenerator` VASP input set generator. + +The Makers' settings can be overridden as shown in the following code example: ```python from autoplex.auto.phonons.flows import CompleteDFTvsMLBenchmarkWorkflow -from autoplex.data.phonons.flows import TightDFTStaticMaker +from autoplex.data.phonons.flows import IsoAtomStaticMaker, TightDFTStaticMaker +from atomate2.vasp.jobs.core import StaticMaker, TightRelaxMaker from atomate2.vasp.sets.core import StaticSetGenerator -complete_flow = CompleteDFTvsMLBenchmarkWorkflow( - phonon_displacement_maker=TightDFTStaticMaker( - input_set_generator=StaticSetGenerator(user_incar_settings={ +example_input_set = StaticSetGenerator( # you can also define multiple input sets + user_kpoints_settings={"grid_density": 1}, + user_incar_settings={ "ALGO": "Normal", "IBRION": -1, "ISPIN": 1, @@ -120,5 +127,33 @@ complete_flow = CompleteDFTvsMLBenchmarkWorkflow( ..., # set all INCAR tags you need "SIGMA": 0.05, "GGA": "PE", # switches to PBE - ...}))).make(...) + ...}, +) +static_isolated_atom_maker = IsoAtomStaticMaker( + name="isolated_atom_maker", + input_set_generator=example_input_set, +) +displacement_maker = TightDFTStaticMaker( + name="displacement_maker", + input_set_generator=example_input_set, +) +rattled_bulk_relax_maker = TightRelaxMaker( + name="bulk_rattled_maker", + input_set_generator=example_input_set, +) +phonon_bulk_relax_maker = TightRelaxMaker( + name="bulk_phonon_maker", + input_set_generator=example_input_set, +) +phonon_static_energy_maker = StaticMaker( + name="phonon_static_energy_maker", + input_set_generator=example_input_set, +) + +complete_flow = CompleteDFTvsMLBenchmarkWorkflow( + displacement_maker=displacement_maker, # one displacement maker for rattled and single-atom displaced supercells to keep VASP settings consistent + phonon_bulk_relax_maker=phonon_bulk_relax_maker, + phonon_static_energy_maker=phonon_static_energy_maker, + rattled_bulk_relax_maker=rattled_bulk_relax_maker, + isolated_atom_maker=static_isolated_atom_maker,).make(...) ``` \ No newline at end of file From a90148b8300a2fe152eee9c2b853c786615a8e9f Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Tue, 22 Oct 2024 13:10:15 +0200 Subject: [PATCH 3/3] added Si GAP autoplex wf example --- docs/user/fitting/fitting.md | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/docs/user/fitting/fitting.md b/docs/user/fitting/fitting.md index c841e2f5..c7824d3e 100644 --- a/docs/user/fitting/fitting.md +++ b/docs/user/fitting/fitting.md @@ -212,6 +212,61 @@ complete_flow = CompleteDFTvsMLBenchmarkWorkflow( ) ``` +## Example script for `autoplex` workflow using GAP to fit and benchmark a Si database + +The following code snippet will demonstrate, how you can submit an `autoplex` workflow for an automated SOAP-only GAP fit +and DFT benchmark for a Si allotrope database. The GAP fit parameters are taken from [J. Chem. Phys. 153, 044104 (2020)](https://pubs.aip.org/aip/jcp/article/153/4/044104/1056348/Combining-phonon-accuracy-with-high). +In this example we will also use `hyper_para_loop=True` to loop through a set of given GAP fit convergence parameter +and hyperparameters set as provided by the lists `atomwise_regularization_list`, `soap_delta_list` and `n_sparse_list`. +In this example script, we are using `jobflow_remote` to submit the jobs to a remote cluster. + +```python +from jobflow_remote import submit_flow +from autoplex.auto.phonons.flows import CompleteDFTvsMLBenchmarkWorkflow +from mp_api.client import MPRester + +mpr = MPRester(api_key='YOUR_MP_API_KEY') +struc_list = [] +benchmark_structure_list = [] +mpids = ["mp-149"] # add all the Si structure mpids you are interested in +mpbenchmark = ["mp-149"] # add all the Si structure mpids you are interested in +for mpid in mpids: + struc = mpr.get_structure_by_material_id(mpid) + struc_list.append(struc) +for mpbm in mpbenchmark: + bm_struc = mpr.get_structure_by_material_id(mpbm) + benchmark_structure_list.append(bm_struc) + +autoplex_flow = CompleteDFTvsMLBenchmarkWorkflow( + n_structures=50, symprec=0.1, + volume_scale_factor_range=[0.95, 1.05], rattle_type=0, distort_type=0, + hyper_para_loop=True, atomwise_regularization_list=[0.1, 0.01], + soap_delta_list=[0.5], n_sparse_list=[7000, 8000, 9000]).make( + structure_list=struc_list, mp_ids=mpids, benchmark_structures=benchmark_structure_list, + benchmark_mp_ids=mpbenchmark, preprocessing_data=True, + **{ + "split_ratio": 0.33, + "regularization": False, + "separated": True, + "num_processes_fit": 48, + "GAP": {"soap": {"delta": 1.0, "l_max": 12, "n_max": 10, + "atom_sigma": 0.5, "zeta": 4, "cutoff": 5.0, + "cutoff_transition_width": 1.0, + "central_weight": 1.0, "n_sparse": 9000, "f0": 0.0, + "covariance_type": "dot_product", + "sparse_method": "cur_points"}, + "general": {"two_body": False, "three_body": False, "soap": True, + "default_sigma": "{0.001 0.05 0.05 0.0}", "sparse_jitter": 1.0e-8, }}}, +) + +autoplex_flow.name = "autoplex_wf" + +resources = {...} + +print(submit_flow(autoplex_flow, worker="autoplex_worker", resources=resources, project="autoplex")) +``` + + ## Running a MLIP fit only The following script shows an example of how you can run a sole GAP fit with `autoplex` using `run_locally` from