@sculxb
2017-12-29T11:19:10.000000Z
字数 2362
阅读 1347
Octopus
Na
脚本
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
do
rm -rf $i
mkdir $i
cd $i/
cat <<EOF > inp
CalculationMode = gs
UnitsOutput = eV_angstrom
FromScratch = yes
Radius = 8*angstrom
Spacing = 0.5*angstrom
%Coordinates
"Na" | 0 | 0 | 0 | no
%
TDDeltaStrength = 0.05/angstrom
%TDPolarization
1 | 0 | 0
0 | 1 | 0
0 | 0 | 1
%
TDPolarizationDirection = 1
TDPropagator = aetrs
TDTimeStep = 0.005/eV
TDMaxSteps = 10000
AbsorbingBoundaries = not_absorbing
EOF
for ((j=1;j<i;j++))
do
p=$(echo "scale=4;$j*3.72"|bc)
sed -i "9a \ \"Na\" | \\$p | 0 | 0 | no" ./inp
done
cat <<EOF >run.oct.sh
#PBS -N log
#PBS -l nodes=1:ppn=12
#PBS -l walltime=10:00:00:00
#PBS -q batch
#PBS -V
#PBS -S /bin/bash
### Set intel environment###
source /opt/intel/composer_xe_2015/bin/compilervars.sh intel64
source /opt/intel/mkl/bin/intel64/mklvars_intel64.sh
source /opt/intel/impi/5.0.2.044/bin64/mpivars.sh
cd \$PBS_O_WORKDIR
#EXEC=/opt/software/octopus/octopus-7.1/bin/oct-propagation_spectrum
EXEC=/opt/software/octopus/octopus-7.1/bin/octopus
#EXEC=/opt/software/octopus/octopus-4.1/bin/octopus_mpi
NP=\`cat \$PBS_NODEFILE | wc -l\`
NN=\`cat \$PBS_NODEFILE | sort | uniq | tee /tmp/nodes.\$$ | wc -l\`
cat \$PBS_NODEFILE > /tmp/nodefile.\$$
mpirun -genv I_MPI_DEVICE rdssm -machinefile /tmp/nodefile.\$$ -n \$NP \$EXEC >& oct.out
rm -rf /tmp/nodefile.\$$
rm -rf /tmp/nodes.\$$
EOF
qsub run.oct.sh
cd ..
done
用来计算电荷密度的
PROGRAM Density
real*8 :: tmpx(1:3), &
gsrho, &
frho(1:16) ! (1:Nw)
integer :: i, Nw, NP
real :: a=0.529177d0
real :: c=27.2d0*(0.529177d0**3)
!------------------------start
open(41,file='NP_fre')
read(41,*) NP
read(41,*) Nw
close(41)
frho(:) = 0.d0
open(42, file='gsrho', form='unformatted')
open(43, file='frho', form='unformatted')
open(40, file='dens.dat')
do i =1, NP , 1
read(42) tmpx(1:3),gsrho
read(43) frho(1:Nw)
tmpx(:) = tmpx(:)*a
gsrho = gsrho/a**3
frho(1:Nw) = frho(1:Nw)/c
write (40, "(E20.8\)") tmpx(1:3), gsrho, frho(1:Nw)
write (40,*)
enddo
close(42)
close(43)
close(40)
end
用来处理电荷密度震荡的
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <fstream>
using namespace std;
/******************************* main **************************/
int main(void) {
double x, y, z, gsrho;
long i, j, nP, nW;
double *frho;
ifstream rhof, frequ;
ofstream densf;
rhof.open("dens.dat",ios::in);
frequ.open("NP_fre",ios::in);
frequ >> nP >> nW ;
frequ.close();
frho = new double [nW];
densf.open("z_0.dat",ios::out);
for (i=0; i<nP; i++){
rhof >> x >> y >> z >> gsrho;
for (j=0; j<nW ; j++ ) rhof >> frho[j];
if (abs(z)<0.01) {
densf << x << "\t" << y << "\t" << gsrho ;
for (j=0; j<nW ; j++ ) densf << "\t" << frho[j];
densf << endl;
}
}
rhof.close();
densf.close();
delete[] frho;
return 0;
}