pyiron / FAQs

General question board for pyiron users
3 stars 0 forks source link

Configuring VASP with pyiron (HPC cluster) #9

Open pkruzikova opened 9 months ago

pkruzikova commented 9 months ago

Having access to the VASP installation on our cluster, and the potentials files, I just need a little more detailed instructions than are available here. Some questions I have include

Thanks!

jan-janssen commented 9 months ago

To generate the csv files for a new release of VASP potentials you can use the following code:

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

path = "/path/to/vasp_potentials"  # change this to match your path 

# https://www.vasp.at/wiki/index.php/Available_PAW_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 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].to_csv("potentials_vasp.csv")