Geant4  10.02
XLogicalLattice.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 #include "XLogicalLattice.hh"
28 #include "G4PhysicalConstants.hh"
29 #include "Randomize.hh"
30 #include <cmath>
31 
33  fVresTheta=0;
34  fVresPhi=0;
35  fDresTheta=0;
36  fDresPhi=0;
37  fA=0;
38  fB=0;
39  fDosL=0;
40  fDosST=0;
41  fDosFT=0;
42  fBeta=0;
43  fLambda=0;
44  fGamma=0;
45  fMu=0;
46 }
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
50 
52 
53 
55  double Gamma,
56  double Lambda,
57  double Mu)
58 {
59  fBeta=Beta;
60  fGamma=Gamma;
61  fLambda=Lambda;
62  fMu=Mu;
63 
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
67 
68 
70 {
71  //Constant governing the rate of isotope scattering, for use with
72  //XPhononScatteringProcess
73  fB=b;
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
77 
78 
80 {
81  //Constant governing rate of anharmonic down conversion of L-phonons,
82  //for use with XPhononDownconversionProcess
83  fA=a;
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
87 
88 void XLogicalLattice::SetLDOS(double LDOS)
89 {
90  //Longitudinal phonon density of states
91  fDosL=LDOS;
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95 
96 
97 void XLogicalLattice::SetSTDOS(double STDOS)
98 {
99  //Slow transverse phonon density of states
100  fDosST=STDOS;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104 
105 
106 void XLogicalLattice::SetFTDOS(double FTDOS)
107 {
108  //Fast transverse phonon density of states
109  fDosFT=FTDOS;
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
113 
114 
116 {
117  return fBeta;
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
121 
122 
124 {
125  return fGamma;
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
129 
130 
132 {
133  return fLambda;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
137 
138 
140 {
141  return fMu;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
145 
146 
148 {
149  return fB;
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
153 
154 
156 {
157  return fA;
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
161 
162 
164 {
165  return fDosL;
166 }
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
169 
170 
172 {
173  return fDosST;
174 }
175 
176 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
177 
178 
180 {
181  return fDosFT;
182 }
183 
184 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
185 
186 
188 //Load map of group velocity scalars (m/s)
191  int pRes,
192  int polarizationState,
193  string m)
194 {
195  if((tRes>MAXRES)||(pRes>MAXRES)){
196  G4cout<<"\nk-V fMap exceeds maximum resolution of "<<MAXRES<<
197  " by "<<MAXRES<<". terminating."<<endl;
198  return false; //terminate if resolution out of bounds.
199  }
200 
201 
202  fMapFile.clear();
203 
204  fThetaRes=tRes;
205  fPhiRes=pRes;
206  fMapFile.open(m.data());
207  if(!fMapFile.is_open()) return false;
208 
209  for(int theta = 0; theta<fThetaRes; theta++){
210  for(int phi = 0; phi<fPhiRes; phi++){
211  fMapFile>>fMap[polarizationState][theta][phi];
212  }
213  }
214  fMapFile.close();
215  G4cout<<"\nXLogicalLattice::LoadMap() sucessful (Vg scalars)."<<endl;
216  fVresTheta=tRes; //store map dimensions
217  fVresPhi=pRes;
218  return true;
219 }
220 
221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
222 
223 
225 //Load map of group velocity unit vectors
228  int pRes,
229  int polarizationState,
230  string m)
231 {
232  if((tRes>MAXRES)||(pRes>MAXRES)){
233  G4cout<<"\nk-V map exceeds maximum resolution of "<<MAXRES<<
234  " by "<<MAXRES<<" terminating."<<endl;
235  return false; //terminate if resolution out of bounds.
236  }
237 
238 
239  fMapFile.clear();
240 
241  fThetaRes=tRes;
242  fPhiRes=pRes;
243  fMapFile.open(m.data());
244  if(!fMapFile.is_open()) return false;
245 
246  for(int theta = 0; theta<fThetaRes; theta++){
247  for(int phi = 0; phi<fPhiRes; phi++){
248  for(int coord = 0; coord<3; coord++){
249  fMapFile>>fN_map[polarizationState][theta][phi][coord];
250  }
251  }
252  }
253  G4cout<<"\n";
254  fMapFile.close();
255  G4cout<<"\nXLogicalLattice::Load_NMap() sucessful"<<endl;
256  fDresTheta=tRes; //store map dimesnions
257  fDresPhi=pRes;
258  return true;
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
262 
263 
264 
265 double XLogicalLattice::MapKtoV(int polarizationState,G4ThreeVector k)
266 {
267  //Given the phonon wave vector k, phonon physical volume Vol
268  //and polarizationState(0=LON, 1=FT, 2=ST),
269  //returns phonon velocity in m/s
270 
271  double theta, phi, tRes, pRes;
272 
273  tRes=pi/(fVresTheta);//The summant "-1" is required:index=[0:array length-1]
274  pRes=2*pi/(fVresPhi);
275 
276 
277  theta=k.getTheta();
278  phi=k.getPhi();
279 
280  if(phi<0) phi = phi + 2*pi;
281  if(theta>pi) theta=theta-pi;
282  //phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
283  if(fMap[polarizationState][int(theta/tRes)][int(phi/pRes)]==0){
284  G4cout<<"\nFound v=0 for polarization "<<polarizationState
285  <<" theta "<<theta<<" phi "<<phi<< " translating to map coords "
286  << "theta "<< int(theta/tRes) << " phi " << int(phi/pRes)<<endl;
287  }
288 
289  return fMap[polarizationState][int(theta/tRes)][int(phi/pRes)];
290 
291 }
292 
293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
294 
295 
297 {
298  //Given the phonon wave vector k, phonon physical volume Vol
299  //and polarizationState(0=LON, 1=FT, 2=ST),
300  //returns phonon propagation direction as dimensionless unit vector
301 
302  double theta, phi, tRes, pRes;
303 
304  tRes=pi/(fDresTheta-1);//The summant "-1" is required:index=[0:array length-1]
305  pRes=2*pi/(fDresPhi-1);
306 
307  theta=k.getTheta();
308  phi=k.getPhi();
309 
310  if(theta>pi) theta=theta-pi;
311  //phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
312  if(phi<0) phi = phi + 2*pi;
313 
314  G4int iTheta = int(theta/tRes+0.5);
315  G4int iPhi = int(phi/pRes+0.5);
316 
317 
318  G4ThreeVector v(fN_map[polarizationState][iTheta][iPhi][0],
319  fN_map[polarizationState][iTheta][iPhi][1],
320  fN_map[polarizationState][iTheta][iPhi][2]);
321 
322 
324  //v.Set(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
325  //v.Set(k.getX(), k.getY(), k.getZ());
326 
327  return v.unit();
328 }
329 
330 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
331 
void SetDynamicalConstants(double, double, double, double)
#define MAXRES
bool Load_NMap(int, int, int, string)
CLHEP::Hep3Vector G4ThreeVector
void SetLDOS(double)
double fMap[3][MAXRES][MAXRES]
void SetScatteringConstant(G4double)
G4double a
Definition: TRTMaterials.hh:39
int G4int
Definition: G4Types.hh:78
G4ThreeVector MapKtoVDir(int, G4ThreeVector)
double MapKtoV(int, G4ThreeVector)
void SetFTDOS(double)
G4GLOB_DLL std::ostream G4cout
G4double GetAnhDecConstant()
double fN_map[3][MAXRES][MAXRES][3]
static const double pi
Definition: G4SIunits.hh:74
bool LoadMap(int, int, int, string)
void SetAnhDecConstant(G4double)
static const double m
Definition: G4SIunits.hh:128
double G4double
Definition: G4Types.hh:76
void SetSTDOS(double)
G4double GetScatteringConstant()