atomate2 icon indicating copy to clipboard operation
atomate2 copied to clipboard

Including VASP surface adsorption flow

Open itsduowang opened this issue 1 year ago • 9 comments

[This PR is still working in progress.]

Summary

including adsorption flow using VASP into atomate2

There are two files added into /vasp/flows and /vasp/jobs directories in order to implement surface adsorption calculation.

  • in /vasp/flows, the adsorption.py defines the general workflow of running the adsorption calculations for different surface-slab configurations and molecules.
  • in /vasp/jobs, the adsorption.py includes multiple elementary jobs for such workflow.

TODO

  • finish the rest of the code in atomate2/vasp/flows/adsorption.py and atomate2/vasp/jobs/adsorption.py
  • finish docstrings
  • test over more materials

Checklist

Before a pull request can be merged, the following items must be checked:

  • [X] Code is in the standard Python style. The easiest way to handle this is to run the following in the correct sequence on your local machine. Start with running ruff and ruff format on your new code. This will automatically reformat your code to PEP8 conventions and fix many linting issues.
  • [x] Doc strings have been added in the Numpy docstring format. Run ruff on your code.
  • [x] Type annotations are highly encouraged. Run mypy to type check your code.
  • [x] Tests have been added for any new functionality or bug fixes.
  • [x] All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more efficient if you already fix most errors prior to submitting the PR. It is highly recommended that you use the pre-commit hook provided in the repository. Simply runpre-commit install and a check will be run prior to allowing commits.

itsduowang avatar Jan 26 '24 07:01 itsduowang

Codecov Report

Attention: Patch coverage is 93.78882% with 10 lines in your changes missing coverage. Please review.

Project coverage is 76.31%. Comparing base (8d57884) to head (5e0fa58). Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
src/atomate2/vasp/flows/adsorption.py 89.65% 3 Missing and 3 partials :warning:
src/atomate2/vasp/jobs/adsorption.py 96.77% 2 Missing and 1 partial :warning:
src/atomate2/vasp/schemas/adsorption.py 90.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #691      +/-   ##
==========================================
+ Coverage   75.70%   76.31%   +0.60%     
==========================================
  Files         147      159      +12     
  Lines       10925    11606     +681     
  Branches     1613     1719     +106     
==========================================
+ Hits         8271     8857     +586     
- Misses       2173     2234      +61     
- Partials      481      515      +34     
Files with missing lines Coverage Δ
src/atomate2/vasp/schemas/adsorption.py 90.00% <90.00%> (ø)
src/atomate2/vasp/jobs/adsorption.py 96.77% <96.77%> (ø)
src/atomate2/vasp/flows/adsorption.py 89.65% <89.65%> (ø)

... and 4 files with indirect coverage changes

codecov[bot] avatar Mar 25 '24 20:03 codecov[bot]

Hi @itsduowang thanks for the PR. You can try to use pre-commit and ruff to fix any lint issues.

Install pre-commit hooks to auto-check types and linting before every commit

pip install -U pre-commit

pre-commit install

Use ruff to check and fix format

ruff format --check .

ruff check --fix

Zhuoying avatar Mar 25 '24 21:03 Zhuoying

@Zhuoying Thank you for the info. Will run the test soon.

itsduowang avatar Mar 25 '24 22:03 itsduowang

Hi @utf, I updated the test files and everything should work well now. Can you help me to review the code and merge it? Many thanks!

itsduowang avatar Jul 30 '24 00:07 itsduowang

Hi @utf I fixed the k mesh and run the sample code again to update the test files successfully. However, after I have done this merge: Merge branch 'materialsproject:main' into add_adsorption

The test and sample code are all failed. The error looks like below. Do you have any idea what might cause it?

Thanks for your help!

