esta.general package
Contents
esta.general package#
Submodules#
esta.general.aadhaar module#
aadhaar class is a base class to read/write and process information related to atoms and lattice information such as atoms coord, atom labels, and types, cell vectors, and so on!!
It reads xyz file or poscar file (not yet completely done .. rather can be done using vaspBag crystal_latticee class
It writes poscar file from cell parameters and xyz file data xyz file/s or xyz file with frozen and notfrozen atoms
- class esta.general.aadhaar.Aadhaar#
Bases:
object
aadhaar class for atomic structure related information handling.
- get_all_xyz_in_a_file(atomic_position, atomic_label, name_outfile=None, comment=None)#
create single XYZ file for all xyz strcutures given the atomic positions and atomic labels. Note that the similar atoms (identical symbols) are grouped together.
- get_all_xyz_in_a_file_(atomic_position, atomic_label, energy=None, name_outfile=None, comment=None)#
create single XYZ file for all xyz strcutures given the atomic positions and atomic labels and energies.
Note
The similar atoms (identical symbols) are grouped together.
- get_com_oniom(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_outfile=None, **kwargs)#
add description here for input oniom ..
create XYZ file from the atomic positions, atomic labels, and integers representing atoms in the high level layer (iatm_high_level) for Oniom software. Atoms in high level layer are indexed with integers starting from 1, not from 0.
Note
link_lowhigh_level_atoms is optionalm but it should have entries like this [[4,3],[15,3],[20,3] ] –> meaning that low levels atoms are 4,15,20 –> link to high level atom 3
other input files (6 in number; total of 7 files needed to execute the oniom calculations) needed should be –> MoH.inp, MoL.inp, ReL.inp, OniomGRRM, Ownoniom.tcsh, Ownoniom.out (check the names again sk!!)
- ..note::
move these methods to grrmBag for clarity
- get_com_oniom_frozen(frozen_tuple, not_frozan_tuple, iatm_high_level, link_lowhigh_level_atoms, name_outfile=None, **kwargs)#
create oniom input file with frozen atoms for MIN calculations (default)
The high level layer (iatm_high_level) for Oniom software. Atoms in high level layer are indexed with integers starting from 1, not from 0.
Note
link_lowhigh_level_atoms is optionalm but it should have entries like this [[4,3],[15,3],[20,3] ] –> meaning that low levels atoms are 4,15,20 –> link to high level atom 3
other input files (6 in number; total of 7 files needed to execute the oniom calculations) needed should be –> MoH.inp, MoL.inp, ReL.inp, OniomGRRM, Ownoniom.tcsh, Ownoniom.out (check the names again sk!!)
- ..note::
move these methods to grrmBag for clarity
- get_com_oniom_min(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_outfile=None, **kwargs)#
add description here for input oniom ..
create XYZ file from the atomic positions, atomic labels, and integers representing atoms in the high level layer (iatm_high_level) for Oniom software. Atoms in high level layer are indexed with integers starting from 1, not from 0.
Note
link_lowhigh_level_atoms is optionalm but it should have entries like this [[4,3],[15,3],[20,3] ] –> meaning that low levels atoms are 4,15,20 –> link to high level atom 3
other input files (6 in number; total of 7 files needed to execute the oniom calculations) needed should be –> MoH.inp, MoL.inp, ReL.inp, OniomGRRM, Ownoniom.tcsh, Ownoniom.out (check the names again sk!!)
- ..note::
move these methods to grrmBag for clarity
- get_poscar(cell_parameter, pos, label, name_outfile=None)#
create POSCAR file given the cell_parameters, atomic postions, and atom labels. Optionally the name of output POSCAR can be provided. When dealing with mutliple POSCAR file, better to provide the name of the output POSCAR file.
- get_xyz_file(atomic_position, atomic_label, name_outfile=None)#
create XYZ file from the atomic positions and atomic labels.
- get_xyz_frozen(frozen_tuple, not_frozan_tuple, name_outfile=None)#
get xyz data with frozan and not frozen atoms in the output file.
- Parameters
frozen_tuple (tuple) – tuple containg fixed atomic_positins, atomic_symbols, and atom index
not_frozen_tuple (tuple) – tuple containg not fixed atomic_positins, atomic_symbols, and atom index
name_outfile (str, optional) – name of the output file
- Returns
name of xyz_frozen_file – create ‘xyz_FROZEN’ type file containing information of frozen and not frozen atoms etc
- Return type
str
- get_xyz_grouped(atomic_position, atomic_label, name_outfile=None)#
create XYZ file from the atomic positions and atomic labels. Note that the similar atoms (identical symbols) are grouped together.
- get_xyz_oniom_file(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_outfile=None)#
create XYZ file from the atomic positions, atomic labels, and integers representing atoms in the high level layer (iatm_high_level) for Oniom software. Atoms in high level layer are indexed with integers starting from 1, not from 0.
Note
link_lowhigh_level_atoms is optionalm but it should have entries like this [[4,3],[15,3],[20,3] ] –> meaning that low levels atoms are 4,15,20 –> link to high level atom 3
more to do later!!
- read_xyz(xyzfile)#
- Parameters
string (str) – name of xyz file, xyzfile
- Returns
array (array of rank 2 with shape (natoms, 3)) – atomic positions
list (list of strs) – list of atomic labels, rank 1 array of atomic labels
- read_xyz_all(xyzfile)#
read xyz data in get all xyz file by reading the atomic positions and atomic labels.
- Parameters
string (str) – name of xyz file containgin many xyz data structures
- Returns
array (array of rank 3 with shape (nstrs, natoms, 3)) – atomic positions
list (a list of strings) – strings/symbols for the atomic labels
- write_xyz_all_separate(xyzfile, comment=None)#
write xyz_all data into separate xyz files
esta.general.add_const_to_dict module#
esta.general.add_vacuum_to_unit_cell module#
- esta.general.add_vacuum_to_unit_cell.add_vacuum(LV1, LV2, LV3, vacuum)#
Add vacuum layer along LV3
- Parameters
LV1 (array) – lattice vec 1
LV2 (array) – lattice vec 2
LV3 (array) – lattice vec 3
vacuum (float) – The thickness of the vacuum in Ang
- Returns
uc – unit cell with vaccumm along the uc[2] vector
- Return type
array of shape(3,3)
Note
in future LV1,LV2,LV3 may be taekn in the form of a cell matrix with each row representing LV1, LV2, and LV3
vacuum in all directions can be added … just pass the axis(LV1..2..3) in a loop to this method
esta.general.affine module#
Linear algebra operations and helpers.
Taken from the link (scikit-ued: https://github.com/LaurentRDC/scikit-ued/)
Inspired by Christoph Gohlke’s transformation.py (link: <http://www.lfd.uci.edu/~gohlke/> )
- esta.general.affine.affine_map(array)#
Extends 3x3 transform matrices to 4x4, i.e. general affine transforms.
- Parameters
array (ndarray, shape {(3,3), (4,4)}) – Transformation matrix. If shape = (4,4), returned intact.
- Returns
extended – Extended array
:raises ValueError : If the transformation matrix is neither 3x3 or 4x4:
- Return type
ndarray, shape (4,4)
- esta.general.affine.change_basis_mesh(xx, yy, zz, basis1, basis2)#
Changes the basis of meshgrid arrays.
- Parameters
xx (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
yy (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
zz (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
basis1 (list of ndarrays, shape(3,)) – Basis of the mesh
basis2 (list of ndarrays, shape(3,)) – Basis in which to express the mesh
- Returns
XX, YY, ZZ
- Return type
~numpy.ndarray
- esta.general.affine.change_of_basis(basis1, basis2=(array([1.0, 0.0, 0.0]), array([0.0, 1.0, 0.0]), array([0.0, 0.0, 1.0])))#
Returns the matrix that goes from one basis to the other.
- Parameters
basis1 (list of array_like, shape (3,)) – First basis
basis2 (list of array_like, shape (3,), optional) – Second basis. By default, this is the standard basis
- Returns
cob – Change-of-basis matrix that, applied to basis, will return basis2.
- Return type
~numpy.ndarray, shape (3,3)
- esta.general.affine.is_basis(basis)#
Returns true if the set of vectors forms a basis. This is done by checking whether basis vectors are independent via an eigenvalue calculation.
- Parameters
basis (list of array-like, shape (3,)) –
- Returns
out – Whether or not the basis is valid.
- Return type
bool
- esta.general.affine.is_rotation_matrix(matrix)#
Checks whether a matrix is orthogonal with unit determinant (1 or -1), properties of rotation matrices.
- Parameters
matrix (ndarray, shape {(3,3), (4,4)}) – Rotation matrix candidate. If (4,4) matrix is provided, only the top-left block matrix of (3,) is checked
- Returns
result – If True, input could be a rotation matrix.
- Return type
bool
- esta.general.affine.minimum_image_distance(xx, yy, zz, lattice)#
Returns a periodic array according to the minimum image convention.
- Parameters
xx (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
yy (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
zz (ndarrays) – Arrays of equal shape, such as produced by numpy.meshgrid.
lattice (list of ndarrays, shape(3,)) – Basis of the mesh
- Returns
r – Minimum image distance over the lattice
- Return type
~numpy.ndarray
- esta.general.affine.rotation_matrix(angle, axis=(0, 0, 1))#
Return matrix to rotate about axis defined by direction around the origin [0,0,0]. To combine rotation and translations, see http://www.euclideanspace.com/maths/geometry/affine/matrix4x4/index.htm
- Parameters
angle (float) – Rotation angle [rad]
axis (array-like of length 3) – Axis about which to rotate
- Returns
matrix – Rotation matrix.
- Return type
~numpy.ndarray, shape (3,3)
See also
- esta.general.affine.transform(matrix, array)#
Applies a matrix transform on an array.
- Parameters
matrix (ndarray, shape {(3,3), (4,4)}) – Transformation matrix.
array (ndarray, shape {(3,), (3,3), (4,4)}) – Array to be transformed. Either a 1x3 vector, or a transformation matrix in 3x3 or 4x4 shape.
- Returns
transformed – Transformed array, either a 1D vector or a 4x4 transformation matrix
:raises ValueError : If the transformation matrix is neither 3x3 or 4x4:
- Return type
ndarray
- esta.general.affine.translation_matrix(direction)#
Return matrix to translate by direction vector.
- Parameters
direction (array_like, shape (3,)) –
- Returns
translation – 4x4 translation matrix.
- Return type
~numpy.ndarray, shape (4,4)
- esta.general.affine.translation_rotation_matrix(angle, axis, translation)#
Returns a 4x4 matrix that includes a rotation and a translation.
- Parameters
angle (float) – Rotation angle [rad]
axis (array-like of length 3) – Axis about which to rotate
translation (array_like, shape (3,)) – Translation vector
- Returns
matrix – Affine transform matrix.
- Return type
~numpy.ndarray, shape (4,4)
esta.general.atomic_Distance_Density module#
esta.general.average module#
esta.general.b module#
convert poscar file to xyz file
- esta.general.b.get_qe_input(posfile, ps_info, lprint_cell=None)#
generate qe input file using poscar and other input parameters
esta.general.bending_nanoribbon module#
- esta.general.bending_nanoribbon.get_bent_structure(angle_degree)#
get a bent POSCAR structure from the POSCAR file present in the current directory.
- Parameters
angle_degree (scalar) – angle for bending in degree
- Returns
filename (str) – filename containg data for bent str in POSCAR format
..note:: – read related information etc from other folder ..for bending
..warning:: – MOST important: perfect periodicity MUST be there for atomic postions …. see if all the attoms are repeated in all dire using vesta ….. if some are repeated and others are not .. then that means that bending will lead to wrong bent poscar files …..wasted lot of time findfing this out ..SK!! … add vac in a dire in 150 and 180 deg ..
Date: 2020
Author: sonu kumar
Email: sonukumar.physics@gmail.com
esta.general.boltzmann module#
Find Boltzman distribution of the states based on their energies
- esta.general.boltzmann.boltzmann_dist(energies, temp=None)#
- Parameters
energies (array) – energis in kjmol-1
temp (scalar, optional) – temperature in K Default values is room temp = 298 K
- Returns
conc (array) – concentration or distribution of energy states
.. note:: – units conversion from JK-1 to kcal mol-1 for the 1/k factor in exponetial:
- JK-1 –> (1/1000) KJ K-1 –> (1/1000 * avogadro_number) kJ K-1 mol-1
cf.kb/1000 * 1/cf.calorie2joule * cf.N_A <– kcal mol-1
- esta.general.boltzmann.boltzmann_dist_(energies, temp=None)#
energies in kcal mol-1 temp in K; if none then room temp = 298 K
- esta.general.boltzmann.boltzmann_factor(energies, temp=None)#
- Parameters
energies (array) – energis in kjmol-1
temp (scalar, optional) – temperature in K Default values is room temp = 298 K
- Returns
conc – boltzmann factor from the boltzmann distribution
- Return type
array
Note
units conversion from JK-1 to kcal mol-1 for the 1/k factor in exponetial:
- JK-1 –> (1/1000) KJ K-1 –> (1/1000 * avogadro_number) kJ K-1 mol-1
cf.kb/1000 * 1/cf.calorie2joule * cf.N_A <– kcal mol-1
esta.general.cartAndSpherical module#
- esta.general.cartAndSpherical.to_cartesian(rthetaphi)#
- esta.general.cartAndSpherical.to_spherical(xyz)#
esta.general.charge_bader module#
esta.general.compare_scalar module#
- esta.general.compare_scalar.max_scalarlist(sequence_list)#
return the max element from scalar elements of a list
- esta.general.compare_scalar.min_scalarlist(sequence_list)#
return the minimum element from scalar elements of a list
esta.general.conjugate_gradient module#
esta.general.conversion_factors module#
library to get conversion factor to convert quantities from once to another
get commanly use physical constants in physical and chemical sciences
NOTE: ii —> means –> inverse
Author: S. Kumar, email: sonukumar.physics@gmail.com
- esta.general.conversion_factors.double(value)#
esta.general.crystal_latticee module#
Crystal lattice class to define lattice parameters and basis crystal = lattice + basis (atoms or molecules )
Author: Sonu Kumar
Email: sonukumar.physics@gmail.com
Date: April, 2017, 2019, 2020
adapted from —-> vaspBag/crystal_lattice.py
- class esta.general.crystal_latticee.CrystalLattice(filename, location)#
Bases:
object
Crystal lattice class to define lattice parameters and basis crystal = lattice + basis (atoms or molecules )
- get_all_atoms_labels()#
by reading POSCAR, find the atomic labels of the atoms and total no of atoms
- Parameters
file (poscar) – POSCAR file in current dir.
- Returns
atomic labels (list of strings of atomic lebels of all atoms according to the numbering of atoms in POSCAR file) – list of strings of atomic lebels of all atoms according to the numbering of atoms in POSCAR file
no. of atoms (integer) – total number of atoms in the POSCAR file
sequence of numbers (scalars) – seq of numbers starting from 1 to ntotal for all atoms (e.g. 1 1 1 2 3 4 4 .. )
author: sk
email: sonukumar.physics@gmail.com
- get_poscar()#
get poscar file variables:
- Parameters
POSCAR (str) – file name
- Returns
if l_SelectDynamics – return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natom_type, self.natoms, self.atomFix, self.atomMove
else – return self.tau_cartesian, self.real_volume, self.LV1, self.LV2, self.LV3,self.atm_type, self.natom_type, self.natoms
- reciprocal_lattice()#
method to calculate the reciprocal lattice vectors
- Parameters
vectors (real space lattice) –
- Returns
reciprocal space lattice vectors
- Return type
b1, b2, b3
Notes
a factor of 2pi is included in b1, b2, and b3
esta.general.direction_index2str module#
- esta.general.direction_index2str.direction_indx_to_str(direction_indices)#
simple way to change direction indices to strings
e.g.
[1,0,0] –> [‘x’, ‘0’, ‘0’] [1,0,1] –> [‘x’, ‘0’, ‘z’] [1,1,1] –> [‘x’, ‘y’, ‘z’] … …
esta.general.distance_matrix_PBC module#
- esta.general.distance_matrix_PBC.distance_atom_pairs(filename=None)#
find distance between atom pairs given poscar data file
- Parameters
filename (str) – name of the poscar file
- Returns
dist – distance matrix or rank 2 tensor or rank2 array
- Return type
ndarry
- BEtter see … stefano curtalo paper on lattice and space gps ..GOOD..SK!!
… on other molecular dynamics book .. ??
- see basics of min imgae conventions … paper of
Efficient Coding of the Minimum Image Convention By Ulrich K. Deiters ∗ Institute of Physical Chemistry, University of Cologne, Luxemburger Str. 116, 50939 Köln, Germany
esta.general.distances_ase_esa module#
- esta.general.distances_ase_esa.distances_pbc_ase(pos1, pos2=None, cell=None, pbc=None, lprint_dist=None)#
get the distance among atoms using MIC …. using ASE geometry class .. for testing with own implementation ..sk!!
- pos1: 3d array
atomic positions of shape(natoms, 3)
- pos2: 3d array
atomic position of shape (natoms, 3)
- cell: 3x3 array or matrix
lattice parameters in the c format e.g. cell = np.array ([lv1],
[lv2], [lv3]])
- which is equivalent to
- np.array ( [[1,0,1],
[0,1,0], [0,0,1]])
pbc: use periodic boundary condtion, set to True by default
- lprint_dist: logical (True/False), optional
to print distance among atoms
dist_vectors: (natoms, natoms, 3) dim array for distance among all atoms along x, y, and z. dist_len : (natoms, natoms) dim matrix or array for distances among all atoms
esta.general.entropy_data module#
List of experimental Entropies of some molecules at 298.15 K
esta.general.filter_vib_freq module#
- esta.general.filter_vib_freq.filter_vib_freq(vib_freq, freq_val=None)#
filter the vib freq:
vib_freq: 1D array of freqs in eV freq_val: scalar;
if none, then freqs <= 50 cm-1 are shifted to 50 cm-1
list of filtered vibrational freqs (close to zero or -ve values replaced by constant value “freq_val” or default 50 cm-1 value)
Note: all values less than 50 cm-1 are replaced by 50 cm-1 if freq_val is None
Note: 50 cm-1 in ev is eq to 0.00619 eV
esta.general.finding_vacuum_region2 module#
esta.general.free_energy_ethane module#
esta.general.from_pos2xyz module#
convert poscar file to xyz file
- esta.general.from_pos2xyz.pos2xyz(posfile)#
convert input poscar file to xyz file
esta.general.get_ACF_bader module#
esta.general.get_com module#
- esta.general.get_com.com(array, label)#
method to find the centre of mass of atomic array
- input: atomic array with atomic symbols (some xyz
files contain atomic numbers, which is not yet implemented-todo-sk!)
return: an array/vector representing the center of mass
- esta.general.get_com.com_slightly_slow(array, label)#
method to find the centre of mass of atomic array
- input: atomic array with atomic symbols (some xyz
files contain atomic numbers, which is not yet implemented-todo-sk!)
return: an array/vector representing the center of mass
esta.general.get_configs module#
Generate atomic configurations between initial and final atomic positions
- esta.general.get_configs.get_atomic_configurations(N, atompositions, atompositions2)#
generate points between a set of two points in N-D space
- Note: initial position in ‘atompositions’
and final positions in ‘atompositions2’ N : will give no. of images between these positions
- esta.general.get_configs.get_poscar_images(N, poscar_obj, poscar_obj2)#
write a function that can generate poscar files, given - atomic positions in cartesian coordinates - lattice parameteres - types of atoms - atom symbols - atoms of each type
- esta.general.get_configs.mass_weighted_distance()#
find mass weighted distance between generalised coordinates
NOTE: from periodic import element atm = element(‘H’) #element_mass(“H” print e atm.mass a = element(label[k]) print a.mass
- Note: use mendeleev
from mendeleev import element element(label[i]).mass
esta.general.get_configs_btw2strs module#
Generate atomic configurations between initial and final atomic positions
- esta.general.get_configs_btw2strs.get_atomic_configurations(N, atompositions, atompositions2)#
generate points between a set of two points in N-D space
- Note: initial position in ‘atompositions’
and final positions in ‘atompositions2’ N : will give no. of images between these positions
- esta.general.get_configs_btw2strs.get_poscar_images(N, poscar_obj, poscar_obj2)#
write a function that can generate poscar files, given - atomic positions in cartesian coordinates - lattice parameteres - types of atoms - atom symbols - atoms of each type
- esta.general.get_configs_btw2strs.mass_weighted_distance()#
find mass weighted distance between generalised coordinates
NOTE: from periodic import element atm = element(‘H’) #element_mass(“H” print e atm.mass a = element(label[k]) print a.mass
- Note: use mendeleev
from mendeleev import element element(label[i]).mass
esta.general.get_labelling_atoms module#
- esta.general.get_labelling_atoms.get_all_atoms_lebels(ffile)#
by reading POSCAR, find the atomic labels of the atoms and total no of atoms
input: POSCAR file in current dir.
- output:
list of strings of atomic lebels of all atoms according to the numbering of atoms in
POSCAR file - integer for total number of atoms in the POSCAR file
author: sk email: sonukumar.physics@gmail.com
esta.general.get_moved_atom_n_symb module#
- esta.general.get_moved_atom_n_symb.get_moved_atoms_and_symbols(filename=None)#
get symbols and atomic coord of moved atoms
esta.general.get_poscar_from_cxyz module#
esta.general.get_range_from_intervals module#
- esta.general.get_range_from_intervals.get_range_int_from_intervals(list_of_intervals)#
get range of integers from intervals
- Parameters
list_of_intervals (list of strings) – list of string of intervals, e.g. [‘1’,’2-4’,’6-10’]
- Returns
elem – range of integers specifying the intervals, e.g. [1, 2, 3, 4, 6, 7, 8, 9, 10]
- Return type
range of integers
esta.general.get_rotation_matrix module#
- esta.general.get_rotation_matrix.rotation_matrix(axis, theta_degree)#
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta degree.
- Parameters
axis (list) – axis around which to rotate.
theta_degree (float) – angle in degree by which to rotate
esta.general.integration1D_over_a_cutoff module#
- esta.general.integration1D_over_a_cutoff.get_integrated_electrons(y, x, x_cutoff=0.01)#
integrate the 1d curve (e.g. dos ) over an energy range with some energy cutoff (usuall Fermi energy) to get no of eletrons contained in that curve
- input:
array: y array: x, of same length as that of y float: x_cutoff, default = 1e-2
- output:
float; electron; electron count wrt cutoff over x range (NOTE: it is fractional) float; electron_all; electron count over all x range
esta.general.list_grouped_and_unique module#
- esta.general.list_grouped_and_unique.get_grouped_list(llist)#
get same string elements of list grouped together
- esta.general.list_grouped_and_unique.get_unique_list(inp)#
get unique elements of list
esta.general.manipulate module#
class for the mainipulation of atoms present in xyz file or poscar type files
Author: skumar email: sonukumar.physics@gmail.com
- class esta.general.manipulate.AtomicStructure(*kwarg)#
Bases:
object
- class esta.general.manipulate.Manipulate(atomic_positions, atomic_labels=None)#
Bases:
object
class to mainipulateatoms present in xyz file or poscar type files
Note
there is shift.py file … add shift class in this file and then
use it as a superclass for the manipulate_structure class …TODO sk!!
- centroid(array)#
find centroid from the shift.py
- delete_atomic_strs(step=None)#
delete atomic strs/points along an arrangement of pts in an array of shape(n, nat, 3) by a step/stride (default=2). n is no. of atomic-sts/points of shape(nat,3), nat is the no. of atoms in each set.
- delete_atoms(delete_list)#
delete atoms from atomic positions array
- Parameters
atomic_positions (array) – atomic positions in xyz file or poscar file
delete_list (list) – list of atoms
- Returns
atomic_position_new – new atomic positions after deletion of some atoms
- Return type
array
- extract_atomic_strs(id_atm_strs=None)#
- extract_atomic_strs_(id_strs=None)#
- extract atomic strs/points along an arrangement of pts in an array
of shape(n, nat, 3) by specifying the list of atomic strs to be extracted. Here n is no. of atomic-sts/points of shape(nat,3), nat is the no. of atoms in each set.
Note
id_atm_strs must be a list; for example: id_atm_strs = [1,2,3,4,7,810,100,123,1932] for last strs: id_strs=[‘-1’]
- freeze_atoms(frozen_atm_indx)#
collect atoms in freeze atoms list by placing them in Frozen block from the xyz file
- Parameters
frozen_atm_indx (list) – list of integers specifying the atom numbers to be fixed, numbering starts from 1 … max of the no. of atoms
- Returns
pos_frozen and pos_not_frozen (tuple) – tuple containing pos_frozen, an array containing fixed atoms and pos_not_frozen, an arrary containing atoms not fixed
frozen_atm_indx and not_frozen_atm_indx (tuple) – frozen_atm_indx: list of integers specifying the atom numbers to be fixed and not_frozen_atm_indx: list of integers specifying the atom numbers not to be fixed.
Note
Works only for rank 2 array of atomic position only. For rank 3 .. easy to implement!!
- get_atm_indices_constraint(frozen_atm_indices=None, not_frozen_atm_indices=None)#
- Parameters
frozen_atm_indices (list of integers, optional) – a list of integers specifying the atom numbers to be fixed; Numbering from 0 .. #natoms: total number of atoms in the xyz file or poscar type file
not_frozen_atm_indices (list of integers, optional) – a list of integers for not fixed atoms
- Returns
frozen_atm_indices (list of integers) – integers for fixed atoms
not_frozen_atm_indices (list of intergers) – integers specifying the atoms numbers NOT to be fixed; Numbering from 0 ..
Note
numbering of atoms must be from 1. And only frozen or not frozen atoms list must be given. Similary output is only integers for not frozen or frozen atoms and vice-versa. One at a time for parameters/returns.
- invert_atoms(target_index, reference_index, misc=None)#
invert atom from atomic positions (target arraay) array or from set of atomic positions in xyz PAth file
- Parameters
target_atoms (target_index or) – array of ints for indexing atoms to be inverted ; numbering starts from 1
reference_atoms (reference_index or) –
- 1D array of intergers of atoms wrt which invertion has to
be done
misc (miscellanous) – tag to do some miscellaneous transformation … under testing … here I am inverting the array by double the distance a normal inversion is done also, reference pt is moved along the inversion direction as well.
- Returns
pos_with_inv – array of positions containing inverted atoms references by target_index is misc is True, then reference atoms is also shifted by inversion operation
- Return type
array
Note
for doing inversion of t array wrt r point: new t = t’ = r - (t-r) = 2* r - t
- for misc tag: following inversion and shifting of reference pt done (using vector algebra)
new t = t’ = -(t-r) + [ -(t-r) ] + r = 3* r - 2 *t or new t = t’ = r + (r-t) + (r-t)/2 = (5*r-3*t)/2 # added (r-t)/2 more distance vect
- taking for now following ..
or new t = t’ = r + (r-t) + 2(r-t)/3 = (8*r-5*t)/3 # added 2(r-t)/3 more distance vect new ref pt, r’ = -(t-r) + r = 2*r - t —– right!! here earliet this pt was r
- merge(pos2, atm_label2)#
merge two xyz files first file read after class initialization second xyz’s pos2 and atmlabel2 are input to this method!!
On output, new pos and label are returned
- replace(atm_index, symbol_index, ofile=None)#
replace atomic positions by atoms of different types
atm_index is list of atomic numbering starting from 1 symbol_index is list of atomic symbols in the final xyz file/poscar file
- shift(filename, xshift, yshift, zshift)#
shift in general from the shift.py
- shift_to_origin(filename)#
shift to orgin from the shift.py
- substitute(iatoms_list, ilinkatom_id, flinkatom_id, xyzfile)#
substiture atoms present in iatom_list by atoms presnt in the xyzfile.
The initial str has a atom link id given by ilinkatom_id and this atom should be replaced by the atom given in the flinkatom_id along with atoms present in the xyzfile.
esta.general.metric_tensor module#
- esta.general.metric_tensor.get_metric_tensor(cell_matrix)#
finding the metric tensor for cell matrix
- Parameters
matrix (cell) – cell or lattice information in the cell matrix
- Returns
metric-tensor – matrix of metric tensor
- Return type
3D array
esta.general.min_trans_rot module#
this module is from ASE, freely available under the GNU LGPL license. For details of ASE, see https://wiki.fysik.dtu.dk/ase/
modified to adapt to the EStA calling modules. Note: easy to implement from scratch as the needed routines are scattered already in the EStA directories .. TODO!!
- esta.general.min_trans_rot.minimize_rotation_and_translation(target, atoms)#
Minimize RMSD between atoms and target.
Rotate and translate atoms to best match target. For more details, see:
Melander et al. J. Chem. Theory Comput., 2015, 11,1055
- esta.general.min_trans_rot.quaternion_to_matrix(q)#
Returns a rotation matrix.
Computed from a unit quaternion Input as (4,) numpy array.
- esta.general.min_trans_rot.rotation_matrix_from_points(m0, m1)#
Returns a rigid transformation/rotation matrix that minimizes the RMSD between two set of points.
m0 and m1 should be (3, npoints) numpy arrays with coordinates as columns:
(x1 x2 x3 ... xN y1 y2 y3 ... yN z1 z2 z3 ... zN)
The centeroids should be set to origin prior to computing the rotation matrix.
The rotation matrix is computed using quaternion algebra as detailed in:
Melander et al. J. Chem. Theory Comput., 2015, 11,1055
esta.general.niggli_reduce module#
- esta.general.niggli_reduce.niggli_reduce(poscar=None, out_poscar_esta=None, out_poscar_ase=None)#
‘ read poscar file using aadhaar object from esta and save the poscar file.
Further niggli reduce the crystal lattice using niggli_reduce from build (not geometery) in ASE package and save the poscar.
Now you can compare the two poscar files to see about the niggli reduction.
esta.general.operation module#
- class esta.general.operation.transform(cryst_obj)#
Bases:
object
- transfor class to
create supercell from crystal lattice object
rotation/translation etc…todo
More transformations to unit cell/atomic positions/reciprocal lattice/kpoints to be added
author: sk email: sonukumar.physics@gmail.com
- get_grouped_list(llist)#
get same string elements of list grouped together
- get_grouped_xyz()#
xyz file with grouped atoms of same type
- get_neach_type(inp)#
get number of list entries of each type
list of strings of atomic labels
get integer number of list entries (atomic symbols) of each type
- get_sposcar()#
get poscar file with scaled dimensions: supercell of POSCAR file
- get_supercell(scale)#
create supercell by shifting ALL atoms in space with scaling
[scale1,scale2,scale3]
looping is performed along three directions of lv’s vectors
- loops are:
i = 0,1,2 … sclae1 j = 0,1,2 … scale2 k = 0,1,2 … scale3
total atoms in supercell = atoms in unit-cell * np.product([scale1,scale2,scale3])
- get_unique_list(inp)#
get unique elements of list
- rot_trans(inp_mat, lcell=None, lposition=None, translation=None, rotation_matrix=None)#
given input matrix (may be cell matrix or position matrix in c order) and rotation matrix (optional; default is unit matrix), output respective new matrix
- Parameters
inp_mat (array) – rank 3 or rank N, N is no. of atoms.
lcell (logical) – indicates inp_mat is for cell
lposition (logical) – indicates that inp_mat is for atomic points/positions
translation (array, optional) – rank 1, optional (default is zero vector = (0 0 0))
rotation_matrix (array of rank3, optional) – rotation matrix; default is unit matrix
- Returns
out_mat – output matrix of same shape as that of input matrix
- Return type
array
Note
following convention like spglib: .. _spglib: https://spglib.github.io/spglib/definition.html
====> Basis vectors (a,b,c) or (a1, a2, a3)
In spglib, basis vectors are represented by three column vectors (in Cartesian coordinates. ) :
a=⎛⎝⎜ax ay az⎞⎠⎟, b=⎛⎝⎜bx by bz⎞⎠⎟, c=⎛⎝⎜cx cy cz⎞⎠⎟,
====> atomic point x are represented as three fractional values relative to basis vectors as follows,
x=⎛⎝⎜x1x2x3⎞⎠⎟
====> The transformation matrix P changes choice of basis vectors as follows (a b c) = (as bs cs) P where (abc) and (as bs cs) are the basis vectors of an arbitrary system and of a starndardized system, respectively
The origin shift p gives the vector from the origin of the standardized system Os to the origin of the arbitrary system O p = O − Os
A change of basis is described by the combination of the transformation matrix and the origin shift denoted by (P,p) where first the transformation matrix is applied and then origin shift. The points in the standardized system xs and arbitrary system x are related by
xs = P x + p,
or equivalently,
x = P^-1 xs − P^-1 p
esta.general.peak_position_and_average_1D module#
- esta.general.peak_position_and_average_1D.get_location_peak_and_average(y, x, eps=None)#
NOTE: it is finding of LOCATION OF PEAK AND AVERAGE !!!
finding index of peak position of a 1D function
- finding index of average of 1D function not taking into account the function
values below epsilon (epsilon = 1e-2 or other values)
- input:
array, x: xvariable array, y: function 1D; y variable float, eps: cutoff below which all values of y array are neglected
- output:
float, peak location or max of the function float, average position or average of 1D function
esta.general.pseudo_info module#
- esta.general.pseudo_info.get_pseudo_tags(atomic_species)#
get ATOMIC_SPECIES information required for generating qe-input file
- input:
list of elements;
- output:
output file containing: label of elements, mass, and UPF files
esta.general.rate_const_IS0_TS1 module#
rate constant calculations
for A* —> B* kind of surface reaction
rate constant ~ r = A * exp ( -Ea/kbT )
- where:
A = ( kb * T/ h ) * (q_vib_TS / q_vib_A*) q = vib partition function = product_i (1/(1-expt(-h*nu_i / kbT)) )
- esta.general.rate_const_IS0_TS1.q_partition(vib_energies_data, temp)#
- esta.general.rate_const_IS0_TS1.read_freq_data(filename, freq_dft)#
esta.general.read_force_constant module#
- esta.general.read_force_constant.read_force_constant_phonopy(filename)#
read force constant from the phonopy.yaml file created using the following command; phonopy –qe –cell ScPtO.scf2phon.in –include-fc -p band.conf | tee x.out
the band.conf contains the following lines: DIM = 1 1 1 PRIMITIVE_AXIS = AUTO BAND = 0. 0. 0. 0 0 0.1 BAND_POINTS=1 WRITEDM = .TRUE.
- ..note::
the force constant are extraced from the q=0 calculation done using phonopy with qe as the backend. Should work for all the non-zero qpts as well..not test yet!!
- Parameters
filename (str) – name of the filename, phonopy.yaml
- Returns
lattice (array) – cell vectors
symbol (list) – list of symbols
pos (array) – atomic positions
masses (array of scalars) – mass of atoms
force_constant (array) – force constant between pair of atoms
esta.general.read_jmol module#
read jmol file and extract the xyz file data: - atomic symbols - atomic positions
- esta.general.read_jmol.get_xyz_data(filename)#
read jmol file created from jmol software and return atomic positions and atomic labels
filename: string
atomic_position: array of rank 2 symbol : list of atomic symbols
esta.general.read_kappa module#
- esta.general.read_kappa.ReadKappaCSV(file_path)#
read kappa lattice from csv file into an array of rank 2
- the format of csv file is:
# 8 columns: T, k_xx, k_yy, k_zz, k_xz, k_yz, k_xy, k_ave.
- esta.general.read_kappa.plot_kappa(csv_filename, scale=None)#
esta.general.read_xyz module#
- esta.general.read_xyz.read_xyz_file(filename, lcharge=False)#
read xyz file
esta.general.reciprocal_lattice module#
method to calculate the reciprocal lattice vectors
- esta.general.reciprocal_lattice.reciprocal_lattice(LV1, LV2, LV3)#
input: real space lattice vectors: LV1, LV2, LV3 output: reciprocal space lattice vectors: b1, b2, b3
note: a factor of 2pi is included in b1, b2, and b3
esta.general.rename module#
- esta.general.rename.split_string(source, separators)#
string split using regex
- esta.general.rename.to_file(filename, separator=None, ilength=None)#
rename file/files to a name derived from the original name by truncating it using separator. By default, if there is not input separator and ilength (no. of splitted componnets in the filename), then new_ is prefix before the original files
esta.general.reverse_array module#
- esta.general.reverse_array.reverse_array(icounter)#
reverse the interger array i.e. save the elements in reverse order
similary a real array can be reversed!!
esta.general.shift module#
method to shift atoms:
shift atoms in xyz file along a direction
shift atoms in xyz file to origin
to get CM see thermo class – already implemented
author: skumar email: sonukumar.physics@gmail.com
- esta.general.shift.centroid(array)#
find centroid of a set of points in array
- if __name__ == “__main__”:
import numpy as np A= np.random.randint(3,size=(9,3)) #(33,3) #.reshape(33,3) print(A) print (centroid(A))
- esta.general.shift.shift(filename, xshift, yshift, zshift)#
method/function to shift atoms: - shift atoms in xyz file along a direction
- esta.general.shift.shift_to_origin(filename)#
method/function to shift atoms: - shift atoms in xyz file to origin
esta.general.shift0 module#
method/function to shift atoms: - shift atoms in xyz file along a direction - shift atoms in xyz file to origin
- esta.general.shift0.centroid(array)#
find centroid of a set of points in array
- esta.general.shift0.shift(filename, xshift, yshift, zshift)#
method/function to shift atoms: - shift atoms in xyz file along a direction
- esta.general.shift0.shift_to_origin(filename)#
method/function to shift atoms: - shift atoms in xyz file to origin
Here more to do: calculate CM or centroid??? todo????? sk!!
esta.general.shift_atom_test_old module#
esta.general.shift_poscar module#
- esta.general.shift_poscar.shift_poscar(poscar_file_target, poscar_file_reference, target_atom_index)#
shift atoms of the poscar wrt to atom present in other similar poscar file
- e.g. for NEB calculations between different images in the transition state
calculations
poscar_file_target: poscar file whose atoms are to be shifted poscar_file_reference: poscar file for the reference; wrt which atoms are to be
shifted
- target_atom_indexr: atom index (starting from 1) in the referecen poscar file wrt to which shift
has be done
esta.general.sum_dictionaries module#
- esta.general.sum_dictionaries.sum_dictionaries(dict1, dict2)#
sum values of two identical dictionaries to get a new dictionary with updated values,
NOTE: here format of the two dictionaries is as follows:
dict1 = {‘freq_expt_ethene.dat’: {‘298.15 K’: ‘-564.632’, ‘500.0 K’: ‘-565.144’, ‘600.0 K’: ‘-565.417’, ‘700 K’: ‘-565.703’, ‘800 K’: ‘-566.000’, ‘900 K’: ‘-566.308’, ‘1000 K’: ‘-566.626’}} dict2 = {‘freq_expt_H2O.dat’: {‘298.15 K’: ‘-32556.942’, ‘500.0 K’: ‘-32557.369’, ‘600.0 K’: ‘-32557.592’, ‘700 K’: ‘-32557.822’, ‘800 K’: ‘-32558.058’, ‘900 K’: ‘-32558.298’, ‘1000 K’: ‘-32558.543’}}
after addition only values in dictionary of dictionaries is updated and key in the dictionary of dictionary remain unchanged!!
author = ‘sk’ email = ‘sonukumar.physics@gmail.com’
esta.general.symbol_from_atm_number module#
- esta.general.symbol_from_atm_number.get_symbol_from_atomic_number(self, atomic_num)#
return list of atomic symbols from list of atomic numbers
esta.general.thermo module#
this is thermo class for calculating the energy contribution coming from the translational, rotational , vibrational and electronic degrees of freedom towards entropy, internal energy, andspecific heat
In Nutshell: we need three components
enthalpy component H = E + PV
entropy components S
free energy components G = H -TS = E + PV - TS
Model under which the thermodynamical quantities can be calculed:
Ideal gas approximation
Harmonic approx
Hindered rotor and vibrator
crystalline materials case
Notes
For More information related to theory, see the following:
see gaussian thermo pdf file,
or chapter 10: essential of compuational chemisty,
or html file in the present folder
or ‘A Note on Thermochemistry’ by openmopac manual
or Introduction to computational chemistry by Jensen chapter 14.5
author: sk, email: sonukumar.physics@gmail.com
- class esta.general.thermo.ThermoDyn(E_dft=None, vib_freq=None, E_zpe=None, S_vib=None, E_vib=None, temp=None, type_molecule=None, spin=None, symbols=None, pos=None, symmetry_number=None, pressure=None)#
Bases:
object
thermodyn class to find energies (eV or other units) for entropy, internal energy, and specific heat with respect to translational, rotational, vibrational, and electronic degrees of freedom
Note theat all energies are in eV or SI units
for theory: see gaussian thermo pdf file, or chapter 10: essential of compuational chemisty, or html file in the present folder
- get_E_vib()#
get vibration contribution to internal energy:
it contains vibtaration heat capacity contains 3N−6 degrees of freedom for nonlinear molecules and 3N−5 degrees of freedom for linear molecules (where N is the number of atoms)
- get_S_vib()#
get S_vib, vibrational entropy in eV/K
- get_moment_inertia()#
get moment of inertia of the molecule or other possible system
formula: see A note on thermochemistry or else where!!
Notes
Taken from A note on thermochemisty:
IA = Σimi(RAi)2, where i runs over all atoms in the system, mi is the mass of the atom in amu, and RAi is the distance from the axis of rotation, A, to atom i in Ångstroms.
The axes of rotation are calculated as follows:
First, a 3 by 3 matrix, t, is constructed, with the elements of t being:
t1,1 = Y2 + Z2 = Σimi(yi2 + zi2) t1,2 = -X.Y = -Σimixiyi t2,2 = X2 + Z2 = Σimi(xi2 + zi2) t1,3 = -X.Z = -Σimixizi t2,3 = -Y.Z = -Σimiyizi t3,3 = X2 + Y2 = Σimi(xi2 + yi2)
where mi is the mass of the atom in amu, and xi, yi, and zi, are the Cartesian coordinates of the atoms, in Ångstroms. Then t is diagonalized. The resulting eigenvalues, (amu Ångstrom2), are divided by N.A2, where N=Avogardo’s number and A = number of Ångstroms in a centimeter, to give the moments of inertia in g.cm2. Because a useful unit is 10-40.g.cm2, the moments of inertia are multiplied by 1040 before being printed. The eigenvectors associated with the eigenvalues are the axes of rotation, A, B, and C.
- Useful conversion factors
1 g cm2 = 1.660540x10-40 (amu Ångstrom2)
Rotational constants in cm-1: A = hN1016/(8π2c)/(amu Ångstrom2) A (in MHz) = 5.053791x105/(amu Ångstrom2) A (in cm-1) = 5.053791x105/c(amu Ångstrom2) = 16.85763/(amu Ångstrom2)
- Parameters
coordinates (array) – cartesian coordinates of rank 2; [:,:]
symbols (list) – list of atomic symbols (need to calculate the Molecular mass or total mass)
- Returns
vector (array) – moment of inertia about axis of rotation A, B, and C;
principle axis (array) – array of rank2, principle axis of rotations, A, B, and C about which moment of inertia is calculated
- get_zpe()#
get quantum mechanical zpe energy in eV
- class esta.general.thermo.ThermoHarmonic(E_dft=None, vib_freq=None, temp=None)#
Bases:
object
Harmonic thermodynamics
Harmonic limit: taken from ASE website: The conversion of electronic structure calculation information into thermodynamic properties is less established for adsorbates. However, the simplest approach often taken is to treat all 3N degrees of freedom of the adsorbate harmonically since the adsorbate often has no real translational or rotational degrees of freedom.
rac{epsilon_i}{e^{epsilon_i / k_ ext{B} T} - 1 }
- S = k_ ext{B} sum_i^ ext{harm DOF}
left[
rac{epsilon_i}{k_ ext{B}Tleft(e^{epsilon_i/k_ ext{B}T}-1 ight)} -
ln left( 1 - e^{-epsilon_i/k_ ext{B}T}
ight) ight]
i.e. U(T)=Eelec+EZPE+∑iharm DOF ϵi eϵi/kBT−1
S=kB ∑iharm DOF[ϵi kBT(e ϵi/kBT−1)−ln(1−e−ϵi/kBT)]
- get_E_vib(set_zero=None)#
find the in internal energy part due to vibrations from 0K to a given temperature in eV. All DOF are considered within the harmonic approximation
Output the vibration contribution to internal energy:
- get_Helmholtz_free_energy()#
calculate the Helmholtz free energy
Notes
G(T ) = H(T) − TS (T) # + E_DFT # P depenedence negligble; PV term may be…
F(T) = U(T)−TS(T) – Helmholtz free energy
assuming PV term to be negligible, we have G(T) equal to F(T)
If we assumes that the pV term in H=U+pV is negligible, then the Helmholtz free energy can be used to approximate the Gibbs free energy, as G=F+pV.
- get_S_vib()#
get vibrational entropy in eV/K (3N DOF) given in eV
output is entropy and entropy energy in eV/K and ev/k, respectively.
- get_internal_energy()#
find internal energy in eV at a given T in the harmonic approximation taking all DOF (3N) at a given temperature (K).
Notes
E(T) = U(T) = Eelec+EZPE+∑iharm DOF ϵi eϵi/kBT−1
- get_zpe()#
Returns the zero-point vibrational energy eV.
- class esta.general.thermo.ThermoHindredRotVib#
Bases:
object
Hinder vibrational and rotation oscillator thermodynamics
- class esta.general.thermo.ThermoIdealGas(thermo_obj)#
Bases:
esta.general.thermo.ThermoDyn
calculate thermodynamic quantities within the ideal gas approximation
- get_Gibbs_free_energy()#
calculate the free energy G at a given temp and pressue
Notes
(T,P ) = H(T) − TS (T,P) + E_DFT
E_DFT is energy from DFT calculation ror some other nonDFT calculations
- get_enthalpy()#
calculate enthapy (H) for ideal gas; H (P,T) = H (T); pressure dependence is not there
Notes
H(P,T) = E + PV = E_electronic (E_DFT) + E_zpe + integrate over T (specific heat capacity at const P)
H(T) = Eelec + EZPE + ∫ C_P dT; integral from 0–>T
Cp = kB + CV,trans + CV,rot + CV,vib + CV,elec
∫CV,vib dT = ∑ ϵi/exp ( ϵi/kBT−1) ; for linear mol = 3N-5 and 3N-6 nonlinear vibrations
- get_entropy()#
calculate entropy S(T,P) = S(T,P_0) − kB ln P/P_0
Notes
S = S_trans + S_rot + S_elec + S_vib − kB ln (P/P_o)
1 Pa = 1 N / m2
- class esta.general.thermo.ThermoLattice#
Bases:
object
Atomic lattice thermodynamics
esta.general.thermo2 module#
this is thermo class for calculating the energy contribution coming from the translational, rotational , vibrational and electronic degrees of freedom towards entropy, internal energy, andspecific heat
In Nutshell: we need three components
enthalpy component H = E + PV
entropy components S
free energy components G = H -TS = E + PV - TS
Model under which the thermodynamical quantities can be calculed:
Ideal gas approximation
Harmonic approx
Hindered rotor and vibrator
crystalline materials case
Notes
For More information related to theory, see the following:
see gaussian thermo pdf file,
or chapter 10: essential of compuational chemisty,
or html file in the present folder
or ‘A Note on Thermochemistry’ by openmopac manual
or Introduction to computational chemistry by Jensen chapter 14.5
author: sk, email: sonukumar.physics@gmail.com
- class esta.general.thermo2.ThermoDyn(E_dft=None, vib_freq=None, E_zpe=None, S_vib=None, E_vib=None, temp=None, type_molecule=None, spin=None, symbols=None, pos=None, symmetry_number=None, pressure=None)#
Bases:
object
thermodyn class to find energies (eV or other units) for entropy, internal energy, and specific heat with respect to translational, rotational, vibrational, and electronic degrees of freedom
Note theat all energies are in eV or SI units
for theory: see gaussian thermo pdf file, or chapter 10: essential of compuational chemisty, or html file in the present folder
- get_E_vib()#
get vibration contribution to internal energy:
it contains vibtaration heat capacity contains 3N−6 degrees of freedom for nonlinear molecules and 3N−5 degrees of freedom for linear molecules (where N is the number of atoms)
- get_S_vib()#
get S_vib, vibrational entropy in eV/K
- get_moment_inertia()#
get moment of inertia of the molecule or other possible system
formula: see A note on thermochemistry or else where!!
Notes
Taken from A note on thermochemisty:
IA = Σimi(RAi)2, where i runs over all atoms in the system, mi is the mass of the atom in amu, and RAi is the distance from the axis of rotation, A, to atom i in Ångstroms.
The axes of rotation are calculated as follows:
First, a 3 by 3 matrix, t, is constructed, with the elements of t being:
t1,1 = Y2 + Z2 = Σimi(yi2 + zi2) t1,2 = -X.Y = -Σimixiyi t2,2 = X2 + Z2 = Σimi(xi2 + zi2) t1,3 = -X.Z = -Σimixizi t2,3 = -Y.Z = -Σimiyizi t3,3 = X2 + Y2 = Σimi(xi2 + yi2)
where mi is the mass of the atom in amu, and xi, yi, and zi, are the Cartesian coordinates of the atoms, in Ångstroms. Then t is diagonalized. The resulting eigenvalues, (amu Ångstrom2), are divided by N.A2, where N=Avogardo’s number and A = number of Ångstroms in a centimeter, to give the moments of inertia in g.cm2. Because a useful unit is 10-40.g.cm2, the moments of inertia are multiplied by 1040 before being printed. The eigenvectors associated with the eigenvalues are the axes of rotation, A, B, and C.
- Useful conversion factors
1 g cm2 = 1.660540x10-40 (amu Ångstrom2)
Rotational constants in cm-1: A = hN1016/(8π2c)/(amu Ångstrom2) A (in MHz) = 5.053791x105/(amu Ångstrom2) A (in cm-1) = 5.053791x105/c(amu Ångstrom2) = 16.85763/(amu Ångstrom2)
- Parameters
coordinates (array) – cartesian coordinates of rank 2; [:,:]
symbols (list) – list of atomic symbols (need to calculate the Molecular mass or total mass)
- Returns
vector (array) – moment of inertia about axis of rotation A, B, and C;
principle axis (array) – array of rank2, principle axis of rotations, A, B, and C about which moment of inertia is calculated
- get_zpe()#
get quantum mechanical zpe energy in eV
- class esta.general.thermo2.ThermoHarmonic(E_dft=None, vib_freq=None, temp=None)#
Bases:
object
Harmonic thermodynamics
Harmonic limit: taken from ASE website: The conversion of electronic structure calculation information into thermodynamic properties is less established for adsorbates. However, the simplest approach often taken is to treat all 3N degrees of freedom of the adsorbate harmonically since the adsorbate often has no real translational or rotational degrees of freedom.
rac{epsilon_i}{e^{epsilon_i / k_ ext{B} T} - 1 }
- S = k_ ext{B} sum_i^ ext{harm DOF}
left[
rac{epsilon_i}{k_ ext{B}Tleft(e^{epsilon_i/k_ ext{B}T}-1 ight)} -
ln left( 1 - e^{-epsilon_i/k_ ext{B}T}
ight) ight]
i.e. U(T)=Eelec+EZPE+∑iharm DOF ϵi eϵi/kBT−1
S=kB ∑iharm DOF[ϵi kBT(e ϵi/kBT−1)−ln(1−e−ϵi/kBT)]
- get_E_vib(set_zero=None)#
find the in internal energy part due to vibrations from 0K to a given temperature in eV. All DOF are considered within the harmonic approximation
Output the vibration contribution to internal energy:
- get_Helmholtz_free_energy()#
calculate the Helmholtz free energy
Notes
G(T ) = H(T) − TS (T) # + E_DFT # P depenedence negligble; PV term may be…
F(T) = U(T)−TS(T) – Helmholtz free energy
assuming PV term to be negligible, we have G(T) equal to F(T)
If we assumes that the pV term in H=U+pV is negligible, then the Helmholtz free energy can be used to approximate the Gibbs free energy, as G=F+pV.
- get_S_vib()#
get vibrational entropy in eV/K (3N DOF) given in eV
output is entropy and entropy energy in eV/K and ev/k, respectively.
- get_internal_energy()#
find internal energy in eV at a given T in the harmonic approximation taking all DOF (3N) at a given temperature (K).
Notes
E(T) = U(T) = Eelec+EZPE+∑iharm DOF ϵi eϵi/kBT−1
- get_zpe()#
Returns the zero-point vibrational energy eV.
- class esta.general.thermo2.ThermoHindredRotVib#
Bases:
object
Hinder vibrational and rotation oscillator thermodynamics
- class esta.general.thermo2.ThermoIdealGas(thermo_obj)#
Bases:
esta.general.thermo2.ThermoDyn
calculate thermodynamic quantities within the ideal gas approximation
- get_Gibbs_free_energy()#
calculate the free energy G at a given temp and pressue
Notes
(T,P ) = H(T) − TS (T,P) + E_DFT
E_DFT is energy from DFT calculation ror some other nonDFT calculations
- get_enthalpy()#
calculate enthapy (H) for ideal gas; H (P,T) = H (T); pressure dependence is not there
Notes
H(P,T) = E + PV = E_electronic (E_DFT) + E_zpe + integrate over T (specific heat capacity at const P)
H(T) = Eelec + EZPE + ∫ C_P dT; integral from 0–>T
Cp = kB + CV,trans + CV,rot + CV,vib + CV,elec
∫CV,vib dT = ∑ ϵi/exp ( ϵi/kBT−1) ; for linear mol = 3N-5 and 3N-6 nonlinear vibrations
- get_entropy()#
calculate entropy S(T,P) = S(T,P_0) − kB ln P/P_0
Notes
S = S_trans + S_rot + S_elec + S_vib − kB ln (P/P_o)
1 Pa = 1 N / m2
- class esta.general.thermo2.ThermoLattice#
Bases:
object
Atomic lattice thermodynamics
esta.general.unique_array module#
- esta.general.unique_array.get_unique_array(array_data)#
get unique array elements with indices in an array
esta.general.use_pbc_ASE module#
- esta.general.use_pbc_ASE.general_find_mic(v, cell, pbc=True)#
Finds the minimum-image representation of vector(s) v. Using the Minkowski reduction the algorithm is relatively slow but safe for any cell.
esta.general.xyz module#
Xyz class to handle data related to xyz file/files
- class esta.general.xyz.Xyz#
Bases:
object
Xyz class to read and write files containing data for one or more atomic structures in xyz format
- read_xyz(filename)#
- Parameters
filename (string) – name of xyz file containing all xyz atomic positions and atomic lables
- Returns
pos (array) – array of shape (no_of_strs, natoms, 3)
label (list) – list of atomic labels containing all atomic symbols
- read_xyz_all(filename)#
- Parameters
filename (string) – name of xyz file containing all xyz atomic positions and atomic lables
- Returns
pos (array) – array of of shape (no_of_strs, natoms, 3)
label (list) – list of atomic labels containing all atomic symbols
esta.general.xyz_grouped module#
- class esta.general.xyz_grouped.RWpwi(infile, outfile=None)#
Bases:
object
class to read the pw input file and create poscar file
- Returns
generate poscar file after reading the pw input file
- get_grouped_list(llist)#
get same string elements of list grouped together
- get_neach_type(inp)#
get number of list entries of each type
- Returns
list of integers for each type of atoms specifying their
- get_poscar()#
write cell_parameters and atomic postions, atom labels etc in poscar file
- get_unique_list(inp)#
get unique elements of list
- Returns
string for each type of atoms
- class esta.general.xyz_grouped.RWpwo(infile, outfile=None)#
Bases:
object
Class to read and write data file for the atomic structures
read cell parmeters and/or atomic positions
write this data in xyz, poscar, and qe-str format
- get_atm_positions()#
find atom positions with labels …
- get_cell_parameters()#
- Returns
cell vectors in angstrom or bohr
what is does:
- for ‘rlx’ calculations:
- search:
“lattice parameter (alat)” “crystal axes: (cart. coord. in units of alat)”
- for ‘vc-relax’ calculations:
search: ‘CELL_PARAMETERS (angstrom)’
…
- get_element_label(input_atomic_number)#
using mendeleev for it : big database of elemental properties
In [22]: from mendeleev import element In [21]: for i in [5,6,7,8]: …: element(i) …: print (element(i).symbol) …: B C N O
- get_energies_and_kpt()#
get the band energies at k point by reading the scf calculation out file
NOTE: Need verbosity =’high’ in the scf input file to print the band energies
- get_grouped_list(llist)#
get same string elements of list grouped together
- get_natoms()#
- get_neach_type(inp)#
get number of list entries of each type
- Returns
list of integers for each type of atoms specifying their number
- get_poscar()#
write cell_parameters and atomic postions, atom labels etc in poscar file
- get_unique_list(inp)#
get unique elements of list
- Returns
string for each type of atoms
- get_xyz_file()#
- get xyz file by reading the atomic positions and atomic labels: use method
get_atm_positions(infile)
- Returns
write data in xyz file specified by name outfile
- Return type
outfile
- IMPORTANT: ordeing same elements together: not done yet .. to be done..
- get_xyz_grouped_file()#
- get xyz file by reading the atomic positions and atomic labels: use method
get_atm_positions(infile)
- Returns
write data in xyz file specified by name outfile
- Return type
outfile
NOTE: similar atoms are grouped together
- classmethod vector_prod(a, b)#
esta.general.xyz_images module#
Generate atomic configurations between initial and final atomic positions
- esta.general.xyz_images.get_atomic_configurations(N, atompositions, atompositions2)#
generate points between a set of two points in N-D space
N: no. of images between these positions atompositions: atomic array for initial position atompositions2: atomic array for final position
configurations: array for all images generated bet initial and final pts total_no_of_images: integer for total no. of images to be generated between initial and
final positions
Note: configuration are returned in FOTRAN order … to use in C or python, use transpose operation..!!
Module contents#
general modules, functions, and classes to analysis