Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the atomate2 elastic workflow to reproduce the Elastic Constants given on next-gen.materialsproject.org. #4

Closed
hongyi-zhao opened this issue Oct 29, 2024 · 11 comments

Comments

@hongyi-zhao
Copy link

hongyi-zhao commented Oct 29, 2024

Dear J. George,

I noticed there is an example atomate2 elastic workflow here. I am also currently trying to use the atomate2 elastic workflow to reproduce the Elastic Constants given on https://next-gen.materialsproject.org, say for this one: https://next-gen.materialsproject.org/materials/mp-126.

Below is my script:

$ cat mp-elastic.py
# The final result is very different from https://next-gen.matialsproject.org/materials/mp-126:
#$ pyenv shell datasci 
#$ module load vasp
#$ python $0

import numpy as np
from jobflow import run_locally
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

from atomate2.common.schemas.elastic import ElasticDocument
from atomate2.vasp.flows.elastic import ElasticMaker
from atomate2.vasp.powerups import (
    update_user_incar_settings,
    update_user_potcar_functional,
    update_user_kpoints_settings,
)

from pymatgen.core import Structure
from mp_api.client import MPRester

from atomate2.vasp.powerups import add_metadata_to_flow

user_potcar_functional = "PBE_64"

with MPRester() as mpr:
    elasticity_docs = mpr.materials.elasticity.search(material_ids=["mp-126"])
    structure = elasticity_docs[0].structure

structure = SpacegroupAnalyzer(structure).get_conventional_standard_structure()

flow = ElasticMaker().make(structure, conventional=True)

flow = update_user_incar_settings(flow, {
    "GGA": "PE", 
    "ISMEAR": 2,   
    "SIGMA": 0.05
})

flow = update_user_potcar_functional(flow, user_potcar_functional)

# (Optional) add metadata to the flow task document.
# Could be useful to filter specific results from the database.
# For e.g., adding material project ID for the compound, use following lines
flow = add_metadata_to_flow(
    flow=flow,
    additional_fields={"mp_id": "mp-126", "submission_label": "mp-126_elastic_tensor-GGA-PE"},
)

responses = run_locally(flow, create_folders=True, ensure_success=True)
elastic_output = responses[flow.jobs[-1].uuid][1].output

matrix = np.array(elastic_output.elastic_tensor.ieee_format)
np.set_printoptions(precision=4, suppress=True)
print(matrix)

The result is as follows:

