PyNEP is a python interface of the machine learning potential NEP used in GPUMD.
- ase calculator of NEP
- descriptor and latent descriptor calculation of atoms
- load and dump for GPUMD dataset
- phonopy calculation of NEP (need phonopy and spglib)
- structures select
- Farthest Point Sampling
| Package | version |
|---|---|
| Python | >= 3.8 |
| NumPy | >= 2.0 |
| SciPy | >= 1.1 |
| ase | >= 3.18.0 |
$ pip install git+https://github.com/bigd4/PyNEP.git$ git clone --recursive https://github.com/bigd4/PyNEP.git
$ cd PyNEP
$ python setup.py install$ git clone --recursive https://github.com/bigd4/PyNEP.git
$ cd PyNEP/nep_cpu
$ mkdir build
$ cd build
$ cmake .. && make
$ cp nep.so ../../PyNEPAdd pynep to your PYTHONPATH environment variable in your ~/.bashrc file.
$ export PYTHONPATH=<path-to-pynep-package>:$PYTHONPATH#For an example of a randomly split training datasets: examples/shuf_xyz.py# NEP to exyztrain_data=load_nep("train.in", ftype="nep")
dump_nep("train.xyz", train_data, ftype="exyz")
# exyz to NEPtrain_data=load_nep("train.xyz", ftype="exyz")
dump_nep("train.in", train_data, ftype="nep")fromase.buildimportbulkatoms=bulk('C', 'diamond', cubic=True)
# calculate energy and forcesfrompynep.calculateimportNEPcalc=NEP('nep.txt')
atoms=bulk('C', 'diamond', cubic=True)
atoms.set_calculator(calc)
energy=atoms.get_potential_energy()
forces=atoms.get_forces()
stress=atoms.get_stress() # stress in ase is different from virial in GPUMD# calculate descriptors and latent descriptorsdes=calc.get_property('descriptor', atoms)
lat=calc.get_property('latent', atoms)
# load and dump GPUMD datafrompynep.ioimportload_nep, dump_nepdump_nep('C.in', [atoms])
atoms=load_nep('C.in')[0]
# calculate band strucuture, dos and thermal properties (need spglib and phonopy)frompynep.phonoimportPhonoCalcphono_calc=PhonoCalc(calc)
phono_calc.calculate(atoms)