Skip to content

aadhaar

esta.general.aadhaar

aadhaar class is a base class to read/write and process information related to atoms such as atoms coord, atom labels, and types, and so on!!

It reads only xyz file (for poscar file use 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

Note

to attach more properites to Aadhaar class for xyz type data ..such as atm manipulation class ... angles, dihedral angles, bond-distances, distance matrix, connectivity matrix, Nearest neighbors (NN), 2NN, 3NN, atomic radii of atoms, and other atomic properites

same has to be done to CrystalLattice class in case of POSCAR file data
.. PBC class, atomic distances using PBC and related connectivity for local 
environment, ...

Aadhaar

aadhaar class for atomic structure related information handling.

natom property

get no. of atoms

atm_position property

get atom positions

atm_symbol property

get atom symbols

get_atm_type property

get symbolic representation of atoms of each type in the form of list

get_natm_type property

get no. of atoms of each type in a list format

get_each_atm_type property

get same integer for atoms of same type

__init__()

initialize the class

read_xyz(xyzfile)

Parameters

xyzfile: str name of xyz file, xyzfile

Returns:

  • pos ( array ) –

    atomic positions (rank 2 with shape (natoms, 3))

  • label ( list ) –

    list of atomic labels, rank 1 array of atomic labels

  • natoms ( scalar ) –
  • comment ( str ) –

    atom coords are in ang

get_fix_atom(fix=None)

return the fix atoms with starting from 0; on input fix contains numbering starting from 1

xyz_as_pdf()

get xyz data in the panda data frame with first line for tags for atoms, and coordinates

xyz_as_csv(csvfile=None, savefile=None)

get xyz data in the csv data format

..not this ...with first line as comment (atom symbTag, and x, y,z)

read_xyz_tagged(xyzfile)

read xyz file with some positions tagged as Fixed by placing F in the 4th column of the xyz file

Parameters

xyzfile: str name of xyz file, xyzfile

Returns:

  • pos ( array ) –

    atomic positions (rank 2 with shape (natoms, 3))

  • label ( list ) –

    list of atomic labels, rank 1 array of atomic labels

  • natoms ( scalar ) –
  • comment ( str ) –

    atom coords are in ang

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

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.

Parameters:

  • cell_parameter

    lattice vectors in the form np.array([lv1, lv2, lv3])

  • pos

    atomic positions

  • label

    strings of atomic symbols

  • name_outfile

    name of the output POSCAR file

Returns:

  • generates POSCAR file with name = name_outfile

get_poscar_selective(cell_parameter, pos, label, fix_tag=None, name_outfile=None)

create POSCAR file given the cell_parameters, atomic postions, atom labels, and fix_tag. 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.

Parameters:

  • cell_parameter

    lattice vectors in the form np.array([lv1, lv2, lv3])

  • pos

    atomic positions

  • label

    strings of atomic symbols

  • fix_tag

    list of list containgin tag for atom fixing, e.g [['F','F','F'], ['T','T','T'], .... to natoms]

  • name_outfile

    name of the output POSCAR file

Returns:

  • generates POSCAR file with name = name_outfile

get_xyz_file(atomic_position, atomic_label, fix_index=None, fix_dir=None, name_outfile=None)

create XYZ file from the atomic positions and atomic labels.

Parameters

atomic_position: array of rank 2 or shape of (natoms, 3) atomic positions with shape (natoms, 3) atomic_label: str list list of atomic labels fix_index: list (optional) list of atoms to be fixed with numbering from 1; e.g. ['1','2','10'] (The resulting xyz file contains F or T for after the x y z coordinates in the same line) fix_dir : list (optional) [TODO .... this is not working properly if it not None ... testing needed .... see ] direction of fix, e.g. xyz (all directions if used for the time being) name_outfile: str, optional prefix for the output file

get_xyz_o(atomic_position, atomic_label, energy=None, name_outfile=None, comment=None)

create single XYZ file given the atomic positions and atomic labels and energies.

Note

xyz_o with o means single file

energy and comment are independent of each other NOW!

get_xyz_grouped(atomic_position, atomic_label, name_outfile=None)

create XYZ file from the atomic positions and atomic labels. name_outfile is the prefix for the output file Note that the similar atoms (identical symbols) are grouped together.

get_all_xyz_separate(xyzfile, comment=None)

write xyz_all data into separate xyz files

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.

name_outfile is the prefix for the output file Note that the similar atoms (identical symbols) are NOT 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. comment True then energy is printed in comment section. .. note:: The similar atoms (identical symbols) are grouped together. ?confirm THIS..TODO 19-04-2024

get_all_xyz_in_a_file__(atomic_position, atomic_label, energy=None, name_outfile=None, comment=None, **extra)

create single XYZ file for all xyz strcutures given the atomic positions and atomic labels and energies.

If comment is True then energy must be present!! **kwargs are added so as to pass addition arguments!!

.. note:: The similar atoms (identical symbols) are grouped together. ?confirm THIS..TODO 19-04-2024 The dictionary extra keyword must be "no.", otherwise error message is emitted

get_axsf(position, symbol, lv, eigen_disp=None, factor=None, name_outfile=None)

get axsf file given xyz data (or xyz file or POSCAR file) and displacements of displaced-atoms/moving atoms

Parameters:

xyzobject

lv: array lattice vectors matrix lv[3,3] with rows as lattice vectors (c-style, opposite to Fortran-style)

eigen_disp: array eigen displacements vectors of shape (3*natom, natom,3) (note sometimes all atoms are displaced and sometimes only few are displace)

Returns:

axsf file for viewing with xcryden

.. format of axsf file

ANIMSTEPS 2 CRYSTAL PRIMVEC 20.1192283600 0.0000000000 0.0000000000 0.0000000000 27.0000000000 0.0000000000 0.0000000000 0.0000000000 17.0000000000 PRIMCOORD 1 5 1 H 11.2498769970 13.8121424280 4.3686516620 -0.0000942577 -0.0000152115 0.0005174206 H 12.5137322430 15.0793556060 1.8688610990 0.0003968067 -0.0001103587 -0.0009433925 H 13.2963873660 13.8030528830 2.8291899960 0.0000467070 0.0000647718 -0.0006208035 H 14.1576884440 15.3238761340 2.5101912960 0.0001419676 -0.0000543467 -0.0006737093 H 13.6497403220 14.1378762940 5.3369092520 -0.0004499922 -0.0000278449 0.0006083637 PRIMCOORD 2 5 1 H 11.2355725044 13.5305891253 4.3477591403 0.0001368359 -0.0000037193 0.0015032442 H 12.3273729886 14.6920409122 1.7133173515 0.0002135816 0.0000056774 -0.0003496343 H 13.2074926046 13.5157335368 2.7144034122 0.0002043936 -0.0001109390 -0.0004939726 H 13.9830728189 15.0490029986 2.2619945638 0.0001662968 -0.0000176645 -0.0002263822 H 13.6135087175 14.0164433539 5.2070257688 -0.0003970061 0.0001379729 0.0006418720

get_all_xyz_in_eqlist_format(atomic_position, atomic_label, name_outfile=None, comment=None)

create single *EQ_list.log file from all xyz strcutures given the atomic positions and atomic labels. Note that the similar atoms (identical symbols) are grouped together.

.. note:: energy, spin, zpe, and normal mode eigenvalues are made zero in utput in *eq_list.log file; need to check if grrm code accepts this or not?

get_all_xyz_in_eqlist_format_adv(atomic_position, atomic_label, energy, name_outfile=None, comment=None)

create single *EQ_list.log file from all xyz strcutures given the atomic positions and atomic labels. Note that the similar atoms (identical symbols) are grouped together.

.. note:: spin, zpe, and normal mode eigenvalues are made zero in outout *eq_list.log file; need to check if grrm code accepts this or not?

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

    name of the output file

Returns:

  • name of xyz_frozen_file : str

    create 'xyz_FROZEN' type file containing information of frozen and not frozen atoms etc

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!!

get_com_oniom(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_outfile, kwargss, l_oniom_gaussian=None)

input oniom file generation

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

Note

update 2024: now gaussian:ONIOM+PM6 type file for GRRM can be genereated/ but remove the lines afer option part and add one line space in end of *com file

get_com_oniom_min(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_outfile=None, **kwargs)

input oniom file for MIN calculations

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_restruct(atomic_position, atomic_label, iatm_high_level, link_lowhigh_level_atoms, name_infile=None, name_outfile=None, **kwargs)

input oniom for ReStruct calculations

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_fix_indices(ref_atm_id=None, direction=None, distance=None, exclude_type=None)

return atom indices with are to be fixed

ref_atm_id MUST be included in the fix indices.

Parametes

ref_atm_id: int reference atom wrt to which atoms are to be selected direction: str direction alogn which atoms are to be selected distance: float distance range along the direction. For example, if it is yz, then some distance along y and z direction is selected (all vals of x allowed) to select the atoms exclude_type: list of str atom symbols to be excluded from the selection

Returns:

  • close_atoms_ ( list of atoms indices ) –

    list of all atoms close to ref atom along a direction

Note
ref_atm_id = 54
direction = 'y'
distance= 1 # ang (+1 and -1 Ang along y direction)
exclude_type = None # type of atoms to exclude; eg. ['B', 'H'] 2 types of atoms