Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 
30 #include "XLogicalLattice.hh"
31 #include "G4PhysicalConstants.hh"
32 #include "Randomize.hh"
33 #include <cmath>
34 
36  fVresTheta=0;
37  fVresPhi=0;
38  fDresTheta=0;
39  fDresPhi=0;
40  fA=0;
41  fB=0;
42  fDosL=0;
43  fDosST=0;
44  fDosFT=0;
45  fBeta=0;
46  fLambda=0;
47  fGamma=0;
48  fMu=0;
49 }
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
53 
55 
56 
58  double Gamma,
59  double Lambda,
60  double Mu)
61 {
62  fBeta=Beta;
63  fGamma=Gamma;
64  fLambda=Lambda;
65  fMu=Mu;
66 
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70 
71 
73 {
74  //Constant governing the rate of isotope scattering, for use with
75  //XPhononScatteringProcess
76  fB=b;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80 
81 
83 {
84  //Constant governing rate of anharmonic down conversion of L-phonons,
85  //for use with XPhononDownconversionProcess
86  fA=a;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90 
91 void XLogicalLattice::SetLDOS(double LDOS)
92 {
93  //Longitudinal phonon density of states
94  fDosL=LDOS;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98 
99 
100 void XLogicalLattice::SetSTDOS(double STDOS)
101 {
102  //Slow transverse phonon density of states
103  fDosST=STDOS;
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
107 
108 
109 void XLogicalLattice::SetFTDOS(double FTDOS)
110 {
111  //Fast transverse phonon density of states
112  fDosFT=FTDOS;
113 }
114 
115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
116 
117 
119 {
120  return fBeta;
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
124 
125 
127 {
128  return fGamma;
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132 
133 
135 {
136  return fLambda;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
140 
141 
143 {
144  return fMu;
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
148 
149 
151 {
152  return fB;
153 }
154 
155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
156 
157 
159 {
160  return fA;
161 }
162 
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
164 
165 
167 {
168  return fDosL;
169 }
170 
171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
172 
173 
175 {
176  return fDosST;
177 }
178 
179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
180 
181 
183 {
184  return fDosFT;
185 }
186 
187 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
188 
189 
191 //Load map of group velocity scalars (m/s)
194  int pRes,
195  int polarizationState,
196  string m)
197 {
198  if((tRes>MAXRES)||(pRes>MAXRES)){
199  G4cout<<"\nk-V fMap exceeds maximum resolution of "<<MAXRES<<
200  " by "<<MAXRES<<". terminating."<<endl;
201  return false; //terminate if resolution out of bounds.
202  }
203 
204 
205  fMapFile.clear();
206 
207  fThetaRes=tRes;
208  fPhiRes=pRes;
209  fMapFile.open(m.data());
210  if(!fMapFile.is_open()) return false;
211 
212  for(int theta = 0; theta<fThetaRes; theta++){
213  for(int phi = 0; phi<fPhiRes; phi++){
214  fMapFile>>fMap[polarizationState][theta][phi];
215  }
216  }
217  fMapFile.close();
218  G4cout<<"\nXLogicalLattice::LoadMap() sucessful (Vg scalars)."<<endl;
219  fVresTheta=tRes; //store map dimensions
220  fVresPhi=pRes;
221  return true;
222 }
223 
224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
225 
226 
228 //Load map of group velocity unit vectors
231  int pRes,
232  int polarizationState,
233  string m)
234 {
235  if((tRes>MAXRES)||(pRes>MAXRES)){
236  G4cout<<"\nk-V map exceeds maximum resolution of "<<MAXRES<<
237  " by "<<MAXRES<<" terminating."<<endl;
238  return false; //terminate if resolution out of bounds.
239  }
240 
241 
242  fMapFile.clear();
243 
244  fThetaRes=tRes;
245  fPhiRes=pRes;
246  fMapFile.open(m.data());
247  if(!fMapFile.is_open()) return false;
248 
249  for(int theta = 0; theta<fThetaRes; theta++){
250  for(int phi = 0; phi<fPhiRes; phi++){
251  for(int coord = 0; coord<3; coord++){
252  fMapFile>>fN_map[polarizationState][theta][phi][coord];
253  }
254  }
255  }
256  G4cout<<"\n";
257  fMapFile.close();
258  G4cout<<"\nXLogicalLattice::Load_NMap() sucessful"<<endl;
259  fDresTheta=tRes; //store map dimesnions
260  fDresPhi=pRes;
261  return true;
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
265 
266 
267 
268 double XLogicalLattice::MapKtoV(int polarizationState,G4ThreeVector k)
269 {
270  //Given the phonon wave vector k, phonon physical volume Vol
271  //and polarizationState(0=LON, 1=FT, 2=ST),
272  //returns phonon velocity in m/s
273 
274  double theta, phi, tRes, pRes;
275 
276  tRes=pi/(fVresTheta);//The summant "-1" is required:index=[0:array length-1]
277  pRes=2*pi/(fVresPhi);
278 
279 
280  theta=k.getTheta();
281  phi=k.getPhi();
282 
283  if(phi<0) phi = phi + 2*pi;
284  if(theta>pi) theta=theta-pi;
285  //phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
286  if(fMap[polarizationState][int(theta/tRes)][int(phi/pRes)]==0){
287  G4cout<<"\nFound v=0 for polarization "<<polarizationState
288  <<" theta "<<theta<<" phi "<<phi<< " translating to map coords "
289  << "theta "<< int(theta/tRes) << " phi " << int(phi/pRes)<<endl;
290  }
291 
292  return fMap[polarizationState][int(theta/tRes)][int(phi/pRes)];
293 
294 }
295 
296 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
297 
298 
300 {
301  //Given the phonon wave vector k, phonon physical volume Vol
302  //and polarizationState(0=LON, 1=FT, 2=ST),
303  //returns phonon propagation direction as dimensionless unit vector
304 
305  double theta, phi, tRes, pRes;
306 
307  tRes=pi/(fDresTheta-1);//The summant "-1" is required:index=[0:array length-1]
308  pRes=2*pi/(fDresPhi-1);
309 
310  theta=k.getTheta();
311  phi=k.getPhi();
312 
313  if(theta>pi) theta=theta-pi;
314  //phi=[0 to 2 pi] in accordance with DMC //if(phi>pi/2) phi=phi-pi/2;
315  if(phi<0) phi = phi + 2*pi;
316 
317  G4int iTheta = int(theta/tRes+0.5);
318  G4int iPhi = int(phi/pRes+0.5);
319 
320 
321  G4ThreeVector v(fN_map[polarizationState][iTheta][iPhi][0],
322  fN_map[polarizationState][iTheta][iPhi][1],
323  fN_map[polarizationState][iTheta][iPhi][2]);
324 
325 
327  //v.Set(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
328  //v.Set(k.getX(), k.getY(), k.getZ());
329 
330  return v.unit();
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
334 
void SetDynamicalConstants(double, double, double, double)
#define MAXRES
bool Load_NMap(int, int, int, string)
void SetLDOS(double)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
void SetScatteringConstant(G4double)
double getTheta() const
int G4int
Definition: G4Types.hh:78
G4ThreeVector MapKtoVDir(int, G4ThreeVector)
double MapKtoV(int, G4ThreeVector)
void SetFTDOS(double)
tuple b
Definition: test.py:12
G4GLOB_DLL std::ostream G4cout
G4double GetAnhDecConstant()
static constexpr double m
Definition: G4SIunits.hh:129
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
tuple v
Definition: test.py:18
Hep3Vector unit() const
double getPhi() const
Definition of the XLogicalLattice class.
bool LoadMap(int, int, int, string)
void SetAnhDecConstant(G4double)
static constexpr double pi
Definition: G4SIunits.hh:75
double G4double
Definition: G4Types.hh:76
void SetSTDOS(double)
G4double GetScatteringConstant()