| Summary: | TRACK003 "the Momentum Change is not unit vector" error in multi-threaded run using thermal scattering libraries | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Sergio Losilla <sergio.losilla> |
| Component: | processes/hadronic/models/neutron_hp | Assignee: | dennis.herbert.wright |
| Status: | RESOLVED INVALID | ||
| Severity: | normal | ||
| Priority: | P4 | ||
| Version: | 10.6 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Sergio Losilla
2020-01-17 15:28:44 CET
Never mind! In an attempt to simplify the thermal library classes, I ended up having only one model for all threads. The race condition happened when one thread modified one of the momentum direction components while another thread was copying it.
I was wondering, it seems that using G4ThermalNeutrons is a much simpler and safer way to enable the HP stuff. I mean, it seems that all of this:
G4HadronElasticProcess* theNeutronElasticProcess = new G4HadronElasticProcess;
// Cross Section Data set
G4NeutronHPElasticData* theHPElasticData = new G4NeutronHPElasticData;
theNeutronElasticProcess->AddDataSet(theHPElasticData);
G4NeutronHPThermalScatteringData* theHPThermalScatteringData = new G4NeutronHPThermalScatteringData;
theNeutronElasticProcess->AddDataSet(theHPThermalScatteringData);
// Models
G4NeutronHPElastic* theNeutronElasticModel = new G4NeutronHPElastic;
theNeutronElasticModel->SetMinEnergy(4.0*eV);
theNeutronElasticProcess->RegisterMe(theNeutronElasticModel);
G4NeutronHPThermalScattering* theNeutronThermalElasticModel = new G4NeutronHPThermalScattering;
theNeutronThermalElasticModel->SetMaxEnergy(4.0*eV);
theNeutronElasticProcess->RegisterMe(theNeutronThermalElasticModel);
// Apply Processes to Process Manager of Neutron
G4ProcessManager* pmanager = G4Neutron::Neutron()->GetProcessManager();
pmanager->AddDiscreteProcess(theNeutronElasticProcess);
can be replaced with
RegisterPhysics(new G4HadronElasticPhysicsHP);
RegisterPhysics(new G4ThermalNeutrons);
Is this correct?
In such case, it would be worth updating the documentation in http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/TrackingAndPhysics/physicsProcess.html#hadronic-interactions ?
Yes, using the physics builders is the better way to do it, as long as they contain all the physics you need. |