Quadrupole local magnetic field

_Geant4 Version: 4-11-01-patch-02
_Operating System:Windows and Linux
_Compiler/Version: VS 2022
_CMake Version:3.27.0

My program is showing following warning while running and abruptly stops executing, could you please help me where I am doing wrong? This warning and abrupting stopping execution occurs while I’m loading an external ascii file with particles of electrons generated from another software with energies spanning from few MeV to 300 MeV. When I use particle generator that generates electrons randomly in gaussian shape and some gun radius (divergence), the program works fine. The ascii file contains total 570000 particles with different weights (number of particles).

-------- WWWW -------- G4Exception-END --------- WWWW -------

G4WT0 >
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav1002
issued by : G4Navigator::ComputeStep()
Stuck Track: potential geometry or navigation problem.
Track stuck, not moving for 10 steps.
Current phys volume: ‘World’

  • at position : (-7.807072828320571,-12.80818542391149,381.6494574654859)
    in direction: (0.6496045648585157,-0.7449256594214371,-0.1519857600254558)
    (local position: (-7.807072828320571,-12.80818542391149,381.6494574654859))
    (local direction: (0.6496045648585157,-0.7449256594214371,-0.1519857600254558)).
    Previous phys volume: ‘Quadrupole_2’

Likely geometry overlap - else navigation problem !
*** Trying to get unstuck using a push - expanding step to 1e-07 (mm) … Potential overlap in geometry !

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

Could you please help me? Thanks for your help.
Snippet of code for Quadrupole 1 ane 2 magnetic field is

G4Mag_UsualEqRhs* fEquation = new G4Mag_UsualEqRhs(quadrupoleFieldQ1);
G4MagIntegratorStepper* fStepper = new G4ClassicalRK4(fEquation, 8);
G4MagInt_Driver* fIntgrDriver =
new G4MagInt_Driver(1 * mm, fStepper, fStepper->GetNumberOfVariables());
G4FieldManager* fieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
G4ChordFinder* fChordFinder = new G4ChordFinder(fIntgrDriver);
fieldManager->SetChordFinder(fChordFinder);
fieldManager->SetDetectorField(quadrupoleFieldQ1);
fieldManager->CreateChordFinder(quadrupoleFieldQ1);
Quadrupole_1_log->SetFieldManager(fieldManager, true);

G4Mag_UsualEqRhs* fEquation1 = new G4Mag_UsualEqRhs(quadrupoleFieldQ2);
G4MagIntegratorStepper* fStepper1 = new G4ClassicalRK4(fEquation1, 8);
G4MagInt_Driver* fIntgrDriver1 =
new G4MagInt_Driver(1 * mm, fStepper1, fStepper1->GetNumberOfVariables());
G4FieldManager* fieldMgr =
G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4ChordFinder* fChordFinder1 = new G4ChordFinder(fIntgrDriver1);
fieldMgr->SetChordFinder(fChordFinder1);
fieldMgr->SetDetectorField(quadrupoleFieldQ2);
Quadrupole_2_log->SetFieldManager(fieldMgr, true);

1 Like