Instruction for compiling deepmd-kit and dpgen on NSCC
wget [https://github.com/deepmodeling/deepmd-kit/releases/download/v3.0.1/deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.0](https://github.com/deepmodeling/deepmd-kit/releases/download/v3.0.1/deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.0)
wget [https://github.com/deepmodeling/deepmd-kit/releases/download/v3.0.1/deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.1](https://github.com/deepmodeling/deepmd-kit/releases/download/v3.0.1/deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.1)
cat deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.0 \
deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh.1 > \
deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh
sh deepmd-kit-3.0.1-cuda126-Linux-x86_64.sh
The software will as you where to install the binary.
source /root/deepmd-kit/bin/activate /root/deepmd-kit
You have to put the above command to your bash script.
The current version is v0.13.1.
https://github.com/deepmodeling/dpgen
Modify the make_vasp_incar
function in dpgen/generator/run.py as follow.
def make_vasp_incar(jdata, filename):
if "fp_incar" in jdata.keys():
fp_incar_path = jdata["fp_incar"]
assert os.path.exists(fp_incar_path)
fp_incar_path = os.path.abspath(fp_incar_path)
fr = open(fp_incar_path)
incar = fr.read()
### adding magmom or plus U
if "fp_incar_magom" in jdata:
fp_incar_magmom = jdata["fp_incar_magom"]
poscar_file = open(os.path.abspath("POSCAR"))
poscar_data = poscar_file.readlines()
elements_order = [ele.strip() for ele in poscar_data[5].split()]
element_counts = [ele.strip() for ele in poscar_data[6].split()]
magmom = "MAGMOM ="
for idx, element in enumerate(elements_order):
mag = fp_incar_magmom[element]
magmom = magmom + " " + element_counts[idx] + "*" + str(mag)
incar = incar + "\n" + magmom
if "fp_incar_plus_u" in jdata:
fp_incar_plus_u = jdata["fp_incar_plus_u"]
poscar_file = open(os.path.abspath("POSCAR"))
poscar_data = poscar_file.readlines()
elements_order = [ele.strip() for ele in poscar_data[5].split()]
total_added_u = 0
max_ul = 0
ldaul = "LDAUL ="
ldauu = "LDAUU ="
ldauj = "LDAUJ ="
for element in elements_order:
ul = fp_incar_plus_u[element]['ul']
if ul>max_ul: max_ul = ul
ldaul = ldaul + " " + str(ul)
uu = fp_incar_plus_u[element]['uu']
ldauu = ldauu + " " + str(uu)
total_added_u +=uu
uj = fp_incar_plus_u[element]['uj']
ldauj = ldauj + " " + str(uj)
total_added_u +=uj
if total_added_u > 0:
incar = incar + "\n" + "LDAU = .TRUE."
incar = incar + "\n" + ldaul
incar = incar + "\n" + ldauu
incar = incar + "\n" + ldauj
if max_ul > 2:
incar = incar + "\n" + "LMAXMIX = 6"
else:
incar = incar + "\n" + "LMAXMIX = 4"
### end of adding magmon or plus U
fr.close()
elif "user_fp_params" in jdata.keys():
incar = write_incar_dict(jdata["user_fp_params"])
else:
incar = make_vasp_incar_user_dict(jdata["fp_params"])
with open(filename, "w") as fp:
fp.write(incar)
return incar
When running dpgen the following tags (fp_incar_magom
and fp_incar_plus_u
) with informattion about initial MAGMON or Plus+U should be added.
For example:
.......
"fp_incar": "./INCAR",
'fp_incar_magom': {'C': 0,
'Ce': 3,
'O': 0,
'Ti': 3,
'Pd': 3,
'H': 0},
'fp_incar_plus_u': {'C': {'ul':-1, 'uu': 0.00, 'uj': 0.00},
'Ce': {'ul':3, 'uu': 5.50, 'uj': 1.00},
'O': {'ul':-1, 'uu': 0.00, 'uj': 0.00},
'Ti': {'ul':2, 'uu': 5.50, 'uj': 1.00},
'Pd': {'ul':-1, 'uu': 0.00, 'uj': 0.00},
'H': {'ul':-1, 'uu': 0.00, 'uj': 0.00},
}
Create an environment (tested with python version 3.11.7)
python3 -m venv dpgen_env
Activate the environment.
source /home/users/ntu/vannamtr/dpgen_env/bin/activate
You must add the above command to your bash script
Then install the package with
pip install ./dpgen
To test if the installation is successful, you may execute
dpgen -h
Note: The above tutorial should work on NCI as well.