GithubHelp home page GithubHelp logo

tomuhama / shc-python-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ksaaskil/shc-python-tools

0.0 0.0 0.0 1.79 MB

Python tools for calculating the spectral heat current distribution from LAMMPS NEMD simulations

License: GNU General Public License v3.0

Python 91.99% C++ 7.69% Makefile 0.32%

shc-python-tools's Introduction

Spectral heat current Python tools

This repository contains Python tools for calculating the spectral heat current from the data produced by non-equilibrium molecular dynamics simulation with LAMMPS software. The relevant theory was published in:

  1. K. Sääskilahti, J. Oksanen, J. Tulkki, and S. Volz, Phys. Rev. B 90, 134312 (2014)
  2. K. Sääskilahti, J. Oksanen, S. Volz, and J. Tulkki, Phys. Rev. B 91, 115426 (2015)

These codes are meant to help anyone interested in implementing the spectral heat current calculations for their own applications. If you want to use the codes for research purposes, please cite the above-mentioned publications and let me know.

See detailed API documentation in readthedocs.io.

Contents

The actual library for computing spectral heat current distributions is found in the sdhc folder. It contains:

  • SHCPostProc.py: Python class for performing the post-processing
  • calcFC.py: Class for calculating the force constants (note that the definition of the "left" and "right" interfaces must be the same in the NEMD simulation and in the calculation of the force constants)
  • compactify_vels.cpp: C++ script for formatting the LAMMPS's dump velocity file into a more easily readable column file. The program can be compiled by running make in shc-tools folder (if g++ is found, otherwise modify Makefile such that appropriate compiler is defined in variable CC).

In addition, the root directory contains the script calcSHC.py demonstrating how the post-processing class is used and how the data could be saved to file.

Usage

Ensure that sdhc is found in your PYTHONPATH and do

from sdhc import SHCPostProc
import numpy as np

postprocessor = SHCPostProc(*args, **kwargs)
postprocessor.postProcess()

# Save frequencies and smoothened spectral heat currents as NumPy files
np.save('angular_frequencies.npy', postprocessor.oms_fft)
np.save('heat_currents.npy', postprocessor.SHC_smooth)

# Save the frequencies and smoothened spectral heat currents to text file
np.savetxt('frequencies_and_currents.txt', np.column_stack((oms, postprocessor.SHC_smooth)))

See the example below for the arguments required by SHCPostProc.

Example

Folder example contains a self-contained example for calculating the spectral heat current flowing across a slab of amorphous Si. The script to be run is called silicon_example.py. It performs the following steps:

  1. prepare a box of atoms,
  2. call LAMMPS to perform the quenching procedure contained in LAMMPS input file quench_Si.lmp,
  3. call LAMMPS to perform the actual NEMD calculation for a-Si using amorphous_interface.lmp, and
  4. perform the post-processing using shc-tools

Prerequisites

  • Using LAMMPS from Python requires that you have built LAMMPS as a dynamically shared library as instructed in the LAMMPS manual
  • You need to build compactify_vels.cpp in scripts folder and have that available in your $PATH.
  • Simulation uses the sw pair style, which is included in the MANYBODY package. See here how to include packages in your LAMMPS build.
  • You need to have numpy installed.

TODO

  • Documentation for calcSHC.py
  • Documentation for the example
  • Preparation of visualization files
  • Documentation for fcCalc.py

shc-python-tools's People

Contributors

ksaaskil avatar tomuhama 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.