Hi here,
I would like to add the following comments on the issues discussed here:
1. K-point grid mesh is related to
KSPACING tag, say, in pymatgen, the following rule of thumb is used:
MP uses 0.22 for metals and 0.44 for insulators with smooth interpolation in between based on band gap.
2. For the different types of relaxations, the relationship between the cell size and the K-point grid mesh size used does not always follow the same relationship, as shown in the following example:
Code: Select all
$ cat ./1_MgNi2_geo/POSCAR
Mg4 Ni8
1.0
4.7933793068000004 0.0000000000000000 0.0000000000000000
-2.3966896534000002 4.1511882496999997 0.0000000000000000
0.0000000000000000 0.0000000000000000 7.8603634833999996
Mg Ni
4 8
direct
0.6666666870000000 0.3333333430000000 0.5626903770000000 Mg
0.3333333430000000 0.6666666870000000 0.0626903920000000 Mg
0.3333333430000000 0.6666666870000000 0.4373096230000000 Mg
0.6666666870000000 0.3333333430000000 0.9373096230000000 Mg
0.0000000000000000 0.0000000000000000 0.5000000000000000 Ni
0.0000000000000000 0.0000000000000000 0.0000000000000000 Ni
0.8311911230000000 0.6623821850000000 0.2500000000000000 Ni
0.1688089070000000 0.8311911230000000 0.7500000000000000 Ni
0.6623821850000000 0.8311911230000000 0.7500000000000000 Ni
0.3376178150000000 0.1688089070000000 0.2500000000000000 Ni
0.8311911230000000 0.1688089070000000 0.2500000000000000 Ni
0.1688089070000000 0.3376178150000000 0.7500000000000000 Ni
In [3]: from pymatgen.io.vasp.sets import MPMDSet
...: from pymatgen.core import Structure
...: from pymatgen.io.vasp.inputs import Kpoints
...:
...: # Load the structure from a CIF file
...: structure = Structure.from_file("./1_MgNi2_geo/POSCAR")
...:
...: # Define user INCAR settings
...: user_incar_settings = {
...: 'ALGO': 'N',
...: 'GGA': 'pe',
...: "ISPIN": 1,
...: }
...:
...: # Define a list of scaling factors for generating supercells
...: scaling_factors = [1, 2, 3] # Example: Generate 1x1x1, 2x2x2, and 3x3x3 supercells
...:
...: for scale in scaling_factors:
...: # Generate the supercell
...: supercell = structure.copy()
...: supercell.make_supercell([scale, scale, scale])
...:
...: # Create VASP input files for the supercell
...: vasp_input = MPMDSet(supercell, user_potcar_functional="PBE_64", user_incar_settings=user_incar_settings)
...:
...: # The Kpoints are automatically generated based on the supercell size by MPMetalRelaxSet
...: # To directly observe and modify the k-point mesh, you might extract it from vasp_input if necessary
...:
...: # Print the mesh size for the current supercell for verification
...: # Note: This approach assumes you're using a method to visualize or extract the kpoints directly.
...: # Adjust the code as necessary to match your method of handling Kpoints.
...:
...: # The following line is a placeholder for where you would extract or check the k-point mesh:
...: print(f"Supercell {scale}x{scale}x{scale} - Kpoints mesh: {vasp_input.kpoints.kpts}")
...:
...: # Write VASP input files to a directory named after the supercell size
...: #output_dir = f"./supercell_{scale}x{scale}x{scale}"
...: #vasp_input.write_input(output_dir)
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/pymatgen/io/vasp/sets.py:415: BadInputSetWarning: Overriding the POTCAR functional is generally not recommended as it significantly affect 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(
Supercell 1x1x1 - Kpoints mesh: [(1, 1, 1)]
Supercell 2x2x2 - Kpoints mesh: [(1, 1, 1)]
Supercell 3x3x3 - Kpoints mesh: [(1, 1, 1)]
In [4]: from pymatgen.io.vasp.sets import MPMetalRelaxSet
...: from pymatgen.core import Structure
...: from pymatgen.io.vasp.inputs import Kpoints
...:
...: # Load the structure from a CIF file
...: structure = Structure.from_file("./1_MgNi2_geo/POSCAR")
...:
...: # Define user INCAR settings
...: user_incar_settings = {
...: 'ALGO': 'N',
...: 'GGA': 'pe',
...: "ISPIN": 1,
...: }
...:
...: # Define a list of scaling factors for generating supercells
...: scaling_factors = [1, 2, 3] # Example: Generate 1x1x1, 2x2x2, and 3x3x3 supercells
...:
...: for scale in scaling_factors:
...: # Generate the supercell
...: supercell = structure.copy()
...: supercell.make_supercell([scale, scale, scale])
...:
...: # Create VASP input files for the supercell
...: vasp_input = MPMetalRelaxSet(supercell, user_potcar_functional="PBE_64", user_incar_settings=user_incar_settings)
...:
...: # The Kpoints are automatically generated based on the supercell size by MPMetalRelaxSet
...: # To directly observe and modify the k-point mesh, you might extract it from vasp_input if necessary
...:
...: # Print the mesh size for the current supercell for verification
...: # Note: This approach assumes you're using a method to visualize or extract the kpoints directly.
...: # Adjust the code as necessary to match your method of handling Kpoints.
...:
...: # The following line is a placeholder for where you would extract or check the k-point mesh:
...: print(f"Supercell {scale}x{scale}x{scale} - Kpoints mesh: {vasp_input.kpoints.kpts}")
...:
...: # Write VASP input files to a directory named after the supercell size
...: #output_dir = f"./supercell_{scale}x{scale}x{scale}"
...: #vasp_input.write_input(output_dir)
/home/werner/Public/repo/github.com/materialsproject/pymatgen.git/pymatgen/io/vasp/sets.py:415: BadInputSetWarning: Overriding the POTCAR functional is generally not recommended as it significantly affect 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(
Supercell 1x1x1 - Kpoints mesh: [[8, 8, 4]]
Supercell 2x2x2 - Kpoints mesh: [[4, 4, 2]]
Supercell 3x3x3 - Kpoints mesh: [[2, 2, 1]]
As you can see, as a rule of thumb, a 1 * 1 * 1 k-point mesh is usually enough for an AIMD relaxation computation, but this is generally not the case for other types of relaxation.
Regards,
Zhao