----------------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------------- 2024-08-01 22:27:30,358 INFO Started executing jobs locally 2024-08-01 22:27:30,367 INFO Starting job - mol_relax_maker__mol_relax_job (97797c8d-2059-4d3b-a780-af8bb980dc0d) 2024-08-01 22:27:30,368 INFO Writing VASP input set. 2024-08-01 22:27:30,370 INFO Running fake VASP. 2024-08-01 22:27:30,380 INFO Verified inputs successfully 2024-08-01 22:27:30,381 INFO Cleared vasp inputs 2024-08-01 22:27:30,390 INFO Generated fake vasp outputs 2024-08-01 22:27:30,570 INFO Finished job - mol_relax_maker__mol_relax_job (97797c8d-2059-4d3b-a780-af8bb980dc0d) 2024-08-01 22:27:30,571 WARNING Response.stored_data is not supported with local manager. 2024-08-01 22:27:30,571 INFO Starting job - bulk_relax_maker__bulk_relax_job (e40ef0e0-424a-42fd-9dff-b20ed7b60774) 2024-08-01 22:27:30,594 INFO Writing VASP input set. 2024-08-01 22:27:30,595 INFO Running fake VASP. 2024-08-01 22:27:30,600 INFO Verified inputs successfully 2024-08-01 22:27:30,601 INFO Cleared vasp inputs 2024-08-01 22:27:30,609 INFO Generated fake vasp outputs 2024-08-01 22:27:30,995 INFO Finished job - bulk_relax_maker__bulk_relax_job (e40ef0e0-424a-42fd-9dff-b20ed7b60774) 2024-08-01 22:27:30,995 WARNING Response.stored_data is not supported with local manager. 2024-08-01 22:27:30,996 INFO Starting job - mol_static_maker__mol_static_job (62e34735-a655-4a57-8e48-59ca7aa3b9fd) 2024-08-01 22:27:31,023 INFO Writing VASP input set. 2024-08-01 22:27:31,024 INFO Running fake VASP. 2024-08-01 22:27:31,028 INFO Verified inputs successfully 2024-08-01 22:27:31,029 INFO Cleared vasp inputs 2024-08-01 22:27:31,036 INFO Generated fake vasp outputs 2024-08-01 22:27:31,190 INFO Finished job - mol_static_maker__mol_static_job (62e34735-a655-4a57-8e48-59ca7aa3b9fd) 2024-08-01 22:27:31,191 WARNING Response.stored_data is not supported with local manager. 2024-08-01 22:27:31,191 INFO Starting job - generate_slab (3bacc521-d7b7-4fdc-9459-909fd733272b) 2024-08-01 22:27:31,329 INFO Finished job - generate_slab (3bacc521-d7b7-4fdc-9459-909fd733272b) 2024-08-01 22:27:31,329 INFO Starting job - generate_adslabs (b64ce7f2-dffd-4daa-adee-f0845d5e365f) 2024-08-01 22:27:31,454 INFO Finished job - generate_adslabs (b64ce7f2-dffd-4daa-adee-f0845d5e365f) 2024-08-01 22:27:31,455 INFO Starting job - slab_relax_maker__slab_relax_job (f75256ab-8b91-4e90-9da1-546ee5e05e23) 2024-08-01 22:27:31,467 INFO Writing VASP input set. 2024-08-01 22:27:31,469 INFO Running fake VASP. 2024-08-01 22:27:31,474 INFO Verified inputs successfully 2024-08-01 22:27:31,475 INFO Cleared vasp inputs 2024-08-01 22:27:31,483 INFO Generated fake vasp outputs 2024-08-01 22:27:32,149 INFO Finished job - slab_relax_maker__slab_relax_job (f75256ab-8b91-4e90-9da1-546ee5e05e23) 2024-08-01 22:27:32,149 WARNING Response.stored_data is not supported with local manager. 2024-08-01 22:27:32,150 INFO Starting job - run_adslabs_job (78e18f84-53cb-4336-aa2b-2a87e3ce30d3) 2024-08-01 22:27:32,542 INFO Finished job - run_adslabs_job (78e18f84-53cb-4336-aa2b-2a87e3ce30d3) 2024-08-01 22:27:32,554 INFO Starting job - slab_relax_maker__adsconfig_0 (28447c1d-5a66-4ac3-851c-f013cdf0a368) 2024-08-01 22:27:32,563 INFO Writing VASP input set. 2024-08-01 22:27:32,568 INFO slab_relax_maker__adsconfig_0 failed with exception: Traceback (most recent call last): File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/managers/local.py", line 114, in _run_job response = job.run(store=store) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/job.py", line 600, in run response = function(self.function_args, **self.function_kwargs) File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/jobs/base.py", line 217, in make write_vasp_input_set( File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/files.py", line 204, in write_vasp_input_set vis.write_input(directory, **kwargs) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 2824, in write_input file.write(str(value)) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 746, in str return self.get_str(sort_keys=True, pretty=False) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 808, in get_str value.append(f"{len(tuple(group))}{_key}") TypeError: float() argument must be a string or a number, not 'NoneType' 2024-08-01 22:27:32,569 INFO Starting job - slab_relax_maker__adsconfig_1 (b0d8a50d-f2ac-49fe-99af-b1bddd04e869) 2024-08-01 22:27:32,578 INFO Writing VASP input set. 2024-08-01 22:27:32,579 INFO slab_relax_maker__adsconfig_1 failed with exception: Traceback (most recent call last): File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/managers/local.py", line 114, in _run_job response = job.run(store=store) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/job.py", line 600, in run response = function(self.function_args, **self.function_kwargs) File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/jobs/base.py", line 217, in make write_vasp_input_set( File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/files.py", line 204, in write_vasp_input_set vis.write_input(directory, **kwargs) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 2824, in write_input file.write(str(value)) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 746, in str return self.get_str(sort_keys=True, pretty=False) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 808, in get_str value.append(f"{len(tuple(group))}{_key}") TypeError: float() argument must be a string or a number, not 'NoneType' 2024-08-01 22:27:32,579 INFO Starting job - slab_relax_maker__adsconfig_2 (aba0f2c9-d032-41f1-a0b7-e68617be2717) 2024-08-01 22:27:32,588 INFO Writing VASP input set. 2024-08-01 22:27:32,589 INFO slab_relax_maker__adsconfig_2 failed with exception: Traceback (most recent call last): File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/managers/local.py", line 114, in _run_job response = job.run(store=store) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/job.py", line 600, in run response = function(self.function_args, **self.function_kwargs) File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/jobs/base.py", line 217, in make write_vasp_input_set( File "/Users/duowang/Documents/GitHub/admin/atomate2/src/atomate2/vasp/files.py", line 204, in write_vasp_input_set vis.write_input(directory, **kwargs) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 2824, in write_input file.write(str(value)) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 746, in str return self.get_str(sort_keys=True, pretty=False) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/pymatgen/io/vasp/inputs.py", line 808, in get_str value.append(f"{len(tuple(group))}{_key}") TypeError: float() argument must be a string or a number, not 'NoneType' 2024-08-01 22:27:32,590 INFO Starting job - store_inputs (78e18f84-53cb-4336-aa2b-2a87e3ce30d3, 2) 2024-08-01 22:27:32,593 INFO Finished job - store_inputs (78e18f84-53cb-4336-aa2b-2a87e3ce30d3, 2) 2024-08-01 22:27:32,593 INFO Starting job - slab_static_maker__slab_static_job (196e7dab-064e-4379-b6d9-dc343c4d5e1f) 2024-08-01 22:27:32,656 INFO Writing VASP input set. 2024-08-01 22:27:32,658 INFO Running fake VASP. 2024-08-01 22:27:32,664 INFO Verified inputs successfully 2024-08-01 22:27:32,665 INFO Cleared vasp inputs 2024-08-01 22:27:32,673 INFO Generated fake vasp outputs 2024-08-01 22:27:33,142 INFO Finished job - slab_static_maker__slab_static_job (196e7dab-064e-4379-b6d9-dc343c4d5e1f) 2024-08-01 22:27:33,142 WARNING Response.stored_data is not supported with local manager. 2024-08-01 22:27:33,142 INFO Starting job - adsorption_calculations (01864286-a9aa-4698-b31a-2ef3bf01ec06) 2024-08-01 22:27:33,147 INFO adsorption_calculations failed with exception: Traceback (most recent call last): File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/managers/local.py", line 114, in _run_job response = job.run(store=store) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/job.py", line 589, in run self.resolve_args(store=store) File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/job.py", line 705, in resolve_args resolved_kwargs = find_and_resolve_references( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/reference.py", line 473, in find_and_resolve_references resolved_references = resolve_references( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/reference.py", line 356, in resolve_references cache[uuid][index] = store.get_output( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/store.py", line 523, in get_output return find_and_resolve_references( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/reference.py", line 473, in find_and_resolve_references resolved_references = resolve_references( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/reference.py", line 361, in resolve_references resolved_references[ref] = ref.resolve( File "/opt/miniconda3/envs/py39/lib/python3.9/site-packages/jobflow/core/reference.py", line 166, in resolve raise ValueError( ValueError: Could not resolve reference - b0d8a50d-f2ac-49fe-99af-b1bddd04e869 not in store or index=None, cache={'b0d8a50d-f2ac-49fe-99af-b1bddd04e869': {}} 2024-08-01 22:27:33,147 INFO Finished executing jobs locally

itsduowang avatar Aug 02 '24 05:08 itsduowang

Hi @itsduowang, can make sure all your dependencies are up to date? Especially pymatgen.

utf avatar Aug 02 '24 08:08 utf

@utf Yes. I tried to updated all the dependencies to the required version. Besides, I observed the testing failed here with the same reason, where the testing installed all the dependencies strictly based on the required versions.

itsduowang avatar Aug 02 '24 14:08 itsduowang

I'm not sure why the relax job is failing. I can't spot anything obvious. It looks like something weird is happening with MAGMOM tag (looking at where the error occurs in pymatgen). This could be a bug with the input sets. Are you able to debug further?

utf avatar Aug 06 '24 11:08 utf

@utf I am still trying to find the problem. I will let you know when I have any clue! Thanks so much.

itsduowang avatar Aug 06 '24 15:08 itsduowang

There would be interest in adding this workflow for FHI-aims as well. Do you have any recommendations on when we should port this for FHI-aims?

tpurcell90 avatar Aug 13 '24 18:08 tpurcell90

Hi @tpurcell90, I am not familiar with the FHI-aims package. But I would love to work with you together to port this for FHI-aims!

itsduowang avatar Aug 13 '24 18:08 itsduowang

Okay we'd be happy to work with you on that (FHI-aims is a nao basis set code). I think it would make sense for this one to get merged in first since it is already quite large. @utf do you agree with that it should wait for this to get merged in?

tpurcell90 avatar Aug 13 '24 18:08 tpurcell90

Yes @tpurcell90, I think it would be better to merge the PR and then we can work on the adding FHI-aims support.

@utf, I have done the debugging for that K point issue and ran the pytest and testing workflow from my end (https://github.com/itsduowang/atomate2/actions/runs/10375913622). Please take a look and help me to rerun the testing. Thanks so much!

itsduowang avatar Aug 13 '24 20:08 itsduowang

Hi @utf, thanks for these updates. I will go through each item and resolve those issues.

itsduowang avatar Aug 14 '24 17:08 itsduowang

Hi @utf. I have resolved all the issues you mentioned above and included the schema into the adsorption workflow. Please take a look and let me know for any further issues or concerns.

itsduowang avatar Sep 17 '24 05:09 itsduowang

Thanks @itsduowang. This looks great to me.

utf avatar Sep 24 '24 14:09 utf