Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4phonon
|
||||
# Package: Geant4.src.G4processes.G4phonon
|
||||
#
|
||||
# CMakeLists.txt for building a single granular library.
|
||||
#
|
||||
# Generated on : 24/10/2013
|
||||
#
|
||||
# $Id: CMakeLists.txt 75844 2013-11-06 17:35:56Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
include(Geant4MacroLibraryTargets)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# $Id: GNUmakefile 75844 2013-11-06 17:35:56Z gcosmo $
|
||||
# ------------------------------------------------------------
|
||||
# GNUmakefile for phonons library. M.Kelsey 24-Oct-2013
|
||||
# ------------------------------------------------------------
|
||||
|
||||
name := G4phonon
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/particles/bosons/include \
|
||||
-I$(G4BASE)/materials/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,85 @@
|
||||
$Id: History 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the SVN log-message one should put at every
|
||||
committal in the SVN repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
15 November 2013 Michael Kelsey (prophonon-V09-06-07)
|
||||
------------------------------------------------------
|
||||
- G4PhononDownconversion.cc: Address Coverity #53462, initialize data
|
||||
buffers in ctor.
|
||||
|
||||
- G4PhononReflection.cc: Address Coverity #53407, throw exception if input
|
||||
track polarization is invalid (i.e., track is not a phonon).
|
||||
|
||||
- G4LatticeManager.hh: Address Coverity #53461, drop lattice counters.
|
||||
|
||||
- G4LatticeReader.hh: Move ctor, dtor implementations to .cc file; fix
|
||||
comment on psLatfile, as stream is owned by reader.
|
||||
|
||||
- G4LatticeReader.cc: Address Coverity #53491-53495, check input data fNX
|
||||
and fNY against allowed size of lattice array (G4LatticeLogical::MAXRES)
|
||||
before using them. NOTE: Requires materials-V09-06-32 or later.
|
||||
|
||||
15 November 2013 Michael Kelsey (prophonon-V09-06-06)
|
||||
------------------------------------------------------
|
||||
- G4VPhononProcess.cc: Add verbosity reporting of vgroup before and after
|
||||
rotation.
|
||||
|
||||
13 November 2013 Michael Kelsey (prophonon-V09-06-05)
|
||||
------------------------------------------------------
|
||||
- G4LatticeManager: Avoid double-delete at end of job by registering unique
|
||||
lattice pointers into std::set<>, and deleting those instead of std::map
|
||||
entries. Supporting non-virtual utility functions for use in ctor/dtor.
|
||||
|
||||
12 November 2013 Michael Kelsey (prophonon-V09-06-04)
|
||||
------------------------------------------------------
|
||||
- G4LatticeReader.cc: Per G.Folger, errors processing input file should
|
||||
throw fatal exception, not return null pointer.
|
||||
|
||||
12 November 2013 Michael Kelsey (prophonon-V09-06-03)
|
||||
------------------------------------------------------
|
||||
- G4VPhononProcess.cc: Add verboseLevel-controlled output to show
|
||||
generation of secondaries.
|
||||
|
||||
- G4PhononDownConversion.cc, G4PhononScattering.cc: Add verboseLevel output
|
||||
to show MFP.
|
||||
|
||||
11 November 2013 Michael Kelsey (prophonon-V09-06-02)
|
||||
------------------------------------------------------
|
||||
- G4PhononTrackMap: Move implementation of Clear() to .cc file. Called
|
||||
from constructor to try to ensure that map data member isn't wonky on
|
||||
Windows.
|
||||
|
||||
6 November 2013 Michael Kelsey (prophonon-V09-06-01)
|
||||
-----------------------------------------------------
|
||||
- G4LatticeReader.cc: Fix compiler warning about implicit cast of string
|
||||
literal to char*, by casting getenv() to (const char*).
|
||||
|
||||
5 November 2013 Michael Kelsey (prophonon-V09-06-00)
|
||||
-----------------------------------------------------
|
||||
NEW PACKAGE for Release 10, containing processes for phonon propagation
|
||||
and interaction in materials:
|
||||
|
||||
README
|
||||
G4LatticeManager.hh,.cc
|
||||
G4LatticeReader.hh,.cc
|
||||
G4PhononDownconversion.hh,.cc
|
||||
G4PhononPolarization.hh,.cc
|
||||
G4PhononReflection.hh,.cc
|
||||
G4PhononScattering.hh,.cc
|
||||
G4PhononTrackMap.hh,.cc
|
||||
G4VPhononProcess.hh,.cc
|
||||
@@ -0,0 +1,39 @@
|
||||
$Id: README 75844 2013-11-06 17:35:56Z gcosmo $
|
||||
|
||||
Contains processes for phonon propagation and interaction in materials.
|
||||
|
||||
G4LatticeManager: Singleton (TLS) for logical and physical lattices
|
||||
associated with materials and volumes.
|
||||
|
||||
G4LatticeReader: Driver to create logical lattices by reading in
|
||||
configuration files and velocity map tables. NOTE: This class will
|
||||
be moved to source/materials/ once Release 10.0 is deployed.
|
||||
|
||||
The lattice data files should be stored under $G4LATTICEDATA (set to
|
||||
"./CrystalMaps" by default, to support the extended example). The
|
||||
configuration and velocity map files for a given material should be stored
|
||||
in a subdirectory with that material's name (e.g., "Ge").
|
||||
|
||||
Documentation for the lattice configuration files will be expanded in the
|
||||
future.
|
||||
|
||||
G4VPhononProcess: Virtual base class for all processes below, providing
|
||||
some utility functions.
|
||||
|
||||
G4PhononDownconversion: Process to convert single longitudinal phonons
|
||||
either into pairs of two transverse phonons, or to emit a transverse
|
||||
phonon.
|
||||
|
||||
G4PhononReflection: Placeholder process to reflect phonons off of crystal
|
||||
surfaces. Currently phonons are absorbed, or converted to hits.
|
||||
|
||||
G4PhononScattering: Process to scatter phonons off the surrounding
|
||||
lattice. Currently handles "transportation" as well, but each
|
||||
scatter destroys the phonon and creates a new one.
|
||||
|
||||
G4PhononPolarization: Enum with conversion functions to map the three
|
||||
phonon particle definitions onto internal codes (L=0, TS=1, TF=2).
|
||||
|
||||
G4PhononTrackMap: Singleton (TLS) map file to connect tracks with
|
||||
wavevectors. for temporary use until wavevector is added to G4Track
|
||||
as a data member, after Release 10.0.
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file materials/include/G4LatticeManager.hh
|
||||
/// \brief Definition of the G4LatticeManager class
|
||||
//
|
||||
// $Id: G4LatticeManager.hh 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131113 Add registry to carry unique lattice pointers, for EOJ deletion
|
||||
// 20131115 Drop lattice counters, not used anywhere
|
||||
|
||||
#ifndef G4LatticeManager_h
|
||||
#define G4LatticeManager_h 1
|
||||
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class G4LatticeLogical;
|
||||
class G4LatticePhysical;
|
||||
class G4Material;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
|
||||
class G4LatticeManager {
|
||||
private:
|
||||
static G4ThreadLocal G4LatticeManager* fLM; // Singleton
|
||||
|
||||
public:
|
||||
static G4LatticeManager* GetLatticeManager();
|
||||
|
||||
void SetVerboseLevel(G4int vb) { verboseLevel = vb; }
|
||||
|
||||
void Reset(); // Remove and delete all registered lattices
|
||||
|
||||
// Users may register physical or logical lattices with volumes
|
||||
G4bool RegisterLattice(G4VPhysicalVolume*, G4LatticePhysical*);
|
||||
G4bool RegisterLattice(G4VPhysicalVolume*, G4LatticeLogical*);
|
||||
|
||||
// Logical lattices are associated with materials
|
||||
G4bool RegisterLattice(G4Material*, G4LatticeLogical*);
|
||||
|
||||
// Logical lattices may be read from <latDir>/config.txt data file
|
||||
G4LatticeLogical* LoadLattice(G4Material*, const G4String& latDir);
|
||||
G4LatticeLogical* GetLattice(G4Material*) const;
|
||||
G4bool HasLattice(G4Material*) const;
|
||||
|
||||
// Combine loading and registration (Material extracted from volume)
|
||||
G4LatticePhysical* LoadLattice(G4VPhysicalVolume*, const G4String& latDir);
|
||||
|
||||
// NOTE: Passing Vol==0 will return the default lattice
|
||||
G4LatticePhysical* GetLattice(G4VPhysicalVolume*) const;
|
||||
G4bool HasLattice(G4VPhysicalVolume*) const;
|
||||
|
||||
G4double MapKtoV(G4VPhysicalVolume*, G4int, const G4ThreeVector &) const;
|
||||
|
||||
G4ThreeVector MapKtoVDir(G4VPhysicalVolume*, G4int,
|
||||
const G4ThreeVector&) const;
|
||||
|
||||
protected:
|
||||
void Clear(); // Remove entries from lookup tables w/o deletion
|
||||
|
||||
protected:
|
||||
G4int verboseLevel; // Allow users to enable diagnostic messages
|
||||
|
||||
typedef std::map<G4Material*, G4LatticeLogical*> LatticeMatMap;
|
||||
typedef std::set<G4LatticeLogical*> LatticeLogReg;
|
||||
|
||||
LatticeLogReg fLLattices; // Registry of unique lattice pointers
|
||||
LatticeMatMap fLLatticeList;
|
||||
|
||||
typedef std::map<G4VPhysicalVolume*, G4LatticePhysical*> LatticeVolMap;
|
||||
typedef std::set<G4LatticePhysical*> LatticePhyReg;
|
||||
|
||||
LatticePhyReg fPLattices; // Registry of unique lattice pointers
|
||||
LatticeVolMap fPLatticeList;
|
||||
|
||||
private:
|
||||
G4LatticeManager();
|
||||
virtual ~G4LatticeManager();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4LatticeReader.hh
|
||||
/// \brief Definition of the G4LatticeReader class
|
||||
//
|
||||
// NOTE: This reader class for logical lattices should be moved to
|
||||
// materials/ after the 10.0 release (and this comment removed).
|
||||
// $Id: G4LatticeReader.hh 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131115 Move ctor, dtor implementations to .cc file.
|
||||
|
||||
#ifndef G4LatticeReader_h
|
||||
#define G4LatticeReader_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include <iosfwd>
|
||||
|
||||
class G4LatticeLogical;
|
||||
|
||||
class G4LatticeReader {
|
||||
public:
|
||||
G4LatticeReader(G4int vb=0);
|
||||
~G4LatticeReader();
|
||||
|
||||
void SetVerboseLevel(G4int vb) { verboseLevel = vb; }
|
||||
|
||||
G4LatticeLogical* MakeLattice(const G4String& filepath);
|
||||
|
||||
protected:
|
||||
G4bool OpenFile(const G4String& filepath);
|
||||
G4bool ProcessToken();
|
||||
G4bool ProcessValue(const G4String& name); // Numerical parameters
|
||||
G4bool ProcessConstants(); // Four dynamical constants
|
||||
G4bool ProcessMap(); // Velocity magnitudes file
|
||||
G4bool ProcessNMap(); // Direction vectors file
|
||||
G4bool ReadMapInfo(); // Get map file parameters
|
||||
G4bool SkipComments(); // Everything after '#'
|
||||
void CloseFile();
|
||||
|
||||
private:
|
||||
G4int verboseLevel; // For reporting progress, also use G4VERBOSE
|
||||
|
||||
std::ifstream* psLatfile; // Configuration file being read
|
||||
G4LatticeLogical* pLattice; // Lattice under construction (not owned)
|
||||
|
||||
G4String fMapPath; // Path to config file to find velocity maps
|
||||
G4String fToken; // Reusable buffers for reading file
|
||||
G4double fValue; // ... floating point data values
|
||||
G4String fMap, fsPol; // ... map filename and polarization code
|
||||
G4int fPol, fNX, fNY; // ... map binning in each direction
|
||||
|
||||
static const G4String fDataDir; // Directory path ($G4LATTICEDATA)
|
||||
};
|
||||
|
||||
#endif /* G4LatticeReader_h */
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4PhononDownconversion.hh
|
||||
/// \brief Definition of the G4PhononDownconversion class
|
||||
//
|
||||
// $Id: G4PhononDownconversion.hh 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
#ifndef G4PhononDownconversion_h
|
||||
#define G4PhononDownconversion_h 1
|
||||
|
||||
#include "G4VPhononProcess.hh"
|
||||
|
||||
class G4PhononDownconversion : public G4VPhononProcess {
|
||||
public:
|
||||
G4PhononDownconversion(const G4String& processName ="phononDownconversion");
|
||||
virtual ~G4PhononDownconversion();
|
||||
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
|
||||
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition&);
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
|
||||
|
||||
private:
|
||||
// relative probability that anharmonic decay occurs L->L'+T'
|
||||
inline double GetLTDecayProb(G4double, G4double) const;
|
||||
inline double GetTTDecayProb(G4double, G4double) const;
|
||||
inline double MakeLDeviation(G4double, G4double) const;
|
||||
inline double MakeTTDeviation(G4double, G4double) const;
|
||||
inline double MakeTDeviation(G4double, G4double) const;
|
||||
|
||||
void MakeTTSecondaries(const G4Track&);
|
||||
void MakeLTSecondaries(const G4Track&);
|
||||
|
||||
private:
|
||||
double fBeta, fGamma, fLambda, fMu; // Local buffers for calculations
|
||||
|
||||
// hide assignment operator as private
|
||||
G4PhononDownconversion(G4PhononDownconversion&);
|
||||
G4PhononDownconversion& operator=(const G4PhononDownconversion& right);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4PhononPolarization.hh
|
||||
/// \brief Definition of the G4PhononPolarization enum
|
||||
//
|
||||
// $Id: G4PhononPolarization.hh 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
#ifndef G4PhononPolarization_h
|
||||
#define G4PhononPolarization_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
|
||||
|
||||
namespace G4PhononPolarization {
|
||||
enum { Long=0, TransSlow=1, TransFast=2, UNKNOWN=-1 };
|
||||
|
||||
G4int Get(const G4ParticleDefinition* aPD);
|
||||
G4ParticleDefinition* Get(G4int pol);
|
||||
}
|
||||
|
||||
#endif /* G4PhononPolarization_h */
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4PhononReflection.hh
|
||||
/// \brief Definition of the G4PhononReflection class
|
||||
//
|
||||
// $Id: G4PhononReflection.hh 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
#ifndef G4PhononReflection_h
|
||||
#define G4PhononReflection_h 1
|
||||
|
||||
#include "G4VPhononProcess.hh"
|
||||
|
||||
|
||||
class G4PhononReflection : public G4VPhononProcess {
|
||||
public:
|
||||
G4PhononReflection(const G4String& processName ="phononReflection" );
|
||||
virtual ~G4PhononReflection();
|
||||
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
|
||||
|
||||
private:
|
||||
G4double kCarTolerance;
|
||||
|
||||
private:
|
||||
// hide assignment operator as private
|
||||
G4PhononReflection(G4PhononReflection&);
|
||||
G4PhononReflection& operator=(const G4PhononReflection& right);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4PhononScattering.hh
|
||||
/// \brief Definition of the G4PhononScattering class
|
||||
//
|
||||
// $Id: G4PhononScattering.hh 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
#ifndef G4PhononScattering_h
|
||||
#define G4PhononScattering_h 1
|
||||
|
||||
#include "G4VPhononProcess.hh"
|
||||
|
||||
class G4PhononScattering : public G4VPhononProcess {
|
||||
public:
|
||||
G4PhononScattering(const G4String& processName ="phononScattering" );
|
||||
virtual ~G4PhononScattering();
|
||||
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
|
||||
|
||||
protected:
|
||||
virtual G4double GetMeanFreePath(const G4Track&, G4double,
|
||||
G4ForceCondition* );
|
||||
|
||||
private:
|
||||
// hide assignment operator as private
|
||||
G4PhononScattering(G4PhononScattering&);
|
||||
G4PhononScattering& operator=(const G4PhononScattering& right);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4PhononTrackMap.hh
|
||||
/// \brief Definition of the G4PhononTrackMap base class
|
||||
//
|
||||
// $Id: G4PhononTrackMap.hh 76503 2013-11-12 08:20:50Z gcosmo $
|
||||
//
|
||||
// 20131111 Move implementation of Clear() to .cc file
|
||||
|
||||
#ifndef G4PhononTrackMap_h
|
||||
#define G4PhononTrackMap_h 1
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <map>
|
||||
|
||||
class G4Track;
|
||||
|
||||
class G4PhononTrackMap {
|
||||
public:
|
||||
typedef std::map<const G4Track*, G4ThreeVector> TrkIDKmap;
|
||||
static G4ThreadLocal G4PhononTrackMap* theTrackMap;
|
||||
|
||||
public:
|
||||
static G4PhononTrackMap* GetPhononTrackMap(); // Synonyms for access
|
||||
static G4PhononTrackMap* GetInstance() { return GetPhononTrackMap(); }
|
||||
|
||||
// Update the wavevector for specified track, add track if not found
|
||||
void SetK(const G4Track* track, const G4ThreeVector& K);
|
||||
void SetK(const G4Track& track, const G4ThreeVector& K) { SetK(&track, K); }
|
||||
|
||||
// Access current wavevector for specified track (NULL if doesn't exist)
|
||||
const G4ThreeVector& GetK(const G4Track* track) const;
|
||||
const G4ThreeVector& GetK(const G4Track& track) const { return GetK(&track); }
|
||||
|
||||
// Check if specified track is already loaded
|
||||
G4bool Find(const G4Track* track) const;
|
||||
G4bool Find(const G4Track& track) const { return Find(&track); }
|
||||
|
||||
// Remove specified track from map (used by EndTracking)
|
||||
void RemoveTrack(const G4Track* track);
|
||||
|
||||
void Clear(); // Remove all entries from map
|
||||
|
||||
private:
|
||||
TrkIDKmap theMap; // Associate track ID numbers with vectors
|
||||
|
||||
private:
|
||||
G4PhononTrackMap() { Clear(); } // Ensure map is empty
|
||||
~G4PhononTrackMap() {;}
|
||||
};
|
||||
#endif /* G4PhononTrackMap_h */
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4VPhononProcess.hh
|
||||
/// \brief Definition of the G4VPhononProcess base class
|
||||
//
|
||||
// $Id: G4VPhononProcess.hh 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
#ifndef G4VPhononProcess_h
|
||||
#define G4VPhononProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VDiscreteProcess.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4PhononTrackMap;
|
||||
class G4LatticePhysical;
|
||||
|
||||
|
||||
class G4VPhononProcess : public G4VDiscreteProcess {
|
||||
public:
|
||||
G4VPhononProcess(const G4String& processName);
|
||||
virtual ~G4VPhononProcess();
|
||||
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& aPD);
|
||||
|
||||
// Initialize wave vectors for currently active track(s)
|
||||
// NOTE: These functions must call back to base class implementations!
|
||||
virtual void StartTracking(G4Track* track);
|
||||
virtual void EndTracking();
|
||||
|
||||
protected:
|
||||
// For convenience, map phonon type to polarization code
|
||||
virtual G4int GetPolarization(const G4Track& track) const;
|
||||
virtual G4int GetPolarization(const G4Track* track) const {
|
||||
return GetPolarization(*track);
|
||||
}
|
||||
|
||||
// For convenience, generate random polarization from density of states
|
||||
// Values passed may be zero to suppress particular states
|
||||
virtual G4int ChoosePolarization(G4double Ldos, G4double STdos,
|
||||
G4double FTdos) const;
|
||||
|
||||
// Construct new track with correct momentum, position, etc.
|
||||
virtual G4Track* CreateSecondary(G4int polarization, const G4ThreeVector& K,
|
||||
G4double energy) const;
|
||||
|
||||
protected:
|
||||
G4PhononTrackMap* trackKmap; // For convenient access by processes
|
||||
const G4LatticePhysical* theLattice;
|
||||
|
||||
private:
|
||||
const G4Track* currentTrack; // For use by Start/EndTracking
|
||||
|
||||
// hide assignment operators as private
|
||||
G4VPhononProcess(G4VPhononProcess&);
|
||||
G4VPhononProcess& operator=(const G4VPhononProcess& right);
|
||||
};
|
||||
|
||||
#endif /* G4VPhononProcess_h */
|
||||
@@ -0,0 +1,75 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4phonon
|
||||
# Package: Geant4.src.G4processes.G4phonon
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 24/10/2013
|
||||
#
|
||||
# $Id: sources.cmake 75844 2013-11-06 17:35:56Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_INCLUDE_DIRS})
|
||||
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4phonon
|
||||
HEADERS
|
||||
G4LatticeManager.hh
|
||||
G4LatticeReader.hh
|
||||
G4PhononDownconversion.hh
|
||||
G4PhononPolarization.hh
|
||||
G4PhononReflection.hh
|
||||
G4PhononScattering.hh
|
||||
G4PhononTrackMap.hh
|
||||
G4VPhononProcess.hh
|
||||
SOURCES
|
||||
G4LatticeManager.cc
|
||||
G4LatticeReader.cc
|
||||
G4PhononDownconversion.cc
|
||||
G4PhononPolarization.cc
|
||||
G4PhononReflection.cc
|
||||
G4PhononScattering.cc
|
||||
G4PhononTrackMap.cc
|
||||
G4VPhononProcess.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4bosons
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4materials
|
||||
G4partman
|
||||
G4procman
|
||||
G4track
|
||||
G4volumes
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4geometry
|
||||
G4global
|
||||
G4materials
|
||||
G4particles
|
||||
G4track
|
||||
LINK_LIBRARIES
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file materials/src/G4LatticeManager.cc
|
||||
/// \brief Implementation of the G4LatticeManager class
|
||||
//
|
||||
// $Id: G4LatticeManager.cc 76693 2013-11-14 08:47:37Z gcosmo $
|
||||
//
|
||||
// 20131113 Delete lattices in (new) registry, not in lookup maps
|
||||
|
||||
#include "G4LatticeManager.hh"
|
||||
#include "G4LatticeLogical.hh"
|
||||
#include "G4LatticePhysical.hh"
|
||||
#include "G4LatticeReader.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include <fstream>
|
||||
|
||||
G4ThreadLocal G4LatticeManager* G4LatticeManager::fLM = 0;
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LatticeManager::G4LatticeManager() : verboseLevel(0) {
|
||||
Clear();
|
||||
}
|
||||
|
||||
G4LatticeManager::~G4LatticeManager() {
|
||||
Reset(); // Deletes all lattices
|
||||
}
|
||||
|
||||
// Delete all registered lattices and clear entries from lookup tables
|
||||
|
||||
void G4LatticeManager::Reset() {
|
||||
for (LatticeLogReg::iterator lm=fLLattices.begin();
|
||||
lm != fLLattices.end(); ++lm) {
|
||||
delete (*lm);
|
||||
}
|
||||
|
||||
for (LatticePhyReg::iterator pm=fPLattices.begin();
|
||||
pm != fPLattices.end(); ++pm) {
|
||||
delete (*pm);
|
||||
}
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
// Remove entries without deletion (for begin-job and end-job initializing)
|
||||
|
||||
void G4LatticeManager::Clear() {
|
||||
fPLatticeList.clear();
|
||||
fPLattices.clear();
|
||||
|
||||
fLLatticeList.clear();
|
||||
fLLattices.clear();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4LatticeManager* G4LatticeManager::GetLatticeManager() {
|
||||
//if no lattice manager exists, create one.
|
||||
if (!fLM) fLM = new G4LatticeManager();
|
||||
return fLM;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Associate logical lattice with material
|
||||
|
||||
G4bool G4LatticeManager::RegisterLattice(G4Material* Mat,
|
||||
G4LatticeLogical* Lat) {
|
||||
if (!Mat || !Lat) return false; // Don't register null pointers
|
||||
|
||||
fLLattices.insert(Lat); // Take ownership in registry
|
||||
fLLatticeList[Mat] = Lat;
|
||||
|
||||
if (verboseLevel) {
|
||||
G4cout << "G4LatticeManager::RegisterLattice: "
|
||||
<< " Total number of logical lattices: " << fLLatticeList.size()
|
||||
<< " (" << fLLattices.size() << " unique)" << G4endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Construct logical lattice for material from config file
|
||||
|
||||
G4LatticeLogical* G4LatticeManager::LoadLattice(G4Material* Mat,
|
||||
const G4String& latDir) {
|
||||
if (verboseLevel) {
|
||||
G4cout << "G4LatticeManager::LoadLattice material " << Mat->GetName()
|
||||
<< " " << latDir << G4endl;
|
||||
}
|
||||
|
||||
G4LatticeReader latReader(verboseLevel);
|
||||
G4LatticeLogical* newLat = latReader.MakeLattice(latDir+"/config.txt");
|
||||
if (verboseLevel>1) G4cout << " Created newLat " << newLat << G4endl;
|
||||
|
||||
if (newLat) RegisterLattice(Mat, newLat);
|
||||
else {
|
||||
G4cerr << "ERROR creating " << latDir << " lattice for material "
|
||||
<< Mat->GetName() << G4endl;
|
||||
}
|
||||
|
||||
return newLat;
|
||||
}
|
||||
|
||||
// Combine loading and registration (Material extracted from volume)
|
||||
|
||||
G4LatticePhysical* G4LatticeManager::LoadLattice(G4VPhysicalVolume* Vol,
|
||||
const G4String& latDir) {
|
||||
if (verboseLevel) {
|
||||
G4cout << "G4LatticeManager::LoadLattice volume " << Vol->GetName()
|
||||
<< " " << latDir << G4endl;
|
||||
}
|
||||
|
||||
G4Material* theMat = Vol->GetLogicalVolume()->GetMaterial();
|
||||
|
||||
// Create and register the logical lattice, then the physical lattice
|
||||
G4LatticeLogical* lLattice = LoadLattice(theMat, latDir);
|
||||
if (!lLattice) return 0;
|
||||
|
||||
G4LatticePhysical* pLattice =
|
||||
new G4LatticePhysical(lLattice, Vol->GetFrameRotation());
|
||||
if (pLattice) RegisterLattice(Vol, pLattice);
|
||||
|
||||
if (verboseLevel>1) G4cout << " Created pLattice " << pLattice << G4endl;
|
||||
|
||||
return pLattice;
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Associate physical (oriented) lattice with physical volume
|
||||
|
||||
G4bool G4LatticeManager::RegisterLattice(G4VPhysicalVolume* Vol,
|
||||
G4LatticePhysical* Lat) {
|
||||
if (!Vol || !Lat) return false; // Don't register null pointers
|
||||
|
||||
// SPECIAL: Register first lattice with a null volume to act as default
|
||||
if (fPLatticeList.empty()) fPLatticeList[0] = Lat;
|
||||
|
||||
fPLattices.insert(Lat);
|
||||
fPLatticeList[Vol] = Lat;
|
||||
|
||||
if (verboseLevel) {
|
||||
G4cout << "G4LatticeManager::RegisterLattice: "
|
||||
<< " Total number of physical lattices: " << fPLatticeList.size()-1
|
||||
<< " (" << fPLattices.size() << " unique)" << G4endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
G4bool G4LatticeManager::RegisterLattice(G4VPhysicalVolume* Vol,
|
||||
G4LatticeLogical* LLat) {
|
||||
if (!Vol || !LLat) return false; // Don't register null pointers
|
||||
|
||||
// Make sure logical lattice is registered for material
|
||||
RegisterLattice(Vol->GetLogicalVolume()->GetMaterial(), LLat);
|
||||
|
||||
// Create and register new physical lattice to go with volume
|
||||
return RegisterLattice(Vol, new G4LatticePhysical(LLat, Vol->GetFrameRotation()));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Returns a pointer to the LatticeLogical associated with material
|
||||
|
||||
G4LatticeLogical* G4LatticeManager::GetLattice(G4Material* Mat) const {
|
||||
LatticeMatMap::const_iterator latFind = fLLatticeList.find(Mat);
|
||||
if (latFind != fLLatticeList.end()) {
|
||||
if (verboseLevel)
|
||||
G4cout << "G4LatticeManager::GetLattice found " << latFind->second
|
||||
<< " for " << (Mat?Mat->GetName():"NULL") << "." << G4endl;
|
||||
return latFind->second;
|
||||
}
|
||||
|
||||
|
||||
if (verboseLevel)
|
||||
G4cerr << "G4LatticeManager:: Found no matching lattices for "
|
||||
<< (Mat?Mat->GetName():"NULL") << "." << G4endl;
|
||||
|
||||
return 0; // No lattice associated with volume
|
||||
}
|
||||
|
||||
// Returns a pointer to the LatticePhysical associated with volume
|
||||
// NOTE: Passing Vol==0 will return the default lattice
|
||||
|
||||
G4LatticePhysical* G4LatticeManager::GetLattice(G4VPhysicalVolume* Vol) const {
|
||||
LatticeVolMap::const_iterator latFind = fPLatticeList.find(Vol);
|
||||
if (latFind != fPLatticeList.end()) {
|
||||
if (verboseLevel)
|
||||
G4cout << "G4LatticeManager::GetLattice found " << latFind->second
|
||||
<< " for " << (Vol?Vol->GetName():"default") << "." << G4endl;
|
||||
return latFind->second;
|
||||
}
|
||||
|
||||
if (verboseLevel)
|
||||
G4cerr << "G4LatticeManager::GetLattice found no matching lattices for "
|
||||
<< (Vol?Vol->GetName():"default") << "." << G4endl;
|
||||
|
||||
return 0; // No lattice associated with volume
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Return true if volume Vol has a physical lattice
|
||||
|
||||
G4bool G4LatticeManager::HasLattice(G4VPhysicalVolume* Vol) const {
|
||||
return (fPLatticeList.find(Vol) != fPLatticeList.end());
|
||||
}
|
||||
|
||||
// Return true if material Mat has a logical lattice
|
||||
|
||||
G4bool G4LatticeManager::HasLattice(G4Material* Mat) const {
|
||||
return (fLLatticeList.find(Mat) != fLLatticeList.end());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//Given the phonon wave vector k, phonon physical volume Vol
|
||||
//and polarizationState(0=LON, 1=FT, 2=ST),
|
||||
//returns phonon velocity in m/s
|
||||
|
||||
G4double G4LatticeManager::MapKtoV(G4VPhysicalVolume* Vol,
|
||||
G4int polarizationState,
|
||||
const G4ThreeVector & k) const {
|
||||
G4LatticePhysical* theLattice = GetLattice(Vol);
|
||||
if (verboseLevel)
|
||||
G4cout << "G4LatticeManager::MapKtoV using lattice " << theLattice
|
||||
<< G4endl;
|
||||
|
||||
// If no lattice available, use generic "speed of sound"
|
||||
return theLattice ? theLattice->MapKtoV(polarizationState, k) : 300.*m/s;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Given the phonon wave vector k, phonon physical volume Vol
|
||||
// and polarizationState(0=LON, 1=FT, 2=ST),
|
||||
// returns phonon propagation direction as dimensionless unit vector
|
||||
|
||||
G4ThreeVector G4LatticeManager::MapKtoVDir(G4VPhysicalVolume* Vol,
|
||||
G4int polarizationState,
|
||||
const G4ThreeVector & k) const {
|
||||
G4LatticePhysical* theLattice = GetLattice(Vol);
|
||||
if (verboseLevel)
|
||||
G4cout << "G4LatticeManager::MapKtoVDir using lattice " << theLattice
|
||||
<< G4endl;
|
||||
|
||||
// If no lattice available, propagate along input wavevector
|
||||
return theLattice ? theLattice->MapKtoVDir(polarizationState, k) : k.unit();
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/include/G4LatticeReader.hh
|
||||
/// \brief Implementation of the G4LatticeReader class
|
||||
//
|
||||
// NOTE: This reader class for logical lattices should be moved to
|
||||
// materials/ after the 10.0 release (and this comment removed).
|
||||
// $Id: G4LatticeReader.cc 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131106 M.Kelsey -- Add const to getenv() to avoid compiler warning.
|
||||
// 20131112 Throw exception if input file fails.
|
||||
// 20131115 Check file input arguments for maps for validity before use;
|
||||
// move ctor, dtor here; check stream pointer before closing.
|
||||
|
||||
#include "G4LatticeReader.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
#include "G4LatticeLogical.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// Default path to lattice files, for use with filenames below
|
||||
|
||||
const G4String G4LatticeReader::fDataDir =
|
||||
getenv("G4LATTICEDATA") ? (const char*)getenv("G4LATTICEDATA") : "./CrystalMaps";
|
||||
|
||||
|
||||
// Constructor and destructor
|
||||
|
||||
G4LatticeReader::G4LatticeReader(G4int vb)
|
||||
: verboseLevel(vb), psLatfile(0), pLattice(0), fMapPath(""),
|
||||
fToken(""), fValue(0.), fMap(""), fsPol(""), fPol(-1), fNX(0), fNY(0) {;}
|
||||
|
||||
G4LatticeReader::~G4LatticeReader() {
|
||||
delete psLatfile; psLatfile = 0;
|
||||
}
|
||||
|
||||
|
||||
// Main drivers to read configuration from file or stream
|
||||
|
||||
G4LatticeLogical* G4LatticeReader::MakeLattice(const G4String& filename) {
|
||||
if (verboseLevel) G4cout << "G4LatticeReader " << filename << G4endl;
|
||||
|
||||
if (!OpenFile(filename)) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Unable to open " << filename;
|
||||
G4Exception("G4LatticeReader::MakeLattice", "Lattice001",
|
||||
FatalException, msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pLattice = new G4LatticeLogical; // Create lattice to be filled
|
||||
|
||||
G4bool goodLattice = true;
|
||||
while (!psLatfile->eof()) {
|
||||
goodLattice &= ProcessToken();
|
||||
}
|
||||
CloseFile();
|
||||
|
||||
if (!goodLattice) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Error reading lattice from " << filename;
|
||||
G4Exception("G4LatticeReader::MakeLattice", "Lattice002",
|
||||
FatalException, msg);
|
||||
delete pLattice;
|
||||
pLattice = 0;
|
||||
}
|
||||
|
||||
return pLattice; // Lattice complete; return pointer with ownership
|
||||
}
|
||||
|
||||
|
||||
// Open local file or file found under data path
|
||||
|
||||
G4bool G4LatticeReader::OpenFile(const G4String& filename) {
|
||||
if (verboseLevel)
|
||||
G4cout << "G4LatticeReader::OpenFile " << filename << G4endl;
|
||||
|
||||
G4String filepath = filename;
|
||||
psLatfile = new std::ifstream(filepath);
|
||||
if (!psLatfile->good()) { // Local file not found
|
||||
filepath = fDataDir + "/" + filename;
|
||||
psLatfile->open(filepath); // Try data directory
|
||||
if (!psLatfile->good()) {
|
||||
CloseFile();
|
||||
return false;
|
||||
}
|
||||
if (verboseLevel>1) G4cout << " Found file " << filepath << G4endl;
|
||||
}
|
||||
|
||||
// Extract path from filename to use in finding .ssv map files
|
||||
size_t lastdir = filepath.last('/');
|
||||
if (lastdir == std::string::npos) fMapPath = "."; // No path at all
|
||||
else fMapPath = filepath(0,lastdir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Close and delete input stream
|
||||
|
||||
void G4LatticeReader::CloseFile() {
|
||||
if (psLatfile) psLatfile->close();
|
||||
delete psLatfile;
|
||||
psLatfile = 0;
|
||||
}
|
||||
|
||||
|
||||
// Read next token from file, use it to store next data into lattice
|
||||
|
||||
G4bool G4LatticeReader::ProcessToken() {
|
||||
fToken = "";
|
||||
*psLatfile >> fToken;
|
||||
if (fToken.empty() || psLatfile->eof()) return true; // End of file reached
|
||||
|
||||
if (verboseLevel>1) G4cout << " ProcessToken " << fToken << G4endl;
|
||||
|
||||
fToken.toLower();
|
||||
if (fToken.contains('#')) return SkipComments(); // Ignore rest of line
|
||||
if (fToken == "vdir") return ProcessNMap(); // Direction vector map
|
||||
if (fToken == "vg") return ProcessMap(); // Velocity magnitudes
|
||||
if (fToken == "dyn") return ProcessConstants(); // Dynamical parameters
|
||||
return ProcessValue(fToken); // Single numeric value
|
||||
}
|
||||
|
||||
// Eat remainder of line, assuming a '#' token was found
|
||||
|
||||
G4bool G4LatticeReader::SkipComments() {
|
||||
psLatfile->ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
return true; // Never fails
|
||||
}
|
||||
|
||||
// Read double value from file, store based on name string
|
||||
|
||||
G4bool G4LatticeReader::ProcessValue(const G4String& name) {
|
||||
*psLatfile >> fValue;
|
||||
if (verboseLevel>1) G4cout << " ProcessValue " << fValue << G4endl;
|
||||
|
||||
G4bool good = true;
|
||||
/***** NOTE: Individual Set functions not included in Release 10.0
|
||||
if (name == "beta") pLattice->SetBeta(fValue);
|
||||
else if (name == "gamma") pLattice->SetGamma(fValue);
|
||||
else if (name == "lambda") pLattice->SetLambda(fValue);
|
||||
else if (name == "mu") pLattice->SetMu(fValue);
|
||||
else *****/
|
||||
if (name == "scat") pLattice->SetScatteringConstant(fValue*s*s*s);
|
||||
else if (name == "b") pLattice->SetScatteringConstant(fValue*s*s*s);
|
||||
else if (name == "decay") pLattice->SetAnhDecConstant(fValue*s*s*s*s);
|
||||
else if (name == "a") pLattice->SetAnhDecConstant(fValue*s*s*s*s);
|
||||
else if (name == "ldos") pLattice->SetLDOS(fValue);
|
||||
else if (name == "stdos") pLattice->SetSTDOS(fValue);
|
||||
else if (name == "ftdos") pLattice->SetFTDOS(fValue);
|
||||
else {
|
||||
G4cerr << "G4LatticeReader: Unrecognized token " << name << G4endl;
|
||||
good = false;
|
||||
}
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
G4bool G4LatticeReader::ProcessConstants() {
|
||||
G4double beta=0., gamma=0., lambda=0., mu=0.;
|
||||
*psLatfile >> beta >> gamma >> lambda >> mu;
|
||||
if (verboseLevel>1)
|
||||
G4cout << " ProcessConstants " << beta << " " << gamma
|
||||
<< " " << lambda << " " << mu << G4endl;
|
||||
|
||||
pLattice->SetDynamicalConstants(beta, gamma, lambda, mu);
|
||||
return psLatfile->good();
|
||||
}
|
||||
|
||||
// Read map filename, polarization, and binning dimensions
|
||||
|
||||
G4bool G4LatticeReader::ReadMapInfo() {
|
||||
*psLatfile >> fMap >> fsPol >> fNX >> fNY;
|
||||
if (verboseLevel>1)
|
||||
G4cout << " ReadMapInfo " << fMap << " " << fsPol
|
||||
<< " " << fNX << " " << fNY << G4endl;
|
||||
|
||||
if (fNX < 0 || fNX >= G4LatticeLogical::MAXRES) {
|
||||
G4cerr << "G4LatticeReader: Invalid map theta dimension " << fNX << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fNY < 0 || fNY >= G4LatticeLogical::MAXRES) {
|
||||
G4cerr << "G4LatticeReader: Invalid map phi dimension " << fNY << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prepend path to data files to map filename
|
||||
fMap = fMapPath + "/" + fMap;
|
||||
|
||||
// Convert string code (L,ST,LT) to polarization index
|
||||
fsPol.toLower();
|
||||
fPol = ( (fsPol=="l") ? 0 : // Longitudinal
|
||||
(fsPol=="st") ? 1 : // Slow-transverse
|
||||
(fsPol=="ft") ? 2 : // Fast-transverse
|
||||
-1 ); // Invalid code
|
||||
|
||||
if (fPol<0 || fPol>2) {
|
||||
G4cerr << "G4LatticeReader: Invalid polarization code " << fsPol << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
G4bool G4LatticeReader::ProcessMap() {
|
||||
if (!ReadMapInfo()) { // Get specific parameters for map to load
|
||||
G4cerr << "G4LatticeReader: Unable to process mapfile directive." << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return pLattice->LoadMap(fNX, fNY, fPol, fMap);
|
||||
}
|
||||
|
||||
G4bool G4LatticeReader::ProcessNMap() {
|
||||
if (!ReadMapInfo()) { // Get specific parameters for map to load
|
||||
G4cerr << "G4LatticeReader: Unable to process mapfile directive." << G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return pLattice->Load_NMap(fNX, fNY, fPol, fMap);
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4PhononDownconversion.cc
|
||||
/// \brief Implementation of the G4PhononDownconversion class
|
||||
//
|
||||
// $Id: G4PhononDownconversion.cc 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131111 Add verbose output for MFP calculation
|
||||
// 20131115 Initialize data buffers in ctor
|
||||
|
||||
#include "G4PhononDownconversion.hh"
|
||||
#include "G4LatticePhysical.hh"
|
||||
#include "G4PhononLong.hh"
|
||||
#include "G4PhononPolarization.hh"
|
||||
#include "G4PhononTrackMap.hh"
|
||||
#include "G4PhononTransFast.hh"
|
||||
#include "G4PhononTransSlow.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4RandomDirection.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "Randomize.hh"
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
G4PhononDownconversion::G4PhononDownconversion(const G4String& aName)
|
||||
: G4VPhononProcess(aName), fBeta(0.), fGamma(0.), fLambda(0.), fMu(0.) {;}
|
||||
|
||||
G4PhononDownconversion::~G4PhononDownconversion() {;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4PhononDownconversion::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition) {
|
||||
//Determines mean free path for longitudinal phonons to split
|
||||
G4double A = theLattice->GetAnhDecConstant();
|
||||
G4double Eoverh = aTrack.GetKineticEnergy()/h_Planck;
|
||||
|
||||
//Calculate mean free path for anh. decay
|
||||
G4double mfp = aTrack.GetVelocity()/(Eoverh*Eoverh*Eoverh*Eoverh*Eoverh*A);
|
||||
|
||||
if (verboseLevel > 1)
|
||||
G4cout << "G4PhononDownconversion::GetMeanFreePath = " << mfp << G4endl;
|
||||
|
||||
*condition = NotForced;
|
||||
return mfp;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
G4VParticleChange* G4PhononDownconversion::PostStepDoIt( const G4Track& aTrack,
|
||||
const G4Step&) {
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
//Obtain dynamical constants from this volume's lattice
|
||||
fBeta=theLattice->GetBeta();
|
||||
fGamma=theLattice->GetGamma();
|
||||
fLambda=theLattice->GetLambda();
|
||||
fMu=theLattice->GetMu();
|
||||
|
||||
//Destroy the parent phonon and create the daughter phonons.
|
||||
//74% chance that daughter phonons are both transverse
|
||||
//26% Transverse and Longitudinal
|
||||
if (G4UniformRand()>0.740) MakeLTSecondaries(aTrack);
|
||||
else MakeTTSecondaries(aTrack);
|
||||
|
||||
aParticleChange.ProposeEnergy(0.);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool G4PhononDownconversion::IsApplicable(const G4ParticleDefinition& aPD) {
|
||||
//Only L-phonons decay
|
||||
return (&aPD==G4PhononLong::PhononDefinition());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//probability density of energy distribution of L'-phonon in L->L'+T process
|
||||
|
||||
inline double G4PhononDownconversion::GetLTDecayProb(double d, double x) const {
|
||||
//d=delta= ratio of group velocities vl/vt and x is the fraction of energy in the longitudinal mode, i.e. x=EL'/EL
|
||||
return (1/(x*x))*(1-x*x)*(1-x*x)*((1+x)*(1+x)-d*d*((1-x)*(1-x)))*(1+x*x-d*d*(1-x)*(1-x))*(1+x*x-d*d*(1-x)*(1-x));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//probability density of energy distribution of T-phonon in L->T+T process
|
||||
|
||||
inline double G4PhononDownconversion::GetTTDecayProb(double d, double x) const {
|
||||
//dynamic constants from Tamura, PRL31, 1985
|
||||
G4double A = 0.5*(1-d*d)*(fBeta+fLambda+(1+d*d)*(fGamma+fMu));
|
||||
G4double B = fBeta+fLambda+2*d*d*(fGamma+fMu);
|
||||
G4double C = fBeta + fLambda + 2*(fGamma+fMu);
|
||||
G4double D = (1-d*d)*(2*fBeta+4*fGamma+fLambda+3*fMu);
|
||||
|
||||
return (A+B*d*x-B*x*x)*(A+B*d*x-B*x*x)+(C*x*(d-x)-D/(d-x)*(x-d-(1-d*d)/(4*x)))*(C*x*(d-x)-D/(d-x)*(x-d-(1-d*d)/(4*x)));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
inline double G4PhononDownconversion::MakeLDeviation(double d, double x) const {
|
||||
//change in L'-phonon propagation direction after decay
|
||||
|
||||
return std::acos((1+(x*x)-((d*d)*(1-x)*(1-x)))/(2*x));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
inline double G4PhononDownconversion::MakeTDeviation(double d, double x) const {
|
||||
//change in T-phonon propagation direction after decay (L->L+T process)
|
||||
|
||||
return std::acos((1-x*x+d*d*(1-x)*(1-x))/(2*d*(1-x)));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
inline double G4PhononDownconversion::MakeTTDeviation(double d, double x) const {
|
||||
//change in T-phonon propagation direction after decay (L->T+T process)
|
||||
|
||||
return std::acos((1-d*d*(1-x)*(1-x)+d*d*x*x)/(2*d*x));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
//Generate daughter phonons from L->T+T process
|
||||
|
||||
void G4PhononDownconversion::MakeTTSecondaries(const G4Track& aTrack) {
|
||||
//d is the velocity ratio vL/vT
|
||||
G4double d=1.6338;
|
||||
G4double upperBound=(1+(1/d))/2;
|
||||
G4double lowerBound=(1-(1/d))/2;
|
||||
|
||||
//Use MC method to generate point from distribution:
|
||||
//if a random point on the energy-probability plane is
|
||||
//smaller that the curve of the probability density,
|
||||
//then accept that point.
|
||||
//x=fraction of parent phonon energy in first T phonon
|
||||
G4double x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
|
||||
G4double p = 1.5*G4UniformRand();
|
||||
while(p >= GetTTDecayProb(d, x*d)) {
|
||||
x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
|
||||
p = 1.5*G4UniformRand();
|
||||
}
|
||||
|
||||
//using energy fraction x to calculate daughter phonon directions
|
||||
G4double theta1=MakeTTDeviation(d, x);
|
||||
G4double theta2=MakeTTDeviation(d, 1-x);
|
||||
G4ThreeVector dir1=trackKmap->GetK(aTrack);
|
||||
G4ThreeVector dir2=dir1;
|
||||
|
||||
// FIXME: These extra randoms change timing and causting outputs of example!
|
||||
G4ThreeVector ran = G4RandomDirection(); // FIXME: Drop this line
|
||||
|
||||
G4double ph=G4UniformRand()*twopi;
|
||||
dir1 = dir1.rotate(dir1.orthogonal(),theta1).rotate(dir1, ph);
|
||||
dir2 = dir2.rotate(dir2.orthogonal(),-theta2).rotate(dir2,ph);
|
||||
|
||||
G4double E=aTrack.GetKineticEnergy();
|
||||
G4double Esec1 = x*E, Esec2 = E-Esec1;
|
||||
|
||||
// Make FT or ST phonon (0. means no longitudinal)
|
||||
G4int polarization1 = ChoosePolarization(0., theLattice->GetSTDOS(),
|
||||
theLattice->GetFTDOS());
|
||||
|
||||
// Make FT or ST phonon (0. means no longitudinal)
|
||||
G4int polarization2 = ChoosePolarization(0., theLattice->GetSTDOS(),
|
||||
theLattice->GetFTDOS());
|
||||
|
||||
// Construct the secondaries and set their wavevectors
|
||||
G4Track* sec1 = CreateSecondary(polarization1, dir1, Esec1);
|
||||
G4Track* sec2 = CreateSecondary(polarization2, dir2, Esec2);
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(2);
|
||||
aParticleChange.AddSecondary(sec1);
|
||||
aParticleChange.AddSecondary(sec2);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
//Generate daughter phonons from L->L'+T process
|
||||
|
||||
void G4PhononDownconversion::MakeLTSecondaries(const G4Track& aTrack) {
|
||||
//d is the velocity ratio vL/v
|
||||
G4double d=1.6338;
|
||||
G4double upperBound=1;
|
||||
G4double lowerBound=(d-1)/(d+1);
|
||||
|
||||
//Use MC method to generate point from distribution:
|
||||
//if a random point on the energy-probability plane is
|
||||
//smaller that the curve of the probability density,
|
||||
//then accept that point.
|
||||
//x=fraction of parent phonon energy in L phonon
|
||||
G4double x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
|
||||
G4double p = 4.0*G4UniformRand();
|
||||
while(p >= GetLTDecayProb(d, x)) {
|
||||
x = G4UniformRand()*(upperBound-lowerBound) + lowerBound;
|
||||
p = 4.0*G4UniformRand(); //4.0 is about the max in the PDF
|
||||
}
|
||||
|
||||
//using energy fraction x to calculate daughter phonon directions
|
||||
G4double thetaL=MakeLDeviation(d, x);
|
||||
G4double thetaT=MakeTDeviation(d, x); // FIXME: Should be 1-x?
|
||||
G4ThreeVector dir1=trackKmap->GetK(aTrack);
|
||||
G4ThreeVector dir2=dir1;
|
||||
|
||||
G4double ph=G4UniformRand()*twopi;
|
||||
dir1 = dir1.rotate(dir1.orthogonal(),thetaL).rotate(dir1, ph);
|
||||
dir2 = dir2.rotate(dir2.orthogonal(),-thetaT).rotate(dir2,ph);
|
||||
|
||||
G4double E=aTrack.GetKineticEnergy();
|
||||
G4double Esec1 = x*E, Esec2 = E-Esec1;
|
||||
|
||||
// First secondary is longitudnal
|
||||
int polarization1 = G4PhononPolarization::Long;
|
||||
|
||||
// Make FT or ST phonon (0. means no longitudinal)
|
||||
G4int polarization2 = ChoosePolarization(0., theLattice->GetSTDOS(),
|
||||
theLattice->GetFTDOS());
|
||||
|
||||
// Construct the secondaries and set their wavevectors
|
||||
G4Track* sec1 = CreateSecondary(polarization1, dir1, Esec1);
|
||||
G4Track* sec2 = CreateSecondary(polarization2, dir2, Esec2);
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(2);
|
||||
aParticleChange.AddSecondary(sec1);
|
||||
aParticleChange.AddSecondary(sec2);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4PhononPolarization.cc
|
||||
/// \brief implementation of the G4PhononPolarization enum
|
||||
//
|
||||
// $Id: G4PhononPolarization.cc 75725 2013-11-05 16:52:30Z mkelsey $
|
||||
//
|
||||
|
||||
#include "G4PhononPolarization.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4PhononLong.hh"
|
||||
#include "G4PhononTransFast.hh"
|
||||
#include "G4PhononTransSlow.hh"
|
||||
|
||||
|
||||
G4int G4PhononPolarization::Get(const G4ParticleDefinition* aPD) {
|
||||
if (aPD == G4PhononLong::Definition()) return Long;
|
||||
if (aPD == G4PhononTransSlow::Definition()) return TransSlow;
|
||||
if (aPD == G4PhononTransFast::Definition()) return TransFast;
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4PhononPolarization::Get(G4int pol) {
|
||||
switch (pol) {
|
||||
case Long: return G4PhononLong::Definition(); break;
|
||||
case TransSlow: return G4PhononTransSlow::Definition(); break;
|
||||
case TransFast: return G4PhononTransFast::Definition(); break;
|
||||
default: ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4PhononReflection.cc
|
||||
/// \brief Implementation of the G4PhononReflection class
|
||||
//
|
||||
// This process handles the interaction of phonons with
|
||||
// boundaries. Implementation of this class is highly
|
||||
// geometry dependent.Currently, phonons are killed when
|
||||
// they reach a boundary. If the other side of the
|
||||
// boundary was Al, a hit is registered.
|
||||
//
|
||||
// $Id: G4PhononReflection.cc 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131115 Throw exception if track's polarization state is invalid.
|
||||
|
||||
#include "G4PhononReflection.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4LatticePhysical.hh"
|
||||
#include "G4PhononLong.hh"
|
||||
#include "G4PhononTransFast.hh"
|
||||
#include "G4PhononTransSlow.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
|
||||
G4PhononReflection::G4PhononReflection(const G4String& aName)
|
||||
: G4VPhononProcess(aName),
|
||||
kCarTolerance(G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()) {;}
|
||||
|
||||
G4PhononReflection::~G4PhononReflection() {;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Always return DBL_MAX and Forced. This ensures that the process is
|
||||
// called at the end of every step. In PostStepDoIt the process
|
||||
// decides whether the step encountered a volume boundary and a
|
||||
// reflection should be applied
|
||||
|
||||
G4double G4PhononReflection::GetMeanFreePath(const G4Track&, G4double,
|
||||
G4ForceCondition* condition) {
|
||||
*condition = Forced;
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// This process handles the interaction of phonons with
|
||||
// boundaries. Implementation of this class is highly geometry
|
||||
// dependent.Currently, phonons are killed when they reach a
|
||||
// boundary. If the other side of the boundary was Al, a hit is
|
||||
// registered.
|
||||
|
||||
G4VParticleChange* G4PhononReflection::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep) {
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
//Check if current step is limited by a volume boundary
|
||||
G4StepPoint* postStepPoint = aStep.GetPostStepPoint();
|
||||
if (postStepPoint->GetStepStatus()!=fGeomBoundary) {
|
||||
//make sure that correct phonon velocity is used after the step
|
||||
int pol = GetPolarization(aTrack);
|
||||
if (pol < 0 || pol > 2) {
|
||||
G4Exception("G4PhononReflection::PostStepDoIt","Phonon001",
|
||||
EventMustBeAborted, "Track is not a phonon");
|
||||
return &aParticleChange; // NOTE: Will never get here
|
||||
}
|
||||
|
||||
// FIXME: This should be using wave-vector, shouldn't it?
|
||||
G4double vg = theLattice->MapKtoV(pol, aTrack.GetMomentumDirection());
|
||||
|
||||
//Since step was not a volume boundary, just set correct phonon velocity and return
|
||||
aParticleChange.ProposeVelocity(vg);
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
// do nothing but return is the step is too short
|
||||
// This is to allow actual reflection where after
|
||||
// the first boundary crossing a second, infinitesimal
|
||||
// step occurs crossing back into the original volume
|
||||
if (aTrack.GetStepLength()<=kCarTolerance/2) {
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
G4double eKin = aTrack.GetKineticEnergy();
|
||||
aParticleChange.ProposeNonIonizingEnergyDeposit(eKin);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4PhononScattering.cc
|
||||
/// \brief Implementation of the G4PhononScattering class
|
||||
//
|
||||
// $Id: G4PhononScattering.cc 76693 2013-11-14 08:47:37Z gcosmo $
|
||||
//
|
||||
// 20131111 Add verbose output for MFP calculation
|
||||
|
||||
#include "G4PhononScattering.hh"
|
||||
#include "G4LatticePhysical.hh"
|
||||
#include "G4PhononPolarization.hh"
|
||||
#include "G4PhononLong.hh"
|
||||
#include "G4PhononTrackMap.hh"
|
||||
#include "G4PhononTransFast.hh"
|
||||
#include "G4PhononTransSlow.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4RandomDirection.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
|
||||
G4PhononScattering::G4PhononScattering(const G4String& aName)
|
||||
: G4VPhononProcess(aName) {;}
|
||||
|
||||
G4PhononScattering::~G4PhononScattering() {;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4PhononScattering::GetMeanFreePath(const G4Track& aTrack,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition) {
|
||||
//Dynamical constants retrieved from PhysicalLattice
|
||||
G4double B = theLattice->GetScatteringConstant();
|
||||
G4double Eoverh = aTrack.GetKineticEnergy()/h_Planck;
|
||||
|
||||
//Calculate mean free path
|
||||
G4double mfp = aTrack.GetVelocity()/(Eoverh*Eoverh*Eoverh*Eoverh*B);
|
||||
|
||||
if (verboseLevel > 1)
|
||||
G4cout << "G4PhononScattering::GetMeanFreePath = " << mfp << G4endl;
|
||||
|
||||
*condition = NotForced;
|
||||
|
||||
return mfp;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VParticleChange* G4PhononScattering::PostStepDoIt( const G4Track& aTrack,
|
||||
const G4Step& aStep) {
|
||||
G4StepPoint* postStepPoint = aStep.GetPostStepPoint();
|
||||
if (postStepPoint->GetStepStatus()==fGeomBoundary) {
|
||||
return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
|
||||
}
|
||||
|
||||
//Initialize particle change
|
||||
aParticleChange.Initialize(aTrack);
|
||||
|
||||
//randomly generate a new direction and polarization state
|
||||
G4ThreeVector newDir = G4RandomDirection();
|
||||
G4int polarization = ChoosePolarization(theLattice->GetLDOS(),
|
||||
theLattice->GetSTDOS(),
|
||||
theLattice->GetFTDOS());
|
||||
|
||||
// Generate the new track after scattering
|
||||
// FIXME: If polarization state is the same, just step the track!
|
||||
G4Track* sec =
|
||||
CreateSecondary(polarization, newDir, aTrack.GetKineticEnergy());
|
||||
aParticleChange.SetNumberOfSecondaries(1);
|
||||
aParticleChange.AddSecondary(sec);
|
||||
|
||||
// Scattered phonon replaces current track
|
||||
aParticleChange.ProposeEnergy(0.);
|
||||
aParticleChange.ProposeTrackStatus(fStopAndKill);
|
||||
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4PhononTrackMap.hh
|
||||
/// \brief Implementation of the G4PhononTrackMap base class
|
||||
//
|
||||
// $Id: G4PhononTrackMap.cc 76503 2013-11-12 08:20:50Z gcosmo $
|
||||
//
|
||||
// 20131111 Move Clear() function to .cc file
|
||||
|
||||
#include "G4PhononTrackMap.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Track.hh"
|
||||
#include <map>
|
||||
|
||||
namespace { const G4ThreeVector nullVec(0.,0.,0.); } // For convenience below
|
||||
|
||||
// Singleton instance, must be created at first request
|
||||
|
||||
G4ThreadLocal G4PhononTrackMap* G4PhononTrackMap::theTrackMap = 0;
|
||||
|
||||
|
||||
// Pseudo-constructor creates singleton instance
|
||||
|
||||
G4PhononTrackMap* G4PhononTrackMap::GetPhononTrackMap() {
|
||||
if (!theTrackMap) theTrackMap = new G4PhononTrackMap;
|
||||
return theTrackMap;
|
||||
}
|
||||
|
||||
void G4PhononTrackMap::Clear() {
|
||||
theMap.clear(); // Remove all entries from map
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if specified track is already loaded
|
||||
|
||||
G4bool G4PhononTrackMap::Find(const G4Track* track) const {
|
||||
return (!track || theMap.find(track) != theMap.end());
|
||||
}
|
||||
|
||||
|
||||
// Remove specified track from map (used by EndTracking)
|
||||
|
||||
void G4PhononTrackMap::RemoveTrack(const G4Track* track) {
|
||||
TrkIDKmap::iterator entry = theMap.find(track);
|
||||
if (entry != theMap.end()) theMap.erase(entry);
|
||||
}
|
||||
|
||||
|
||||
// Update the wavevector for specified track, add track if non-existent
|
||||
|
||||
void G4PhononTrackMap::SetK(const G4Track* track, const G4ThreeVector& K) {
|
||||
if (track) theMap[track] = K;
|
||||
}
|
||||
|
||||
|
||||
// Access current wavevector for specified track (NULL if doesn't exist)
|
||||
|
||||
const G4ThreeVector& G4PhononTrackMap::GetK(const G4Track* track) const {
|
||||
TrkIDKmap::const_iterator entry = theMap.find(track);
|
||||
return (entry != theMap.end()) ? entry->second : nullVec;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file processes/phonon/src/G4VPhononProcess.cc
|
||||
/// \brief Implementation of the G4VPhononProcess base class
|
||||
//
|
||||
// $Id: G4VPhononProcess.cc 76885 2013-11-18 12:55:15Z gcosmo $
|
||||
//
|
||||
// 20131111 Add verbosity to report creating secondaries
|
||||
|
||||
#include "G4VPhononProcess.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
#include "G4LatticeManager.hh"
|
||||
#include "G4LatticePhysical.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4PhononLong.hh"
|
||||
#include "G4PhononPolarization.hh"
|
||||
#include "G4PhononTrackMap.hh"
|
||||
#include "G4PhononTransFast.hh"
|
||||
#include "G4PhononTransSlow.hh"
|
||||
#include "G4ProcessType.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
namespace {
|
||||
const G4ThreeVector nullVec(0.,0.,0.); // For convenience below
|
||||
}
|
||||
|
||||
// Constructor and destructor
|
||||
|
||||
G4VPhononProcess::G4VPhononProcess(const G4String& processName)
|
||||
: G4VDiscreteProcess(processName, fPhonon),
|
||||
trackKmap(G4PhononTrackMap::GetInstance()), theLattice(0),
|
||||
currentTrack(0) {}
|
||||
|
||||
G4VPhononProcess::~G4VPhononProcess() {;}
|
||||
|
||||
|
||||
// Only applies to the known phonon polarization states
|
||||
|
||||
G4bool G4VPhononProcess::IsApplicable(const G4ParticleDefinition& aPD) {
|
||||
return (&aPD==G4PhononLong::Definition() ||
|
||||
&aPD==G4PhononTransFast::Definition() ||
|
||||
&aPD==G4PhononTransSlow::Definition() );
|
||||
}
|
||||
|
||||
|
||||
// Initialize wave vectors for currently active track(s)
|
||||
|
||||
void G4VPhononProcess::StartTracking(G4Track* track) {
|
||||
G4VProcess::StartTracking(track); // Apply base class actions
|
||||
|
||||
// FIXME: THE WAVEVECTOR SHOULD BE COMPUTED BY INVERTING THE K/V MAP
|
||||
if (!trackKmap->Find(track))
|
||||
trackKmap->SetK(track, track->GetMomentumDirection());
|
||||
|
||||
currentTrack = track; // Save for use by EndTracking
|
||||
|
||||
// Fetch lattice for current track once, use in subsequent steps
|
||||
G4LatticeManager* LM = G4LatticeManager::GetLatticeManager();
|
||||
theLattice = LM->GetLattice(track->GetVolume());
|
||||
}
|
||||
|
||||
void G4VPhononProcess::EndTracking() {
|
||||
G4VProcess::EndTracking(); // Apply base class actions
|
||||
trackKmap->RemoveTrack(currentTrack);
|
||||
currentTrack = 0;
|
||||
theLattice = 0;
|
||||
}
|
||||
|
||||
|
||||
// For convenience, map phonon type to polarization code
|
||||
|
||||
G4int G4VPhononProcess::GetPolarization(const G4Track& track) const {
|
||||
return G4PhononPolarization::Get(track.GetParticleDefinition());
|
||||
}
|
||||
|
||||
|
||||
// Generate random polarization from density of states
|
||||
|
||||
G4int G4VPhononProcess::ChoosePolarization(G4double Ldos, G4double STdos,
|
||||
G4double FTdos) const {
|
||||
G4double norm = Ldos + STdos + FTdos;
|
||||
G4double cProbST = STdos/norm;
|
||||
G4double cProbFT = FTdos/norm + cProbST;
|
||||
|
||||
// NOTE: Order of selection done to match previous random sequences
|
||||
G4double modeMixer = G4UniformRand();
|
||||
if (modeMixer<cProbST) return G4PhononPolarization::TransSlow;
|
||||
if (modeMixer<cProbFT) return G4PhononPolarization::TransFast;
|
||||
return G4PhononPolarization::Long;
|
||||
}
|
||||
|
||||
|
||||
// Create new secondary track from phonon configuration
|
||||
|
||||
G4Track* G4VPhononProcess::CreateSecondary(G4int polarization,
|
||||
const G4ThreeVector& waveVec,
|
||||
G4double energy) const {
|
||||
if (verboseLevel>1) {
|
||||
G4cout << GetProcessName() << " CreateSecondary pol " << polarization
|
||||
<< " K " << waveVec << " E " << energy << G4endl;
|
||||
}
|
||||
|
||||
G4ThreeVector vgroup = theLattice->MapKtoVDir(polarization, waveVec);
|
||||
if (verboseLevel>1) G4cout << " MapKtoVDir returned " << vgroup << G4endl;
|
||||
|
||||
vgroup = theLattice->RotateToGlobal(vgroup);
|
||||
if (verboseLevel>1) G4cout << " RotateToGlobal returned " << vgroup << G4endl;
|
||||
|
||||
if (verboseLevel && std::fabs(vgroup.mag()-1.) > 0.01) {
|
||||
G4cout << "WARNING: " << GetProcessName() << " vgroup not a unit vector: "
|
||||
<< vgroup << G4endl;
|
||||
}
|
||||
|
||||
G4ParticleDefinition* thePhonon = G4PhononPolarization::Get(polarization);
|
||||
|
||||
// Secondaries are created at the current track coordinates
|
||||
G4Track* sec = new G4Track(new G4DynamicParticle(thePhonon, vgroup, energy),
|
||||
currentTrack->GetGlobalTime(),
|
||||
currentTrack->GetPosition());
|
||||
|
||||
// Store wavevector in lookup table for future tracking
|
||||
trackKmap->SetK(sec, theLattice->RotateToGlobal(waveVec));
|
||||
|
||||
if (verboseLevel>1) {
|
||||
G4cout << GetProcessName() << " secondary K rotated to "
|
||||
<< trackKmap->GetK(sec) << G4endl;
|
||||
}
|
||||
|
||||
sec->SetVelocity(theLattice->MapKtoV(polarization, waveVec));
|
||||
sec->UseGivenVelocity(true);
|
||||
|
||||
return sec;
|
||||
}
|
||||
Reference in New Issue
Block a user