Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. double Funktionswertmu(int mu,double x,double y,double z,double** &exponenten,double** &Coordinates,int** &L,double** &contraccoeff,int* &mubasisfunktionentyp,int* &mucoordinaten,int* &prim){
  2. double WERT=0.0;
  3. for(int p=0; p<prim[mubasisfunktionentyp[mu]]; p++){
  4. WERT=WERT+contraccoeff[mubasisfunktionentyp[mu]][p]*pow((x-Coordinates[mucoordinaten[mu]][0]),L[mubasisfunktionentyp[mu]][0])*
  5. pow((y-Coordinates[mucoordinaten[mu]][1]),L[mubasisfunktionentyp[mu]][1])*
  6. pow((z-Coordinates[mucoordinaten[mu]][2]),L[mubasisfunktionentyp[mu]][2])*
  7. exp(-exponenten[mubasisfunktionentyp[mu]][p]*pow((x-Coordinates[mucoordinaten[mu]][0]),2))*
  8. exp(-exponenten[mubasisfunktionentyp[mu]][p]*pow((y-Coordinates[mucoordinaten[mu]][1]),2))*
  9. exp(-exponenten[mubasisfunktionentyp[mu]][p]*pow((z-Coordinates[mucoordinaten[mu]][2]),2));
  10. }
  11. return WERT;
  12. }
  13.  
  14. double CalcRHOXYZ(double x,double y,double z,double** &exponenten,double** &Coordinates,int** &L,double** &contraccoeff,int* &mubasisfunktionentyp,int* &mucoordinaten,double* &Pdiff,int* &prim,int N){
  15. double RHO=0.0;
  16. for(int mu=0; mu<N; mu++){
  17. for(int nu=0; nu<N; nu++){
  18. RHO+=Pdiff[mu+nu*N]*Funktionswertmu(mu,x,y,z,exponenten,Coordinates,L,contraccoeff,mubasisfunktionentyp,mucoordinaten,prim)*
  19. Funktionswertmu(nu,x,y,z,exponenten,Coordinates,L,contraccoeff,mubasisfunktionentyp,mucoordinaten,prim);
  20. }
  21. }
  22. return RHO;
  23. }
  24.  
  25.  
  26. // Berechnung der Elektronendichte RHO am Ort x,y,z.
  27.  
  28. //test
  29. //cout<<CalcRHOXYZ(1.0,1.0,1.0,exponenten,Coordinates,L,contraccoeff,mubasisfunktionentyp,mucoordinaten,Pdiff,prim,N);
  30.  
  31. // Berechnung des RHOarrays
  32.  
  33. // Die Grenzen eingeben,zwischen denen abgerastert werden soll
  34. double XMax=-1.0;
  35. double XMin=-3.0;
  36. double YMax=4.0;
  37. double YMin=2.0;
  38. double ZMax=1.0;
  39. double ZMin=-1.0;
  40. // Die Anzahl der Rasterpunkte eingeben in Richtung X,Y,Z
  41. int MaxPointsX=20;
  42. int MaxPointsY=25;
  43. int MaxPointsZ=30;
  44. // Berechnung der Schrittweite zwischen den Rasterpunkten
  45. double SchrittweiteX=abs(XMin-XMax)/(MaxPointsX-1);
  46. double SchrittweiteY=abs(YMin-YMax)/(MaxPointsY-1);
  47. double SchrittweiteZ=abs(ZMin-ZMax)/(MaxPointsZ-1);
  48. // Festlegung des Arrays in dem die Elektronendichten zu einem Rasterpunkt eingeschrieben werden
  49. double* RHOARRAY = new double [MaxPointsX*MaxPointsY*MaxPointsZ];
  50. // Festlegung, welche Achse konstant gehalten wird. z.B. für E-dichte in XY-Ebene z-Achse konstant halten
  51. bool constantXAchse=true;
  52. bool constantYAchse=false;
  53. bool constantZAchse=false;
  54. // Festlegung wo auf der konstanten Achse der Querschnitt erfolgt
  55. double Xconstant=1.345;
  56. double Yconstant=1.2392;
  57. double Zconstant=1.782346;
  58.  
  59. int zaehler=0;
  60. if(constantXAchse==true){MaxPointsX=1;}
  61. if(constantYAchse==true){MaxPointsY=1;}
  62. if(constantZAchse==true){MaxPointsZ=1;}
  63. for(int PointX=0; PointX<MaxPointsX; PointX++){
  64. for(int PointY=0; PointY<MaxPointsY; PointY++){
  65. for(int PointZ=0; PointZ<MaxPointsZ; PointZ++){
  66. double x=XMin+SchrittweiteX*PointX;
  67. double y=YMin+SchrittweiteY*PointY;
  68. double z=ZMin+SchrittweiteZ*PointZ;
  69. if(constantXAchse==true){x=Xconstant;}
  70. if(constantYAchse==true){y=Yconstant;}
  71. if(constantZAchse==true){z=Zconstant;}
  72. RHOARRAY[PointX+PointY*MaxPointsX+PointZ*MaxPointsX*MaxPointsY]=CalcRHOXYZ(x,y,z,exponenten,Coordinates,L,contraccoeff,mubasisfunktionentyp,mucoordinaten,Pdiff,prim,N);
  73. zaehler+=1;
  74. }
  75. }
  76. }
  77.  
  78.  
  79. // Ausgabe der Elektronendichte an den Rasterpunkten und deren Koordinaten
  80. cout<<endl;
  81. cout<<"Ausgabe der Elektronendichte an den Rasterpunkten"<<endl;
  82. cout<<endl;
  83.  
  84. cout<<endl;
  85. cout<<"Anzahl berechneter Rasterpunkte für die Elektronendichte-Darstellung"<<endl;
  86. cout<<zaehler<<endl;
  87. cout<<endl;
  88.  
  89. if(constantXAchse==false){cout<<" x-Koordinaten ";}
  90. if(constantYAchse==false){cout<<"y-Kooridnaten ";}
  91. if(constantZAchse==false){cout<<"z-Koordinaten ";}
  92. cout<<" DELTARHO(x,y,z) ";
  93. if(constantXAchse==true){printf("x-Querschn.:%12.8f" ,Xconstant);}
  94. if(constantYAchse==true){printf(" y-Querschn.:%12.8f" ,Yconstant);}
  95. if(constantZAchse==true){printf(" z-Querschn.:%12.8f" ,Zconstant);}
  96. cout<<endl;
  97. cout<<endl;
  98.  
  99. for(int PointX=0; PointX<MaxPointsX; PointX++){
  100. for(int PointY=0; PointY<MaxPointsY; PointY++){
  101. for(int PointZ=0; PointZ<MaxPointsZ; PointZ++){
  102. double x=XMin+SchrittweiteX*PointX;
  103. double y=YMin+SchrittweiteY*PointY;
  104. double z=ZMin+SchrittweiteZ*PointZ;
  105. if(constantXAchse==false){printf("%12.8f ", x);}
  106. if(constantYAchse==false){printf("%12.8f ", y);}
  107. if(constantZAchse==false){printf("%12.8f ", z);}
  108. cout<<" ";
  109. cout<<RHOARRAY[PointX+PointY*MaxPointsX+PointZ*MaxPointsX*MaxPointsY]<<endl;
  110. }
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement