准备四个文件,POSCAR,POTCAR,INCAR0,KPOINTS,vasp5ncl.pbs
此时INCAR不要加MAGMOM,加MAGMOM这一步放到脚本中
#!/bin/bash ## set M m=8.0 pi=$(echo "scale=8;4*a(1.0)"|bc -l) ## loop start for i in `seq 0 5 90`;do j=0 theta=$(echo "scale=8;$i*$pi/180.0"|bc -l) z=$(echo "scale=3;${m}*c($theta)"|bc -l) f=${i}_$j mkdir $f cp POSCAR POTCAR KPOINTS vasp5ncl.pbs $f cp INCAR0 ${f}/INCAR cd $f phi=$(echo "scale=8;$j*$pi/180.0"|bc -l) echo $theta $phi >> ../logfile x=$(echo "scale=3;${m}*s($theta)*c($phi)"|bc -l) y=$(echo "scale=3;${m}*s($theta)*s($phi)"|bc -l) echo $x $y $z >> ../logfile cat >> INCAR <<EOF MAGMOM=12*0 $x $y $z $x $y $z EOF qsub vasp5ncl.pbs cd .. done
笔记: pi=$(echo "scale=8;4*a(1.0)"|bc -l) 定义pi的数值,scale为小数点后多少位 a (x) 为x的反正切,反正切返回弧度 i变化,j不变,是绕着yz面旋转
参考网站:
https://www.gnu.org/software/bc/manual/html_mono/bc.html
如果MAE为面内,则代码如下,i等于90,是因为面内的theta为90°:
#!/bin/bash ## set M m=8.0 pi=$(echo "scale=8;4*a(1.0)"|bc -l) ## loop start for j in `seq 0 5 90`;do i=90 theta=$(echo "scale=8;$i*$pi/180.0"|bc -l) z=$(echo "scale=3;${m}*c($theta)"|bc -l) f=${i}_$j mkdir $f cp POSCAR POTCAR KPOINTS vasp5ncl.pbs $f cp INCAR0 ${f}/INCAR cd $f phi=$(echo "scale=8;$j*$pi/180.0"|bc -l) echo $theta $phi >> ../logfile x=$(echo "scale=3;${m}*s($theta)*c($phi)"|bc -l) y=$(echo "scale=3;${m}*s($theta)*s($phi)"|bc -l) echo $x $y $z >> ../logfile cat >> INCAR <<EOF MAGMOM=12*0 $x $y $z $x $y $z EOF qsub vasp5ncl.pbs cd .. done
判断是否是文件夹,并进入
for file in * do file_path=`pwd` #反引号 dir_name="$file_path/$file" if test -d $dir_name then cp vasp5ncl.pbs ./$file cd ./$file qsub vasp5ncl.pbs cd .. fi done
批量杀掉任务:
for i in {20088..20106};do qdel $i done
No Comments
Leave a comment Cancel