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!
fix atomic position
Moderator: moderators
Re: fix atomic position
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
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
Re: fix atomic position
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.
and, the method to type ^M when you write the script is Ctrl+V+M.
Re: fix atomic position
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)