$ pyenv shell datasci
$ module load vasp
$ python mp-elastic.py 
Retrieving ElasticityDoc documents: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 13934.56it/s]
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/vasp/sets.py:288: BadInputSetWarning: Overriding the POTCAR functional is generally not recommended  as it significantly affects the results of calculations and compatibility with other calculations done with the same input set. Note that some POTCAR symbols specified in the configuration file may not be available in the selected functional.
  warnings.warn(
2024-10-29 16:53:28,720 INFO Started executing jobs locally
2024-10-29 16:53:28,729 INFO Starting job - tight relax 1 (23651f75-2df2-4b37-8e87-6155190237b1)
2024-10-29 16:53:59,866 INFO Finished job - tight relax 1 (23651f75-2df2-4b37-8e87-6155190237b1)
2024-10-29 16:53:59,866 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:53:59,867 INFO Starting job - tight relax 2 (661990a0-5a29-4f11-9a96-feb7902c1166)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/INCAR is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/OUTCAR is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/CONTCAR is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/vasprun.xml is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/POTCAR is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/elastic2ieee/atomate2/job_2024-10-29-08-53-59-867156-29532/KPOINTS is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
2024-10-29 16:54:21,285 INFO Finished job - tight relax 2 (661990a0-5a29-4f11-9a96-feb7902c1166)
2024-10-29 16:54:21,285 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:54:21,285 INFO Starting job - structure_to_conventional (0d2e00d6-37b9-4c16-93e9-964674e184bf)
2024-10-29 16:54:21,314 INFO Finished job - structure_to_conventional (0d2e00d6-37b9-4c16-93e9-964674e184bf)
2024-10-29 16:54:21,315 INFO Starting job - generate_elastic_deformations (66b926b8-91db-4f8e-be6b-e5f400ab97da)
2024-10-29 16:54:22,261 INFO Finished job - generate_elastic_deformations (66b926b8-91db-4f8e-be6b-e5f400ab97da)
2024-10-29 16:54:22,261 INFO Starting job - run_elastic_deformations (c03aeca4-a17a-42d0-9876-018f12cff20b)
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/src/pymatgen/io/vasp/sets.py:288: BadInputSetWarning: Overriding the POTCAR functional is generally not recommended  as it significantly affects the results of calculations and compatibility with other calculations done with the same input set. Note that some POTCAR symbols specified in the configuration file may not be available in the selected functional.
  warnings.warn(
2024-10-29 16:54:22,629 INFO Finished job - run_elastic_deformations (c03aeca4-a17a-42d0-9876-018f12cff20b)
2024-10-29 16:54:22,634 INFO Starting job - elastic relax 1/6 (88abf11a-8bef-41f1-8dd5-074f55d9a75b)
2024-10-29 16:55:26,191 INFO Finished job - elastic relax 1/6 (88abf11a-8bef-41f1-8dd5-074f55d9a75b)
2024-10-29 16:55:26,191 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:55:26,192 INFO Starting job - elastic relax 2/6 (f34cb1fb-115d-44ab-abae-84a5891760fd)
2024-10-29 16:56:29,371 INFO Finished job - elastic relax 2/6 (f34cb1fb-115d-44ab-abae-84a5891760fd)
2024-10-29 16:56:29,371 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:56:29,372 INFO Starting job - elastic relax 3/6 (3b05aca4-2771-4c63-84bb-2408fc9cc778)
2024-10-29 16:57:32,885 INFO Finished job - elastic relax 3/6 (3b05aca4-2771-4c63-84bb-2408fc9cc778)
2024-10-29 16:57:32,885 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:57:32,885 INFO Starting job - elastic relax 4/6 (9db86c63-4010-43f6-9dd8-3782a9d20bc9)
2024-10-29 16:58:25,763 INFO Finished job - elastic relax 4/6 (9db86c63-4010-43f6-9dd8-3782a9d20bc9)
2024-10-29 16:58:25,764 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:58:25,764 INFO Starting job - elastic relax 5/6 (b58ae1e6-7e99-4033-96e6-d07c5c3a185d)
2024-10-29 16:59:49,881 INFO Finished job - elastic relax 5/6 (b58ae1e6-7e99-4033-96e6-d07c5c3a185d)
2024-10-29 16:59:49,881 WARNING Response.stored_data is not supported with local manager.
2024-10-29 16:59:49,882 INFO Starting job - elastic relax 6/6 (63fb7580-3b34-47e6-9899-b30a3ab826a9)
2024-10-29 17:01:13,971 INFO Finished job - elastic relax 6/6 (63fb7580-3b34-47e6-9899-b30a3ab826a9)
2024-10-29 17:01:13,971 WARNING Response.stored_data is not supported with local manager.
2024-10-29 17:01:13,971 INFO Starting job - store_inputs (c03aeca4-a17a-42d0-9876-018f12cff20b, 2)
2024-10-29 17:01:13,974 INFO Finished job - store_inputs (c03aeca4-a17a-42d0-9876-018f12cff20b, 2)
2024-10-29 17:01:13,974 INFO Starting job - fit_elastic_tensor (37ae793f-8698-4d85-843c-c4ef54706c0d)
2024-10-29 17:01:14,406 INFO Finished job - fit_elastic_tensor (37ae793f-8698-4d85-843c-c4ef54706c0d)
2024-10-29 17:01:14,406 INFO Finished executing jobs locally
[[329.1842 202.1619 202.1619   0.       0.      -0.    ]
 [202.1619 329.1842 202.1619   0.       0.      -0.    ]
 [202.1619 202.1619 329.1842   0.       0.      -0.    ]
 [  0.       0.       0.      72.9088  -0.       0.    ]
 [  0.       0.       0.      -0.      72.9088   0.    ]
 [ -0.      -0.      -0.       0.       0.      72.9088]]

As you can see, this is very different from the result reported on the materialsproject official site:
image

So, any hints/tips/comments for using the atomate2 elastic workflow to reproduce the Elastic Constants given on https://next-gen.materialsproject.org?

Regards,
Zhao

@JaGeo
Copy link
Owner

JaGeo commented Oct 29, 2024

You should look into the MP modules (mp in atomate2) to get the right input sets as a first step. Both for optimization and static run. Additionally, another POTCAR version was likely used.

@JaGeo
Copy link
Owner

JaGeo commented Oct 29, 2024

If this does not help, the matsci forum or the materials project api are good places to ask.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Oct 29, 2024

My other confusion is: Are the current data from the Materials Project obtained through high-throughput calculations using atomate or atomate2?

@JaGeo
Copy link
Owner

JaGeo commented Oct 29, 2024

Partially atomate. In the future, it will be atomate2. But there is also historic data. I would check the documentation and the corresponding papers (https://docs.materialsproject.org/).

This is again a very good question for the matsci forum (https://matsci.org/)

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Oct 29, 2024

In fact, I have made some attempts and summary here: materialsproject/pymatgen#4139 (comment), however, there are still many aspects that I cannot understand and find confusing.

@JaGeo
Copy link
Owner

JaGeo commented Oct 29, 2024

As said, please ask in the matsci forum. pymatgen issue is also not the best spot to ask as the pymatgen maintainers are not the same people that update MP

@hongyi-zhao
Copy link
Author

Okay, I will try to discuss the related questions there.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Oct 29, 2024

#4 (comment)
If this does not help, the matsci forum or the materials project api are good places to ask.

By saying the materials project api, do you mean: https://github.com/materialsproject/api?

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Oct 30, 2024

I created a discussion on matsci.org. See here and here for the related discussions.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented Nov 2, 2024

So far, I have successfully replicated the result reported by the Materials Project, relying entirely on its original data, as demonstrated here.

@JaGeo
Copy link
Owner

JaGeo commented Nov 2, 2024

Great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants