-
Notifications
You must be signed in to change notification settings - Fork 0
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
Comments
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, |
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:
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:
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:
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:
Test 5:The settings: user_potcar_functional = "PBE"
keys_to_extract = {'ALGO', 'ISMEAR', 'SIGMA'} The result:
Therefore, we can summarize as follows:
For the related discussion, see #1 (comment). |
Hi there,
I noticed in the examples of this package, the
ISMEAR
andSIGMA
tags are set as follows: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
The text was updated successfully, but these errors were encountered: