manipulate
esta.general.manipulate
¶
class for the mainipulation of atoms present in xyz file or poscar type files
gradually shift ot manipulate_adv module .. as that has many more functions added**
Author: skumar email: sonukumar.physics@gmail.com
Manipulate
¶
Bases: object
class to mainipulateatoms present in xyz file or poscar type files
.. what is done so far:: - delete atoms from poscar or xyzfile ... done - replace atoms by another type/type of atoms ..done - shift atoms about origin ..done - shift atoms alogn a general direction .. done - other possiblities .....like bending ..done see other location - inverstion .. done - merge two xyz data files in a given order (> 2 to be done)
.. 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!!
__init__(atomic_positions, atomic_labels=None)
¶
self
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
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
(array
) –new atomic positions after deletion of some atoms
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.
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']
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_index
–array of ints for indexing atoms to be inverted ; numbering starts from 1
-
reference_index
–1D array of intergers of atoms wrt which invertion has to be done
-
misc
–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
) –array of positions containing inverted atoms references by target_index is misc is True, then reference atoms is also shifted by inversion operation
-
.. 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 vecttaking 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
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
–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
–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.
centroid(array)
¶
find centroid from the shift.py
shift_to_origin(filename)
¶
shift to orgin from the shift.py
shift(filename, xshift, yshift, zshift)
¶
shift in general 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.
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