Skip to content

Repository files navigation

PyNEP

Documentation Status

PyNEP is a python interface of the machine learning potential NEP used in GPUMD.

Features

  • 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

Installation

Requirements

Packageversion
Python>= 3.8
NumPy>= 2.0
SciPy>= 1.1
ase>= 3.18.0

By pip

$ pip install git+https://github.com/bigd4/PyNEP.git

By setup.py

$ git clone --recursive https://github.com/bigd4/PyNEP.git
$ cd PyNEP
$ python setup.py install

From Source

$ git clone --recursive https://github.com/bigd4/PyNEP.git
$ cd PyNEP/nep_cpu
$ mkdir build
$ cd build
$ cmake .. && make
$ cp nep.so ../../PyNEP

Add pynep to your PYTHONPATH environment variable in your ~/.bashrc file.

$ export PYTHONPATH=<path-to-pynep-package>:$PYTHONPATH

File format conversion

#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")

Usage

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)

About

A python interface of NEP

Topics

Resources

Stars

71 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages