You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frommp_api.clientimportMPResterfrompymatgen.symmetry.analyzerimportSpacegroupAnalyzerfromatomate2.vasp.flows.mpimportMPGGADoubleRelaxMakerfromatomate2.vasp.powerupsimport (
update_user_incar_settings,
update_user_potcar_functional,
)
fromjobflowimportrun_locally# Set POTCAR functionaluser_potcar_functional="PBE_64"# Get structure from MPmaterial_id="mp-126"withMPRester() asmpr:
# First get the task id from the materials docmaterials=mpr.materials.search(material_ids=[material_id], fields=["task_ids"])
task_id=materials[0].task_ids[0]
# Now get the calculation that includes MAGMOM settingstasks=mpr.materials.tasks.search(task_ids=[task_id],
fields=["input.incar", "calcs_reversed"])
# Get the INCAR settings from the calculationincar_settings=tasks[0].calcs_reversed[0].input.incar# Get the structure and convert to conventional cellstructure=mpr.materials.get_structure_by_material_id(material_id)
structure=SpacegroupAnalyzer(structure).get_conventional_standard_structure()
# Convert MAGMOM list to dictionary formatif"MAGMOM"inincar_settings:
print("Original MAGMOM settings:", incar_settings["MAGMOM"])
print("Number of sites in structure:", len(structure))
# Get unique species listspecies_list= [site.species_stringforsiteinstructure]
unique_species=sorted(set(species_list))
print("Unique species in structure:", unique_species)
# Set all species to the first MAGMOM value from the original calculationmagmom_dict= {specie: incar_settings["MAGMOM"][0] forspecieinunique_species}
incar_settings["MAGMOM"] =magmom_dictprint("MAGMOM dictionary:", magmom_dict)
# Create a simple flow with just the relaxflow=MPGGADoubleRelaxMaker().make(structure)
# Update POTCAR settingsflow=update_user_potcar_functional(flow, user_potcar_functional)
# Update INCAR settingsflow=update_user_incar_settings(flow, incar_settings)
# Run the flow#responses = run_locally(flow, create_folders=True, ensure_success=True)
The following info will be shown:
In [29]: flow = update_user_potcar_functional(flow, user_potcar_functional)
/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(
In [30]: flow = update_user_incar_settings(flow, incar_settings)
/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(
When running the following code:
The following info will be shown:
It seems that this warning should be triggered by update_user_potcar_functional instead of update_user_incar_settings.
See materialsproject/pymatgen#4179 for the related discussion.
Regards,
Zhao
The text was updated successfully, but these errors were encountered: