fix atomic position

Vasp transition state theory tools

Moderator: moderators

Post Reply
MaxScott
Posts: 3
Joined: Wed Jan 03, 2018 8:01 pm
Contact:

fix atomic position

Post by MaxScott »

I have a POSCAR file. I want to do geometry optimization in VASP allwoing some atoms to move and fixing atomic position of the rest. I should use selective dynamics in POSCAR but it takes time to put F and T infront of each atom because the system is large. Is there a script in vtstscripts to do so?

Thanks!
zyang
Posts: 3
Joined: Sat Jan 27, 2018 5:08 am

Re: fix atomic position

Post by zyang »

ha! I write a simple script to add F or T to POSCAR, the only useful in this script is sed -i "${k}s/$/&F F T/g" POSCAR ,
k is the row number you add F or T. You can rewrite a simple script for yourself.
Here is main.

#!/bin/sh
for i in 01 02 03 04 05
do
cd /home/yangbc/zyang/Diamond/neb/pure_diamond/7diamond/11-2_1/glide
cd $i
#sed -i '6d' $i
sed -i '6aSelective Dynamics' POSCAR
for j in 9 35 # add "F F F" to the end of the line
do
sed -i "${j}s/$/&F F F/g" POSCAR
done
for k in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 36 37 38 39 40 # add "F F T" to the end of the line
do
sed -i "${k}s/$/&F F T/g" POSCAR
done
sed -i 's/^M/ /g' POSCAR
cd ..

done
zyang
Posts: 3
Joined: Sat Jan 27, 2018 5:08 am

Re: fix atomic position

Post by zyang »

say more, when you use sed -i "${j}s/$/&F F F/g" POSCAR to add FFF to the POSCAR, you can get a lot of ^M symbol in you POSCAR, I used sed -i 's/^M/ /g' POSCAR to delete them.
and, the method to type ^M when you write the script is Ctrl+V+M.
arosen
Posts: 25
Joined: Sat Oct 14, 2017 4:30 am

Re: fix atomic position

Post by arosen »

You could use the Atomic Simulation Environment to set constraints using the `FixAtoms` class. It's pretty user-friendly (see here: https://wiki.fysik.dtu.dk/ase/ase/constraints.html)
Post Reply