From 1f59ad6d58949f689e728a2443a8618d61cb3c34 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Tue, 21 Jan 2025 16:33:42 +0100 Subject: [PATCH 01/21] jfr docs extension --- docs/user/jobflowremote.md | 125 +++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/docs/user/jobflowremote.md b/docs/user/jobflowremote.md index e71362147..2ebb22aa3 100644 --- a/docs/user/jobflowremote.md +++ b/docs/user/jobflowremote.md @@ -240,3 +240,128 @@ inconsistent because of this, can be fixed be force-rerunning the respective job 1. Check slurm.py for finding different available options you can set for resources dict [here](https://github.com/Matgenix/qtoolkit/tree/develop/src/qtoolkit/io) 2. More details on project config and settings can be found [here](https://matgenix.github.io/jobflow-remote/user/projectconf.html) 3. Details on different setup options [here](https://matgenix.github.io/jobflow-remote/user/install.html) + +# Download (all) the data of a flow from your remote cluster + +Once, your workflows have finished, you can download the data you need for further analysis. +You can first check the jobs of your workflow via jobflow-remote as `jf flow info db_id/flow_id` +to check the names of the jobs whose data you want to retrieve, like e.g.: +```bash +jf flow info 12345 +The selected project is autoplex from config file /home/user/.jfremote/auto.yaml + Flow: LiCl - f45374e9-f095-4c8a-a0e5-be3e50e15e21 - COMPLETED +┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ +┃ DB id ┃ Name ┃ State ┃ Job id (Index) ┃ Worker ┃ +┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ +│ 43076 │ run_phonon_displacements_mp-22905 │ COMPLETED │ 0074c8d0-ce6a-49fd-a2a8-ffd00c14982e (1) │ auto_worker │ +│ 43126 │ store_inputs_mp-22905 │ COMPLETED │ 0074c8d0-ce6a-49fd-a2a8-ffd00c14982e (2) │ auto_worker │ +│ 43106 │ gap phonon static 1/20_mp-22905 │ COMPLETED │ 025a49ba-a45d-493f-8761-021f506da5c4 (1) │ auto_worker │ +│ 43020 │ tight relax 1_mp-22905 │ COMPLETED │ 07f2f80d-df47-4cf1-b4e8-0d5e00f1a74e (1) │ auto_worker │ +│ 43070 │ run_phonon_displacements_mp-22905 │ COMPLETED │ 083c4c17-d1cd-4ef7-b1bc-8c6be8305f0f (1) │ auto_worker │ +│ 43069 │ generate_phonon_displacements_mp-22905 │ COMPLETED │ 0b6bffe3-10a8-47b4-b15d-c948337c0dae (1) │ auto_worker │ +│ 43017 │ generate_randomized_structures_mp-22905 │ COMPLETED │ 198b30d8-470c-4357-893e-a6ce98dcea3f (1) │ auto_worker │ +│ 43047 │ dft phonon static 9/20_mp-22905 │ COMPLETED │ 20bdb7b3-875f-45cb-91a3-dbe11dfa5100 (1) │ auto_worker │ +│ 43036 │ dft rattle static 10/11_mp-22905 │ COMPLETED │ 24d92e7b-4aff-4f7a-9883-4f2b31d3f09c (1) │ auto_worker │ +│ 43077 │ generate_frequencies_eigenvectors_mp-22905 │ COMPLETED │ 2829ea98-220b-4bdb-9c2f-11c19d95557d (1) │ auto_worker │ +│ 43008 │ single-atom displaced supercells_mp-22905 │ COMPLETED │ 337cf0ee-c003-4b0f-a988-01b903c416ca (1) │ auto_worker │ +│ 43062 │ Benchmark_mp-22905 │ COMPLETED │ 3d456713-a88e-4b19-a9c4-970413631078 (1) │ auto_worker │ +│ 43010 │ machine_learning_fit │ COMPLETED │ 72665b79-bcdf-4455-a330-b2b5bca76b30 (1) │ auto_worker │ +│ 43011 │ complete_benchmark_mp-22905 │ COMPLETED │ d4c6c8fb-b8b0-41ee-a794-d13f1cc874ef (1) │ auto_worker │ +│ 43005 │ reduce_supercell_size_job │ COMPLETED │ f87e9be8-94f5-46a4-a7a8-d6ba2f4b0577 (1) │ auto_worker │ +│ ..... │ ... │ COMPLETED │ ... (1) │ auto_worker │ +│ ..... │ ... │ COMPLETED │ ... (1) │ auto_worker │ +│ 43084 │ store_inputs_mp-22905 │ COMPLETED │ faf20068-67bc-426b-aa11-e9f2c9e11ea7 (2) │ auto_worker │ +└───────┴──────────────────────────────────────────────┴───────────┴───────────────────────────────────────────┴─────────────┘ +``` +Depending on the data you need, you can then use the job names in the following scripts for filtering. + +You can download your data in one batch from your remote cluster using this script: +```python +import os +import subprocess +from jobflow_remote.jobs.jobcontroller import JobController + +jc = JobController.from_project_name(project_name='project-name') # initialize a job controller + +flow_query = jc.get_flows_info(flow_ids="the-flow-id") # make sure to use the long flow_id and not the db_id +job_docs = jc.get_jobs_doc(db_ids=flow_query[0].db_ids) +os.chdir("/your/desired/destination/directory") +user = "your remote cluster user name" +remote_tmp_dir = f"/home/path/to/{user}/tmp_folder" + +try: + subprocess.run(["ssh", f"{user}@remote_cluster", f"mkdir -p {remote_tmp_dir}"], check=True) + print(f"Created temporary folder on remote cluster: {remote_tmp_dir}") +except subprocess.CalledProcessError as e: + print(f"Failed to create temporary folder on remote cluster: {e}") + exit(1) + +for i in job_docs: + base_dir_name = i.job.name.replace(' ', '_').replace('/', '_') + dir_name = base_dir_name + counter = 1 + + while os.path.exists(dir_name): + dir_name = f"{base_dir_name}_{counter}" + counter += 1 + + # filter out the data you don't need + if 'displacements' not in base_dir_name and 'store_inputs' not in base_dir_name and 'reduce_supercell_size' not in base_dir_name and 'relax' not in base_dir_name: + remote_target_dir = f"{remote_tmp_dir}/{dir_name}" + + remote_dir = f"{i.run_dir}/*" + scp_to_tmp_command = ["ssh", f"{user}@remote_cluster", f"mkdir -p {remote_target_dir} && cp -r {remote_dir} {remote_target_dir}"] + try: + subprocess.run(scp_to_tmp_command, check=True) + print(f"Copied files from {remote_dir} to {remote_target_dir} on the remote cluster") + except subprocess.CalledProcessError as e: + print(f"Failed to copy files to remote temporary folder: {e}") + +try: + scp_final_command = ["scp", "-r", f"{user}@remote_cluster:{remote_tmp_dir}", "."] + subprocess.run(scp_final_command, check=True) + print(f"Copied {remote_tmp_dir} to the local machine") +except subprocess.CalledProcessError as e: + print(f"Failed to copy the temporary folder to the local machine: {e}") + +try: + subprocess.run(["ssh", f"{user}@remote_cluster", f"rm -rf {remote_tmp_dir}"], check=True) + print(f"Cleaned up temporary folder on remote cluster: {remote_tmp_dir}") +except subprocess.CalledProcessError as e: + print(f"Failed to clean up temporary folder on remote cluster: {e}") +``` + +Alternatively, you can use this script to download the data of a whole flow: + +```python +import os +import subprocess +from jobflow_remote.jobs.jobcontroller import JobController + +jc = JobController.from_project_name(project_name='project-name') # initialize a job controller + +flow_query = jc.get_flows_info(flow_ids="the-flow-id") # make sure to use the long flow_id and not the db_id +job_docs = jc.get_jobs_doc(db_ids=flow_query[0].db_ids) +os.chdir("/your/desired/destination/directory") +user = "your remote cluster user name" + +for i in job_docs: + dir_name = i.job.name.replace(' ', '_').replace('/', '_') + # filter out the data you don't need + if 'displacements' not in dir_name and 'store_inputs' not in dir_name and 'reduce_supercell_size' not in dir_name and 'relax' not in dir_name: + base_dir_name = dir_name + counter = 1 + + while os.path.exists(dir_name): + dir_name = f"{base_dir_name}_{counter}" + counter += 1 + + os.mkdir(dir_name) + remote_dir = f"{user}@remote_cluster:{i.run_dir}/*" + scp_command = ["scp", "-r", remote_dir, dir_name] + try: + subprocess.run(scp_command, check=True) + print(f"Copied files from {remote_dir} to {dir_name}") + except subprocess.CalledProcessError as e: + print(f"Failed to copy files from {remote_dir}: {e}") +``` From a79f3207beb106078e14eee2fabb2a74cf680d74 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 16:25:08 +0100 Subject: [PATCH 02/21] move Maker defaults to complete_dft_vs_ml wf def --- src/autoplex/auto/phonons/flows.py | 82 +++++++++++++++++++++++++- src/autoplex/auto/phonons/jobs.py | 93 ++++-------------------------- 2 files changed, 89 insertions(+), 86 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index 0000371b0..fce8885e7 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -6,12 +6,15 @@ from pathlib import Path from atomate2.common.schemas.phonons import PhononBSDOSDoc +from atomate2.vasp.flows.core import DoubleRelaxMaker from atomate2.vasp.flows.mp import ( MPGGADoubleRelaxMaker, MPGGARelaxMaker, MPGGAStaticMaker, ) from atomate2.vasp.jobs.base import BaseVaspMaker +from atomate2.vasp.jobs.core import StaticMaker, TightRelaxMaker +from atomate2.vasp.sets.core import StaticSetGenerator, TightRelaxSetGenerator from jobflow import Flow, Maker from pymatgen.core.structure import Structure from pymatgen.io.vasp.sets import ( @@ -186,9 +189,82 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker): add_dft_rattled_struct: bool = True add_rss_struct: bool = False displacement_maker: BaseVaspMaker = None - phonon_bulk_relax_maker: BaseVaspMaker = None - phonon_static_energy_maker: BaseVaspMaker = None - rattled_bulk_relax_maker: BaseVaspMaker = None + phonon_bulk_relax_maker: BaseVaspMaker | None = field( + default_factory=lambda: DoubleRelaxMaker.from_relax_maker( + TightRelaxMaker( + name="dft tight relax", + run_vasp_kwargs={"handlers": {}}, + input_set_generator=TightRelaxSetGenerator( + user_incar_settings={ + # TODO check if user_incar_settings has to be set like that or can be left out + "ALGO": "Normal", + "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": 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, + } + ), + ) + ) + ) + phonon_static_energy_maker: BaseVaspMaker | None = field( + default_factory=lambda: StaticMaker( + name="dft static", + input_set_generator=StaticSetGenerator( + auto_ispin=False, + user_incar_settings={ + "ALGO": "Normal", + "ISPIN": 1, + "LAECHG": False, + "ISMEAR": 0, + "ENCUT": 700, + "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR + "LOPTICS": False, # No PCDAT file + # to be removed + "NPAR": 4, + }, + ), + ) + ) + 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, + } + ), + ) + ) isolated_atom_maker: IsoAtomStaticMaker | None = None n_structures: int = 10 displacements: list[float] = field(default_factory=lambda: [0.01]) diff --git a/src/autoplex/auto/phonons/jobs.py b/src/autoplex/auto/phonons/jobs.py index ee6feb5e0..c4874e23a 100644 --- a/src/autoplex/auto/phonons/jobs.py +++ b/src/autoplex/auto/phonons/jobs.py @@ -6,10 +6,7 @@ import numpy as np from atomate2.common.schemas.phonons import ForceConstants, PhononBSDOSDoc -from atomate2.vasp.flows.core import DoubleRelaxMaker from atomate2.vasp.jobs.base import BaseVaspMaker -from atomate2.vasp.jobs.core import StaticMaker, TightRelaxMaker -from atomate2.vasp.sets.core import StaticSetGenerator, TightRelaxSetGenerator from jobflow import Flow, Response, job from pymatgen.core.structure import Structure from pymatgen.phonon.bandstructure import PhononBandStructure @@ -537,65 +534,17 @@ def dft_phonopy_gen_data( if phonon_displacement_maker is None: phonon_displacement_maker = TightDFTStaticMaker(name="dft phonon static") - if phonon_bulk_relax_maker is None: - phonon_bulk_relax_maker = DoubleRelaxMaker.from_relax_maker( - TightRelaxMaker( - name="dft tight relax", - run_vasp_kwargs={"handlers": {}}, - input_set_generator=TightRelaxSetGenerator( - user_incar_settings={ - "ALGO": "Normal", - "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": 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, - } - ), - ) - ) - - if phonon_static_energy_maker is None: - phonon_static_energy_maker = StaticMaker( - name="dft static", - input_set_generator=StaticSetGenerator( - auto_ispin=False, - user_incar_settings={ - "ALGO": "Normal", - "ISPIN": 1, - "LAECHG": False, - "ISMEAR": 0, - "ENCUT": 700, - "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR - "LOPTICS": False, # No PCDAT file - # to be removed - "NPAR": 4, - }, - ), - ) # always set autoplex default as job name phonon_displacement_maker.name = "dft phonon static" - phonon_static_energy_maker.name = "dft static" - try: - phonon_bulk_relax_maker.relax_maker1.name = "dft tight relax" - phonon_bulk_relax_maker.relax_maker2.name = "dft tight relax" - except AttributeError: - phonon_bulk_relax_maker.name = "dft tight relax" + if phonon_static_energy_maker is not None: + phonon_static_energy_maker.name = "dft static" + if phonon_bulk_relax_maker is not None: + try: + phonon_bulk_relax_maker.relax_maker1.name = "dft tight relax" + phonon_bulk_relax_maker.relax_maker2.name = "dft tight relax" + except AttributeError: + phonon_bulk_relax_maker.name = "dft tight relax" for displacement in displacements: dft_phonons = DFTPhononMaker( @@ -704,33 +653,11 @@ def dft_random_gen_data( if displacement_maker is None: displacement_maker = TightDFTStaticMaker(name="dft rattle static") - if rattled_bulk_relax_maker is None: - rattled_bulk_relax_maker = 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, - } - ), - ) # always set autoplex default as job name displacement_maker.name = "dft rattle static" - rattled_bulk_relax_maker.name = "dft tight relax" + if rattled_bulk_relax_maker is not None: + rattled_bulk_relax_maker.name = "dft tight relax" # TODO: decide if we should remove the additional response here as well # looks like only the output is changing From 114469fb9f4e6ab89e17112e6a0a80c65220b459 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 16:28:01 +0100 Subject: [PATCH 03/21] set phonon_static_energy to None --- src/autoplex/auto/phonons/flows.py | 50 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index fce8885e7..02f5e4022 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -13,8 +13,8 @@ MPGGAStaticMaker, ) from atomate2.vasp.jobs.base import BaseVaspMaker -from atomate2.vasp.jobs.core import StaticMaker, TightRelaxMaker -from atomate2.vasp.sets.core import StaticSetGenerator, TightRelaxSetGenerator +from atomate2.vasp.jobs.core import TightRelaxMaker +from atomate2.vasp.sets.core import TightRelaxSetGenerator from jobflow import Flow, Maker from pymatgen.core.structure import Structure from pymatgen.io.vasp.sets import ( @@ -218,29 +218,29 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker): ) ) ) - phonon_static_energy_maker: BaseVaspMaker | None = field( - default_factory=lambda: StaticMaker( - name="dft static", - input_set_generator=StaticSetGenerator( - auto_ispin=False, - user_incar_settings={ - "ALGO": "Normal", - "ISPIN": 1, - "LAECHG": False, - "ISMEAR": 0, - "ENCUT": 700, - "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR - "LOPTICS": False, # No PCDAT file - # to be removed - "NPAR": 4, - }, - ), - ) - ) + phonon_static_energy_maker: BaseVaspMaker | None = None # field( + # default_factory=lambda: StaticMaker( + # name="dft static", + # input_set_generator=StaticSetGenerator( + # auto_ispin=False, + # user_incar_settings={ + # "ALGO": "Normal", + # "ISPIN": 1, + # "LAECHG": False, + # "ISMEAR": 0, + # "ENCUT": 700, + # "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR + # "LOPTICS": False, # No PCDAT file + # # to be removed + # "NPAR": 4, + # }, + # ), + # ) + # ) rattled_bulk_relax_maker: BaseVaspMaker | None = field( default_factory=lambda: TightRelaxMaker( run_vasp_kwargs={"handlers": {}}, From 51dc9026a6acc4e71bd195535026ae64f30350d2 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:19:14 +0100 Subject: [PATCH 04/21] remove commented out code --- src/autoplex/auto/phonons/flows.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index 02f5e4022..8aab4c3b7 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -218,29 +218,8 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker): ) ) ) - phonon_static_energy_maker: BaseVaspMaker | None = None # field( - # default_factory=lambda: StaticMaker( - # name="dft static", - # input_set_generator=StaticSetGenerator( - # auto_ispin=False, - # user_incar_settings={ - # "ALGO": "Normal", - # "ISPIN": 1, - # "LAECHG": False, - # "ISMEAR": 0, - # "ENCUT": 700, - # "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR - # "LOPTICS": False, # No PCDAT file - # # to be removed - # "NPAR": 4, - # }, - # ), - # ) - # ) + phonon_static_energy_maker: BaseVaspMaker | None = None + rattled_bulk_relax_maker: BaseVaspMaker | None = field( default_factory=lambda: TightRelaxMaker( run_vasp_kwargs={"handlers": {}}, From 69929171e08285140c43f84881a1a1270e6e3488 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:28:15 +0100 Subject: [PATCH 05/21] removed all dft_static... ref paths from fixture in auto phonon flow unit test --- tests/auto/phonons/test_flows.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/tests/auto/phonons/test_flows.py b/tests/auto/phonons/test_flows.py index 4ec5084b4..e7527cb82 100644 --- a/tests/auto/phonons/test_flows.py +++ b/tests/auto/phonons/test_flows.py @@ -18,7 +18,6 @@ def ref_paths(): "dft tight relax_test": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 1_test": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_test": "dft_ml_data_generation/tight_relax_2/", - "dft static_test": "dft_ml_data_generation/static/", "Cl-stat_iso_atom": "Cl_iso_atoms/Cl-statisoatom/", "Li-stat_iso_atom": "Li_iso_atoms/Li-statisoatom/", "dft phonon static 1/2_test": "dft_ml_data_generation/phonon_static_1/", @@ -38,7 +37,6 @@ def ref_paths(): "dft tight relax_mp-22905": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 1_mp-22905": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_mp-22905": "dft_ml_data_generation/tight_relax_2/", - "dft static_mp-22905": "dft_ml_data_generation/static/", "dft phonon static 1/2_mp-22905": "dft_ml_data_generation/phonon_static_1/", "dft phonon static 2/2_mp-22905": "dft_ml_data_generation/phonon_static_2/", "dft rattle static 1/12_mp-22905": "dft_ml_data_generation/rand_static_1/", @@ -53,7 +51,6 @@ def ref_paths(): "dft rattle static 10/12_mp-22905": "dft_ml_data_generation/rand_static_10/", "dft rattle static 11/12_mp-22905": "dft_ml_data_generation/rand_static_11/", "dft rattle static 12/12_mp-22905": "dft_ml_data_generation/rand_static_12/", - } @@ -63,7 +60,6 @@ def ref_paths_mpid(): "dft tight relax_mp-22905": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 1_mp-22905": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_mp-22905": "dft_ml_data_generation/tight_relax_2/", - "dft static_mp-22905": "dft_ml_data_generation/static/", "Cl-stat_iso_atom": "Cl_iso_atoms/Cl-statisoatom/", "Li-stat_iso_atom": "Li_iso_atoms/Li-statisoatom/", "dft phonon static 1/2_mp-22905": "dft_ml_data_generation/phonon_static_1/", @@ -260,7 +256,6 @@ def ref_paths4(): "dft tight relax_test": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 1_test": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_test": "dft_ml_data_generation/tight_relax_2/", - "dft static_test": "dft_ml_data_generation/static/", "Cl-stat_iso_atom": "Cl_iso_atoms/Cl-statisoatom/", "Li-stat_iso_atom": "Li_iso_atoms/Li-statisoatom/", "dft phonon static 1/2_test": "dft_ml_data_generation/phonon_static_1/", @@ -280,7 +275,6 @@ def fake_run_vasp_kwargs5(): "dft tight relax 2_test": {"incar_settings": ["NSW", "ISMEAR"]}, "dft phonon static 1/2_test": {"incar_settings": ["NSW", "ISMEAR"]}, "dft phonon static 2/2_test": {"incar_settings": ["NSW", "ISMEAR"]}, - "dft rattle static 1/4_test": { "incar_settings": ["NSW", "ISMEAR"], "check_inputs": ["incar", "potcar"], @@ -308,7 +302,6 @@ def fake_run_vasp_kwargs4(): "dft tight relax 2_test": {"incar_settings": ["NSW", "ISMEAR"]}, "dft phonon static 1/2_test": {"incar_settings": ["NSW", "ISMEAR"]}, "dft phonon static 2/2_test": {"incar_settings": ["NSW", "ISMEAR"]}, - "dft rattle static 1/4_test": { "incar_settings": ["NSW", "ISMEAR"], "check_inputs": ["incar", "potcar"], @@ -347,21 +340,10 @@ def ref_paths4_mpid(): "dft tight relax 1_test3": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_test2": "dft_ml_data_generation/tight_relax_2/", "dft tight relax 2_test3": "dft_ml_data_generation/tight_relax_2/", - "dft static_test": "dft_ml_data_generation/static/", - "dft static_test_0": "dft_ml_data_generation/static/", - "dft static_test_1": "dft_ml_data_generation/static/", - "dft static_test2": "dft_ml_data_generation/static/", - "dft static_test2_0": "dft_ml_data_generation/static/", - "dft static_test2_1": "dft_ml_data_generation/static/", - "dft static_test3": "dft_ml_data_generation/static/", - "dft static_test3_0": "dft_ml_data_generation/static/", - "dft static_test3_1": "dft_ml_data_generation/static/", "dft tight relax 1_mp-22905": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 1_mp-22905_0": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2_mp-22905": "dft_ml_data_generation/tight_relax_2/", "dft tight relax 2_mp-22905_0": "dft_ml_data_generation/tight_relax_2/", - "dft static_mp-22905": "dft_ml_data_generation/static/", - "dft static_mp-22905_0": "dft_ml_data_generation/static/", "Cl-stat_iso_atom": "Cl_iso_atoms/Cl-statisoatom/", "Cl-stat_iso_atom_0": "Cl_iso_atoms/Cl-statisoatom/", "Cl-stat_iso_atom_1": "Cl_iso_atoms/Cl-statisoatom/", @@ -434,11 +416,6 @@ def ref_paths4_mpid_new(): "dft tight relax 2_test3": "dft_ml_data_generation/strict_test/tight_relax_2_test/", "dft tight relax 1_mp-22905": "dft_ml_data_generation/strict_test/tight_relax_1_test/", "dft tight relax 2_mp-22905": "dft_ml_data_generation/strict_test/tight_relax_2_test/", - "dft static_test": "dft_ml_data_generation/static/", - "dft static_test2": "dft_ml_data_generation/static/", - "dft static_mp-22905": "dft_ml_data_generation/static/", - "dft static_test3": "dft_ml_data_generation/static/", - "dft static_test_mp-22905": "dft_ml_data_generation/static/", "Cl-stat_iso_atom": "Cl_iso_atoms/Cl-statisoatom/", "Li-stat_iso_atom": "Li_iso_atoms/Li-statisoatom/", "dft phonon static 1/2_test": "dft_ml_data_generation/strict_test/phonon_static_1/", @@ -473,10 +450,6 @@ def ref_paths4_mpid_new2(): "dft tight relax 2_test_1": "dft_ml_data_generation/strict_test/tight_relax_2_test/", "dft tight relax 2_test_2": "dft_ml_data_generation/strict_test/tight_relax_2_test/", "dft tight relax 2_test_3": "dft_ml_data_generation/strict_test/tight_relax_2_test/", - "dft static_test_0": "dft_ml_data_generation/static/", - "dft static_test_1": "dft_ml_data_generation/static/", - "dft static_test_2": "dft_ml_data_generation/static/", - "dft static_test_3": "dft_ml_data_generation/static/", "Cl-stat_iso_atom_0": "Cl_iso_atoms/Cl-statisoatom/", "Cl-stat_iso_atom_1": "Cl_iso_atoms/Cl-statisoatom/", "Cl-stat_iso_atom_2": "Cl_iso_atoms/Cl-statisoatom/", @@ -505,7 +478,6 @@ def ref_paths5_mpid(): "dft tight relax 1_test": "MP_finetuning/tight_relax_1/", "dft tight relax 2_test": "MP_finetuning/tight_relax_2/", "Sn-stat_iso_atom": "MP_finetuning/Sn-stat_iso_atom/", - "dft static_test": "MP_finetuning/static_test/", "dft phonon static 1/1_test": "MP_finetuning/phonon_static_1/", "dft rattle static 1/3_test": "MP_finetuning/rand_static_1/", "dft rattle static 2/3_test": "MP_finetuning/rand_static_2/", From fa2c6c3bb966921727513680087344e8b93e5492 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:32:06 +0100 Subject: [PATCH 06/21] set static_energy_maker default in DFTPhononMaker to None --- src/autoplex/data/phonons/flows.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/autoplex/data/phonons/flows.py b/src/autoplex/data/phonons/flows.py index 472b45eda..df42aa8b3 100644 --- a/src/autoplex/data/phonons/flows.py +++ b/src/autoplex/data/phonons/flows.py @@ -223,28 +223,7 @@ class DFTPhononMaker(PhononMaker): ) ), ) - static_energy_maker: BaseVaspMaker | None = field( - default_factory=lambda: StaticMaker( - input_set_generator=StaticSetGenerator( - auto_ispin=False, - user_incar_settings={ - "ALGO": "Normal", - "ISPIN": 1, - "LAECHG": False, - "ISMEAR": 0, - "ENCUT": 700, - "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR - "LOPTICS": False, # No PCDAT file - # to be removed - "NPAR": 4, - }, - ) - ) - ) + static_energy_maker: BaseVaspMaker | None = None phonon_displacement_maker: BaseVaspMaker | None = field( default_factory=TightDFTStaticMaker From 2917b493711a55ceac9121f1b1f7ce303b909059 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:37:12 +0100 Subject: [PATCH 07/21] set static_energy_maker default in MLPhononMaker to None --- src/autoplex/data/phonons/flows.py | 16 ++++------------ src/autoplex/data/phonons/utils.py | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/autoplex/data/phonons/flows.py b/src/autoplex/data/phonons/flows.py index df42aa8b3..ba92cd344 100644 --- a/src/autoplex/data/phonons/flows.py +++ b/src/autoplex/data/phonons/flows.py @@ -559,9 +559,7 @@ class MLPhononMaker(FFPhononMaker): force_field_name="GAP", ) ) - static_energy_maker: ForceFieldStaticMaker | None = field( - default_factory=lambda: ForceFieldStaticMaker(force_field_name="GAP") - ) + static_energy_maker: ForceFieldStaticMaker | None = None store_force_constants: bool = False get_supercell_size_kwargs: dict = field( default_factory=lambda: {"max_atoms": 20000, "step_size": 0.1} @@ -647,9 +645,7 @@ def make_from_ml_model( name="nequip phonon static", force_field_name="Nequip", ), - static_energy_maker=ForceFieldStaticMaker( - force_field_name="Nequip", - ), + static_energy_maker=None, calculator_kwargs=calculator_kwargs, relax_maker_kwargs=self.relax_maker_kwargs, static_maker_kwargs=self.static_maker_kwargs, @@ -669,9 +665,7 @@ def make_from_ml_model( name="m3gnet phonon static", force_field_name="M3GNet", ), - static_energy_maker=ForceFieldStaticMaker( - force_field_name="M3GNet", - ), + static_energy_maker=None, calculator_kwargs=calculator_kwargs, relax_maker_kwargs=self.relax_maker_kwargs, static_maker_kwargs=self.static_maker_kwargs, @@ -699,9 +693,7 @@ def make_from_ml_model( name="mace phonon static", force_field_name="MACE", ), - static_energy_maker=ForceFieldStaticMaker( - force_field_name="MACE", - ), + static_energy_maker=None, calculator_kwargs=calculator_kwargs, relax_maker_kwargs=self.relax_maker_kwargs, static_maker_kwargs=self.static_maker_kwargs, diff --git a/src/autoplex/data/phonons/utils.py b/src/autoplex/data/phonons/utils.py index f9a00e9eb..e14e2bbd0 100644 --- a/src/autoplex/data/phonons/utils.py +++ b/src/autoplex/data/phonons/utils.py @@ -24,7 +24,7 @@ def ml_phonon_maker_preparation( static_maker_kwargs: dict | None, bulk_relax_maker: ForceFieldRelaxMaker, phonon_displacement_maker: ForceFieldStaticMaker, - static_energy_maker: ForceFieldStaticMaker, + static_energy_maker: ForceFieldStaticMaker | None, ) -> tuple[ ForceFieldRelaxMaker | None, ForceFieldStaticMaker | None, From ca8eeaf3c4407be38fa5f0da1c2ee75a58781622 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:53:30 +0100 Subject: [PATCH 08/21] removed dft_static... in ref paths and static_energy_maker from fixture and set static_energy:maker to None --- tests/auto/phonons/test_jobs.py | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/tests/auto/phonons/test_jobs.py b/tests/auto/phonons/test_jobs.py index 0a7f81559..b3a69d40a 100644 --- a/tests/auto/phonons/test_jobs.py +++ b/tests/auto/phonons/test_jobs.py @@ -45,37 +45,11 @@ def relax_maker(): ) ) - -@pytest.fixture(scope="class") -def static_energy_maker(): - return StaticMaker( - input_set_generator=StaticSetGenerator( - auto_ispin=False, - user_incar_settings={ - "ALGO": "Normal", - "ISPIN": 1, - "LAECHG": False, - "ISMEAR": 0, - "ENCUT": 700, - "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": None, # No output of projected or partial DOS in EIGENVAL, PROCAR and DOSCAR - "LOPTICS": False, # No PCDAT file - # to be removed - "NPAR": 4, - }, - ) - ) - - @pytest.fixture(scope="class") def ref_paths(): return { "dft tight relax 1": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2": "dft_ml_data_generation/tight_relax_2/", - "dft static": "dft_ml_data_generation/static/", "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/", @@ -89,7 +63,6 @@ def ref_paths_check_sc_mat(): return { "dft tight relax 1": "dft_ml_data_generation/tight_relax_1/", "dft tight relax 2": "dft_ml_data_generation/tight_relax_2/", - "dft static": "dft_ml_data_generation/static/", "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/", @@ -296,7 +269,6 @@ def test_dft_task_doc( test_dir, memory_jobstore, relax_maker, - static_energy_maker, ref_paths, fake_run_vasp_kwargs, clean_dir @@ -307,7 +279,7 @@ def test_dft_task_doc( dft_phonon_workflow = dft_phonopy_gen_data(structure=structure, mp_id="test", displacements=[0.01], symprec=0.1, phonon_displacement_maker=TightDFTStaticMaker(), phonon_bulk_relax_maker=relax_maker, - phonon_static_energy_maker=static_energy_maker, + phonon_static_energy_maker=None, supercell_settings={"min_length": 10, "min_atoms": 20}) # automatically use fake VASP and write POTCAR.spec during the test @@ -334,7 +306,6 @@ def test_dft_phonopy_gen_data_manual_supercell_matrix( test_dir, memory_jobstore, relax_maker, - static_energy_maker, ref_paths_check_sc_mat, fake_run_vasp_kwargs, clean_dir @@ -354,7 +325,7 @@ def test_dft_phonopy_gen_data_manual_supercell_matrix( dft_phonon_workflow = dft_phonopy_gen_data(structure=structure, mp_id="test", displacements=[0.01], symprec=0.1, phonon_displacement_maker=TightDFTStaticMaker(), phonon_bulk_relax_maker=relax_maker, - phonon_static_energy_maker=static_energy_maker, + phonon_static_energy_maker=None, supercell_settings=supercell_settings) # automatically use fake VASP and write POTCAR.spec during the test From 397f53b834e1486d0435878e6b5d78563f2d623f Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 30 Jan 2025 17:59:05 +0100 Subject: [PATCH 09/21] set phonon_static_energy_maker default to None in CompleteDFTvsMLBenchmarkWorkflowMPSettings --- src/autoplex/auto/phonons/flows.py | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index 8aab4c3b7..84acb8f37 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -975,28 +975,7 @@ class CompleteDFTvsMLBenchmarkWorkflowMPSettings(CompleteDFTvsMLBenchmarkWorkflo ) ) - phonon_static_energy_maker: BaseVaspMaker = field( - default_factory=lambda: MPGGAStaticMaker( - run_vasp_kwargs={"handlers": ()}, - name="dft phonon static", - input_set_generator=MPStaticSet( - force_gamma=True, - auto_metal_kpoints=True, - inherit_incar=False, - user_incar_settings={ - "NPAR": 4, - "EDIFF": 1e-7, - "EDIFFG": 1e-6, - "ALGO": "NORMAL", - "ISPIN": 1, - "LREAL": False, - "LCHARG": False, - "ISMEAR": 0, - "KSPACING": 0.2, - }, - ), - ) - ) + phonon_static_energy_maker: BaseVaspMaker = None @dataclass From f631dd8f461fb8861984bf71eb59a7d052c696b7 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 6 Feb 2025 17:11:59 +0100 Subject: [PATCH 10/21] keep dosctrings consistent --- src/autoplex/fitting/common/jobs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autoplex/fitting/common/jobs.py b/src/autoplex/fitting/common/jobs.py index 4d36d48f0..cd077b77a 100644 --- a/src/autoplex/fitting/common/jobs.py +++ b/src/autoplex/fitting/common/jobs.py @@ -54,11 +54,11 @@ def machine_learning_fit( num_processes_fit: int Number of processes for fitting. auto_delta: bool - Automatically determine delta for 2b, 3b and soap terms. + Automatically determine delta for 2b, 3b and soap terms. Only used for GAP fitting. glue_xml: bool - Use the glue.xml core potential instead of fitting 2b terms. + Use the glue.xml core potential instead of fitting 2b terms. Only used for GAP fitting. glue_file_path: str - Name of the glue.xml file path. + Name of the glue.xml file path. Only used for GAP fitting. gpu_identifier_indices: list[int] List of GPU indices to be used for fitting. Only used for NEP fitting. mlip_type: str From 3a4240636587b9e499d5f98ae003d0ab0fad69be Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 6 Feb 2025 17:14:18 +0100 Subject: [PATCH 11/21] set NEP static maker to None --- src/autoplex/data/phonons/flows.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/autoplex/data/phonons/flows.py b/src/autoplex/data/phonons/flows.py index 72e685010..0833077d5 100644 --- a/src/autoplex/data/phonons/flows.py +++ b/src/autoplex/data/phonons/flows.py @@ -640,9 +640,7 @@ def make_from_ml_model( name="nep phonon static", force_field_name="NEP", ), - static_energy_maker=ForceFieldStaticMaker( - force_field_name="NEP", - ), + static_energy_maker=None, calculator_kwargs=calculator_kwargs, relax_maker_kwargs=self.relax_maker_kwargs, static_maker_kwargs=self.static_maker_kwargs, From 2324b8a918701ed55dc2a0a4db435b2557f938b4 Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Thu, 6 Feb 2025 17:30:25 +0100 Subject: [PATCH 12/21] remove commented out lines from pyproject.toml --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a0025ed00..aabf1406d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,10 +45,6 @@ dependencies = [ [tool.setuptools.packages.find] where = ["src"] -#[tool.setuptools.package-data] -#"autoplex.fitting.common" = ["*.json"] -#"autoplex.auto.rss" = ["*.yaml"] - [project.optional-dependencies] docs = [ "autodoc_pydantic==2.2.0", From f931fe07fc742ffe22b25a465721d5330d76298c Mon Sep 17 00:00:00 2001 From: QuantumChemist Date: Fri, 7 Feb 2025 08:06:03 +0100 Subject: [PATCH 13/21] remove bc print --- src/autoplex/auto/rss/jobs.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/autoplex/auto/rss/jobs.py b/src/autoplex/auto/rss/jobs.py index 4c3069857..ae126e75e 100644 --- a/src/autoplex/auto/rss/jobs.py +++ b/src/autoplex/auto/rss/jobs.py @@ -171,8 +171,6 @@ def initial_rss( if dimer_box is None: dimer_box = [20.0, 20.0, 20.0] - print(buildcell_options) - do_randomized_structure_generation = BuildMultiRandomizedStructure( generated_struct_numbers=generated_struct_numbers, buildcell_options=buildcell_options, From 2065ef6aaad78e65d2b066520c83ba06ee18e3cc Mon Sep 17 00:00:00 2001 From: JaGeo Date: Sun, 6 Apr 2025 17:36:07 +0200 Subject: [PATCH 14/21] allow bulk relax maker to be none --- src/autoplex/auto/phonons/flows.py | 2 ++ src/autoplex/data/phonons/flows.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index c7b8f626f..ffe18b408 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -342,6 +342,8 @@ def make( ), default_hyperparameters["GAP"]["soap"], ) + # add an optional pre-optimization step here + for structure, mp_id in zip(structure_list, mp_ids): self.supercell_settings.setdefault(mp_id, {}) diff --git a/src/autoplex/data/phonons/flows.py b/src/autoplex/data/phonons/flows.py index 0833077d5..8b21aee86 100644 --- a/src/autoplex/data/phonons/flows.py +++ b/src/autoplex/data/phonons/flows.py @@ -360,10 +360,10 @@ def make( ) jobs = [] # initializing empty job list outputs = [] - - relaxed = self.bulk_relax_maker.make(structure) - jobs.append(relaxed) - structure = relaxed.output.structure + if self.bulk_relax_maker is not None: + relaxed = self.bulk_relax_maker.make(structure) + jobs.append(relaxed) + structure = relaxed.output.structure supercell_matrix = self.supercell_settings.get(mp_id, {}).get( "supercell_matrix" From 6630dd31a9895a4f2986686ccc5cd1fdcecdbca4 Mon Sep 17 00:00:00 2001 From: JaGeo Date: Sun, 6 Apr 2025 19:38:24 +0200 Subject: [PATCH 15/21] add a pre optimization --- src/autoplex/auto/phonons/flows.py | 35 +++++++++--------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index ffe18b408..bf317223b 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -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 @@ -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", @@ -210,32 +213,10 @@ 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]) @@ -346,6 +327,10 @@ def make( 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) + structure=pre_relax_job.output.structure + pre_relax_job.name="dft tight relax" self.supercell_settings.setdefault(mp_id, {}) logging.warning( "Currently, " From 20edb52454638e5b4d2b27b33da3d6ace7d5398e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:41:39 +0000 Subject: [PATCH 16/21] pre-commit auto-fixes --- src/autoplex/auto/phonons/flows.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index 0b2806c27..f88c0f3be 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -326,9 +326,9 @@ def make( 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) - structure=pre_relax_job.output.structure - pre_relax_job.name="dft tight relax" + pre_relax_job = self.pre_relax_maker.make(structure) + structure = pre_relax_job.output.structure + pre_relax_job.name = "dft tight relax" self.supercell_settings.setdefault(mp_id, {}) logging.warning( "Currently, " From de7f83da52a9cd5fc784f590db6211b4cb6d2d16 Mon Sep 17 00:00:00 2001 From: JaGeo Date: Sun, 6 Apr 2025 19:44:24 +0200 Subject: [PATCH 17/21] add a pre optimization --- src/autoplex/auto/phonons/flows.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index f88c0f3be..ceb56b279 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -216,7 +216,6 @@ class CompleteDFTvsMLBenchmarkWorkflow(Maker): phonon_bulk_relax_maker: BaseVaspMaker | None = None phonon_static_energy_maker: BaseVaspMaker | None = None rattled_bulk_relax_maker: BaseVaspMaker | None = None - phonon_static_energy_maker: BaseVaspMaker | None = None isolated_atom_maker: IsoAtomStaticMaker | None = None n_structures: int = 10 displacements: list[float] = field(default_factory=lambda: [0.01]) From 47a6d120b6a48d780f83681d98a0c50c55e5155e Mon Sep 17 00:00:00 2001 From: JaGeo Date: Sun, 6 Apr 2025 19:46:28 +0200 Subject: [PATCH 18/21] add a pre optimization --- src/autoplex/auto/phonons/flows.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index ceb56b279..1b1d4c8ec 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -326,6 +326,7 @@ def make( 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) structure = pre_relax_job.output.structure pre_relax_job.name = "dft tight relax" self.supercell_settings.setdefault(mp_id, {}) From bb29eb7434f459b1c0c13fff16ecd7b94883e339 Mon Sep 17 00:00:00 2001 From: JaGeo Date: Sun, 6 Apr 2025 19:52:01 +0200 Subject: [PATCH 19/21] add a pre optimization --- src/autoplex/auto/phonons/flows.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index 1b1d4c8ec..f4bc9b092 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -327,15 +327,17 @@ def make( if self.pre_relax_maker is not None: pre_relax_job = self.pre_relax_maker.make(structure) flows.append(pre_relax_job) - structure = pre_relax_job.output.structure + 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( @@ -355,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, @@ -383,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, @@ -449,6 +451,10 @@ 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( From 62e338d46c5fa43b916ecbc660d7f3a275a23d56 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:52:15 +0000 Subject: [PATCH 20/21] pre-commit auto-fixes --- src/autoplex/auto/phonons/flows.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/autoplex/auto/phonons/flows.py b/src/autoplex/auto/phonons/flows.py index f4bc9b092..703a50a3e 100644 --- a/src/autoplex/auto/phonons/flows.py +++ b/src/autoplex/auto/phonons/flows.py @@ -330,7 +330,7 @@ def make( new_structure = pre_relax_job.output.structure pre_relax_job.name = "dft tight relax" else: - new_structure=structure + new_structure = structure self.supercell_settings.setdefault(mp_id, {}) logging.warning( "Currently, " @@ -452,8 +452,11 @@ def make( 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 + 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 From b9d1adaa8c1b9605601ac69fc4a9986eb41af15a Mon Sep 17 00:00:00 2001 From: "J. George" Date: Fri, 6 Jun 2025 22:35:35 +0200 Subject: [PATCH 21/21] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d824247a8..876a916f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ requires-python = ">=3.10,<3.12" dependencies = [ "pymatgen>=2024.9.17.1", - "atomate2[strict]>=0.0.19", + "atomate2[strict]>=0.0.21", "ase==3.23.0", "calorine>=3.0", "matgl==1.1.3", @@ -67,7 +67,7 @@ workflow-managers = [ strict = [ "calorine==3.0", "pymatgen==2024.11.13", #? - "atomate2[strict]==0.0.19", + "atomate2[strict]==0.0.21", "matgl==1.1.3", "quippy-ase==0.9.14; python_version < '3.12'", "torch==2.2.1",