Giter Site home page Giter Site logo

pynep's Introduction

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

Package version
Python >= 3.8
NumPy < 1.22.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 exyz
train_data = load_nep("train.in", ftype="nep")
dump_nep("train.xyz", train_data, ftype="exyz")

# exyz to NEP
train_data = load_nep("train.xyz", ftype="exyz")
dump_nep("train.in", train_data, ftype="nep")

Usage

from ase.build import bulk
atoms = bulk('C', 'diamond', cubic=True)

# calculate energy and forces
from pynep.calculate import NEP
calc = 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 descriptors
des = calc.get_property('descriptor', atoms)
lat = calc.get_property('latent', atoms)

# load and dump GPUMD data
from pynep.io import load_nep, dump_nep
dump_nep('C.in', [atoms])
atoms = load_nep('C.in')[0]

# calculate band strucuture, dos and thermal properties (need spglib and phonopy)
from pynep.phono import PhonoCalc
phono_calc = PhonoCalc(calc)
phono_calc.calculate(atoms)

pynep's People

Contributors

bigd4 avatar brucefan1983 avatar jonsnow-willow avatar kick-h avatar psn417 avatar qhjia avatar tamaswells avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.