Skip to content

Lkangming/pysotropy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

python interface to isotropy

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%