Giter Site home page Giter Site logo

pysotropy's Introduction

Python Interface to ISOTROPY for linux

Preform the various tasks possible with the excellent ISOTROPY tool in an automated fashion using python.

The software can preform various tasks applying group theoretical methods to the analysis of crystalline solids.

If you use this tool in publishing a paper you should cite:

H. T. Stokes, D. M. Hatch, and B. J. Campbell, ISOTROPY Software Suite, iso.byu.edu.

I am not affiliated with the ISOTROPY authors, but their tool is being used “under the hood” and they should be credited appropriately.

Obtain the ISOTROPY for linux executable here.

After downloading and extracting the iso.zip file either place the iso directory inside the pysotropy directory (where the pysotropy.py and pysodistort.py files are) or create a symlink of the name iso to whereever it is you wish to keep your isotropy for linux executable.

pysotropy

As a simple wrapper

When used as a simple wrapper commands can be passed to the isotropy program and results are parsed in to a list of python dictionaries.

This requires some knowledge of how to use the command line tool itself, but is the basis for how other functionality is built.

Simple example:

obtain the irrep and direction involved in a distortion which changes the space group from 221 to 99.

import pysotropy as iso

values = {'parent': 221, 'subgroup': 99}
shows = ['irrep', 'direction vector']
with iso.IsotropySession(values, shows) as isos:
    irreps = isos.getDisplayData('ISOTROPY')
print('Irrep: {}'.format(irreps[0]['Irrep']))
print('Direction: {}'.format(irreps[0]['Dir']))
Irrep: GM4-
Direction: ['P1', ['a', '0', '0']]

convenient functions

from prettytable import PrettyTable
import pysotropy as iso
distortion = iso.getDistortion(parent=221, wyckoffs=['a', 'b', 'c'], irrep='R4-', direction='P1')

for wyckoff in distortion:
    print('Wyckoff: {}'.format(wyckoff['Wyckoff']))
    pt = PrettyTable()
    pt.add_column('Point', wyckoff['Point'])
    pt.add_column('Displacement Vector', wyckoff['Projected Vectors'])
    print(pt)
Wyckoff: a
+-----------------+---------------------+
|      Point      | Displacement Vector |
+-----------------+---------------------+
| ['0', '0', '0'] |   ['0', '0', '1']   |
| ['0', '0', '1'] |   ['0', '0', '-1']  |
+-----------------+---------------------+
Wyckoff: c
+---------------------+---------------------+
|        Point        | Displacement Vector |
+---------------------+---------------------+
| ['0', '1/2', '1/2'] |   ['0', '2', '0']   |
| ['0', '1/2', '3/2'] |   ['0', '-2', '0']  |
| ['1/2', '1/2', '0'] |   ['0', '0', '0']   |
| ['1/2', '1/2', '1'] |   ['0', '0', '0']   |
| ['1/2', '0', '1/2'] |   ['2', '0', '0']   |
| ['1/2', '0', '3/2'] |   ['-2', '0', '0']  |
+---------------------+---------------------+

pysodistort

Preform the tasks of the isodistort online tool using pymatgen structure objects, including mode decomposition of the distortion between a high symmetry and low symmetry crystal.

Very much a work in progress, but has been useful to me already.

Simple (artificial) example on finding modes of a distorted perovskite:

import numpy as np
import pymatgen as pmg
from pysotropy import pysodistort as psd

cubic_structure = pmg.Structure(pmg.Lattice.cubic(4.0), species=['Sr', 'Ti', 'O', 'O', 'O'],
                            coords=[[0., 0., 0.],
                                    [0.5, 0.5, 0.5],
                                    [0.5, 0.5, 0.],
                                    [0.5, 0., 0.5],
                                    [0., 0.5, 0.5]])

distorted_structure = pmg.Structure(pmg.Lattice.tetragonal(4.0, 8.0),
                                    species=['Sr', 'Sr', 'Ti', 'Ti', 'O', 'O', 'O', 'O', 'O', 'O'],
                                    coords=[[0., 0., 0.],
                                            [0.0, 0.0, 0.5],
                                            [0.5, 0.5, 0.2],
                                            [0.5, 0.5, 0.8],
                                            [0.5, 0.5, 0.],
                                            [0.5, 0.5, 0.5],
                                            [0.5, 0., 0.28],
                                            [0.5, 0., 0.72],
                                            [0., 0.5, 0.28],
                                            [0., 0.5, 0.72]])
distortion = psd.get_mode_decomposition(cubic_structure, distorted_structure, nonzero_only=True)
print("Mode Definitions:")
for irrep, wycks in distortion.items():
    print(irrep)
    for wyck, data in wycks.items():
        print("\t{}".format(wyck))
        print("\t\t{}".format(data["direction"]))
        print("\t\t{}".format(data["dist_defs"]))
print("Mode Amplitudes")
for irrep, wycks in distortion.items():
    print(irrep)
    for wyck, data in wycks.items():
        print('\t{}'.format(wyck))
        print('\t\t{}'.format(data["direction"]))
        print('\t\t{}'.format(np.round_(data["amplitudes"], decimals=5)))
Mode Definitions:
X1+
	b0
		('P1', ['0', '0', 'a'])
		Full Formula (Ti2)
Reduced Formula: Ti
abc   :   4.000000   4.000000   8.000000
angles:  90.000000  90.000000  90.000000
Sites (2)
  #  SP      a    b     c  projvecs
---  ----  ---  ---  ----  ---------------
  0  Ti    0.5  0.5  0.25  [[0. 0. 1.]]
  1  Ti    0.5  0.5  0.75  [[ 0.  0. -1.]]
	c1
		('P1', ['0', '0', 'a'])
		Full Formula (O6)
Reduced Formula: O2
abc   :   4.000000   4.000000   8.000000
angles:  90.000000  90.000000  90.000000
Sites (6)
  #  SP      a    b     c  projvecs
---  ----  ---  ---  ----  ---------------
  0  O     0    0.5  0.25  [[0. 0. 1.]]
  1  O     0    0.5  0.75  [[ 0.  0. -1.]]
  2  O     0.5  0.5  0     [[0. 0. 0.]]
  3  O     0.5  0.5  0.5   [[0. 0. 0.]]
  4  O     0.5  0    0.25  [[0. 0. 1.]]
  5  O     0.5  0    0.75  [[ 0.  0. -1.]]
Mode Amplitudes
X1+
	b0
		('P1', ['0', '0', 'a'])
		[0.56569]
	c1
		('P1', ['0', '0', 'a'])
		[-0.48]

pysotropy's People

Contributors

guymoore13 avatar jrbp 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.