-
Notifications
You must be signed in to change notification settings - Fork 5
modify_poscar.py
This python script performs several modifications of POSCAR files for a convenient modification of periodic structures in general.
It can multiply unit cells, shift some or all atom of a unit cell by a certain factor, convert between fractional and cartesian coordinates, freeze or unfreeze certain atoms and insert another structure into a POSCAR file, by removing all atoms of it in the area where collisions could occur.
The script is managed entirely via command line arguments. To apply it, go into a folder where the POSCAR file is located and execute the script. If no arguments are given, all available commands are written. Else, the desired operation is done and a modified file named POSCAR_mod is written. The modified (or unmodified) structure can be also stored as xyz file, which is then called poscar_mod.xyz.
List of available commands:
-
-shift=a,b,cShift all or some chosen atoms in the unit cell by a vector in direct coordinates, given by the values after the command. If only some atoms shall be moved, the commandsselect_elorselect_indcan be used to select the atoms that shall be moved (for example only some adsorbate molecules, but not the underlying surface and other molecules). For example:-shift=0.1,0.5,0.0, would shift the atoms mostly along the b axis, but not along the c axis. - **
-multiply=a,b,c** Multiplies the unit cell, such that a supercell with many identical unit cells is obtained. For example:multiply=3,3,1, would be suitable if a surface slab shall be multiplied threefold in both directions. -
-frac2cartTranslate aPOSCARgiven in fractional/direct coordinates to cartesian coordinates. -
-cart2fracTranslate aPOSCARgiven in cartesian coordinates to fractional/direct coordinates. -
-map2unitIf image flags are present in aPOSCARfile, for example after doing a MD simulation where some atoms moved several unit cells, they are removed and all atoms are put back into the unit cell. -
-freeze=listSet the movement flags of all atoms belonging to the given list of elements toF F F, i.e., freezes them for a selective dynamics. For example-freeze=Si,Owould freeze all atoms of a silica surface, whereas the Pt cluster located on it is still movable. -
-select_el=listIf only some atoms shall be moved with theshiftcommand, select the elements whose atoms shall be moved. Example-select_el=C,H** selects only C and H atom, maybe of an anthracene molecule adsorbed on a metal surface. -
-select_ind=listSelect all indices of atoms that shall be moved with theshiftcommand, if for example only some atoms of a certain element shall be moved. Both individual indices and longer lists of connected indices can be given simultaneously. For example:-select_ind=20,51-76,82,100-110. -
-insert_struc=a,b,cInserts a structure given byPOSCAR_insertinto thePOSCARstructure. The parameters a, b and c (in direct coordinates) give the desired position of the center of mass of the inserted structure with respect to the coordinates of the overallPOSCARfile. It is important that the inserted structure is smaller than the structure inPOSCARand that no atom of the inserted structure leaves the central unit cell of the surroundingPOSCAR, since else the removal of atoms near the inserted structure does not work. If the structure is set reasonably, all atoms in thePOSCARstructure located too near to the inserted atoms are removed to avoid collisions. The distance below which the removal happens can be set with the-remove_distkeyword. -
-bottom=[value]Set all atoms with a z-coordinate below the given value toF F F, i.e., freeze them. The value can be either given in direct or in cartesian coordinates, depending of the format of the givenPOSCARfile (direct or cartesian). Example:-bottom=3.5with aPOSCARgiven in cartesian coordinates: all atoms below z=3.5 Ang. are frozen (for example in a surface slab). -
-remove_dist=[value]For the-insert_struccommand: All atoms of thePOSCARwith a distance equal or nearer the given value to any of the atoms of the inserted structure inPOSCAR_insertare removed to avoid collisions. Independent of the given coordinate format, the value must always be given in Angstroms. Example:-remove_dist=3.5: All atoms with distances below 3.5 Ang. are removed. The default is 2.5 Angstroms, which should be reasonable in most cases. -
-phasetrans=[axis]A unitcell for a phase transition sampling (for example a crystal structure vs a liquid with the same composition) will be build. This command must be given in combination with-multiply.[axis]must be set toa,borc, depending the direction along which the phases shall border each other. Further, the-multiplymust have an equal number along the axis given by this keyword. Then, the atoms in the lower part of the cell will be kept fix (F F F) and those in the upper part will be free to move (T T T). Then, the phase can be melted at a high temperature only at the upper part and the phase transition can be studied with all atoms free to move at a lower temperature in a separate calculation. Example:-phasetrans=ctogether with-multiply=2,3,4. The lower half of the multipled cell along the c axis will be kept fix (two unit cells), the upper half will be free to move. -
-writexyzWrite the coordinates of the updated structure (after executing all commands above) to a xyz file namedposcar-mod.xyz.
- Description of Input Files
- Geometry Optimizations
- Single Point Energy
- Ab Initio Molecular Dynamics
- Machine-Learning Force Fields
- Normal Modes and IR Spectrum
- Implicit Solvation
- Gibbs Free Energies
- External Electric Fields
- Density of States
- Band Structure
- Bader Charges
- DDEC6 Charges
- Wannier Orbitals
- Core Level (Shifts)
- Simulation of STM Images
- Charge Density Differences
- 2D Charge Densities
- Electrostatic Potential
- Nudged Elastic Band
- TS Optimization
- Steered Molecular Dynamics