UPU: Difference between revisions
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
</p> | </p> | ||
UPU is a command-line tool for | UPU is a powerful command-line tool for processing POSCAR/CONTCAR files. | ||
It enables viewing, modifying and extracting information of those structure files interactively or in a batch (<TT>awk</TT>-like scripting) mode. | |||
As the program is a rather private project of the only developer Dr. M. Jahnátek (Univ.Vienna [http://www.cms.tuwien.ac.at/cms/person/63/]), it is not documented elsewhere. | As the program is a rather private project of the only developer Dr. M. Jahnátek (Univ.Vienna [http://www.cms.tuwien.ac.at/cms/person/63/]), it is not documented elsewhere. | ||
| Line 40: | Line 42: | ||
The command reads in a stucture-*CAR file, and measures the distance between atoms # 1 and 2, the bond angle between the atoms # 1-2-3 and the dihedral angle on the atoms # 1-2-3-4. | The command reads in a stucture-*CAR file, and measures the distance between atoms # 1 and 2, the bond angle between the atoms # 1-2-3 and the dihedral angle on the atoms # 1-2-3-4. | ||
Each | Each ''measure''ment has a one-line numerical output, thus it is easy to be parsed. So if the output of the <TT>upu</TT> command is redirected into a file ("<TT>upu '{commands}' CONTCAR > data.dat</TT>"), you can easily parse the variable in a BASH-script using e.g | ||
tail -3 data.dat > temp.dat | tail -3 data.dat > temp.dat | ||
for i in `seq 1 3` ; do | for i in `seq 1 3` ; do | ||
| Line 63: | Line 65: | ||
|- | |- | ||
|'''<TT>cartesian</TT>''' | |'''<TT>cartesian</TT>''' | ||
| | | switch atom coordinates being shown in Cartesian format | ||
|- | |- | ||
|'''<TT>cell</TT>''' | |'''<TT>cell</TT>''' | ||
| | | print cell parameters | ||
|- | |- | ||
|'''<TT>cmd</TT>''' | |'''<TT>cmd</TT>''' | ||
| Line 81: | Line 83: | ||
|- | |- | ||
|'''<TT>direct</TT>''' | |'''<TT>direct</TT>''' | ||
| | | switch atom coordinates being shown in direct (=fractional) format | ||
|- | |- | ||
|'''<TT>deassoct</TT>''' | |'''<TT>deassoct</TT>''' | ||
| Line 92: | Line 94: | ||
| exit | | exit | ||
|- | |- | ||
|'''<TT>export</TT>''' | |'''<TT>export ''[XSF|AXSFF|XYZ|UNIXYZ|XYZ_WTA|UNIXYZ_WTA]''</TT>''' | ||
| | | | ||
|- | |- | ||
| Line 99: | Line 101: | ||
|- | |- | ||
|'''<TT>fractional</TT>''' | |'''<TT>fractional</TT>''' | ||
| | | switch atom coordinates being shown in direct (=fractional) format | ||
|- | |- | ||
|'''<TT>identify</TT>''' | |'''<TT>identify</TT>''' | ||
| Line 119: | Line 121: | ||
| list atoms | | list atoms | ||
|- | |- | ||
|'''<TT>label</TT>''' | |'''<TT>label ''text''</TT>''' | ||
| | | change the label of the structure file (1<sup>st</sup> line in POSCAR) to a specified text | ||
|- | |- | ||
|'''<TT>layers@alook</TT>''' | |'''<TT>layers@alook x|y|z</TT>''' | ||
| | | automatically search for atomic layers along the given axis | ||
|- | |- | ||
|'''<TT>layers@buckling</TT>''' | |'''<TT>layers@buckling</TT>''' | ||
| | | | ||
|- | |- | ||
|'''<TT>layers@create</TT>''' | |'''<TT>layers@create byatom|bytype ''nr1 [nr2] [...]''</TT>''' | ||
| | | create an atomic layer defined by specific atom numbers (<TT>byatom</TT>) or atomic types (<TT>bytype</TT>) | ||
|- | |- | ||
|'''<TT>layers@delete</TT>''' | |'''<TT>layers@delete</TT>''' | ||
| | | delete a definition of an existing atomic layer | ||
|- | |- | ||
|'''<TT>layers@join</TT>''' | |'''<TT>layers@join</TT>''' | ||
| | | join (=concatenate) 2 or more atomic layers | ||
|- | |- | ||
|'''<TT>layers@look</TT>''' | |'''<TT>layers@look x|y|z ''[nr]''</TT>''' | ||
| | | | ||
|- | |- | ||
|'''<TT>layers@ls</TT>''' | |'''<TT>layers@ls</TT>''' | ||
| | | list atomic layers | ||
|- | |- | ||
|'''<TT>layers@measure</TT>''' | |'''<TT>layers@measure spacing|distance|angle ''specification''</TT>''' | ||
| | | | ||
|- | |- | ||
| Line 156: | Line 158: | ||
|- | |- | ||
|'''<TT>load ''file''</TT>''' | |'''<TT>load ''file''</TT>''' | ||
| load | | load the ''file'' (usually POSCAR/CONTCAR) to buffer | ||
|- | |- | ||
|'''<TT>loud</TT>''' | |'''<TT>loud</TT>''' | ||
| Line 162: | Line 164: | ||
|- | |- | ||
|'''<TT>ls</TT>''' | |'''<TT>ls</TT>''' | ||
| | | list the POSCAR/CONTCAR file | ||
|- | |- | ||
|'''<TT>measure</TT>''' | |'''<TT>measure</TT>''' | ||
| | | | ||
|- | |- | ||
|'''<TT>open | |'''<TT>open</TT>''' | ||
| | | | ||
|- | |- | ||
|'''<TT>origin</TT>''' | |'''<TT>origin</TT>''' | ||
| Line 176: | Line 178: | ||
| apply periodic boundary conditions (PBS) - all atoms with coordinates sticking out of the supercell will be moved inside; use with caution | | apply periodic boundary conditions (PBS) - all atoms with coordinates sticking out of the supercell will be moved inside; use with caution | ||
|- | |- | ||
|'''<TT>prefix '' | |'''<TT>prefix ''number''</TT>''' | ||
| change the prefix factor (2<sup>nd</sup> line in POSCAR) to a specified number | | change the prefix factor (2<sup>nd</sup> line in POSCAR) to a specified number | ||
|- | |- | ||
| Line 229: | Line 231: | ||
|'''<TT>update</TT>''' | |'''<TT>update</TT>''' | ||
| | | | ||
|- | |- | ||
|} | |} | ||
</p> | </p> | ||
== INSTALLATION == | == INSTALLATION == | ||
| Line 247: | Line 245: | ||
Do not forget to update your <TT>$PATH</TT> shell variable, e.g.: | Do not forget to update your <TT>$PATH</TT> shell variable, e.g.: | ||
printf '\nexport PATH=$PATH:~/bin/upu\n' >> ~/.bashrc | printf '\nexport PATH=$PATH:~/bin/upu\n' >> ~/.bashrc | ||
: '''Note:''' Currently, UPU may work smoothly on local machines and on TEKLA (but not on TEKLA2). | |||
Revision as of 11:32, 22 September 2010
go back to Main Page, Computational Resources, Chemistry & More, Computational Codes, VASP
DESCRIPTION
| UPU = Universal POSCAR Utilities |
UPU is a powerful command-line tool for processing POSCAR/CONTCAR files.
It enables viewing, modifying and extracting information of those structure files interactively or in a batch (awk-like scripting) mode.
As the program is a rather private project of the only developer Dr. M. Jahnátek (Univ.Vienna [1]), it is not documented elsewhere.
SYNTAX
UPU is programmed in C language and uses a C-like syntax.
Script mode:
upu '{command1;command2}' POSCAR|CONTCAR
Interactive mode:
upu POSCAR|CONTCAR
(or just "upu" command). You are redirected to the UPU sub-shell. The output of inserted commands is directly listed into the UPU shell. Press <ESC><ESC> or type quit command to return to BASH shell.
- Note: C-like syntax also means that UPU starts to count atoms and atomic layers from 0, i.e. the 5th atom in the POSCAR/POTCAR has the label 4. Take care of avoiding errors based on wrong numbering.
USAGE
Example #1 (level 1)
upu '{cartesian;ls;save;export xsf}' /path/to/CONTCAR
The command proceeds the following steps: reads a CONTCAR file, switches easily from the default direct coordinates to Cartesian, prints this half-edited version of CONTCAR to the the stdout, saves it the modification (output file "CONTCAR"), exports and saves the supercell to the XCrysDen format (output file "CONTCAR.xsf") and quits to BASH shell.
Example #2 (level 2)
upu '{cartesian ;\
measure distance a 0 a 1 ;\
measure angle a 0 a 1 a 2 ;\
measure dihedral a 0 a 1 a 2 a 3
}' /path/to/CONTCAR
The command reads in a stucture-*CAR file, and measures the distance between atoms # 1 and 2, the bond angle between the atoms # 1-2-3 and the dihedral angle on the atoms # 1-2-3-4.
Each measurement has a one-line numerical output, thus it is easy to be parsed. So if the output of the upu command is redirected into a file ("upu '{commands}' CONTCAR > data.dat"), you can easily parse the variable in a BASH-script using e.g
tail -3 data.dat > temp.dat
for i in `seq 1 3` ; do
var[$i]=`awk -v line=$i '(NR==line){print $1}' temp.dat`
done
LIST OF COMMANDS
Listed alphabetically:
| aassoct | attempt to specify atom types automatically by reading OUTCAR file in the current directory (no parameters needed) |
| assoct element1 [element2] [...] | associate the previously unspecified atom types with the user input (e.g. "assoct Pt N H") |
| bye | exit |
| cartesian | switch atom coordinates being shown in Cartesian format |
| cell | print cell parameters |
| cmd | |
| commandline | |
| cmd | |
| curl | |
| direct | switch atom coordinates being shown in direct (=fractional) format |
| deassoct | |
| exchange | |
| exit | exit |
| export [XSF|AXSFF|XYZ|UNIXYZ|XYZ_WTA|UNIXYZ_WTA] | |
| extract | |
| fractional | switch atom coordinates being shown in direct (=fractional) format |
| identify | |
| kpoints | |
| kpoints@ls | |
| kpoints@save | |
| kpoints@set | |
| la | list atoms |
| label text | change the label of the structure file (1st line in POSCAR) to a specified text |
| layers@alook x|y|z | automatically search for atomic layers along the given axis |
| layers@buckling | |
| layers@create byatom|bytype nr1 [nr2] [...] | create an atomic layer defined by specific atom numbers (byatom) or atomic types (bytype) |
| layers@delete | delete a definition of an existing atomic layer |
| layers@join | join (=concatenate) 2 or more atomic layers |
| layers@look x|y|z [nr] | |
| layers@ls | list atomic layers |
| layers@measure spacing|distance|angle specification | |
| layers@order | |
| layers@shift | |
| list | list the POSCAR/CONTCAR file |
| load file | load the file (usually POSCAR/CONTCAR) to buffer |
| loud | |
| ls | list the POSCAR/CONTCAR file |
| measure | |
| open | |
| origin | |
| pbc | apply periodic boundary conditions (PBS) - all atoms with coordinates sticking out of the supercell will be moved inside; use with caution |
| prefix number | change the prefix factor (2nd line in POSCAR) to a specified number |
| pretty | |
| quiet | enter quiet mode - reduce UPU messages to minimum |
| quit | exit |
| redo | |
| replicate | |
| rotate | |
| save [file] | save the current state of the buffer (structure) to a file |
| scale | |
| script | |
| seldyn | |
| select | |
| selection | |
| sense | |
| strain | |
| undo | |
| unselect | |
| update |
INSTALLATION
Although UPU is a freeware, you will not find it easily in internet. The compressed packages are located at the author's homepage (binary (5.9MB)).
The preferred way of installation is the following:
wget -nv http://homepage.univie.ac.at/michal.jahnatek/upu/upu-1.4.0-linux-bundle.tar.bz2 mkdir ~/bin/upu ; tar -C ~/bin/upu -xjf upu-1.4.0-linux-bundle.tar.bz2
Do not forget to update your $PATH shell variable, e.g.:
printf '\nexport PATH=$PATH:~/bin/upu\n' >> ~/.bashrc
- Note: Currently, UPU may work smoothly on local machines and on TEKLA (but not on TEKLA2).