[关闭]
@sculxb 2017-12-29T03:19:10.000000Z 字数 2362 阅读 1212

Octopus 钠链脚本

Octopus Na 脚本


  1. for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
  2. do
  3. rm -rf $i
  4. mkdir $i
  5. cd $i/
  6. cat <<EOF > inp
  7. CalculationMode = gs
  8. UnitsOutput = eV_angstrom
  9. FromScratch = yes
  10. Radius = 8*angstrom
  11. Spacing = 0.5*angstrom
  12. %Coordinates
  13. "Na" | 0 | 0 | 0 | no
  14. %
  15. TDDeltaStrength = 0.05/angstrom
  16. %TDPolarization
  17. 1 | 0 | 0
  18. 0 | 1 | 0
  19. 0 | 0 | 1
  20. %
  21. TDPolarizationDirection = 1
  22. TDPropagator = aetrs
  23. TDTimeStep = 0.005/eV
  24. TDMaxSteps = 10000
  25. AbsorbingBoundaries = not_absorbing
  26. EOF
  27. for ((j=1;j<i;j++))
  28. do
  29. p=$(echo "scale=4;$j*3.72"|bc)
  30. sed -i "9a \ \"Na\" | \\$p | 0 | 0 | no" ./inp
  31. done
  32. cat <<EOF >run.oct.sh
  33. #PBS -N log
  34. #PBS -l nodes=1:ppn=12
  35. #PBS -l walltime=10:00:00:00
  36. #PBS -q batch
  37. #PBS -V
  38. #PBS -S /bin/bash
  39. ### Set intel environment###
  40. source /opt/intel/composer_xe_2015/bin/compilervars.sh intel64
  41. source /opt/intel/mkl/bin/intel64/mklvars_intel64.sh
  42. source /opt/intel/impi/5.0.2.044/bin64/mpivars.sh
  43. cd \$PBS_O_WORKDIR
  44. #EXEC=/opt/software/octopus/octopus-7.1/bin/oct-propagation_spectrum
  45. EXEC=/opt/software/octopus/octopus-7.1/bin/octopus
  46. #EXEC=/opt/software/octopus/octopus-4.1/bin/octopus_mpi
  47. NP=\`cat \$PBS_NODEFILE | wc -l\`
  48. NN=\`cat \$PBS_NODEFILE | sort | uniq | tee /tmp/nodes.\$$ | wc -l\`
  49. cat \$PBS_NODEFILE > /tmp/nodefile.\$$
  50. mpirun -genv I_MPI_DEVICE rdssm -machinefile /tmp/nodefile.\$$ -n \$NP \$EXEC >& oct.out
  51. rm -rf /tmp/nodefile.\$$
  52. rm -rf /tmp/nodes.\$$
  53. EOF
  54. qsub run.oct.sh
  55. cd ..
  56. done

用来计算电荷密度的

  1. PROGRAM Density
  2. real*8 :: tmpx(1:3), &
  3. gsrho, &
  4. frho(1:16) ! (1:Nw)
  5. integer :: i, Nw, NP
  6. real :: a=0.529177d0
  7. real :: c=27.2d0*(0.529177d0**3)
  8. !------------------------start
  9. open(41,file='NP_fre')
  10. read(41,*) NP
  11. read(41,*) Nw
  12. close(41)
  13. frho(:) = 0.d0
  14. open(42, file='gsrho', form='unformatted')
  15. open(43, file='frho', form='unformatted')
  16. open(40, file='dens.dat')
  17. do i =1, NP , 1
  18. read(42) tmpx(1:3),gsrho
  19. read(43) frho(1:Nw)
  20. tmpx(:) = tmpx(:)*a
  21. gsrho = gsrho/a**3
  22. frho(1:Nw) = frho(1:Nw)/c
  23. write (40, "(E20.8\)") tmpx(1:3), gsrho, frho(1:Nw)
  24. write (40,*)
  25. enddo
  26. close(42)
  27. close(43)
  28. close(40)
  29. end

用来处理电荷密度震荡的

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <fstream>
  6. using namespace std;
  7. /******************************* main **************************/
  8. int main(void) {
  9. double x, y, z, gsrho;
  10. long i, j, nP, nW;
  11. double *frho;
  12. ifstream rhof, frequ;
  13. ofstream densf;
  14. rhof.open("dens.dat",ios::in);
  15. frequ.open("NP_fre",ios::in);
  16. frequ >> nP >> nW ;
  17. frequ.close();
  18. frho = new double [nW];
  19. densf.open("z_0.dat",ios::out);
  20. for (i=0; i<nP; i++){
  21. rhof >> x >> y >> z >> gsrho;
  22. for (j=0; j<nW ; j++ ) rhof >> frho[j];
  23. if (abs(z)<0.01) {
  24. densf << x << "\t" << y << "\t" << gsrho ;
  25. for (j=0; j<nW ; j++ ) densf << "\t" << frho[j];
  26. densf << endl;
  27. }
  28. }
  29. rhof.close();
  30. densf.close();
  31. delete[] frho;
  32. return 0;
  33. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注