Import Geant4 11.1.0.beta source tree
This commit is contained in:
+8
-1
@@ -293,6 +293,9 @@ public:
|
||||
|
||||
inline void Finalize();
|
||||
static void FinalizeAll();
|
||||
static void PrintAll(); //hoang added
|
||||
inline void UnFinalize();
|
||||
void SetUserID(const G4String& userID);//hoang moved it to public
|
||||
|
||||
inline const G4String& GetUserID() const;
|
||||
|
||||
@@ -331,7 +334,6 @@ protected:
|
||||
|
||||
void CheckElectronOccupancy(const char* line) const;
|
||||
void MakeExceptionIfFinalized();
|
||||
void SetUserID(const G4String& userID);
|
||||
|
||||
void CreateDefaultDiffCoeffParam();
|
||||
static void ScaleAllDiffusionCoefficientsOnWater(double temperature_K);
|
||||
@@ -591,4 +593,9 @@ G4MolecularConfiguration::GetDiffusionCoefficient(const G4Material* material,
|
||||
return fDiffParam(material, temperature, this);
|
||||
}
|
||||
|
||||
inline void G4MolecularConfiguration::UnFinalize()
|
||||
{
|
||||
fIsFinalized = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,8 +49,11 @@
|
||||
#include "G4MoleculeIterator.hh"
|
||||
#include "G4ElectronOccupancy.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class G4MoleculeDefinition;
|
||||
class G4MolecularConfiguration;
|
||||
class G4MoleculeTableMessenger;
|
||||
|
||||
typedef G4MoleculeIterator<G4MoleculeDefinition> G4MoleculeDefinitionIterator;
|
||||
typedef G4MoleculeIterator<G4MolecularConfiguration> G4ConfigurationIterator;
|
||||
@@ -131,6 +134,8 @@ protected:
|
||||
typedef std::map<G4String, G4MoleculeDefinition*> MoleculeDefTable;
|
||||
|
||||
MoleculeDefTable fMoleculeDefTable;
|
||||
std::unique_ptr<G4MoleculeTableMessenger> fMoleculeDefTableMessenger;
|
||||
|
||||
};
|
||||
|
||||
#endif /* G4MOLECULETABLE_HH_ */
|
||||
|
||||
+55
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#ifndef _G4MOLECULETABLEMESSENGER_HH
|
||||
#define _G4MOLECULETABLEMESSENGER_HH
|
||||
|
||||
#include <G4UImessenger.hh>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class G4UIcmdWithAString;
|
||||
class G4DNAMolecularReactionTable;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithABool;
|
||||
|
||||
class G4MoleculeTableMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4MoleculeTableMessenger();
|
||||
~G4MoleculeTableMessenger() override;
|
||||
void SetNewValue(G4UIcommand * command,G4String newValue) override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<G4UIcmdWithoutParameter> fpPrintTable;
|
||||
std::unique_ptr<G4UIcmdWithAString> fpSpecies;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // GEANT4_G4MOLECULETABLEMESSENGER_HH
|
||||
+3
-3
@@ -44,7 +44,7 @@ class G4VMoleculeCounter
|
||||
{
|
||||
protected:
|
||||
static G4ThreadLocal G4VMoleculeCounter* fpInstance;
|
||||
static G4bool fUse;
|
||||
G4bool fUse = false;
|
||||
|
||||
G4VMoleculeCounter() = default;
|
||||
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
* at every creation/deletion of a molecule to
|
||||
* to increase/decrease the number at a given time.
|
||||
*/
|
||||
static void Use(G4bool flag = true);
|
||||
void Use(G4bool flag = true);
|
||||
|
||||
static G4bool InUse();
|
||||
G4bool InUse();
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ geant4_add_module(G4emdna-molman
|
||||
G4Serialize.hh
|
||||
G4VMolecularDissociationDisplacer.hh
|
||||
G4VMoleculeCounter.hh
|
||||
G4MoleculeTableMessenger.hh
|
||||
SOURCES
|
||||
G4MolecularConfiguration.cc
|
||||
G4MolecularDissociationChannel.cc
|
||||
@@ -28,7 +29,8 @@ geant4_add_module(G4emdna-molman
|
||||
G4MoleculeTable.cc
|
||||
G4Serialize.cc
|
||||
G4VMolecularDissociationDisplacer.cc
|
||||
G4VMoleculeCounter.cc)
|
||||
G4VMoleculeCounter.cc
|
||||
G4MoleculeTableMessenger.cc)
|
||||
|
||||
geant4_module_link_libraries(G4emdna-molman
|
||||
PUBLIC
|
||||
|
||||
+20
@@ -1553,3 +1553,23 @@ void G4MolecularConfiguration::FinalizeAll()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void G4MolecularConfiguration::PrintAll() //hoang added
|
||||
{
|
||||
const std::vector<G4MolecularConfiguration*>& species =
|
||||
GetManager()->GetAllSpecies();
|
||||
G4cout<<G4endl;
|
||||
G4cout<<"Molecular Config"<<std::setw(25)<<" | Diffusion Coefficient (m2 / s) "<<std::setw(20)<<" | Radius (nm) "<<G4endl;
|
||||
G4cout<<"__________________________________________"
|
||||
"___________________________________"<<G4endl;
|
||||
for(size_t i = 0; i < species.size() ; ++i)
|
||||
{
|
||||
G4cout<<species[i]->GetName()
|
||||
<<std::setw(30 - species[i]->GetName().length())
|
||||
<<right<<species[i]->GetDiffusionCoefficient() * 1.0e3<<std::setw(30)
|
||||
<<species[i]->GetVanDerVaalsRadius()/CLHEP::nm<<G4endl;
|
||||
G4cout<<"__________________________________________"
|
||||
"___________________________________"<<G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ITImp(G4Molecule)
|
||||
|
||||
G4Allocator<G4Molecule>*& aMoleculeAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4Molecule>* _instance = nullptr;
|
||||
@@ -396,7 +394,7 @@ G4Track* G4Molecule::BuildTrack(G4double globalTime,
|
||||
fpMolecularConfiguration->GetDefinition(), MomentumDirection,
|
||||
KineticEnergy);
|
||||
|
||||
if (G4VMoleculeCounter::InUse())
|
||||
if (G4VMoleculeCounter::Instance()->InUse())
|
||||
{
|
||||
G4VMoleculeCounter::Instance()->
|
||||
AddAMoleculeAtTime(fpMolecularConfiguration,
|
||||
|
||||
@@ -33,12 +33,14 @@
|
||||
#include "G4MoleculeTable.hh"
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
#include "G4MoleculeDefinition.hh"
|
||||
#include "G4MoleculeTableMessenger.hh"
|
||||
|
||||
G4MoleculeTable* G4MoleculeTable::fpgMoleculeTable(0);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4MoleculeTable::G4MoleculeTable()
|
||||
: fMoleculeDefTableMessenger(new G4MoleculeTableMessenger())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#include "G4MoleculeTableMessenger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include <G4SystemOfUnits.hh>
|
||||
#include <G4UIcmdWithoutParameter.hh>
|
||||
#include "G4MoleculeTable.hh"
|
||||
#include "G4MoleculeDefinition.hh"
|
||||
#include "G4MolecularConfiguration.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4MoleculeTableMessenger::G4MoleculeTableMessenger()
|
||||
: G4UImessenger()
|
||||
, fpPrintTable(new G4UIcmdWithoutParameter("/chem/PrintSpeciesTable", this))
|
||||
, fpSpecies(new G4UIcmdWithAString("/chem/species", this))
|
||||
{}
|
||||
|
||||
G4MoleculeTableMessenger::~G4MoleculeTableMessenger() = default;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void G4MoleculeTableMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if(command == fpPrintTable.get())
|
||||
{
|
||||
G4MolecularConfiguration::PrintAll();
|
||||
}
|
||||
if(command == fpSpecies.get())
|
||||
{
|
||||
std::istringstream iss(newValue);
|
||||
|
||||
G4String speciesName;
|
||||
iss >> speciesName;
|
||||
|
||||
G4String marker;
|
||||
iss >> marker; // must be [
|
||||
|
||||
if(marker != "[")
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description << " marker : " << marker << G4endl;
|
||||
G4Exception("G4MoleculeTableMessenger::SetNewValue",
|
||||
"FAIL_SPECIES_DEFINITION04", FatalException, description);
|
||||
}
|
||||
|
||||
G4String speciesDefName;
|
||||
iss >> speciesDefName;
|
||||
|
||||
iss >> marker; // peut etre |
|
||||
|
||||
G4int charge = 0;
|
||||
if(marker == "|")
|
||||
{
|
||||
iss >> charge;
|
||||
}
|
||||
iss >> marker; // peut etre |
|
||||
G4double diffusion_coefficient = 0;
|
||||
if(marker == "|")
|
||||
{
|
||||
iss >> diffusion_coefficient;
|
||||
}
|
||||
iss >> marker; // peut etre |
|
||||
G4double VanDerVaalsRadius = 0;
|
||||
if(marker == "|")
|
||||
{
|
||||
iss >> VanDerVaalsRadius; // in nm
|
||||
}
|
||||
|
||||
auto pConf =
|
||||
G4MolecularConfiguration::GetMolecularConfiguration(speciesName);
|
||||
if(pConf != nullptr)
|
||||
{
|
||||
pConf->UnFinalize();
|
||||
if(VanDerVaalsRadius != 0)
|
||||
{
|
||||
pConf->SetVanDerVaalsRadius(VanDerVaalsRadius * nm);
|
||||
}
|
||||
if(diffusion_coefficient != 0)
|
||||
{
|
||||
pConf->SetDiffusionCoefficient(diffusion_coefficient * (m2 / s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto particleDef = dynamic_cast<G4MoleculeDefinition*>(
|
||||
G4ParticleTable::GetParticleTable()->FindParticle(speciesDefName));
|
||||
if(particleDef != nullptr)
|
||||
{
|
||||
auto molConf =
|
||||
G4MolecularConfiguration::GetOrCreateMolecularConfiguration(
|
||||
particleDef, charge);
|
||||
if(molConf == nullptr)
|
||||
{
|
||||
G4ExceptionDescription description;
|
||||
description << "This molecule has not been defined" << G4endl;
|
||||
G4Exception("G4MoleculeTableMessenger::SetNewValue",
|
||||
"FAIL_SPECIES_DEFINITION02", FatalException, description);
|
||||
}
|
||||
molConf->UnFinalize();
|
||||
if(VanDerVaalsRadius != 0)
|
||||
{
|
||||
molConf->SetVanDerVaalsRadius(VanDerVaalsRadius * nm);
|
||||
}
|
||||
if(diffusion_coefficient != 0)
|
||||
{
|
||||
molConf->SetDiffusionCoefficient(diffusion_coefficient * (m2 / s));
|
||||
}
|
||||
|
||||
auto usedName = molConf->GetUserID();
|
||||
if(usedName != "")
|
||||
{
|
||||
molConf->PrintState();
|
||||
G4ExceptionDescription description;
|
||||
description << "This molecule has been defined by the name : "
|
||||
<< usedName << " . Please, use this name." << G4endl;
|
||||
G4Exception("G4MoleculeTableMessenger::SetNewValue",
|
||||
"FAIL_SPECIES_DEFINITION", FatalException, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
molConf->SetUserID(speciesName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto speciesDef =
|
||||
new G4MoleculeDefinition(speciesDefName, /*mass no needed*/ 0,
|
||||
/*D*/ diffusion_coefficient * (m * m / s),
|
||||
/*charge*/ charge, 1,
|
||||
/*electronL*/ 0,
|
||||
/*radius*/ VanDerVaalsRadius * nm);
|
||||
G4bool alreadyCreated(false);
|
||||
G4MolecularConfiguration::CreateMolecularConfiguration(
|
||||
speciesName, speciesDef, alreadyCreated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
#include "G4VMoleculeCounter.hh"
|
||||
#include "G4MoleculeCounter.hh"
|
||||
|
||||
G4bool G4VMoleculeCounter::fUse = false;
|
||||
G4ThreadLocal
|
||||
G4VMoleculeCounter* G4VMoleculeCounter::fpInstance = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user