Coder Social home page Coder Social logo

foresighter007 / vaspy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pytlab/vaspy

0.0 0.0 0.0 21.59 MB

Manipulating VASP files with Python.

Home Page: https://pypi.python.org/pypi/vaspy/

License: MIT License

Python 89.36% Shell 1.05% Arc 9.59%

vaspy's Introduction

VASPy

Build Status

Code Health

image

platform

versions

Introduction

VASPy is a pure Python library designed to make it easy and quick to manipulate VASP files.

You can use VASPy to manipulate VASP files in command lins or write your own python scripts to process VASP files and visualize VASP data.

In /scripts , there are some scripts written by me for daily use.

More interfaces examples in Jupyter Notebook format are in /examples. Any contribution is welcomed!

Installation

  1. Via pip(recommend):

    pip install vaspy
  2. Via easy_install:

    easy_install vaspy
  3. From source:

    python setup.py install

If you want to use mayavi to visualize VASP data, it is recommened to install Canopy environment on your device instead of installing it manually.

After installing canopy, you can set corresponding aliases, for example:

alias canopy='/Users/<yourname>/Library/Enthought/Canopy/edm/envs/User/bin/python'
alias canopy-pip='/Users/<yourname>/Library/Enthought/Canopy/edm/envs/User/bin/pip'
alias canopy-ipython='/Users/<yourname>/Library/Enthought/Canopy/edm/envs/User/bin/ipython'
alias canopy-jupyter='/Users/<yourname>/Library/Enthought/Canopy/edm/envs/User/bin/jupyter'

Then you can install VASPy to canopy:

canopy-pip install vaspy

Examples

manipulate splited DOS file in command-line

# Manipulate splited DOS files.
>>> from vaspy.electro import DosX
>>> a = DosX('DOS1')
>>> b = DosX('DOS8')

# Merge DOS data.
>>> c = a
>>> c.reset_data()              # Initialize DOS data
>>> for i in range(1, 10):
>>>    c += DosX('DOS'+str(i))  # Merge DOS data.
>>> ...
>>> c.data                      # Get data(numpy array/matrix)
>>> c.tofile()                  # Get new DOS file with merged data

# Plot.
>>> c.plotsum(0, (5, 10))

Output

image

Visualize ELFCAR

>>> from vaspy.electro import ElfCar
>>> a = ElfCar() 
>>> a.plot_contour()   # Plot coutour
>>> a.plot_mcontour()  # Plot coutour using mlab(with Mayavi installed)
>>> a.plot_contour3d() # Plot 3D coutour
>>> a.plot_field()     # Plot scalar field

Output

image

image

3D contour

image

Scalar field

image

Charge difference (Use ChgCar class)

image

Manipulate XDATCAR:

>>> from vaspy.atomco import XdatCar
>>> xdatcar = XdatCar()
>>> # Get Cartisan coordinates and step number in XDATCAR.
>>> for item in xdatcar:
>>>     print(item.step)
>>>     print(xdatcar.dir2cart(xdatcar.bases, item.coordinates))

>>> python xdatcar_to_arc.py

animation

image

Process animation file:

Now VASPy can manipulate animation files to get more realistice results like atom trajectories or 2D/3D probability distribution.

image

You can write your OWN script to process VASP files

From the author

Welcome to use VASPy (●'◡'●)ノ♥

  • If you find any bug, please report it to me by opening a issue.
  • VASPy needs to be improved, your contribution will be welcomed.

Important update log

Date Version Description
2016-08-08 0.7.0 Enhance universality
2016-07-15 0.6.0 Compatible with python 3
2015-08-04 0.1.0 Initial version

vaspy's People

Contributors

pytlab 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.