Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <math.h>
  4. #include <iomanip>
  5. # define M_PI           3.14159265358979323846
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     ofstream kpoints;
  12.     kpoints.open("kpoints01.txt");
  13.  
  14.     double a = 4.235;
  15.     double b = 6.098;
  16.     double c = 15;
  17.  
  18. //    double Gx = 0.0, Gy = 0.0;
  19. //    double Xx = M_PI/a, Xy = 0.0;
  20. //    double Mx = M_PI/a, My = M_PI/b;
  21. //    double Yx = 0.0, Yy = M_PI/b;
  22.  
  23.     double Gx = 0.0, Gy = 0.0;
  24.     double Xx = 0.5, Xy = 0.0;
  25.     double Mx = 0.5, My = 0.5;
  26.     double Yx = 0.0, Yy = 0.5;
  27.  
  28. //    double Gx = 0.0, Gy = 0.0;
  29. //    double Xx = a/M_PI/2, Xy = 0.0;
  30. //    double Mx = a/M_PI/2, My = b/M_PI/2;
  31. //    double Yx = 0.0, Yy = b/M_PI/2;
  32.  
  33.     int n=512;
  34.     double dGX = (Xx-Gx)/n;
  35.     double dXM = (My-Xy)/n;
  36.     double dMY = (Yx-Mx)/n;
  37.     double dYG = (Gy-Yy)/n;
  38.     kpoints << setprecision(15)<<fixed;
  39.     //cout << endl << "G " <<Gx<<", "<<Gy<< endl << endl;
  40.     for(int i=0;i<n;i++)
  41.     {
  42.         kpoints << Gx + dGX * i<< ", " << Gy <<", "<<0.0<< endl;
  43.     }
  44.  
  45.     //cout << endl << "X " <<Xx<<", "<<Xy<< endl << endl;
  46.     for(int i=0;i<n;i++)
  47.     {
  48.         kpoints << Xx<< ", " << Xy + dXM * i <<", "<<0.0<< endl;
  49.     }
  50.  
  51.     //cout << endl << "M " <<Mx<<", "<<My<< endl << endl;
  52.     for(int i=0;i<n;i++)
  53.     {
  54.         kpoints << Yx - dMY * (n-1-i)<< ", " << My <<", "<<0.0<< endl;
  55.     }
  56.  
  57.     //cout << endl << "Y " <<Yx<<", "<<Yy<< endl << endl;
  58.     for(int i=0;i<n;i++)
  59.     {
  60.         kpoints << Yx << ", " << Gy - dYG * (n-1-i) <<", "<<0.0<< endl;
  61.     }
  62.  
  63.     //cout << endl << "G " <<Gx<<", "<<Gy<< endl << endl;
  64.  
  65.     kpoints.close();
  66.  
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement