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

VASP Potential Documentation #71

Open
jan-janssen opened this issue Mar 13, 2024 · 0 comments
Open

VASP Potential Documentation #71

jan-janssen opened this issue Mar 13, 2024 · 0 comments

Comments

@jan-janssen
Copy link
Member

jan-janssen commented Mar 13, 2024

The defaults for the VASP potentials are generated from the tables published in the VASP wiki:
https://www.vasp.at/wiki/index.php/Available_PAW_potentials

The script to generate the corresponding potential files for a new release of pseudo potentials:

import os
import glob
import pandas
import numpy as np
from mendeleev.fetch import fetch_table


path = "/Users/janssen/Downloads/vasp_potentials"


elements_dict = {
    "H": "H",
    "He": "He",
    "Li": "Li_sv",
    "Be": "Be",
    "B": "B",
    "C": "C",
    "N": "N",
    "O": "O", 
    "F": "F",
    "Ne": "Ne",
    "Na": "Na_pv",
    "Mg": "Mg",
    "Al": "Al",
    "Si": "Si",
    "P": "P",
    "S": "S",
    "Cl": "Cl",
    "Ar": "Ar",
    "K": "K_sv",
    "Ca": "Ca_sv",
    "Sc": "Sc_sv",
    "Ti": "Ti_sv",
    "V": "V_sv",
    "Cr": "Cr_pv",
    "Mn": "Mn_pv",
    "Fe": "Fe",
    "Co": "Co",
    "Ni": "Ni",
    "Cu": "Cu",
    "Zn": "Zn",
    "Ga": "Ga_d",
    "Ge": "Ge_d",
    "As": "As",
    "Se": "Se",
    "Br": "Br",
    "Kr": "Kr",
    "Rb": "Rb_sv",
    "Sr": "Sr_sv",
    "Y": "Y_sv",
    "Zr": "Zr_sv",
    "Nb": "Nb_sv",
    "Mo": "Mo_sv",
    "Tc": "Tc_pv",
    "Ru": "Ru_pv",
    "Rh": "Rh_pv",
    "Pd": "Pd",
    "Ag": "Ag",
    "Cd": "Cd",
    "In": "In_d",
    "Sn": "Sn_d",
    "Sb": "Sb",
    "Te": "Te",
    "I": "I",
    "Xe": "Xe",
    "Cs": "Cs_sv",
    "Ba": "Ba_sv",
    "La": "La",
    "Ce": "Ce",
    "Pr": "Pr_3",
    "Nd": "Nd_3",
    "Pm": "Pm_3",
    "Sm": "Sm_3",
    "Eu": "Eu_2",
    "Gd": "Gd_3",
    "Tb": "Tb_3",
    "Dy": "Dy_3",
    "Ho": "Ho_3",
    "Er": "Er_3",
    "Tm": "Tm_3",
    "Yb": "Yb_2",
    "Lu": "Lu_3",
    "Hf": "Hf_pv",
    "Ta": "Ta_pv",
    "W": "W_sv",
    "Re": "Re",
    "Os": "Os",
    "Ir": "Ir",
    "Pt": "Pt",
    "Au": "Au",
    "Hg": "Hg",
    "Tl": "Tl_d",
    "Pb": "Pb_d",
    "Bi": "Bi_d",
    "Po": "Po_d",
    "At": "At",
    "Rn": "Rn",
    "Fr": "Fr_sv",
    "Ra": "Ra_sv",
    "Ac": "Ac",
    "Th": "Th",
    "Pa": "Pa",
    "U": "U",
    "Np": "Np",
    "Pu": "Pu",
    "Am": "Am",
    "Cm": "Cm"
}


if __name__ == "__main__":
    potcar_lst = [name for name in glob.glob(path + '/*/*/POTCAR')]
    file_name_lst = [p.split(path)[-1][1:] for p in potcar_lst]
    model_lst = ["gga-pbe" if "/potpaw_PBE/" in p else "lda" for p in potcar_lst]
    filename_lst = [p.split("/")[-2] for p in potcar_lst]
    species_lst = [[p.split("_")[0]] for p in filename_lst]
    name_lst = [s+"-"+m for s, m in zip(filename_lst, model_lst)]

    encut_recommended_lst, electrons_lst = [], []
    for potcar_file in potcar_lst:
        with open(potcar_file, "r") as f:
            content = f.readlines()
        for l in content:    
            if "ENMAX" in l:
                encut_low = float(l.split()[2].replace(";", ""))
            if "ZVAL" in l:
                zval_electron = float(l.split()[5])
        encut_recommended_lst.append(encut_low)
        electrons_lst.append(zval_electron)

    df = pandas.DataFrame({
        "Filename": file_name_lst,
        "Model": model_lst,
        "Name": name_lst,
        "Species": species_lst,
        "n_elect": electrons_lst,
        "ENMAX": encut_recommended_lst
    })
    df_mendeleev = fetch_table('elements')
    ind = np.array([
        l[0] in df_mendeleev.symbol.values or l[0].split(".")[0] in df_mendeleev.symbol.values or l[0].split(".")[0] == "H1" 
        for l in df.Species
    ])
    ind = np.array([l[0] in df_mendeleev.symbol.values for l in df.Species])

    df_lda = pandas.DataFrame({"Element": elements_dict.keys(), "Name": [v + "-lda" for k, v in elements_dict.items()]})
    df_lda.set_index("Element", inplace=True)
    df_lda.sort_index(inplace=True)

    df_pbe = pandas.DataFrame({"Element": elements_dict.keys(), "Name": [v + "-gga-pbe" for k, v in elements_dict.items()]})
    df_pbe.set_index("Element", inplace=True)
    df_pbe.sort_index(inplace=True)

    df_pbe.to_csv("potentials_vasp_pbe_default.csv")
    df_lda.to_csv("potentials_vasp_lda_default.csv")
    df[ind].sort_values(by=["Model", "Name"], ignore_index=True).to_csv("potentials_vasp.csv")
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

1 participant