diff --git a/src/geometry.f90 b/src/geometry.f90
index da2a3febab..3ad533223c 100644
--- a/src/geometry.f90
+++ b/src/geometry.f90
@@ -231,7 +231,7 @@ contains
type(Surface), pointer :: surf => null()
surf => surfaces(abs(p % surface))
- if (verbosity >= 10) then
+ if (verbosity >= 10 .or. trace) then
message = " Crossing surface " // trim(int_to_str(surf % id))
call write_message()
end if
@@ -254,7 +254,7 @@ contains
call score_surface_current(p)
! Display message
- if (verbosity >= 10) then
+ if (verbosity >= 10 .or. trace) then
message = " Leaked out of surface " // trim(int_to_str(surf % id))
call write_message()
end if
@@ -373,7 +373,7 @@ contains
p % last_xyz = p % coord0 % xyz + TINY_BIT * p % coord0 % uvw
! Diagnostic message
- if (verbosity >= 10) then
+ if (verbosity >= 10 .or. trace) then
message = " Reflected from surface " // trim(int_to_str(surf%id))
call write_message()
end if
@@ -440,7 +440,7 @@ contains
lat => lattices(p % coord % lattice)
- if (verbosity >= 10) then
+ if (verbosity >= 10 .or. trace) then
message = " Crossing lattice " // int_to_str(lat % id)
call write_message()
end if
diff --git a/src/global.f90 b/src/global.f90
index 570c726cad..814313c71e 100644
--- a/src/global.f90
+++ b/src/global.f90
@@ -168,6 +168,11 @@ module global
! screen and in logs
integer :: verbosity = 7
+ ! Trace for single particle
+ logical :: trace
+ integer :: trace_cycle
+ integer(8) :: trace_particle
+
contains
!===============================================================================
diff --git a/src/input_xml.f90 b/src/input_xml.f90
index a698fbd37d..d08f7e8d8a 100644
--- a/src/input_xml.f90
+++ b/src/input_xml.f90
@@ -136,6 +136,12 @@ contains
weight_survive = cutoff_(1) % weight_avg
end if
+ ! Particle trace
+ if (size(trace_) > 0) then
+ trace_cycle = trace_(1)
+ trace_particle = trace_(2)
+ end if
+
end subroutine read_settings_xml
!===============================================================================
diff --git a/src/main.f90 b/src/main.f90
index 8d8efbc61e..a123d4790c 100644
--- a/src/main.f90
+++ b/src/main.f90
@@ -90,6 +90,11 @@ contains
! set random number seed
i_particle = (i_cycle-1)*n_particles + p % id
call set_particle_seed(i_particle)
+
+ ! set particle trace
+ trace = .false.
+ if (i_cycle == trace_cycle .and. &
+ p % id == trace_particle) trace = .true.
! transport particle
call transport(p)
diff --git a/src/physics.f90 b/src/physics.f90
index 6c5d4ec902..7e5d71a8d0 100644
--- a/src/physics.f90
+++ b/src/physics.f90
@@ -52,12 +52,12 @@ contains
p % cell_born = p % coord % cell
end if
- if (verbosity >= 9) then
+ if (verbosity >= 9 .or. trace) then
message = "Simulating Particle " // trim(int_to_str(p % id))
call write_message()
end if
- if (verbosity >= 10) then
+ if (verbosity >= 10 .or. trace) then
message = " Born in cell " // trim(int_to_str(&
cells(p % coord % cell) % id))
call write_message()
diff --git a/src/xml-fortran/templates/settings_t.xml b/src/xml-fortran/templates/settings_t.xml
index 167ff0d63d..71ae91bd27 100644
--- a/src/xml-fortran/templates/settings_t.xml
+++ b/src/xml-fortran/templates/settings_t.xml
@@ -25,5 +25,6 @@
+