Code Monkey home page Code Monkey logo

hdnnpy-phonopy-interface's Introduction

About this script

hdnnpy2phono3py.py is script to interfacing phono3py and hdnnpy (high-dimensional neural network potential code, see https://github.com/masayoshi-ogura/HDNNP (archived) or https://github.com/eminamitani/hdnnpy-update (mostly same as the above but including minor update))

Usage

For prepare the input files to predict the force by hdnnpy

python hdnnpy2phono3py.py prep

In this preperation process, the job-script predictionRun.sh for hdnnpy calculation is generated based on the information written in config file. Then, submit hdnnpy job using jobscheduler. For example

qsub predictionRun.sh

After that, run phono3py calculation by

python hdnnpy2phono3py.py run

In this script, two situations are considered.

  1. 2nd and 3rd order force constant is evaluated in the same size of supercell.
  2. different supercell size is used for 2nd and 3rd order force constant

These two cases can be specified by setting --dimfc2 in the config file as shown in below.

  • config file
    The name of config file for prep and run is phono3py_config.yaml. The meaning of the tags in config file is
dim: [2,2,2] #supercell size for phono3py calculation
symfc: True  #use Acoustic sum rule or not
prefix: crystal #prefix used in hdnnpy calculation
poscar: POSCAR #file name of POSCAR used in phono3py
dimfc2: [3,3,3] #if different supercell size for 2nd order FC case
mesh: [11,11,11] #mesh in phono3py-BTE calculation
pipfile: /Users/emi/PycharmProjects/hdnnpy+phono3py/Pipfile
#path for Pipfile of virtualenv to use hdnnpy and phono3py
nnpoutput: ../output # the path for the directory contain master_nnp.npz (hdnnpy output)
fc3output: ../fc3-output # the path for working directory for 3rd order FC calculation
fc2output: ../fc2-output # the path for working directory for 2nd order FC calculation
mpicommand: mpirun -np 24 #command fo mpi
strpa: [0,1/2,1/2,1/2,0,1/2,1/2,1/2,0] #translation matrix to conventional to primitive cell, optional. used in phono3py
#the header part of job script in your system
jobscriptheader: |
  #!/bin/csh
  #$ -cwd
  #$ -V -S /bin/bash
  #$ -N prediction
  #$ -o stdout
  #$ -e stderr
  #$ -q all.q
  #$ -pe smp 24
  export OMP_NUM_THREADS=1
  root=$PWD
  MPIROOT=/usr/local/openmpi-1.8.8/
  export PATH=$MPIROOT/bin:$PATH
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPIROOT/lib
  export MANPATH=$MANPATH:$MPIROOT/share/man

If dimfc2 is not empty, the calculation for 2nd order FC is prepared.

Environment setup

hdnnpy+phonopy+phono3py using pyenv+pipenv

Optional: install pyenv

in mac OS + zsh

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

In my case, install 3.7.6 by pyenv install 3.7.6

install pipenv by pip install pipenv

clone hdnnpy with minor update

Minor update for newer version of several python package is inplemented in initialize branch. This, after clone, checkout to that branch is recommended.

git clone [email protected]:eminamitani/hdnnpy-update.git
git fetch
git checkout -b initialize origin/initialize

This package include Pipfile. (The Pipfile.lock is also included, but some of library is old. This, it may be better to remove Pipfile.lock.)

pipenv --python 3.7
pipenv install --dev

Add phono3py to pipenv virtual environment

Activate virtual environment by pipenv

pipenv shell

Then, install phonopy

pip install phonopy

Clone phono3py source package. The development branch version requires phonopy version >2.7. But pip install phonopy install the stable version of 2.6. Thus, here I checkout to the master branch after clone.

git clone https://github.com/phonopy/phono3py.git
git fetch
git checkout -b master origin/master

new version of gcc is installed by Macport

sudo port install gcc6
sudo port select --set gcc mp-gcc6
sudo port install OpenBLAS +gcc6

Then, make a minor change in setup.py if necessary. In gcc on Mac installed by Macport, I encounter compile error caused by openmp related option. So, I removed before compile

extra_compile_args = [ ]
if cc == 'gcc' or cc is None:
    lib_omp = ''
python setup.py build
pip install -e .

In Linux, it is better to make setup_mkl.py and use intel MKL to avoid compile error.

hdnnpy-phonopy-interface's People

Contributors

eminamitani avatar

Stargazers

Liangting avatar

Watchers

James Cloos avatar masayoshi.ogura avatar

Forkers

s-okugawa

hdnnpy-phonopy-interface's Issues

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.