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

About the ISMEAR and SIGMA tags used in your examples. #2

Closed
hongyi-zhao opened this issue Nov 16, 2024 · 2 comments
Closed

About the ISMEAR and SIGMA tags used in your examples. #2

hongyi-zhao opened this issue Nov 16, 2024 · 2 comments

Comments

@hongyi-zhao
Copy link

Hi there,

I noticed in the examples of this package, the ISMEAR and SIGMA tags are set as follows:

werner@x13dai-t:~/Public/repo/github.com/Neraaz/HTESP.git$ ug -h -i 'ismear|sigma' -g '*.in' |awk 'NF==2' | sort -u
ISMEAR 0
ISMEAR -5
SIGMA 0.02
SIGMA 0.05

As we all know, setting up these two tags for different systems can be tricky. So, I would like to know your strategy for reasonably setting these tags.

Regards,
Zhao

@Neraaz
Copy link
Owner

Neraaz commented Nov 16, 2024

Hi Hongyi,

For ISMEAR, I typically follow the VASP manual's recommendations. When calculating the Density of States (DOS), I use the tetrahedron method with ISMEAR = -5, which allows for DOS calculations without smearing. In most cases, Gaussian smearing with ISMEAR = 0 is effective for a wide range of systems when needed. For SIGMA (the smearing width), it should be chosen in conjunction with the k-point mesh: a denser k-point grid allows for a smaller SIGMA, while a coarser grid may need a higher value. Additionally, this choice may depend on the type of compound. For example, metals often require a denser k-point mesh paired with a larger SIGMA value. Also, if you're performing ionic relaxation, ensure that the forces have converged.

Best,
Niraj

@Neraaz Neraaz closed this as completed Nov 16, 2024
@hongyi-zhao
Copy link
Author

hongyi-zhao commented Nov 17, 2024

IMHO, a more robust way is to use tools like custodian to tackle such things automatically, as shown below:

Test 1:

import numpy as np
from jobflow import run_locally
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
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.io.vasp.inputs import Kpoints
from pymatgen.core import Structure
from mp_api.client import MPRester
from atomate2.vasp.powerups import add_metadata_to_flow
#https://github.com/materialsproject/atomate2/issues/1014#issuecomment-2454955891
from atomate2.vasp.flows.mp import MPGGADoubleRelaxMaker, MPGGAStaticMaker

user_potcar_functional = "PBE_64"

