Users of VASP are often familiar with the struggles/hardships to easily visualize the coordinates from the output file OUTCAR. To that effect, I wrote the following script … with help at a crucial stage from Pat Krogel, Center for Experimental Computation at Michigan Technological University. It requires the OUTCAR and POSCAR files from a VASP simulation to be in the same folder and when successfully completed, it generates in OUTPUT_FILENAME.xyz – containing frame-by-frame XYZ coordinate information corresponding to each (optimization) step.
The script is part of a GitHub repository.
Hi…
That is such a nice information. It can be very helpful to a lot of people here. Thank you so much for sharing.
Hi….I already save the script with the name vasp2xyz.sh but I have some problem to execute the program….This is what happen when I want to use the program :
[revival@localhost Program]$ vasp2xyz
bash: vasp2xyz: command not found
Could someone give me an answer about this???
GBU
I also try like this but no result :
[revival@localhost Program]$ vasp2xyz.sh ONCH
bash: vasp2xyz.sh: command not found
Any comment???
GBU
It is important [and often assumed] that you place these programs/scripts in one of the locations defined by
PATH
variable. You could check for this by running the command:echo $PATH
One such common location for keeping user’s personal collection of scripts is ‘
bin
‘ folder within your$HOME
directory. Be sure to change the permission of the downloaded script to 755 [or at least 700] by running the command:chmod 700 vasp2xyz.sh
Assuming that you are using the default shell [
/bin/bash
] for your login, you will need to add the following line to$HOME/.bashrc
file:export PATH="$HOME/bin:$PATH"
Save the file and run the command:
. $HOME/.bashrc
Once these [customary] steps are completed, you can call vasp2xyz.sh [or any such script stored in your ‘
bin
‘ folder] from just about any other folder.Hope this helps.
Dear Gowtham,,,,thanks so much for your reply and I did like you told me,,,and this is the result :
I change the mode of vasp2xyz
[revival@localhost Program]$ chmod 700 vasp2xyz.sh
I put the bin path into the .bashrc
[revival@localhost Program]$ vi ~/.bashrc
#——————————-
#this is for vasp2xyz.sh
export PATH=”$HOME/bin:$PATH”
and then I try again to execute the vasp2xyz.sh and it doesn’t work
[revival@localhost Program]$ vasp2xyz.sh
bash: vasp2xyz.sh: command not found
This is the $PATH
[revival@localhost Program]$ echo $PATH
/home/revival/bin:/home/revival/vtstscripts:/home/revival/ase/tools:/home/revival/XCrySDen-1.4.1bin-shared:/home/revival/vtstscripts:/home/revival/ase/tools:/home/revival/XCrySDen-1.4.1bin-shared:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin/:/usr/games:/usr/lib/qt4/bin:/home/revival/XCrySDen-1.4.1bin-shared/scripts:/home/revival/XCrySDen-1.4.1bin-shared/util:/home/revival/bin:/home/revival/XCrySDen-1.4.1bin-shared/scripts:/home/revival/XCrySDen-1.4.1bin-shared/util
Is there anything that I miss to do???? I’m sorry to ask a very basic question like this because I’m still a newbee in linux,,,,this is the first year for me to learn linux but I’m improving much after I read your reply
Thanks so much Gowtham
GBU
I am kind of stumped. Is there any output if you type
$HOME/bin/vasp2xyz.sh
??Dear Gowtham
This is the result
[revival@localhost bin]$ $HOME/bin/vasp2xyz.sh
bash: /home/revival/bin/vasp2xyz.sh: /bin/bash^M: bad interpreter: No such file or directory
I already put the file vasp2xyz.sh in bin folder,,,,how do you think Gowtham???
GBU
Ok – I think I know the problem. The error message says
/bin/bash^M.
^M
indicates invisible Carriage Return character. To get rid of them, do the following:1.
vi $HOME/bin/vasp2xyz.sh
2.
:g/CTRL+V+M/s///g
CTRL+V+M means hold down the Control Key along with V & M
3.
:wq
4. Then try
$HOME/bin/vasp2xyz.sh
And let me know if this works.
Dear Gowtham
I try like you told me and I find something strange
[revival@localhost bin]$ vi $HOME/bin/vasp2xyz.sh
then I type :g/CTRL+V+M/s///g
Then I press my keyboard
And it says :
E486: Pattern not found: CTRL+V+M
Then I save it :wq
After that I try again
[revival@localhost bin]$ vasp2xyz.sh
bash: /home/revival/bin/vasp2xyz.sh: /bin/bash^M: bad interpreter: No such file or directory
for information,,,,,I’m using mandriva operating system,,,,I don’t know whether it always happens like this with mandriva
So Gowtham,,,,how do you think???
Thanks so much for helping a newbee like me
GBU
O I miss type my reply
“Then I press Enter on my keyboard”
Sorry
CTRL+V+M means hold down the Control Key along with V & M
Dear Gowtham
I try it again
I type g/CTRL+V+M/s///g
CTRL+V+M means hold down the Control Key along with V & M
and then I press Enter on my keyboard….This is the result :
E486: Pattern not found: ^M
So I save it again,,,,and then I type in command line
[revival@localhost ~]$ $HOME/bin/vasp2xyz.sh
bash: /home/revival/bin/vasp2xyz.sh: /bin/bash^M: bad interpreter: No such file or directory
How do you think Gowtham???
GBU
OK – the last trick in my bag is to try the following command:
dos2unix $HOME/bin/vasp2xyz.sh
and see if the command works.
If not, then you are better off literally typing out the script.
Dear gowtham
I’m sorry to tell you bad result,,,,it’s fail again,,,
[revival@localhost ~]$ dos2unix $HOME/bin/vasp2xyz.sh
bash: dos2unix: command not found
Then I think I will need to type out the script by own,,,,anyway,,,,thanks so much for helping until now,,,,I appreciate all your kindness
I will tell again the result
GBU