material_id = "mp-126"
with MPRester() as mpr:
    # Obtain elastic data and the related task IDs.
    elasticity_doc = mpr.materials.elasticity.search(material_ids=[material_id])
    opt_id = elasticity_doc[0].fitting_data.optimization_task.string
    first_deform_id = str(elasticity_doc[0].fitting_data.deformation_tasks[0])
    opt_doc = mpr.materials.tasks.search([opt_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

    deform_dep_doc = mpr.materials.tasks.search([first_deform_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

structure = mpr.materials.get_structure_by_material_id(material_id)
structure = SpacegroupAnalyzer(structure).get_conventional_standard_structure()

opt_kpoints_settings = opt_doc[0].calcs_reversed[0].input.kpoints
deform_kpoints_settings = deform_dep_doc[0].calcs_reversed[0].input.kpoints

opt_incar_settings = opt_doc[0].input.incar
deform_incar_settings = deform_dep_doc[0].input.incar

# The purpose of this test is to solely assess the impact of using the MP's following incar settings on the final result.
keys_to_extract = {'ISMEAR', 'SIGMA'}
opt_incar_settings1 = {k: v for k, v in opt_incar_settings.items() if k in keys_to_extract}
deform_incar_settings1 = {k: v for k, v in deform_incar_settings.items() if k in keys_to_extract}

print(opt_incar_settings1)
print(deform_incar_settings1)

flow = ElasticMaker(
    bulk_relax_maker=MPGGADoubleRelaxMaker(),  # 使用MP的双重优化设置
    elastic_relax_maker=MPGGAStaticMaker(),    # 使用MP的静态计算设置
    ).make(structure, conventional=True)
flow = update_user_potcar_functional(flow, user_potcar_functional)

# flow = update_user_kpoints_settings(flow, opt_kpoints_settings, name_filter="MP GGA relax")
# flow = update_user_kpoints_settings(flow, deform_kpoints_settings, name_filter="MP GGA static")

#flow = update_user_incar_settings(flow, opt_incar_settings1, name_filter="MP GGA relax" )
#flow = update_user_incar_settings(flow, deform_incar_settings1, name_filter="MP GGA static" )


# Run the flow
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:

Retrieving ElasticityDoc documents: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 16644.06it/s]
Retrieving TaskDoc documents: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11683.30it/s]
Retrieving TaskDoc documents: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11781.75it/s]
Retrieving MaterialsDoc documents: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11683.30it/s]
{'ISMEAR': 2, 'SIGMA': 0.14}
{'ISMEAR': 2, 'SIGMA': 0.14}
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/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-12-02 16:59:50,132 INFO Started executing jobs locally
INFO:jobflow.managers.local:Started executing jobs locally
2024-12-02 16:59:50,135 INFO Starting job - MP GGA relax 1 (fb60826c-2e3b-4708-a77e-106fb051dbf3)
INFO:jobflow.core.job:Starting job - MP GGA relax 1 (fb60826c-2e3b-4708-a77e-106fb051dbf3)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/pymatgen/io/vasp/sets.py:757: BadInputSetWarning: Relaxation of likely metal with ISMEAR < 0 (-5). See VASP recommendations on ISMEAR for metals (https://www.vasp.at/wiki/index.php/ISMEAR).
  warnings.warn(
ERROR:custodian.custodian:IncorrectSmearingHandler
ERROR:custodian.custodian:LargeSigmaHandler
ERROR:custodian.custodian:LargeSigmaHandler
2024-12-02 17:01:12,154 INFO Finished job - MP GGA relax 1 (fb60826c-2e3b-4708-a77e-106fb051dbf3)
INFO:jobflow.core.job:Finished job - MP GGA relax 1 (fb60826c-2e3b-4708-a77e-106fb051dbf3)
2024-12-02 17:01:12,154 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:01:12,154 INFO Starting job - MP GGA relax 2 (f25b7e73-22bd-40f0-9719-d24b457486fb)
INFO:jobflow.core.job:Starting job - MP GGA relax 2 (f25b7e73-22bd-40f0-9719-d24b457486fb)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/test/job_2024-12-02-09-01-12-154362-99746/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/test/job_2024-12-02-09-01-12-154362-99746/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/test/job_2024-12-02-09-01-12-154362-99746/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/test/job_2024-12-02-09-01-12-154362-99746/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/test/job_2024-12-02-09-01-12-154362-99746/WAVECAR 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/test/job_2024-12-02-09-01-12-154362-99746/CHGCAR 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/test/job_2024-12-02-09-01-12-154362-99746/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/test/job_2024-12-02-09-01-12-154362-99746/KPOINTS is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/pymatgen/io/vasp/sets.py:757: BadInputSetWarning: Relaxation of likely metal with ISMEAR < 0 (-5). See VASP recommendations on ISMEAR for metals (https://www.vasp.at/wiki/index.php/ISMEAR).
  warnings.warn(
ERROR:custodian.custodian:IncorrectSmearingHandler
ERROR:custodian.custodian:LargeSigmaHandler
ERROR:custodian.custodian:LargeSigmaHandler
2024-12-02 17:02:03,755 INFO Finished job - MP GGA relax 2 (f25b7e73-22bd-40f0-9719-d24b457486fb)
INFO:jobflow.core.job:Finished job - MP GGA relax 2 (f25b7e73-22bd-40f0-9719-d24b457486fb)
2024-12-02 17:02:03,755 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:02:03,756 INFO Starting job - structure_to_conventional (d7b71332-0eb7-4689-ad20-ea125d72fc1b)
INFO:jobflow.core.job:Starting job - structure_to_conventional (d7b71332-0eb7-4689-ad20-ea125d72fc1b)
2024-12-02 17:02:03,785 INFO Finished job - structure_to_conventional (d7b71332-0eb7-4689-ad20-ea125d72fc1b)
INFO:jobflow.core.job:Finished job - structure_to_conventional (d7b71332-0eb7-4689-ad20-ea125d72fc1b)
2024-12-02 17:02:03,785 INFO Starting job - generate_elastic_deformations (90c4677a-6479-45f7-8f86-b2e7009c9bf9)
INFO:jobflow.core.job:Starting job - generate_elastic_deformations (90c4677a-6479-45f7-8f86-b2e7009c9bf9)
2024-12-02 17:02:05,121 INFO Finished job - generate_elastic_deformations (90c4677a-6479-45f7-8f86-b2e7009c9bf9)
INFO:jobflow.core.job:Finished job - generate_elastic_deformations (90c4677a-6479-45f7-8f86-b2e7009c9bf9)
2024-12-02 17:02:05,121 INFO Starting job - run_elastic_deformations (73d07694-b3f4-4af4-bd4f-ee3d3d816c18)
INFO:jobflow.core.job:Starting job - run_elastic_deformations (73d07694-b3f4-4af4-bd4f-ee3d3d816c18)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/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-12-02 17:02:05,528 INFO Finished job - run_elastic_deformations (73d07694-b3f4-4af4-bd4f-ee3d3d816c18)
INFO:jobflow.core.job:Finished job - run_elastic_deformations (73d07694-b3f4-4af4-bd4f-ee3d3d816c18)
2024-12-02 17:02:05,532 INFO Starting job - MP GGA static 1/6 (83816675-308d-4809-be1d-045668d15588)
INFO:jobflow.core.job:Starting job - MP GGA static 1/6 (83816675-308d-4809-be1d-045668d15588)
2024-12-02 17:02:16,234 INFO Finished job - MP GGA static 1/6 (83816675-308d-4809-be1d-045668d15588)
INFO:jobflow.core.job:Finished job - MP GGA static 1/6 (83816675-308d-4809-be1d-045668d15588)
2024-12-02 17:02:16,234 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:02:16,234 INFO Starting job - MP GGA static 2/6 (2c43d5a6-2ef9-4e42-8600-945bc31c7763)
INFO:jobflow.core.job:Starting job - MP GGA static 2/6 (2c43d5a6-2ef9-4e42-8600-945bc31c7763)
2024-12-02 17:02:26,921 INFO Finished job - MP GGA static 2/6 (2c43d5a6-2ef9-4e42-8600-945bc31c7763)
INFO:jobflow.core.job:Finished job - MP GGA static 2/6 (2c43d5a6-2ef9-4e42-8600-945bc31c7763)
2024-12-02 17:02:26,921 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:02:26,922 INFO Starting job - MP GGA static 3/6 (8c57186b-5747-46e9-8dad-f9c52646d1dd)
INFO:jobflow.core.job:Starting job - MP GGA static 3/6 (8c57186b-5747-46e9-8dad-f9c52646d1dd)
2024-12-02 17:02:37,421 INFO Finished job - MP GGA static 3/6 (8c57186b-5747-46e9-8dad-f9c52646d1dd)
INFO:jobflow.core.job:Finished job - MP GGA static 3/6 (8c57186b-5747-46e9-8dad-f9c52646d1dd)
2024-12-02 17:02:37,421 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:02:37,421 INFO Starting job - MP GGA static 4/6 (82227386-5c69-439c-8d68-7d85745e437a)
INFO:jobflow.core.job:Starting job - MP GGA static 4/6 (82227386-5c69-439c-8d68-7d85745e437a)
2024-12-02 17:02:48,111 INFO Finished job - MP GGA static 4/6 (82227386-5c69-439c-8d68-7d85745e437a)
INFO:jobflow.core.job:Finished job - MP GGA static 4/6 (82227386-5c69-439c-8d68-7d85745e437a)
2024-12-02 17:02:48,111 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:02:48,111 INFO Starting job - MP GGA static 5/6 (a22e7963-3806-4985-80dd-77527cedfc39)
INFO:jobflow.core.job:Starting job - MP GGA static 5/6 (a22e7963-3806-4985-80dd-77527cedfc39)
2024-12-02 17:03:09,014 INFO Finished job - MP GGA static 5/6 (a22e7963-3806-4985-80dd-77527cedfc39)
INFO:jobflow.core.job:Finished job - MP GGA static 5/6 (a22e7963-3806-4985-80dd-77527cedfc39)
2024-12-02 17:03:09,014 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:03:09,015 INFO Starting job - MP GGA static 6/6 (041d8d84-1072-4278-a094-6f8a25bb0456)
INFO:jobflow.core.job:Starting job - MP GGA static 6/6 (041d8d84-1072-4278-a094-6f8a25bb0456)
2024-12-02 17:03:29,862 INFO Finished job - MP GGA static 6/6 (041d8d84-1072-4278-a094-6f8a25bb0456)
INFO:jobflow.core.job:Finished job - MP GGA static 6/6 (041d8d84-1072-4278-a094-6f8a25bb0456)
2024-12-02 17:03:29,862 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 17:03:29,862 INFO Starting job - store_inputs (73d07694-b3f4-4af4-bd4f-ee3d3d816c18, 2)
INFO:jobflow.core.job:Starting job - store_inputs (73d07694-b3f4-4af4-bd4f-ee3d3d816c18, 2)
2024-12-02 17:03:29,866 INFO Finished job - store_inputs (73d07694-b3f4-4af4-bd4f-ee3d3d816c18, 2)
INFO:jobflow.core.job:Finished job - store_inputs (73d07694-b3f4-4af4-bd4f-ee3d3d816c18, 2)
2024-12-02 17:03:29,866 INFO Starting job - fit_elastic_tensor (dc70d0b9-a9a1-4a6b-9bf9-c19bce28154f)
INFO:jobflow.core.job:Starting job - fit_elastic_tensor (dc70d0b9-a9a1-4a6b-9bf9-c19bce28154f)
2024-12-02 17:03:30,356 INFO Finished job - fit_elastic_tensor (dc70d0b9-a9a1-4a6b-9bf9-c19bce28154f)
INFO:jobflow.core.job:Finished job - fit_elastic_tensor (dc70d0b9-a9a1-4a6b-9bf9-c19bce28154f)
2024-12-02 17:03:30,356 INFO Finished executing jobs locally
INFO:jobflow.managers.local:Finished executing jobs locally
[[225.1525 259.8009 259.8009   0.       0.      -0.    ]
 [259.8009 225.1525 259.8009   0.       0.      -0.    ]
 [259.8009 259.8009 225.1525   0.       0.      -0.    ]
 [  0.       0.       0.      18.945   -0.       0.    ]
 [  0.       0.       0.      -0.      18.945    0.    ]
 [ -0.      -0.      -0.       0.       0.      18.945 ]]

Test 2:

In this test, we use the same kpoints settings as those used by MP:

import numpy as np
from jobflow import run_locally
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
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.io.vasp.inputs import Kpoints
from pymatgen.core import Structure
from mp_api.client import MPRester
from atomate2.vasp.powerups import add_metadata_to_flow
#https://github.com/materialsproject/atomate2/issues/1014#issuecomment-2454955891
from atomate2.vasp.flows.mp import MPGGADoubleRelaxMaker, MPGGAStaticMaker

user_potcar_functional = "PBE_64"

material_id = "mp-126"
with MPRester() as mpr:
    # Obtain elastic data and the related task IDs.
    elasticity_doc = mpr.materials.elasticity.search(material_ids=[material_id])
    opt_id = elasticity_doc[0].fitting_data.optimization_task.string
    first_deform_id = str(elasticity_doc[0].fitting_data.deformation_tasks[0])
    opt_doc = mpr.materials.tasks.search([opt_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

    deform_dep_doc = mpr.materials.tasks.search([first_deform_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

structure = mpr.materials.get_structure_by_material_id(material_id)
structure = SpacegroupAnalyzer(structure).get_conventional_standard_structure()

opt_kpoints_settings = opt_doc[0].calcs_reversed[0].input.kpoints
deform_kpoints_settings = deform_dep_doc[0].calcs_reversed[0].input.kpoints

opt_incar_settings = opt_doc[0].input.incar
deform_incar_settings = deform_dep_doc[0].input.incar

# The purpose of this test is to solely assess the impact of using the MP's following incar settings on the final result.
keys_to_extract = {'ISMEAR', 'SIGMA'}
opt_incar_settings1 = {k: v for k, v in opt_incar_settings.items() if k in keys_to_extract}
deform_incar_settings1 = {k: v for k, v in deform_incar_settings.items() if k in keys_to_extract}

print(opt_incar_settings1)
print(deform_incar_settings1)

flow = ElasticMaker(
    bulk_relax_maker=MPGGADoubleRelaxMaker(),  # 使用MP的双重优化设置
    elastic_relax_maker=MPGGAStaticMaker(),    # 使用MP的静态计算设置
    ).make(structure, conventional=True)
flow = update_user_potcar_functional(flow, user_potcar_functional)


flow = update_user_kpoints_settings(flow, opt_kpoints_settings, name_filter="MP GGA relax")
flow = update_user_kpoints_settings(flow, deform_kpoints_settings, name_filter="MP GGA static")

#flow = update_user_incar_settings(flow, opt_incar_settings1, name_filter="MP GGA relax" )
#flow = update_user_incar_settings(flow, deform_incar_settings1, name_filter="MP GGA static" )


# Run the flow
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:

Retrieving ElasticityDoc documents: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 10155.70it/s]
Retrieving TaskDoc documents: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11949.58it/s]
Retrieving TaskDoc documents: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11848.32it/s]
Retrieving MaterialsDoc documents: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 11683.30it/s]
{'ISMEAR': 2, 'SIGMA': 0.14}
{'ISMEAR': 2, 'SIGMA': 0.14}
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/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-12-02 16:32:35,554 INFO Started executing jobs locally
INFO:jobflow.managers.local:Started executing jobs locally
2024-12-02 16:32:35,558 INFO Starting job - MP GGA relax 1 (254fa5a7-c231-4dd7-b290-673079970a33)
INFO:jobflow.core.job:Starting job - MP GGA relax 1 (254fa5a7-c231-4dd7-b290-673079970a33)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/pymatgen/io/vasp/sets.py:757: BadInputSetWarning: Relaxation of likely metal with ISMEAR < 0 (-5). See VASP recommendations on ISMEAR for metals (https://www.vasp.at/wiki/index.php/ISMEAR).
  warnings.warn(
ERROR:custodian.custodian:IncorrectSmearingHandler
ERROR:custodian.custodian:LargeSigmaHandler
2024-12-02 16:37:15,506 INFO Finished job - MP GGA relax 1 (254fa5a7-c231-4dd7-b290-673079970a33)
INFO:jobflow.core.job:Finished job - MP GGA relax 1 (254fa5a7-c231-4dd7-b290-673079970a33)
2024-12-02 16:37:15,506 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:37:15,506 INFO Starting job - MP GGA relax 2 (43400a47-4ea3-4e48-9e2d-ceaa7b7a3176)
INFO:jobflow.core.job:Starting job - MP GGA relax 2 (43400a47-4ea3-4e48-9e2d-ceaa7b7a3176)
/home/werner/Public/repo/github.com/materialsproject/atomate2.git/src/atomate2/common/files.py:268: UserWarning: /home/werner/test/job_2024-12-02-08-37-15-506568-38058/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/test/job_2024-12-02-08-37-15-506568-38058/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/test/job_2024-12-02-08-37-15-506568-38058/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/test/job_2024-12-02-08-37-15-506568-38058/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/test/job_2024-12-02-08-37-15-506568-38058/WAVECAR 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/test/job_2024-12-02-08-37-15-506568-38058/CHGCAR 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/test/job_2024-12-02-08-37-15-506568-38058/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/test/job_2024-12-02-08-37-15-506568-38058/KPOINTS is not gzipped, skipping...
  file_client.gunzip(directory / file, host=host, force=force)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/pymatgen/io/vasp/sets.py:757: BadInputSetWarning: Relaxation of likely metal with ISMEAR < 0 (-5). See VASP recommendations on ISMEAR for metals (https://www.vasp.at/wiki/index.php/ISMEAR).
  warnings.warn(
ERROR:custodian.custodian:IncorrectSmearingHandler
2024-12-02 16:39:02,188 INFO Finished job - MP GGA relax 2 (43400a47-4ea3-4e48-9e2d-ceaa7b7a3176)
INFO:jobflow.core.job:Finished job - MP GGA relax 2 (43400a47-4ea3-4e48-9e2d-ceaa7b7a3176)
2024-12-02 16:39:02,188 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:39:02,188 INFO Starting job - structure_to_conventional (7bbda604-7e56-4baa-ba64-79311e8937fe)
INFO:jobflow.core.job:Starting job - structure_to_conventional (7bbda604-7e56-4baa-ba64-79311e8937fe)
2024-12-02 16:39:02,233 INFO Finished job - structure_to_conventional (7bbda604-7e56-4baa-ba64-79311e8937fe)
INFO:jobflow.core.job:Finished job - structure_to_conventional (7bbda604-7e56-4baa-ba64-79311e8937fe)
2024-12-02 16:39:02,233 INFO Starting job - generate_elastic_deformations (ed4937e1-633b-417d-8f7c-aef987d0c8dc)
INFO:jobflow.core.job:Starting job - generate_elastic_deformations (ed4937e1-633b-417d-8f7c-aef987d0c8dc)
2024-12-02 16:39:04,132 INFO Finished job - generate_elastic_deformations (ed4937e1-633b-417d-8f7c-aef987d0c8dc)
INFO:jobflow.core.job:Finished job - generate_elastic_deformations (ed4937e1-633b-417d-8f7c-aef987d0c8dc)
2024-12-02 16:39:04,132 INFO Starting job - run_elastic_deformations (e7dc13ea-a684-4331-89fd-86166c3f8b61)
INFO:jobflow.core.job:Starting job - run_elastic_deformations (e7dc13ea-a684-4331-89fd-86166c3f8b61)
/home/werner/.pyenv/versions/3.11.1/envs/datasci/lib/python3.11/site-packages/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-12-02 16:39:04,536 INFO Finished job - run_elastic_deformations (e7dc13ea-a684-4331-89fd-86166c3f8b61)
INFO:jobflow.core.job:Finished job - run_elastic_deformations (e7dc13ea-a684-4331-89fd-86166c3f8b61)
2024-12-02 16:39:04,540 INFO Starting job - MP GGA static 1/6 (bfab354e-380f-4a98-8818-b01294b7cf2f)
INFO:jobflow.core.job:Starting job - MP GGA static 1/6 (bfab354e-380f-4a98-8818-b01294b7cf2f)
2024-12-02 16:40:20,622 INFO Finished job - MP GGA static 1/6 (bfab354e-380f-4a98-8818-b01294b7cf2f)
INFO:jobflow.core.job:Finished job - MP GGA static 1/6 (bfab354e-380f-4a98-8818-b01294b7cf2f)
2024-12-02 16:40:20,622 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:40:20,622 INFO Starting job - MP GGA static 2/6 (27052bb9-7dc7-4e2b-b822-884207d62958)
INFO:jobflow.core.job:Starting job - MP GGA static 2/6 (27052bb9-7dc7-4e2b-b822-884207d62958)
2024-12-02 16:41:36,678 INFO Finished job - MP GGA static 2/6 (27052bb9-7dc7-4e2b-b822-884207d62958)
INFO:jobflow.core.job:Finished job - MP GGA static 2/6 (27052bb9-7dc7-4e2b-b822-884207d62958)
2024-12-02 16:41:36,678 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:41:36,678 INFO Starting job - MP GGA static 3/6 (9316772a-2110-4479-abfb-4f74fb17a346)
INFO:jobflow.core.job:Starting job - MP GGA static 3/6 (9316772a-2110-4479-abfb-4f74fb17a346)
2024-12-02 16:42:52,813 INFO Finished job - MP GGA static 3/6 (9316772a-2110-4479-abfb-4f74fb17a346)
INFO:jobflow.core.job:Finished job - MP GGA static 3/6 (9316772a-2110-4479-abfb-4f74fb17a346)
2024-12-02 16:42:52,813 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:42:52,814 INFO Starting job - MP GGA static 4/6 (eabed7dd-ad82-40d7-858a-81f38a42f80d)
INFO:jobflow.core.job:Starting job - MP GGA static 4/6 (eabed7dd-ad82-40d7-858a-81f38a42f80d)
2024-12-02 16:44:08,336 INFO Finished job - MP GGA static 4/6 (eabed7dd-ad82-40d7-858a-81f38a42f80d)
INFO:jobflow.core.job:Finished job - MP GGA static 4/6 (eabed7dd-ad82-40d7-858a-81f38a42f80d)
2024-12-02 16:44:08,337 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:44:08,337 INFO Starting job - MP GGA static 5/6 (329b7c0b-0150-46bb-9ec8-ae997ab95d25)
INFO:jobflow.core.job:Starting job - MP GGA static 5/6 (329b7c0b-0150-46bb-9ec8-ae997ab95d25)
2024-12-02 16:46:17,455 INFO Finished job - MP GGA static 5/6 (329b7c0b-0150-46bb-9ec8-ae997ab95d25)
INFO:jobflow.core.job:Finished job - MP GGA static 5/6 (329b7c0b-0150-46bb-9ec8-ae997ab95d25)
2024-12-02 16:46:17,455 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:46:17,455 INFO Starting job - MP GGA static 6/6 (252d5caf-a627-4a8b-ad5c-f0239d509beb)
INFO:jobflow.core.job:Starting job - MP GGA static 6/6 (252d5caf-a627-4a8b-ad5c-f0239d509beb)
2024-12-02 16:48:26,377 INFO Finished job - MP GGA static 6/6 (252d5caf-a627-4a8b-ad5c-f0239d509beb)
INFO:jobflow.core.job:Finished job - MP GGA static 6/6 (252d5caf-a627-4a8b-ad5c-f0239d509beb)
2024-12-02 16:48:26,377 WARNING Response.stored_data is not supported with local manager.
WARNING:jobflow.managers.local:Response.stored_data is not supported with local manager.
2024-12-02 16:48:26,377 INFO Starting job - store_inputs (e7dc13ea-a684-4331-89fd-86166c3f8b61, 2)
INFO:jobflow.core.job:Starting job - store_inputs (e7dc13ea-a684-4331-89fd-86166c3f8b61, 2)
2024-12-02 16:48:26,381 INFO Finished job - store_inputs (e7dc13ea-a684-4331-89fd-86166c3f8b61, 2)
INFO:jobflow.core.job:Finished job - store_inputs (e7dc13ea-a684-4331-89fd-86166c3f8b61, 2)
2024-12-02 16:48:26,381 INFO Starting job - fit_elastic_tensor (19429b93-851c-485b-8b13-bded6951efa9)
INFO:jobflow.core.job:Starting job - fit_elastic_tensor (19429b93-851c-485b-8b13-bded6951efa9)
2024-12-02 16:48:27,088 INFO Finished job - fit_elastic_tensor (19429b93-851c-485b-8b13-bded6951efa9)
INFO:jobflow.core.job:Finished job - fit_elastic_tensor (19429b93-851c-485b-8b13-bded6951efa9)
2024-12-02 16:48:27,088 INFO Finished executing jobs locally
INFO:jobflow.managers.local:Finished executing jobs locally
[[293.2878 227.9777 227.9777   0.       0.      -0.    ]
 [227.9777 293.2878 227.9777   0.       0.      -0.    ]
 [227.9777 227.9777 293.2878   0.       0.      -0.    ]
 [  0.       0.       0.      48.4982  -0.       0.    ]
 [  0.       0.       0.      -0.      48.4982   0.    ]
 [ -0.      -0.      -0.       0.       0.      48.4982]]

Here are some more tests I have conducted:

Test 3:

With the following settings:

user_potcar_functional = "PBE_64"
keys_to_extract = {'ALGO'}

The corresponding complete python code:

import numpy as np
from jobflow import run_locally
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
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.io.vasp.inputs import Kpoints
from pymatgen.core import Structure
from mp_api.client import MPRester
from atomate2.vasp.powerups import add_metadata_to_flow
#https://github.com/materialsproject/atomate2/issues/1014#issuecomment-2454955891
from atomate2.vasp.flows.mp import MPGGADoubleRelaxMaker, MPGGAStaticMaker

user_potcar_functional = "PBE_64"

material_id = "mp-126"
with MPRester() as mpr:
    # Obtain elastic data and the related task IDs.
    elasticity_doc = mpr.materials.elasticity.search(material_ids=[material_id])
    opt_id = elasticity_doc[0].fitting_data.optimization_task.string
    first_deform_id = str(elasticity_doc[0].fitting_data.deformation_tasks[0])
    opt_doc = mpr.materials.tasks.search([opt_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

    deform_dep_doc = mpr.materials.tasks.search([first_deform_id],
        fields=["input", "orig_inputs", "calcs_reversed"])

structure = mpr.materials.get_structure_by_material_id(material_id)
structure = SpacegroupAnalyzer(structure).get_conventional_standard_structure()

opt_kpoints_settings = opt_doc[0].calcs_reversed[0].input.kpoints
deform_kpoints_settings = deform_dep_doc[0].calcs_reversed[0].input.kpoints

opt_incar_settings = opt_doc[0].input.incar
deform_incar_settings = deform_dep_doc[0].input.incar

# The purpose of this test is to solely assess the impact of using the MP's following incar settings on the final result.
keys_to_extract = {'ALGO'}
opt_incar_settings1 = {k: v for k, v in opt_incar_settings.items() if k in keys_to_extract}
deform_incar_settings1 = {k: v for k, v in deform_incar_settings.items() if k in keys_to_extract}

print(opt_incar_settings1)
print(deform_incar_settings1)

flow = ElasticMaker(
    bulk_relax_maker=MPGGADoubleRelaxMaker(),  # 使用MP的双重优化设置
    elastic_relax_maker=MPGGAStaticMaker(),    # 使用MP的静态计算设置
    ).make(structure, conventional=True)
flow = update_user_potcar_functional(flow, user_potcar_functional)


flow = update_user_kpoints_settings(flow, opt_kpoints_settings, name_filter="MP GGA relax")
flow = update_user_kpoints_settings(flow, deform_kpoints_settings, name_filter="MP GGA static")

flow = update_user_incar_settings(flow, opt_incar_settings1, name_filter="MP GGA relax" )
flow = update_user_incar_settings(flow, deform_incar_settings1, name_filter="MP GGA static" )


# Run the flow
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:

[[293.1039 227.552  227.552    0.       0.      -0.    ]
 [227.552  293.1039 227.552    0.       0.      -0.    ]
 [227.552  227.552  293.1039   0.       0.      -0.    ]
 [  0.       0.       0.      48.3924  -0.       0.    ]
 [  0.       0.       0.      -0.      48.3924   0.    ]
 [ -0.      -0.      -0.       0.       0.      48.3924]]

For simplicity, in the following testings, I only list the different settings:

Test 4:

The settings:

user_potcar_functional = "PBE"
keys_to_extract = {'ALGO'}

The result:

[[286.9476 224.9959 224.9959   0.       0.      -0.    ]
 [224.9959 286.9476 224.9959   0.       0.      -0.    ]
 [224.9959 224.9959 286.9476   0.       0.      -0.    ]
 [  0.       0.       0.      49.1152  -0.       0.    ]
 [  0.       0.       0.      -0.      49.1152   0.    ]
 [ -0.      -0.      -0.       0.       0.      49.1152]] 

Test 5:

The settings:

user_potcar_functional = "PBE"
keys_to_extract = {'ALGO', 'ISMEAR', 'SIGMA'}

The result:

[[294.784  217.0219 217.0219   0.       0.      -0.    ]
 [217.0219 294.784  217.0219   0.       0.      -0.    ]
 [217.0219 217.0219 294.784    0.       0.      -0.    ]
 [  0.       0.       0.      57.6786  -0.       0.    ]
 [  0.       0.       0.      -0.      57.6786   0.    ]
 [ -0.      -0.      -0.       0.       0.      57.6786]]

Therefore, we can summarize as follows:

  • We can see that while custodian provides automated error handling and parameter adjustments, initial reasonable parameter settings are still important for obtaining meaningful calculation results.

  • It is necessary to simultaneously use the specific system's incar and kpoints provided by MP. For reproducing results of MP, use the same version of potcar as MP (if available to you). For actual research, use the latest version of potcar officially recommended by VASP.

  • The input settings displayed on the MP official website (e.g.: https://next-gen.materialsproject.org/materials/mp-126/tasks/mp-2383742) correspond to "orig_inputs" and should not be used for reproducing results of MP or actual research. For reproducing results of MP and actual research, use "input" and "calcs_reversed".

  • The VASP input set setup, especially the setting of KPOINTS, the version of POTCAR, and certain parameters of a specific VASP job in the INCAR file (e.g., the 'ALGO', 'ISMEAR', 'SIGMA' parameters here), significantly influence the ultimate calculation results.

For the related discussion, see #1 (comment).

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