From d21244766574f45f6f040d324546adb5e111b9de Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Fri, 5 Jul 2019 11:01:52 +0200 Subject: [PATCH 01/38] Some header cleanup in mod_partciles --- source/mod_particles.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/mod_particles.f90 b/source/mod_particles.f90 index 78df8ea50..6886a1e45 100644 --- a/source/mod_particles.f90 +++ b/source/mod_particles.f90 @@ -5,7 +5,6 @@ ! ================================================================================================ ! module mod_particles - use crcoall use floatPrecision implicit none @@ -67,6 +66,7 @@ end subroutine part_applyClosedOrbit ! ================================================================================================ ! subroutine part_updateRefEnergy(refEnergy) + use crcoall use mod_common use mod_common_main use numerical_constants, only : one, c1m6 @@ -110,6 +110,7 @@ end subroutine part_updateRefEnergy ! ================================================================================================ ! subroutine part_updatePartEnergy(refArray,updateAngle) + use crcoall use mod_common use mod_common_track use mod_common_main @@ -182,8 +183,8 @@ end subroutine part_updatePartEnergy ! ================================================================================================ ! subroutine part_writeState(fileName, isText, withIons) - use mod_units use parpro + use mod_units use mod_common use mod_common_main use mod_common_track From 2e3030ea5a4d4a231edbbeccffcc788cfaf85371 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Fri, 5 Jul 2019 18:46:23 +0200 Subject: [PATCH 02/38] Added parsing of the DIST FORMAT keyword --- source/mod_dist.f90 | 213 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 3 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 330b41c91..17c217d0e 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -32,11 +32,56 @@ module mod_dist logical, public, save :: dist_enable ! DIST input block given logical, public, save :: dist_echo ! Echo the read distribution? + logical, public, save :: dist_hasFormat ! Whether the format flag is set character(len=256), public, save :: dist_readFile ! File name for reading the distribution character(len=256), public, save :: dist_echoFile ! File name for echoing the distribution integer, private, save :: dist_readUnit ! Unit for reading the distribution integer, private, save :: dist_echoUnit ! Unit for echoing the distribution + integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns + integer, private, save :: dist_nColumns = 0 ! The number of columns in the file + + ! Column formats + ! ================ + integer, parameter :: dist_fmtNONE = 0 + integer, parameter :: dist_fmtPartID = 1 + integer, parameter :: dist_fmtParentID = 2 + + ! Physical Coordinates + integer, parameter :: dist_fmtX = 11 ! Horizontal position + integer, parameter :: dist_fmtY = 12 ! Vertical positiom + integer, parameter :: dist_fmtXP = 13 ! Horizontal angle + integer, parameter :: dist_fmtYP = 14 ! Vertical angle + integer, parameter :: dist_fmtPX = 15 ! Horizontal momentum + integer, parameter :: dist_fmtPY = 16 ! Vertical momentum + integer, parameter :: dist_fmtSIGMA = 17 ! Longitudinal relative position + integer, parameter :: dist_fmtDT = 18 ! Time delay + integer, parameter :: dist_fmtE = 19 ! Particle energy + integer, parameter :: dist_fmtP = 20 ! Particle momentum + integer, parameter :: dist_fmtDEE0 = 21 ! Relative particle energy (to reference particle) + integer, parameter :: dist_fmtDPP0 = 22 ! Relative particle momentum (to reference particle) + + ! Normalised Coordinates + integer, parameter :: dist_fmtX_NORM = 31 ! Normalised horizontal position + integer, parameter :: dist_fmtY_NORM = 32 ! Normalised vertical positiom + integer, parameter :: dist_fmtXP_NORM = 33 ! Normalised horizontal angle + integer, parameter :: dist_fmtYP_NORM = 34 ! Normalised vertical angle + integer, parameter :: dist_fmtPX_NORM = 35 ! Normalised horizontal momentum + integer, parameter :: dist_fmtPY_NORM = 36 ! Normalised vertical momentum + integer, parameter :: dist_fmtSIGMA_NORM = 37 ! Normalised longitudinal relative position + integer, parameter :: dist_fmtDT_NORM = 38 ! Normalised time delay + integer, parameter :: dist_fmtE_NORM = 39 ! Normalised particle energy + integer, parameter :: dist_fmtP_NORM = 40 ! Normalised particle momentum + integer, parameter :: dist_fmtDEE0_NORM = 41 ! Normalised relative particle energy (to reference particle) + integer, parameter :: dist_fmtDPP0_NORM = 42 ! Normalised relative particle momentum (to reference particle) + + ! Ion Columns + integer, parameter :: dist_fmtMASS = 51 ! Particle mass + integer, parameter :: dist_fmtCHARGE = 52 ! Particle Charge + integer, parameter :: dist_fmtIonA = 53 ! Ion atomic number + integer, parameter :: dist_fmtIonZ = 54 ! Ion atomic charge + integer, parameter :: dist_fmtPDGID = 55 ! Particle PDG ID + contains ! ================================================================================================ ! @@ -56,8 +101,8 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) logical, intent(inout) :: iErr character(len=:), allocatable :: lnSplit(:) - integer nSplit - logical spErr + integer nSplit, i + logical spErr, cErr call chr_split(inLine, lnSplit, nSplit, spErr) if(spErr) then @@ -69,9 +114,25 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) select case(lnSplit(1)) + case("FORMAT") + if(nSplit < 2) then + write(lerr,"(a,i0)") "DIST> ERROR FORMAT takes at least 1 argument, got ",nSplit-1 + write(lerr,"(a)") "DIST> FORMAT [list of columns]" + iErr = .true. + return + end if + do i=2,nSplit + call dist_setColumnFormat(lnSplit(i),cErr) + if(cErr) then + iErr = .true. + return + end if + end do + case("READ") if(nSplit < 2) then - write(lerr,"(a)") "DIST> ERROR READ must be followed by one file name only." + write(lerr,"(a,i0)") "DIST> ERROR READ takes 1 argument, got ",nSplit-1 + write(lerr,"(a)") "DIST> READ filename" iErr = .true. return end if @@ -97,6 +158,152 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end subroutine dist_parseInputLine +subroutine dist_setColumnFormat(fmtName, fErr) + + use crcoall + use string_tools + + character(len=*), intent(in) :: fmtName + logical, intent(out) :: fErr + + fErr = .false. + + select case(chr_toUpper(fmtName)) + + case("NONE") + call dist_appendFormat(dist_fmtNONE) ! Ignored + case("ID") + call dist_appendFormat(dist_fmtPartID) ! Particle ID + case("PARENT") + call dist_appendFormat(dist_fmtParentID) ! Parent ID + + case("X") + call dist_appendFormat(dist_fmtX) ! Horizontal position + case("Y") + call dist_appendFormat(dist_fmtY) ! Vertical positiom + case("XP") + call dist_appendFormat(dist_fmtXP) ! Horizontal angle + case("YP") + call dist_appendFormat(dist_fmtYP) ! Vertical angle + case("PX") + call dist_appendFormat(dist_fmtPX) ! Horizontal momentum + case("PY") + call dist_appendFormat(dist_fmtPY) ! Vertical momentum + case("SIGMA","DS") + call dist_appendFormat(dist_fmtSIGMA) ! Longitudinal relative position + case("DT") + call dist_appendFormat(dist_fmtDT) ! Time delay + case("E") + call dist_appendFormat(dist_fmtE) ! Particle energy + case("P") + call dist_appendFormat(dist_fmtP) ! Particle momentum + case("DE/E0") + call dist_appendFormat(dist_fmtDEE0) ! Relative particle energy (to reference particle) + case("DP/P0") + call dist_appendFormat(dist_fmtDPP0) ! Relative particle momentum (to reference particle) + + case("X_NORM") + call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position + case("Y_NORM") + call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom + case("XP_NORM") + call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle + case("YP_NORM") + call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle + case("PX_NORM") + call dist_appendFormat(dist_fmtPX_NORM) ! Normalised horizontal momentum + case("PY_NORM") + call dist_appendFormat(dist_fmtPY_NORM) ! Normalised vertical momentum + case("SIGMA_NORM","DS_NORM") + call dist_appendFormat(dist_fmtSIGMA_NORM) ! Normalised longitudinal relative position + case("DT_NORM") + call dist_appendFormat(dist_fmtDT_NORM) ! Normalised time delay + case("E_NORM") + call dist_appendFormat(dist_fmtE_NORM) ! Normalised particle energy + case("P_NORM") + call dist_appendFormat(dist_fmtP_NORM) ! Normalised particle momentum + case("DE/E0_NORM") + call dist_appendFormat(dist_fmtDEE0_NORM) ! Normalised relative particle energy (to reference particle) + case("DP/P0_NORM") + call dist_appendFormat(dist_fmtDPP0_NORM) ! Normalised relative particle momentum (to reference particle) + + case("MASS","M") + call dist_appendFormat(dist_fmtMASS) ! Particle mass + case("CHARGE","Q") + call dist_appendFormat(dist_fmtCHARGE) ! Particle charge + case("ION_A") + call dist_appendFormat(dist_fmtIonA) ! Ion atomic number + case("ION_Z") + call dist_appendFormat(dist_fmtIonZ) ! Ion atomic charge + case("PDGID") + call dist_appendFormat(dist_fmtPDGID) ! Particle PDG ID + + case("DEFAULT_4D") ! 4D default coordinates + call dist_appendFormat(dist_fmtX) ! Horizontal position + call dist_appendFormat(dist_fmtY) ! Vertical positiom + call dist_appendFormat(dist_fmtXP) ! Horizontal angle + call dist_appendFormat(dist_fmtYP) ! Vertical angle + + case("DEFAULT_6D") ! 6D default coordinates + call dist_appendFormat(dist_fmtX) ! Horizontal position + call dist_appendFormat(dist_fmtY) ! Vertical positiom + call dist_appendFormat(dist_fmtXP) ! Horizontal angle + call dist_appendFormat(dist_fmtYP) ! Vertical angle + call dist_appendFormat(dist_fmtSIGMA) ! Longitudinal relative position + call dist_appendFormat(dist_fmtDPP0) ! Relative particle momentum (to reference particle) + + case("DEFAULT_4D_NORM") ! 4D normalised coordinates + call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle + + case("DEFAULT_6D_NORM") ! 6D normalised coordinates + call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle + call dist_appendFormat(dist_fmtSIGMA_NORM) ! Normalised longitudinal relative position + call dist_appendFormat(dist_fmtDPP0_NORM) ! Normalised relative particle momentum (to reference particle) + + case("DEFAULT_OLD") ! The old DIST block file format + call dist_appendFormat(dist_fmtPartID) ! Particle ID + call dist_appendFormat(dist_fmtNONE) ! Ignored + call dist_appendFormat(dist_fmtNONE) ! Ignored + call dist_appendFormat(dist_fmtX) ! Horizontal position + call dist_appendFormat(dist_fmtY) ! Vertical positiom + call dist_appendFormat(dist_fmtNONE) ! Ignored + call dist_appendFormat(dist_fmtXP) ! Horizontal angle + call dist_appendFormat(dist_fmtYP) ! Vertical angle + call dist_appendFormat(dist_fmtNONE) ! Ignored + call dist_appendFormat(dist_fmtIonA) ! Ion atomic number + call dist_appendFormat(dist_fmtIonZ) ! Ion atomic charge + call dist_appendFormat(dist_fmtMASS) ! Particle mass + call dist_appendFormat(dist_fmtP) ! Particle momentum + call dist_appendFormat(dist_fmtDT) ! Time delay + ! call dist_appendFormat(dist_fmtCHARGE) ! Particle charge + ! call dist_appendFormat(dist_fmtPDGID) ! Particle PDG ID + + case default + write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" + fErr = .true. + + end select + +end subroutine dist_setColumnFormat + +subroutine dist_appendFormat(fmtID) + + use mod_alloc + + integer, intent(in) :: fmtID + + dist_nColumns = dist_nColumns + 1 + call alloc(dist_colFormat,dist_nColumns,dist_fmtNONE,"dist_colFormat") + dist_colFormat(dist_nColumns) = fmtID + +end subroutine dist_appendFormat + ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS From 9980a28667fa64f1711af292e4a62abc0f619856 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Fri, 5 Jul 2019 20:07:52 +0200 Subject: [PATCH 03/38] Rewritten DIST parser to support current functionality with new format --- source/mod_dist.f90 | 330 ++++++++++++++++++++++++++++++-------------- 1 file changed, 230 insertions(+), 100 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 17c217d0e..b3ce5b40f 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -38,8 +38,9 @@ module mod_dist integer, private, save :: dist_readUnit ! Unit for reading the distribution integer, private, save :: dist_echoUnit ! Unit for echoing the distribution - integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns - integer, private, save :: dist_nColumns = 0 ! The number of columns in the file + integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns + real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns + integer, private, save :: dist_nColumns = 0 ! The number of columns in the file ! Column formats ! ================ @@ -128,6 +129,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) return end if end do + dist_hasFormat = .true. case("READ") if(nSplit < 2) then @@ -162,6 +164,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) use crcoall use string_tools + use numerical_constants character(len=*), intent(in) :: fmtName logical, intent(out) :: fErr @@ -171,118 +174,118 @@ subroutine dist_setColumnFormat(fmtName, fErr) select case(chr_toUpper(fmtName)) case("NONE") - call dist_appendFormat(dist_fmtNONE) ! Ignored + call dist_appendFormat(dist_fmtNONE, one) ! Ignored case("ID") - call dist_appendFormat(dist_fmtPartID) ! Particle ID + call dist_appendFormat(dist_fmtPartID, one) ! Particle ID case("PARENT") - call dist_appendFormat(dist_fmtParentID) ! Parent ID + call dist_appendFormat(dist_fmtParentID, one) ! Parent ID case("X") - call dist_appendFormat(dist_fmtX) ! Horizontal position + call dist_appendFormat(dist_fmtX, one) ! Horizontal position case("Y") - call dist_appendFormat(dist_fmtY) ! Vertical positiom + call dist_appendFormat(dist_fmtY, one) ! Vertical positiom case("XP") - call dist_appendFormat(dist_fmtXP) ! Horizontal angle + call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle case("YP") - call dist_appendFormat(dist_fmtYP) ! Vertical angle + call dist_appendFormat(dist_fmtYP, one) ! Vertical angle case("PX") - call dist_appendFormat(dist_fmtPX) ! Horizontal momentum + call dist_appendFormat(dist_fmtPX, one) ! Horizontal momentum case("PY") - call dist_appendFormat(dist_fmtPY) ! Vertical momentum + call dist_appendFormat(dist_fmtPY, one) ! Vertical momentum case("SIGMA","DS") - call dist_appendFormat(dist_fmtSIGMA) ! Longitudinal relative position + call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position case("DT") - call dist_appendFormat(dist_fmtDT) ! Time delay + call dist_appendFormat(dist_fmtDT, one) ! Time delay case("E") - call dist_appendFormat(dist_fmtE) ! Particle energy + call dist_appendFormat(dist_fmtE, one) ! Particle energy case("P") - call dist_appendFormat(dist_fmtP) ! Particle momentum + call dist_appendFormat(dist_fmtP, one) ! Particle momentum case("DE/E0") - call dist_appendFormat(dist_fmtDEE0) ! Relative particle energy (to reference particle) + call dist_appendFormat(dist_fmtDEE0, one) ! Relative particle energy (to reference particle) case("DP/P0") - call dist_appendFormat(dist_fmtDPP0) ! Relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) case("X_NORM") - call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position + call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position case("Y_NORM") - call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom case("XP_NORM") - call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle case("YP_NORM") - call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle + call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle case("PX_NORM") - call dist_appendFormat(dist_fmtPX_NORM) ! Normalised horizontal momentum + call dist_appendFormat(dist_fmtPX_NORM, one) ! Normalised horizontal momentum case("PY_NORM") - call dist_appendFormat(dist_fmtPY_NORM) ! Normalised vertical momentum + call dist_appendFormat(dist_fmtPY_NORM, one) ! Normalised vertical momentum case("SIGMA_NORM","DS_NORM") - call dist_appendFormat(dist_fmtSIGMA_NORM) ! Normalised longitudinal relative position + call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position case("DT_NORM") - call dist_appendFormat(dist_fmtDT_NORM) ! Normalised time delay + call dist_appendFormat(dist_fmtDT_NORM, one) ! Normalised time delay case("E_NORM") - call dist_appendFormat(dist_fmtE_NORM) ! Normalised particle energy + call dist_appendFormat(dist_fmtE_NORM, one) ! Normalised particle energy case("P_NORM") - call dist_appendFormat(dist_fmtP_NORM) ! Normalised particle momentum + call dist_appendFormat(dist_fmtP_NORM, one) ! Normalised particle momentum case("DE/E0_NORM") - call dist_appendFormat(dist_fmtDEE0_NORM) ! Normalised relative particle energy (to reference particle) + call dist_appendFormat(dist_fmtDEE0_NORM, one) ! Normalised relative particle energy (to reference particle) case("DP/P0_NORM") - call dist_appendFormat(dist_fmtDPP0_NORM) ! Normalised relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) case("MASS","M") - call dist_appendFormat(dist_fmtMASS) ! Particle mass + call dist_appendFormat(dist_fmtMASS, one) ! Particle mass case("CHARGE","Q") - call dist_appendFormat(dist_fmtCHARGE) ! Particle charge + call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge case("ION_A") - call dist_appendFormat(dist_fmtIonA) ! Ion atomic number + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic number case("ION_Z") - call dist_appendFormat(dist_fmtIonZ) ! Ion atomic charge + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic charge case("PDGID") - call dist_appendFormat(dist_fmtPDGID) ! Particle PDG ID + call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case("DEFAULT_4D") ! 4D default coordinates - call dist_appendFormat(dist_fmtX) ! Horizontal position - call dist_appendFormat(dist_fmtY) ! Vertical positiom - call dist_appendFormat(dist_fmtXP) ! Horizontal angle - call dist_appendFormat(dist_fmtYP) ! Vertical angle + call dist_appendFormat(dist_fmtX, one) ! Horizontal position + call dist_appendFormat(dist_fmtY, one) ! Vertical positiom + call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, one) ! Vertical angle case("DEFAULT_6D") ! 6D default coordinates - call dist_appendFormat(dist_fmtX) ! Horizontal position - call dist_appendFormat(dist_fmtY) ! Vertical positiom - call dist_appendFormat(dist_fmtXP) ! Horizontal angle - call dist_appendFormat(dist_fmtYP) ! Vertical angle - call dist_appendFormat(dist_fmtSIGMA) ! Longitudinal relative position - call dist_appendFormat(dist_fmtDPP0) ! Relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtX, one) ! Horizontal position + call dist_appendFormat(dist_fmtY, one) ! Vertical positiom + call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, one) ! Vertical angle + call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position + call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) case("DEFAULT_4D_NORM") ! 4D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle + call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle case("DEFAULT_6D_NORM") ! 6D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM) ! Normalised vertical angle - call dist_appendFormat(dist_fmtSIGMA_NORM) ! Normalised longitudinal relative position - call dist_appendFormat(dist_fmtDPP0_NORM) ! Normalised relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle + call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position + call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) case("DEFAULT_OLD") ! The old DIST block file format - call dist_appendFormat(dist_fmtPartID) ! Particle ID - call dist_appendFormat(dist_fmtNONE) ! Ignored - call dist_appendFormat(dist_fmtNONE) ! Ignored - call dist_appendFormat(dist_fmtX) ! Horizontal position - call dist_appendFormat(dist_fmtY) ! Vertical positiom - call dist_appendFormat(dist_fmtNONE) ! Ignored - call dist_appendFormat(dist_fmtXP) ! Horizontal angle - call dist_appendFormat(dist_fmtYP) ! Vertical angle - call dist_appendFormat(dist_fmtNONE) ! Ignored - call dist_appendFormat(dist_fmtIonA) ! Ion atomic number - call dist_appendFormat(dist_fmtIonZ) ! Ion atomic charge - call dist_appendFormat(dist_fmtMASS) ! Particle mass - call dist_appendFormat(dist_fmtP) ! Particle momentum - call dist_appendFormat(dist_fmtDT) ! Time delay - ! call dist_appendFormat(dist_fmtCHARGE) ! Particle charge - ! call dist_appendFormat(dist_fmtPDGID) ! Particle PDG ID + call dist_appendFormat(dist_fmtPartID, one) ! Particle ID + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtX, c1e3) ! Horizontal position + call dist_appendFormat(dist_fmtY, c1e3) ! Vertical positiom + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtXP, c1e3) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, c1e3) ! Vertical angle + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic number + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic charge + call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass + call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum + call dist_appendFormat(dist_fmtDT, one) ! Time delay + ! call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge + ! call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case default write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" @@ -292,15 +295,21 @@ subroutine dist_setColumnFormat(fmtName, fErr) end subroutine dist_setColumnFormat -subroutine dist_appendFormat(fmtID) +subroutine dist_appendFormat(fmtID, colScale) use mod_alloc + use numerical_constants - integer, intent(in) :: fmtID + integer, intent(in) :: fmtID + real(kind=fPrec), intent(in) :: colScale dist_nColumns = dist_nColumns + 1 - call alloc(dist_colFormat,dist_nColumns,dist_fmtNONE,"dist_colFormat") + + call alloc(dist_colFormat, dist_nColumns, dist_fmtNONE, "dist_colFormat") + call alloc(dist_colScale, dist_nColumns, one, "dist_colScale") + dist_colFormat(dist_nColumns) = fmtID + dist_colScale(dist_nColumns) = colScale end subroutine dist_appendFormat @@ -322,7 +331,7 @@ subroutine dist_readDist implicit none - integer id, gen, j, ln, nSplit + integer id, gen, i, j, ln, nSplit real(kind=fPrec) weight, z, zp, dt(npart) logical spErr, cErr character(len=mInputLn) inLine @@ -346,6 +355,10 @@ subroutine dist_readDist ln = 0 cErr = .false. + if(dist_hasFormat .eqv. .false.) then + call dist_setColumnFormat("DEFAULT_OLD",cErr) + end if + call f_open(unit=dist_readUnit,file=dist_readFile,mode='r',err=cErr,formatted=.true.,status="old") if(cErr) goto 19 @@ -366,34 +379,14 @@ subroutine dist_readDist call chr_split(inLine, lnSplit, nSplit, spErr) if(spErr) goto 20 - if(nSplit > 0) call chr_cast(lnSplit(1), id, cErr) - if(nSplit > 1) call chr_cast(lnSplit(2), gen, cErr) - if(nSplit > 2) call chr_cast(lnSplit(3), weight, cErr) - if(nSplit > 3) call chr_cast(lnSplit(4), xv1(j), cErr) - if(nSplit > 4) call chr_cast(lnSplit(5), xv2(j), cErr) - if(nSplit > 5) call chr_cast(lnSplit(6), z, cErr) - if(nSplit > 6) call chr_cast(lnSplit(7), yv1(j), cErr) - if(nSplit > 7) call chr_cast(lnSplit(8), yv2(j), cErr) - if(nSplit > 8) call chr_cast(lnSplit(9), zp, cErr) - if(nSplit > 9) call chr_cast(lnSplit(10), naa(j), cErr) - if(nSplit > 10) call chr_cast(lnSplit(11), nzz(j), cErr) - if(nSplit > 11) call chr_cast(lnSplit(12), nucm(j), cErr) - if(nSplit > 12) call chr_cast(lnSplit(13), ejfv(j), cErr) - if(nSplit > 13) call chr_cast(lnSplit(14), dt(j), cErr) + do i=1,nSplit + call dist_saveParticle(j, i, lnSplit(i), cErr) + end do if(cErr) goto 20 - xv1(j) = xv1(j)*c1e3 - xv2(j) = xv2(j)*c1e3 - yv1(j) = yv1(j)*c1e3 - yv2(j) = yv2(j)*c1e3 - ejfv(j) = ejfv(j)*c1e3 - nucm(j) = nucm(j)*c1e3 - sigmv(j) = -(e0f/e0)*((dt(j)*clight)*c1e3) - mtc(j) = (nzz(j)*nucm0)/(zz0*nucm(j)) - partID(j) = j - parentID(j) = j - pstop(j) = .false. - ejf0v(j) = ejfv(j) + mtc(j) = (nzz(j)*nucm0)/(zz0*nucm(j)) + pstop(j) = .false. + ejf0v(j) = ejfv(j) goto 10 @@ -417,6 +410,8 @@ subroutine dist_readDist call f_close(dist_readUnit) write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_readFile)//"'" + call dist_postprParticles(nSplit, cErr) + ! Update longitudinal particle arrays from read momentum call part_updatePartEnergy(2) @@ -427,6 +422,141 @@ subroutine dist_readDist end subroutine dist_readDist +subroutine dist_saveParticle(partNo, colNo, inVal, sErr) + + use mod_common + use mod_common_main + use string_tools + + integer, intent(in) :: partNo + integer, intent(in) :: colNo + character(len=*), intent(in) :: inVal + logical, intent(out) :: sErr + + real(kind=fPrec) pScale + logical cErr + + sErr = .false. + cErr = .false. + + pScale = dist_colScale(colNo) + + select case(dist_colFormat(colNo)) + + case(dist_fmtNONE) + return + case(dist_fmtPartID) + call chr_cast(inVal,partID(partNo),cErr) + case(dist_fmtParentID) + call chr_cast(inVal,parentID(partNo),cErr) + + case(dist_fmtX, dist_fmtX_NORM) + call chr_cast(inVal, xv1(partNo), cErr) + xv1(partNo) = xv1(partNo) * pScale + case(dist_fmtY, dist_fmtY_NORM) + call chr_cast(inVal, xv2(partNo), cErr) + xv2(partNo) = xv2(partNo) * pScale + case(dist_fmtXP, dist_fmtPX, dist_fmtXP_NORM, dist_fmtPX_NORM) + call chr_cast(inVal, yv1(partNo), cErr) + yv1(partNo) = yv1(partNo) * pScale + case(dist_fmtYP, dist_fmtPY, dist_fmtYP_NORM, dist_fmtPY_NORM) + call chr_cast(inVal, yv2(partNo), cErr) + yv2(partNo) = yv2(partNo) * pScale + + case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM, dist_fmtDT_NORM) + call chr_cast(inVal, sigmv(partNo), cErr) + sigmv(partNo) = sigmv(partNo) * pScale + case(dist_fmtE, dist_fmtE_NORM) + call chr_cast(inVal, ejv(partNo), cErr) + ejv(partNo) = ejv(partNo) * pScale + case(dist_fmtP, dist_fmtP_NORM) + call chr_cast(inVal, ejfv(partNo), cErr) + ejfv(partNo) = ejfv(partNo) * pScale + case(dist_fmtDEE0, dist_fmtDEE0_NORM) + call chr_cast(inVal, ejv(partNo), cErr) + ejv(partNo) = ejv(partNo) * pScale + case(dist_fmtDPP0, dist_fmtDPP0_NORM) + call chr_cast(inVal, dpsv(partNo), cErr) + + case(dist_fmtMASS) + call chr_cast(inVal, nucm(partNo), cErr) + nucm(partNo) = nucm(partNo) * pScale + case(dist_fmtCHARGE) + call chr_cast(inVal, nqq(partNo), cErr) + case(dist_fmtIonA) + call chr_cast(inVal, naa(partNo), cErr) + case(dist_fmtIonZ) + call chr_cast(inVal, nzz(partNo), cErr) +! case(dist_fmtPDGID) +! call chr_cast(inVal, pdgid(partNo), cErr) + + end select + +end subroutine dist_saveParticle + +subroutine dist_postprParticles(numCols, sErr) + + use mod_common + use mod_common_main + use mathlib_bouncer + use numerical_constants + use physical_constants + + integer, intent(in) :: numCols + logical, intent(out) :: sErr + + integer i, j + logical cErr + + sErr = .false. + cErr = .false. + + do i=1,numCols + select case(dist_colFormat(i)) + + case(dist_fmtPX) + do j=1, napx + yv1(j) = tan_mb(yv1(j)/ejfv(j))*c1e3 + end do + case(dist_fmtPY) + do j=1, napx + yv2(j) = tan_mb(yv2(j)/ejfv(j))*c1e3 + end do + case(dist_fmtDT) + sigmv(:) = -(e0f/e0)*(sigmv(:)*clight) + case(dist_fmtDEE0) + ejv(:) = ejv(:)*e0 + + case(dist_fmtX_NORM) + return + case(dist_fmtY_NORM) + return + case(dist_fmtXP_NORM) + return + case(dist_fmtYP_NORM) + return + case(dist_fmtPX_NORM) + return + case(dist_fmtPY_NORM) + return + case(dist_fmtSIGMA_NORM) + return + case(dist_fmtDT_NORM) + return + case(dist_fmtE_NORM) + return + case(dist_fmtP_NORM) + return + case(dist_fmtDEE0_NORM) + return + case(dist_fmtDPP0_NORM) + return + + end select + end do + +end subroutine dist_postprParticles + ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS From d65a43ba0fedd41d3246da5a21f02346664dfe46 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sun, 7 Jul 2019 11:24:46 +0200 Subject: [PATCH 04/38] Some minor fixes before I forget ... --- source/mod_dist.f90 | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index b3ce5b40f..1685820ba 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -44,9 +44,9 @@ module mod_dist ! Column formats ! ================ - integer, parameter :: dist_fmtNONE = 0 - integer, parameter :: dist_fmtPartID = 1 - integer, parameter :: dist_fmtParentID = 2 + integer, parameter :: dist_fmtNONE = 0 ! Column ignored + integer, parameter :: dist_fmtPartID = 1 ! Paricle ID + integer, parameter :: dist_fmtParentID = 2 ! Particle parent ID (for secondary particles, otherwise equal particle ID) ! Physical Coordinates integer, parameter :: dist_fmtX = 11 ! Horizontal position @@ -79,8 +79,8 @@ module mod_dist ! Ion Columns integer, parameter :: dist_fmtMASS = 51 ! Particle mass integer, parameter :: dist_fmtCHARGE = 52 ! Particle Charge - integer, parameter :: dist_fmtIonA = 53 ! Ion atomic number - integer, parameter :: dist_fmtIonZ = 54 ! Ion atomic charge + integer, parameter :: dist_fmtIonA = 53 ! Ion atomic mass + integer, parameter :: dist_fmtIonZ = 54 ! Ion atomic number integer, parameter :: dist_fmtPDGID = 55 ! Particle PDG ID contains @@ -200,9 +200,9 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtE, one) ! Particle energy case("P") call dist_appendFormat(dist_fmtP, one) ! Particle momentum - case("DE/E0") + case("DE/E0","DEE0") call dist_appendFormat(dist_fmtDEE0, one) ! Relative particle energy (to reference particle) - case("DP/P0") + case("DP/P0","DPP0") call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) case("X_NORM") @@ -225,9 +225,9 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtE_NORM, one) ! Normalised particle energy case("P_NORM") call dist_appendFormat(dist_fmtP_NORM, one) ! Normalised particle momentum - case("DE/E0_NORM") + case("DE/E0_NORM","DEE0_NORM") call dist_appendFormat(dist_fmtDEE0_NORM, one) ! Normalised relative particle energy (to reference particle) - case("DP/P0_NORM") + case("DP/P0_NORM","DPP0_NORM") call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) case("MASS","M") @@ -235,9 +235,9 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("CHARGE","Q") call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge case("ION_A") - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic number + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass case("ION_Z") - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic charge + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number case("PDGID") call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID @@ -269,7 +269,14 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) - case("DEFAULT_OLD") ! The old DIST block file format + case("IONS") ! The ion columns + call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass + call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number + call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID + + case("OLD_DIST") ! The old DIST block file format call dist_appendFormat(dist_fmtPartID, one) ! Particle ID call dist_appendFormat(dist_fmtNONE, one) ! Ignored call dist_appendFormat(dist_fmtNONE, one) ! Ignored @@ -279,8 +286,8 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtXP, c1e3) ! Horizontal angle call dist_appendFormat(dist_fmtYP, c1e3) ! Vertical angle call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic number - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic charge + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum call dist_appendFormat(dist_fmtDT, one) ! Time delay @@ -356,7 +363,7 @@ subroutine dist_readDist cErr = .false. if(dist_hasFormat .eqv. .false.) then - call dist_setColumnFormat("DEFAULT_OLD",cErr) + call dist_setColumnFormat("OLD_DIST",cErr) end if call f_open(unit=dist_readUnit,file=dist_readFile,mode='r',err=cErr,formatted=.true.,status="old") From 482a66d0c27aabd5d11275fa9fe524a7e58fe997 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 15:30:36 +0200 Subject: [PATCH 05/38] The unit parsing bits of the new DIST format --- source/mod_dist.f90 | 356 +++++++++++++++++++++++++++------------- test/thin6d_ions/fort.3 | 3 +- 2 files changed, 248 insertions(+), 111 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 1685820ba..f7651aca9 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -160,6 +160,12 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end subroutine dist_parseInputLine +! ================================================================================================ ! +! Parse File Column Formats +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-08 +! ================================================================================================ ! subroutine dist_setColumnFormat(fmtName, fErr) use crcoall @@ -169,130 +175,168 @@ subroutine dist_setColumnFormat(fmtName, fErr) character(len=*), intent(in) :: fmtName logical, intent(out) :: fErr + character(len=20) fmtBase + character(len=10) fmtUnit + real(kind=fPrec) uFac + integer c, unitPos, fmtLen + fErr = .false. - select case(chr_toUpper(fmtName)) - - case("NONE") - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - case("ID") - call dist_appendFormat(dist_fmtPartID, one) ! Particle ID - case("PARENT") - call dist_appendFormat(dist_fmtParentID, one) ! Parent ID - - case("X") - call dist_appendFormat(dist_fmtX, one) ! Horizontal position - case("Y") - call dist_appendFormat(dist_fmtY, one) ! Vertical positiom - case("XP") - call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle - case("YP") - call dist_appendFormat(dist_fmtYP, one) ! Vertical angle - case("PX") - call dist_appendFormat(dist_fmtPX, one) ! Horizontal momentum - case("PY") - call dist_appendFormat(dist_fmtPY, one) ! Vertical momentum - case("SIGMA","DS") - call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position - case("DT") - call dist_appendFormat(dist_fmtDT, one) ! Time delay - case("E") - call dist_appendFormat(dist_fmtE, one) ! Particle energy - case("P") - call dist_appendFormat(dist_fmtP, one) ! Particle momentum - case("DE/E0","DEE0") - call dist_appendFormat(dist_fmtDEE0, one) ! Relative particle energy (to reference particle) - case("DP/P0","DPP0") - call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) - - case("X_NORM") - call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position - case("Y_NORM") - call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom - case("XP_NORM") - call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle - case("YP_NORM") - call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle - case("PX_NORM") - call dist_appendFormat(dist_fmtPX_NORM, one) ! Normalised horizontal momentum - case("PY_NORM") - call dist_appendFormat(dist_fmtPY_NORM, one) ! Normalised vertical momentum - case("SIGMA_NORM","DS_NORM") - call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position - case("DT_NORM") - call dist_appendFormat(dist_fmtDT_NORM, one) ! Normalised time delay - case("E_NORM") - call dist_appendFormat(dist_fmtE_NORM, one) ! Normalised particle energy - case("P_NORM") - call dist_appendFormat(dist_fmtP_NORM, one) ! Normalised particle momentum - case("DE/E0_NORM","DEE0_NORM") - call dist_appendFormat(dist_fmtDEE0_NORM, one) ! Normalised relative particle energy (to reference particle) - case("DP/P0_NORM","DPP0_NORM") - call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) - - case("MASS","M") - call dist_appendFormat(dist_fmtMASS, one) ! Particle mass - case("CHARGE","Q") - call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge - case("ION_A") - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass - case("ION_Z") - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number - case("PDGID") - call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID + fmtLen = len_trim(fmtName) + if(fmtLen < 1) then + write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" + fErr = .true. + end if + + unitPos = -1 + do c=1,fmtLen + if(fmtName(c:c) == "[") then + unitPos = c + exit + end if + end do + + if(unitPos > 1 .and. fmtLen > unitPos+1) then + fmtBase = trim(fmtName(1:unitPos-1)) + fmtUnit = trim(fmtName(unitPos:fmtLen)) + else + fmtBase = trim(fmtName) + fmtUnit = "[none]" + end if + + select case(chr_toUpper(fmtBase)) + + case("NONE","SKIP") ! Ignored + call dist_appendFormat(dist_fmtNONE, one) + case("ID") ! Particle ID + call dist_appendFormat(dist_fmtPartID, one) + case("PARENT") ! Parent ID + call dist_appendFormat(dist_fmtParentID, one) + + case("X") ! Horizontal position + call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) + call dist_appendFormat(dist_fmtX, uFac) + case("Y") ! Vertical positiom + call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) + call dist_appendFormat(dist_fmtY, uFac) + case("XP") ! Horizontal angle + call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) + call dist_appendFormat(dist_fmtXP, uFac) + case("YP") ! Vertical angle + call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) + call dist_appendFormat(dist_fmtYP, uFac) + case("PX") ! Horizontal momentum + call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) + call dist_appendFormat(dist_fmtPX, uFac) + case("PY") ! Vertical momentum + call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) + call dist_appendFormat(dist_fmtPY, uFac) + case("SIGMA","DS") ! Longitudinal relative position + call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) + call dist_appendFormat(dist_fmtSIGMA, uFac) + case("DT") ! Time delay + call dist_unitScale(fmtName, fmtUnit, 4, uFac, fErr) + call dist_appendFormat(dist_fmtDT, uFac) + case("E") ! Particle energy + call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) + call dist_appendFormat(dist_fmtE, uFac) + case("P") ! Particle momentum + call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) + call dist_appendFormat(dist_fmtP, uFac) + case("DE/E0","DEE0") ! Relative particle energy (to reference particle) + call dist_appendFormat(dist_fmtDEE0, one) + case("DP/P0","DPP0") ! Relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtDPP0, one) + + case("X_NORM") ! Normalised horizontal position + call dist_appendFormat(dist_fmtX_NORM, one) + case("Y_NORM") ! Normalised vertical positiom + call dist_appendFormat(dist_fmtY_NORM, one) + case("XP_NORM") ! Normalised horizontal angle + call dist_appendFormat(dist_fmtXP_NORM, one) + case("YP_NORM") ! Normalised vertical angle + call dist_appendFormat(dist_fmtYP_NORM, one) + case("PX_NORM") ! Normalised horizontal momentum + call dist_appendFormat(dist_fmtPX_NORM, one) + case("PY_NORM") ! Normalised vertical momentum + call dist_appendFormat(dist_fmtPY_NORM, one) + case("SIGMA_NORM","DS_NORM") ! Normalised longitudinal relative position + call dist_appendFormat(dist_fmtSIGMA_NORM, one) + case("DT_NORM") ! Normalised time delay + call dist_appendFormat(dist_fmtDT_NORM, one) + case("E_NORM") ! Normalised particle energy + call dist_appendFormat(dist_fmtE_NORM, one) + case("P_NORM") ! Normalised particle momentum + call dist_appendFormat(dist_fmtP_NORM, one) + case("DE/E0_NORM","DEE0_NORM") ! Normalised relative particle energy (to reference particle) + call dist_appendFormat(dist_fmtDEE0_NORM, one) + case("DP/P0_NORM","DPP0_NORM") ! Normalised relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtDPP0_NORM, one) + + case("MASS","M") ! Particle mass + call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) + call dist_appendFormat(dist_fmtMASS, uFac) + case("CHARGE","Q") ! Particle charge + call dist_appendFormat(dist_fmtCHARGE, one) + case("ION_A") ! Ion atomic mass + call dist_appendFormat(dist_fmtIonA, one) + case("ION_Z") ! Ion atomic number + call dist_appendFormat(dist_fmtIonZ, one) + case("PDGID") ! Particle PDG ID + call dist_appendFormat(dist_fmtPDGID, one) case("DEFAULT_4D") ! 4D default coordinates - call dist_appendFormat(dist_fmtX, one) ! Horizontal position - call dist_appendFormat(dist_fmtY, one) ! Vertical positiom - call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, one) ! Vertical angle + call dist_appendFormat(dist_fmtX, one) ! Horizontal position + call dist_appendFormat(dist_fmtY, one) ! Vertical positiom + call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, one) ! Vertical angle case("DEFAULT_6D") ! 6D default coordinates - call dist_appendFormat(dist_fmtX, one) ! Horizontal position - call dist_appendFormat(dist_fmtY, one) ! Vertical positiom - call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, one) ! Vertical angle - call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position - call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtX, one) ! Horizontal position + call dist_appendFormat(dist_fmtY, one) ! Vertical positiom + call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, one) ! Vertical angle + call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position + call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) case("DEFAULT_4D_NORM") ! 4D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle + call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle case("DEFAULT_6D_NORM") ! 6D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle - call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position - call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) + call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position + call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom + call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle + call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle + call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position + call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) case("IONS") ! The ion columns - call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass - call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number - call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID + call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass + call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number + call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case("OLD_DIST") ! The old DIST block file format - call dist_appendFormat(dist_fmtPartID, one) ! Particle ID - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtX, c1e3) ! Horizontal position - call dist_appendFormat(dist_fmtY, c1e3) ! Vertical positiom - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtXP, c1e3) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, c1e3) ! Vertical angle - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number - call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass - call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum - call dist_appendFormat(dist_fmtDT, one) ! Time delay - ! call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge - ! call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID + call dist_appendFormat(dist_fmtPartID, one) ! Particle ID + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtX, c1e3) ! Horizontal position + call dist_appendFormat(dist_fmtY, c1e3) ! Vertical positiom + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtXP, c1e3) ! Horizontal angle + call dist_appendFormat(dist_fmtYP, c1e3) ! Vertical angle + call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass + call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number + call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass + call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum + call dist_appendFormat(dist_fmtDT, one) ! Time delay + ! call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge + ! call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case default write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" @@ -302,6 +346,98 @@ subroutine dist_setColumnFormat(fmtName, fErr) end subroutine dist_setColumnFormat +! ================================================================================================ ! +! Parse File Column Units +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-08 +! ================================================================================================ ! +subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) + + use crcoall + use string_tools + use numerical_constants + + character(len=*), intent(in) :: fmtName + character(len=*), intent(in) :: fmtUnit + integer, intent(in) :: unitType + real(kind=fPrec), intent(out) :: unitScale + logical, intent(inout) :: uErr + + unitScale = zero + + if(unitType == 1) then ! Positions + select case(chr_toLower(fmtUnit)) + case("[m]") + unitScale = c1e3 + case("[mm]") + unitScale = one + case("[none]") + unitScale = one + case default + goto 100 + end select + elseif(unitType == 2) then ! Angle + select case(chr_toLower(fmtUnit)) + case("[rad]") + unitScale = c1e3 + case("[mrad]") + unitScale = one + case("[none]") + unitScale = one + case default + goto 100 + end select + elseif(unitType == 3) then ! Energy + select case(chr_toLower(fmtUnit)) + case("[ev]") + unitScale = c1m6 + case("[kev]") + unitScale = c1m3 + case("[mev]") + unitScale = one + case("[gev]") + unitScale = c1e3 + case("[tev]") + unitScale = c1e6 + case("[none]") + unitScale = one + case default + goto 100 + end select + elseif(unitType == 4) then ! Time + select case(chr_toLower(fmtUnit)) + case("[s]") + unitScale = one + case("[ms]") + unitScale = c1e3 + case("[us]","[µs]") + unitScale = c1e6 + case("[ns]") + unitScale = c1e9 + case("[ps]") + unitScale = c1e12 + case("[none]") + unitScale = one + case default + goto 100 + end select + end if + + return + +100 continue + write(lout,"(a)") "DIST> ERROR Unrecognised or invalid unit for format identifier '"//trim(fmtName)//"'" + uErr = .true. + +end subroutine dist_unitScale + +! ================================================================================================ ! +! Save File Column Format +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-05 +! ================================================================================================ ! subroutine dist_appendFormat(fmtID, colScale) use mod_alloc diff --git a/test/thin6d_ions/fort.3 b/test/thin6d_ions/fort.3 index 41f7b184e..77795a291 100644 --- a/test/thin6d_ions/fort.3 +++ b/test/thin6d_ions/fort.3 @@ -75,7 +75,8 @@ HION 208 82 1.93687690162648124E+02 NEXT DIST -READ initial.dat +! FORMAT ID none none x[m] y[m] none xp[rad] yp[rad] none ion_a ion_z mass[GeV] P[GeV] dT[s] + READ initial.dat NEXT ENDE==================================================================== ORGA-------------------------------------------------------------------- From c433bd08b2a609b40e521b48a02248fe9e373455 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 17:30:50 +0200 Subject: [PATCH 06/38] DIST block can now add particles directly in fort.3 as well. --- source/main_cr.f90 | 7 +- source/mod_dist.f90 | 275 +++++++++++++++++++++++++++----------------- 2 files changed, 170 insertions(+), 112 deletions(-) diff --git a/source/main_cr.f90 b/source/main_cr.f90 index 240c5d2ef..cd61d805e 100644 --- a/source/main_cr.f90 +++ b/source/main_cr.f90 @@ -968,12 +968,7 @@ program maincr if(dist_enable) then ! DIST Block - call dist_readDist - call dist_finaliseDist - call part_applyClosedOrbit - if(dist_echo) then - call dist_echoDist - end if + call dist_generateDist elseif(rdfort13) then ! Restart from fort.13 call readFort13 diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index f7651aca9..b3e03ce5a 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -27,21 +27,23 @@ module mod_dist use crcoall use floatPrecision + use parpro, only : mFileName implicit none - logical, public, save :: dist_enable ! DIST input block given - logical, public, save :: dist_echo ! Echo the read distribution? - logical, public, save :: dist_hasFormat ! Whether the format flag is set - character(len=256), public, save :: dist_readFile ! File name for reading the distribution - character(len=256), public, save :: dist_echoFile ! File name for echoing the distribution - integer, private, save :: dist_readUnit ! Unit for reading the distribution - integer, private, save :: dist_echoUnit ! Unit for echoing the distribution + logical, public, save :: dist_enable = .false. ! DIST input block given + logical, public, save :: dist_echo = .false. ! Echo the read distribution? + logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not + character(len=mFileName), public, save :: dist_distFile = " " ! File name for reading the distribution + character(len=mFileName), public, save :: dist_echoFile = " " ! File name for echoing the distribution integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns integer, private, save :: dist_nColumns = 0 ! The number of columns in the file + character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block + integer, public, save :: dist_numPart = 0 ! Number of PARTICLE keywords in block + ! Column formats ! ================ integer, parameter :: dist_fmtNONE = 0 ! Column ignored @@ -85,17 +87,52 @@ module mod_dist contains +! ================================================================================================ ! +! Master Module Subrotuine +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-08 +! Updated: 2019-07-08 +! Called from main_cr if dist_enable is true. This should handle everything needed. +! ================================================================================================ ! +subroutine dist_generateDist + + use mod_particles + + logical hasParticles + + hasParticles = .false. + + if(dist_numPart > 0) then + call dist_parseParticles + hasParticles = .true. + end if + + if(dist_distFile /= " ") then + call dist_readDist + hasParticles = .true. + end if + + if(hasParticles) then + call dist_finaliseDist + call part_applyClosedOrbit + if(dist_echo) then + call dist_echoDist + end if + end if + +end subroutine dist_generateDist + ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2018-10-30 +! Updated: 2018-10-30 ! ================================================================================================ ! subroutine dist_parseInputLine(inLine, iLine, iErr) - use string_tools + use parpro + use mod_alloc use mod_units - - implicit none + use string_tools character(len=*), intent(in) :: inLine integer, intent(inout) :: iLine @@ -138,9 +175,23 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) iErr = .true. return end if - dist_readFile = trim(lnSplit(2)) - call f_requestUnit(dist_readFile, dist_readUnit) - if(.not.dist_enable) dist_enable = .true. + dist_distFile = trim(lnSplit(2)) + + case("PARTICLE") + if(dist_hasFormat .eqv. .false.) then + write(lerr,"(a,i0)") "DIST> ERROR PARTICLE requires a FORMAT definition to be defined first" + iErr = .true. + return + end if + if(nSplit /= dist_nColumns + 1) then + write(lerr,"(a)") "DIST> ERROR PARTICLE values must match the number of definitions in FORMAT" + write(lerr,"(2(a,i0))") "DIST> Got ",nsplit-1," values, but FORMAT defines ",dist_nColumns + iErr = .true. + return + end if + dist_numPart = dist_numPart + 1 + call alloc(dist_partLine, mInputLn, dist_numPart, " ", "dist_partLine") + dist_partLine(dist_numPart) = trim(inLine) case("ECHO") if(nSplit >= 2) then @@ -149,7 +200,6 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) dist_echoFile = "echo_distribution.dat" end if dist_echo = .true. - call f_requestUnit(dist_echoFile, dist_echoUnit) case default write(lerr,"(a)") "DIST> ERROR Unknown keyword '"//trim(lnSplit(1))//"'." @@ -184,7 +234,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) fmtLen = len_trim(fmtName) if(fmtLen < 1) then - write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" + write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" fErr = .true. end if @@ -206,7 +256,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) select case(chr_toUpper(fmtBase)) - case("NONE","SKIP") ! Ignored + case("OFF","SKIP") ! Ignored call dist_appendFormat(dist_fmtNONE, one) case("ID") ! Particle ID call dist_appendFormat(dist_fmtPartID, one) @@ -339,7 +389,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) ! call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case default - write(lout,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" + write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" fErr = .true. end select @@ -427,7 +477,7 @@ subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) return 100 continue - write(lout,"(a)") "DIST> ERROR Unrecognised or invalid unit for format identifier '"//trim(fmtName)//"'" + write(lerr,"(a)") "DIST> ERROR Unrecognised or invalid unit for format identifier '"//trim(fmtName)//"'" uErr = .true. end subroutine dist_unitScale @@ -456,6 +506,33 @@ subroutine dist_appendFormat(fmtID, colScale) end subroutine dist_appendFormat +subroutine dist_parseParticles + + use mod_common + use string_tools + + character(len=:), allocatable :: lnSplit(:) + integer i, j, nSplit + logical spErr, cErr + + if(dist_numPart > 0) then + do j=1,dist_numPart + call chr_split(dist_partLine(j), lnSplit, nSplit, spErr) + if(spErr) goto 20 + do i=2,nSplit + call dist_saveParticle(j, i-1, lnSplit(i), cErr) + end do + if(cErr) goto 20 + end do + end if + + return + +20 continue + write(lout,"(a,i0,a)") "DIST> ERROR Could not parse PARTICLE definition number ",j," from "//trim(fort3) + +end subroutine dist_parseParticles + ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS @@ -468,19 +545,15 @@ subroutine dist_readDist use mod_common_main use string_tools use mod_particles - use physical_constants use numerical_constants - use mod_units, only : f_open, f_close - - implicit none + use mod_units - integer id, gen, i, j, ln, nSplit - real(kind=fPrec) weight, z, zp, dt(npart) - logical spErr, cErr - character(len=mInputLn) inLine character(len=:), allocatable :: lnSplit(:) + character(len=mInputLn) inLine + integer i, j, nSplit, lineNo, fUnit + logical spErr, cErr - write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_readFile)//"'" + write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" xv1(:) = zero yv1(:) = zero @@ -492,22 +565,22 @@ subroutine dist_readDist naa(:) = 0 nzz(:) = 0 nucm(:) = zero - dt(:) = zero - j = 0 - ln = 0 - cErr = .false. + lineNo = 0 + cErr = .false. + j = dist_numPart ! PARTICLE definitions in the block are saved first if(dist_hasFormat .eqv. .false.) then call dist_setColumnFormat("OLD_DIST",cErr) end if - call f_open(unit=dist_readUnit,file=dist_readFile,mode='r',err=cErr,formatted=.true.,status="old") + call f_requestUnit(dist_distFile, fUnit) + call f_open(unit=fUnit,file=dist_distFile,mode='r',err=cErr,formatted=.true.,status="old") if(cErr) goto 19 10 continue - read(dist_readUnit,"(a)",end=30,err=20) inLine - ln = ln+1 + read(fUnit,"(a)",end=30,err=20) inLine + lineNo = lineNo+1 if(inLine(1:1) == "*") goto 10 if(inLine(1:1) == "#") goto 10 @@ -522,24 +595,26 @@ subroutine dist_readDist call chr_split(inLine, lnSplit, nSplit, spErr) if(spErr) goto 20 + if(nSplit == 0) goto 10 + if(nSplit /= dist_nColumns) then + write(lerr,"(2(a,i0))") "DIST> ERROR Number of columns in file on line ",lineNo,& + " does not match format with ",dist_nColumns," columns" + call prror + end if do i=1,nSplit call dist_saveParticle(j, i, lnSplit(i), cErr) end do if(cErr) goto 20 - mtc(j) = (nzz(j)*nucm0)/(zz0*nucm(j)) - pstop(j) = .false. - ejf0v(j) = ejfv(j) - goto 10 19 continue - write(lerr,"(a)") "DIST> ERROR Opening file '"//trim(dist_readFile)//"'" + write(lerr,"(a)") "DIST> ERROR Opening file '"//trim(dist_distFile)//"'" call prror return 20 continue - write(lerr,"(a,i0)") "DIST> ERROR Reading particles from line ",ln + write(lerr,"(a,i0)") "DIST> ERROR Reading particles from line ",lineNo call prror return @@ -550,8 +625,8 @@ subroutine dist_readDist return end if - call f_close(dist_readUnit) - write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_readFile)//"'" + call f_close(fUnit) + write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_distFile)//"'" call dist_postprParticles(nSplit, cErr) @@ -571,67 +646,59 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) use mod_common_main use string_tools - integer, intent(in) :: partNo - integer, intent(in) :: colNo - character(len=*), intent(in) :: inVal - logical, intent(out) :: sErr - - real(kind=fPrec) pScale - logical cErr - - sErr = .false. - cErr = .false. - - pScale = dist_colScale(colNo) + integer, intent(in) :: partNo + integer, intent(in) :: colNo + character(len=*), intent(in) :: inVal + logical, intent(inout) :: sErr select case(dist_colFormat(colNo)) case(dist_fmtNONE) return case(dist_fmtPartID) - call chr_cast(inVal,partID(partNo),cErr) + call chr_cast(inVal,partID(partNo),sErr) case(dist_fmtParentID) - call chr_cast(inVal,parentID(partNo),cErr) + call chr_cast(inVal,parentID(partNo),sErr) case(dist_fmtX, dist_fmtX_NORM) - call chr_cast(inVal, xv1(partNo), cErr) - xv1(partNo) = xv1(partNo) * pScale + call chr_cast(inVal, xv1(partNo), sErr) + xv1(partNo) = xv1(partNo) * dist_colScale(colNo) case(dist_fmtY, dist_fmtY_NORM) - call chr_cast(inVal, xv2(partNo), cErr) - xv2(partNo) = xv2(partNo) * pScale + call chr_cast(inVal, xv2(partNo), sErr) + xv2(partNo) = xv2(partNo) * dist_colScale(colNo) case(dist_fmtXP, dist_fmtPX, dist_fmtXP_NORM, dist_fmtPX_NORM) - call chr_cast(inVal, yv1(partNo), cErr) - yv1(partNo) = yv1(partNo) * pScale + call chr_cast(inVal, yv1(partNo), sErr) + yv1(partNo) = yv1(partNo) * dist_colScale(colNo) case(dist_fmtYP, dist_fmtPY, dist_fmtYP_NORM, dist_fmtPY_NORM) - call chr_cast(inVal, yv2(partNo), cErr) - yv2(partNo) = yv2(partNo) * pScale + call chr_cast(inVal, yv2(partNo), sErr) + yv2(partNo) = yv2(partNo) * dist_colScale(colNo) case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM, dist_fmtDT_NORM) - call chr_cast(inVal, sigmv(partNo), cErr) - sigmv(partNo) = sigmv(partNo) * pScale + call chr_cast(inVal, sigmv(partNo), sErr) + sigmv(partNo) = sigmv(partNo) * dist_colScale(colNo) case(dist_fmtE, dist_fmtE_NORM) - call chr_cast(inVal, ejv(partNo), cErr) - ejv(partNo) = ejv(partNo) * pScale + call chr_cast(inVal, ejv(partNo), sErr) + ejv(partNo) = ejv(partNo) * dist_colScale(colNo) case(dist_fmtP, dist_fmtP_NORM) - call chr_cast(inVal, ejfv(partNo), cErr) - ejfv(partNo) = ejfv(partNo) * pScale + call chr_cast(inVal, ejfv(partNo), sErr) + ejfv(partNo) = ejfv(partNo) * dist_colScale(colNo) case(dist_fmtDEE0, dist_fmtDEE0_NORM) - call chr_cast(inVal, ejv(partNo), cErr) - ejv(partNo) = ejv(partNo) * pScale + call chr_cast(inVal, ejv(partNo), sErr) + ejv(partNo) = ejv(partNo) * dist_colScale(colNo) case(dist_fmtDPP0, dist_fmtDPP0_NORM) - call chr_cast(inVal, dpsv(partNo), cErr) + call chr_cast(inVal, dpsv(partNo), sErr) case(dist_fmtMASS) - call chr_cast(inVal, nucm(partNo), cErr) - nucm(partNo) = nucm(partNo) * pScale + call chr_cast(inVal, nucm(partNo), sErr) + nucm(partNo) = nucm(partNo) * dist_colScale(colNo) case(dist_fmtCHARGE) - call chr_cast(inVal, nqq(partNo), cErr) + call chr_cast(inVal, nqq(partNo), sErr) case(dist_fmtIonA) - call chr_cast(inVal, naa(partNo), cErr) + call chr_cast(inVal, naa(partNo), sErr) case(dist_fmtIonZ) - call chr_cast(inVal, nzz(partNo), cErr) + call chr_cast(inVal, nzz(partNo), sErr) ! case(dist_fmtPDGID) -! call chr_cast(inVal, pdgid(partNo), cErr) +! call chr_cast(inVal, pdgid(partNo), sErr) end select @@ -641,34 +708,25 @@ subroutine dist_postprParticles(numCols, sErr) use mod_common use mod_common_main - use mathlib_bouncer use numerical_constants use physical_constants - integer, intent(in) :: numCols - logical, intent(out) :: sErr - - integer i, j - logical cErr + integer, intent(in) :: numCols + logical, intent(inout) :: sErr - sErr = .false. - cErr = .false. + integer i do i=1,numCols select case(dist_colFormat(i)) case(dist_fmtPX) - do j=1, napx - yv1(j) = tan_mb(yv1(j)/ejfv(j))*c1e3 - end do + yv1(1:napx) = (yv1(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtPY) - do j=1, napx - yv2(j) = tan_mb(yv2(j)/ejfv(j))*c1e3 - end do + yv2(1:napx) = (yv2(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtDT) - sigmv(:) = -(e0f/e0)*(sigmv(:)*clight) + sigmv(1:napx) = -(e0f/e0)*(sigmv(1:napx)*clight) case(dist_fmtDEE0) - ejv(:) = ejv(:)*e0 + ejv(1:napx) = (one + ejv(1:napx))*e0 case(dist_fmtX_NORM) return @@ -698,6 +756,10 @@ subroutine dist_postprParticles(numCols, sErr) end select end do + mtc(1:napx) = (nzz(1:napx)*nucm0)/(zz0*nucm(1:napx)) + pstop(1:napx) = .false. + ejf0v(1:napx) = ejfv(1:napx) + end subroutine dist_postprParticles ! ================================================================================================ ! @@ -780,23 +842,24 @@ subroutine dist_echoDist use mod_common use mod_common_main - use mod_units, only : f_open, f_close + use mod_units - integer j + integer j, fUnit logical cErr - call f_open(unit=dist_echoUnit,file=dist_echoFile,mode='w',err=cErr,formatted=.true.) + call f_requestUnit(dist_echoFile, fUnit) + call f_open(unit=fUnit,file=dist_echoFile,mode='w',err=cErr,formatted=.true.) if(cErr) goto 19 - rewind(dist_echoUnit) - write(dist_echoUnit,"(a,1pe25.18)") "# Total energy of synch part [MeV]: ",e0 - write(dist_echoUnit,"(a,1pe25.18)") "# Momentum of synch part [MeV/c]: ",e0f - write(dist_echoUnit,"(a)") "#" - write(dist_echoUnit,"(a)") "# x[mm], y[mm], xp[mrad], yp[mrad], sigmv[mm], ejfv[MeV/c]" + rewind(fUnit) + write(fUnit,"(a,1pe25.18)") "# Total energy of synch part [MeV]: ",e0 + write(fUnit,"(a,1pe25.18)") "# Momentum of synch part [MeV/c]: ",e0f + write(fUnit,"(a)") "#" + write(fUnit,"(a)") "# x[mm], y[mm], xp[mrad], yp[mrad], sigmv[mm], ejfv[MeV/c]" do j=1, napx - write(dist_echoUnit,"(6(1x,1pe25.18))") xv1(j), yv1(j), xv2(j), yv2(j), sigmv(j), ejfv(j) + write(fUnit,"(6(1x,1pe25.18))") xv1(j), yv1(j), xv2(j), yv2(j), sigmv(j), ejfv(j) end do - call f_close(dist_echoUnit) + call f_close(fUnit) return From 520dd3f500c61121bf583aa1520c93292565ee72 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 17:36:09 +0200 Subject: [PATCH 07/38] Added a flag for reading DIST file with dist library instead of internal --- source/mod_dist.f90 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index b3e03ce5a..49b03bd0b 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -32,17 +32,18 @@ module mod_dist implicit none logical, public, save :: dist_enable = .false. ! DIST input block given - logical, public, save :: dist_echo = .false. ! Echo the read distribution? + logical, private save :: dist_echo = .false. ! Echo the read distribution? logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not - character(len=mFileName), public, save :: dist_distFile = " " ! File name for reading the distribution - character(len=mFileName), public, save :: dist_echoFile = " " ! File name for echoing the distribution + logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader + character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution + character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns integer, private, save :: dist_nColumns = 0 ! The number of columns in the file character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block - integer, public, save :: dist_numPart = 0 ! Number of PARTICLE keywords in block + integer, private, save :: dist_numPart = 0 ! Number of PARTICLE keywords in block ! Column formats ! ================ @@ -169,13 +170,18 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) dist_hasFormat = .true. case("READ") - if(nSplit < 2) then - write(lerr,"(a,i0)") "DIST> ERROR READ takes 1 argument, got ",nSplit-1 - write(lerr,"(a)") "DIST> READ filename" + if(nSplit /= 2 .or. nSplit /= 3) then + write(lerr,"(a,i0)") "DIST> ERROR READ takes 1 or 2 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> READ filename [LIBDIST]" iErr = .true. return end if dist_distFile = trim(lnSplit(2)) + if(nSplit > 2) call chr_cast(lnSplit(3), dist_libRead, cErr) + if(cErr) then + iErr = .true. + return + end if case("PARTICLE") if(dist_hasFormat .eqv. .false.) then From 67a2f40597b083e9fb3964b16164e3a311136f3a Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 17:48:39 +0200 Subject: [PATCH 08/38] I no code good --- source/mod_dist.f90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 49b03bd0b..86066e84b 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -32,7 +32,7 @@ module mod_dist implicit none logical, public, save :: dist_enable = .false. ! DIST input block given - logical, private save :: dist_echo = .false. ! Echo the read distribution? + logical, private, save :: dist_echo = .false. ! Echo the read distribution? logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution @@ -151,6 +151,8 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end if if(nSplit == 0) return + cErr = .false. + select case(lnSplit(1)) case("FORMAT") @@ -170,7 +172,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) dist_hasFormat = .true. case("READ") - if(nSplit /= 2 .or. nSplit /= 3) then + if(nSplit /= 2 .and. nSplit /= 3) then write(lerr,"(a,i0)") "DIST> ERROR READ takes 1 or 2 arguments, got ",nSplit-1 write(lerr,"(a)") "DIST> READ filename [LIBDIST]" iErr = .true. From 4004b371ad1238b15db5f542e2af5b1159fb0104 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 18:33:48 +0200 Subject: [PATCH 09/38] Fix error message --- source/mod_dist.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 86066e84b..3be688480 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -187,7 +187,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) case("PARTICLE") if(dist_hasFormat .eqv. .false.) then - write(lerr,"(a,i0)") "DIST> ERROR PARTICLE requires a FORMAT definition to be defined first" + write(lerr,"(a,i0)") "DIST> ERROR PARTICLE keyword requires a FORMAT to be defined first" iErr = .true. return end if From 48b2e7ae2eff81ff6fc9951705067be31f908376 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 20:14:54 +0200 Subject: [PATCH 10/38] Fixed some issues after merging master, and added some checks --- source/main_cr.f90 | 2 +- source/mod_dist.f90 | 62 +++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/source/main_cr.f90 b/source/main_cr.f90 index 45c2a7fa6..22fcf36f1 100644 --- a/source/main_cr.f90 +++ b/source/main_cr.f90 @@ -976,6 +976,7 @@ program maincr end do rat0 = rat + call part_setParticleID ! Must be set before reading DIST if(dist_enable) then ! DIST Block call dist_generateDist @@ -1250,7 +1251,6 @@ program maincr ! START OF TRACKING ! ---------------------------------------------------------------------------- ! write(lout,10200) - call part_setParticleID if(st_iStateWrite) then if(st_iStateText) then diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 11cd6ff3e..7cf54d3aa 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -341,19 +341,14 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("MASS","M") ! Particle mass call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) call dist_appendFormat(dist_fmtMASS, uFac) - dist_readMass = .true. case("CHARGE","Q") ! Particle charge call dist_appendFormat(dist_fmtCHARGE, one) - dist_readCharge = .true. case("ION_A") ! Ion atomic mass call dist_appendFormat(dist_fmtIonA, one) - dist_readIonA = .true. case("ION_Z") ! Ion atomic number call dist_appendFormat(dist_fmtIonZ, one) - dist_readIonZ = .true. case("PDGID") ! Particle PDG ID call dist_appendFormat(dist_fmtPDGID, one) - dist_readPDGID = .true. case("DEFAULT_4D") ! 4D default coordinates call dist_appendFormat(dist_fmtX, one) ! Horizontal position @@ -570,27 +565,16 @@ subroutine dist_readDist character(len=:), allocatable :: lnSplit(:) character(len=mInputLn) inLine - integer i, j, nSplit, lineNo, fUnit - logical spErr, cErr + integer i, j, nSplit, lineNo, fUnit, fmtCols + logical spErr, cErr, isFirst write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" - xv1(:) = zero - yv1(:) = zero - xv2(:) = zero - yv2(:) = zero - sigmv(:) = zero - ejfv(:) = zero - ejf0v(:) = zero - naa(:) = 0 - nzz(:) = 0 - nqq(:) = 0 - pdgid(:) = 0 - nucm(:) = zero - - lineNo = 0 - cErr = .false. - j = dist_numPart ! PARTICLE definitions in the block are saved first + isFirst = .true. + fmtCols = dist_nColumns + lineNo = 0 + cErr = .false. + j = dist_numPart ! PARTICLE definitions in the block are saved first if(dist_hasFormat .eqv. .false.) then call dist_setColumnFormat("OLD_DIST",cErr) @@ -602,15 +586,15 @@ subroutine dist_readDist 10 continue read(fUnit,"(a)",end=30,err=20) inLine - lineNo = lineNo+1 + lineNo = lineNo + 1 if(inLine(1:1) == "*") goto 10 if(inLine(1:1) == "#") goto 10 if(inLine(1:1) == "!") goto 10 - j = j+1 + j = j + 1 if(j > napx) then - write(lout,"(a,i0,a)") "DIST> Stopping reading file as ",napx," particles have been read, as requested in "//trim(fort3) + write(lout,"(a,i0,a)") "DIST> Stopping reading file as ",napx," particles have been read, as requested in '"//trim(fort3)//"'" j = napx goto 30 end if @@ -618,12 +602,20 @@ subroutine dist_readDist call chr_split(inLine, lnSplit, nSplit, spErr) if(spErr) goto 20 if(nSplit == 0) goto 10 - if(nSplit /= dist_nColumns) then + + if(isFirst) then + if(nSplit < dist_nColumns) then + fmtCols = nSplit + write(lout,"(2(a,i0))") "DIST> WARNING Distribution file has ",nSplit," columns, but format has ",dist_nColumns + end if + isFirst = .false. + end if + if(nSplit < fmtCols) then write(lerr,"(3(a,i0),a)") "DIST> ERROR Number of columns in file on line ",lineNo," is ",nSplit,& - " and does not match format with ",dist_nColumns," columns" + " but expected ",fmtCols," columns" call prror end if - do i=1,nSplit + do i=1,fmtCols call dist_saveParticle(j, i, lnSplit(i), cErr) end do if(cErr) goto 20 @@ -712,15 +704,20 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtMASS) call chr_cast(inVal, nucm(partNo), sErr) - nucm(partNo) = nucm(partNo) * dist_colScale(colNo) + nucm(partNo) = nucm(partNo) * dist_colScale(colNo) + dist_readMass = .true. case(dist_fmtCHARGE) call chr_cast(inVal, nqq(partNo), sErr) + dist_readCharge = .true. case(dist_fmtIonA) call chr_cast(inVal, naa(partNo), sErr) + dist_readIonA = .true. case(dist_fmtIonZ) call chr_cast(inVal, nzz(partNo), sErr) + dist_readIonZ = .true. case(dist_fmtPDGID) call chr_cast(inVal, pdgid(partNo), sErr) + dist_readPDGID = .true. end select @@ -779,6 +776,11 @@ subroutine dist_postprParticles(numCols, sErr) end select end do + if(dist_readIonA .neqv. dist_readIonZ) then + write(lerr,"(a)") "DIST> ERROR ION_A and ION_Z columns have to both be present if one of them is" + call prror + end if + if(dist_readIonZ .and. .not. dist_readCharge) then nqq(1:napx) = nzz(1:napx) end if From 9003e3821c0c74cde3a28915c6e33d1ab928ba9e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Mon, 8 Jul 2019 20:55:53 +0200 Subject: [PATCH 11/38] Cleaned up the interface a little. Too many options. --- source/mod_dist.f90 | 168 ++++++++++++++++++++------------------------ 1 file changed, 78 insertions(+), 90 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 7cf54d3aa..244785d8b 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -35,12 +35,14 @@ module mod_dist logical, private, save :: dist_echo = .false. ! Echo the read distribution? logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader + integer, private, save :: dist_updtEFrom = 3 ! The parameter sent to part_updatePartEnergy after DIST character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns integer, private, save :: dist_nColumns = 0 ! The number of columns in the file + integer, private, save :: dist_readCols = 0 ! The number of columns read from file character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block integer, private, save :: dist_numPart = 0 ! Number of PARTICLE keywords in block @@ -70,14 +72,8 @@ module mod_dist integer, parameter :: dist_fmtY_NORM = 32 ! Normalised vertical positiom integer, parameter :: dist_fmtXP_NORM = 33 ! Normalised horizontal angle integer, parameter :: dist_fmtYP_NORM = 34 ! Normalised vertical angle - integer, parameter :: dist_fmtPX_NORM = 35 ! Normalised horizontal momentum - integer, parameter :: dist_fmtPY_NORM = 36 ! Normalised vertical momentum - integer, parameter :: dist_fmtSIGMA_NORM = 37 ! Normalised longitudinal relative position - integer, parameter :: dist_fmtDT_NORM = 38 ! Normalised time delay - integer, parameter :: dist_fmtE_NORM = 39 ! Normalised particle energy - integer, parameter :: dist_fmtP_NORM = 40 ! Normalised particle momentum - integer, parameter :: dist_fmtDEE0_NORM = 41 ! Normalised relative particle energy (to reference particle) - integer, parameter :: dist_fmtDPP0_NORM = 42 ! Normalised relative particle momentum (to reference particle) + integer, parameter :: dist_fmtSIGMA_NORM = 35 ! Normalised longitudinal relative position + integer, parameter :: dist_fmtDPP0_NORM = 36 ! Normalised relative particle momentum (to reference particle) ! Ion Columns integer, parameter :: dist_fmtMASS = 51 ! Particle mass @@ -121,6 +117,7 @@ subroutine dist_generateDist end if if(hasParticles) then + call dist_postprParticles call dist_finaliseDist call part_applyClosedOrbit if(dist_echo) then @@ -321,20 +318,8 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtXP_NORM, one) case("YP_NORM") ! Normalised vertical angle call dist_appendFormat(dist_fmtYP_NORM, one) - case("PX_NORM") ! Normalised horizontal momentum - call dist_appendFormat(dist_fmtPX_NORM, one) - case("PY_NORM") ! Normalised vertical momentum - call dist_appendFormat(dist_fmtPY_NORM, one) case("SIGMA_NORM","DS_NORM") ! Normalised longitudinal relative position call dist_appendFormat(dist_fmtSIGMA_NORM, one) - case("DT_NORM") ! Normalised time delay - call dist_appendFormat(dist_fmtDT_NORM, one) - case("E_NORM") ! Normalised particle energy - call dist_appendFormat(dist_fmtE_NORM, one) - case("P_NORM") ! Normalised particle momentum - call dist_appendFormat(dist_fmtP_NORM, one) - case("DE/E0_NORM","DEE0_NORM") ! Normalised relative particle energy (to reference particle) - call dist_appendFormat(dist_fmtDEE0_NORM, one) case("DP/P0_NORM","DPP0_NORM") ! Normalised relative particle momentum (to reference particle) call dist_appendFormat(dist_fmtDPP0_NORM, one) @@ -350,13 +335,13 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("PDGID") ! Particle PDG ID call dist_appendFormat(dist_fmtPDGID, one) - case("DEFAULT_4D") ! 4D default coordinates + case("4D") ! 4D default coordinates call dist_appendFormat(dist_fmtX, one) ! Horizontal position call dist_appendFormat(dist_fmtY, one) ! Vertical positiom call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle call dist_appendFormat(dist_fmtYP, one) ! Vertical angle - case("DEFAULT_6D") ! 6D default coordinates + case("6D") ! 6D default coordinates call dist_appendFormat(dist_fmtX, one) ! Horizontal position call dist_appendFormat(dist_fmtY, one) ! Vertical positiom call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle @@ -364,13 +349,13 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) - case("DEFAULT_4D_NORM") ! 4D normalised coordinates + case("4D_NORM") ! 4D normalised coordinates call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle - case("DEFAULT_6D_NORM") ! 6D normalised coordinates + case("6D_NORM") ! 6D normalised coordinates call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle @@ -387,7 +372,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("OLD_DIST") ! The old DIST block file format call dist_appendFormat(dist_fmtPartID, one) ! Particle ID - call dist_appendFormat(dist_fmtNONE, one) ! Ignored + call dist_appendFormat(dist_fmtParentID, one) ! Parent ID call dist_appendFormat(dist_fmtNONE, one) ! Ignored call dist_appendFormat(dist_fmtX, c1e3) ! Horizontal position call dist_appendFormat(dist_fmtY, c1e3) ! Vertical positiom @@ -521,6 +506,12 @@ subroutine dist_appendFormat(fmtID, colScale) end subroutine dist_appendFormat +! ================================================================================================ ! +! Parse PARTICLE Lines from DIST Block +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-08 +! Updated: 2019-07-08 +! ================================================================================================ ! subroutine dist_parseParticles use mod_common @@ -559,19 +550,19 @@ subroutine dist_readDist use mod_common use mod_common_main use string_tools - use mod_particles use numerical_constants use mod_units character(len=:), allocatable :: lnSplit(:) character(len=mInputLn) inLine - integer i, j, nSplit, lineNo, fUnit, fmtCols + integer i, j, nSplit, lineNo, fUnit logical spErr, cErr, isFirst write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" + dist_readCols = dist_nColumns + isFirst = .true. - fmtCols = dist_nColumns lineNo = 0 cErr = .false. j = dist_numPart ! PARTICLE definitions in the block are saved first @@ -605,17 +596,17 @@ subroutine dist_readDist if(isFirst) then if(nSplit < dist_nColumns) then - fmtCols = nSplit + dist_readCols = nSplit write(lout,"(2(a,i0))") "DIST> WARNING Distribution file has ",nSplit," columns, but format has ",dist_nColumns end if isFirst = .false. end if - if(nSplit < fmtCols) then + if(nSplit < dist_readCols) then write(lerr,"(3(a,i0),a)") "DIST> ERROR Number of columns in file on line ",lineNo," is ",nSplit,& - " but expected ",fmtCols," columns" + " but expected ",dist_readCols," columns" call prror end if - do i=1,fmtCols + do i=1,dist_readCols call dist_saveParticle(j, i, lnSplit(i), cErr) end do if(cErr) goto 20 @@ -642,11 +633,6 @@ subroutine dist_readDist call f_close(fUnit) write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_distFile)//"'" - call dist_postprParticles(nSplit, cErr) - - ! Update longitudinal particle arrays from read momentum - call part_updatePartEnergy(2) - if(j < napx) then write(lout,"(a,i0)") "DIST> WARNING Read a number of particles LOWER than requested: ",napx napx = j @@ -654,6 +640,12 @@ subroutine dist_readDist end subroutine dist_readDist +! ================================================================================================ ! +! Save Particle Data to Arrays +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-08 +! Updated: 2019-07-08 +! ================================================================================================ ! subroutine dist_saveParticle(partNo, colNo, inVal, sErr) use mod_common @@ -670,9 +662,9 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtNONE) return case(dist_fmtPartID) - call chr_cast(inVal,partID(partNo),sErr) + call chr_cast(inVal, partID(partNo), sErr) case(dist_fmtParentID) - call chr_cast(inVal,parentID(partNo),sErr) + call chr_cast(inVal, parentID(partNo), sErr) case(dist_fmtX, dist_fmtX_NORM) call chr_cast(inVal, xv1(partNo), sErr) @@ -680,27 +672,31 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtY, dist_fmtY_NORM) call chr_cast(inVal, xv2(partNo), sErr) xv2(partNo) = xv2(partNo) * dist_colScale(colNo) - case(dist_fmtXP, dist_fmtPX, dist_fmtXP_NORM, dist_fmtPX_NORM) + case(dist_fmtXP, dist_fmtPX, dist_fmtXP_NORM) call chr_cast(inVal, yv1(partNo), sErr) yv1(partNo) = yv1(partNo) * dist_colScale(colNo) - case(dist_fmtYP, dist_fmtPY, dist_fmtYP_NORM, dist_fmtPY_NORM) + case(dist_fmtYP, dist_fmtPY, dist_fmtYP_NORM) call chr_cast(inVal, yv2(partNo), sErr) yv2(partNo) = yv2(partNo) * dist_colScale(colNo) - case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM, dist_fmtDT_NORM) + case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM) call chr_cast(inVal, sigmv(partNo), sErr) sigmv(partNo) = sigmv(partNo) * dist_colScale(colNo) - case(dist_fmtE, dist_fmtE_NORM) + case(dist_fmtE) call chr_cast(inVal, ejv(partNo), sErr) - ejv(partNo) = ejv(partNo) * dist_colScale(colNo) - case(dist_fmtP, dist_fmtP_NORM) + ejv(partNo) = ejv(partNo) * dist_colScale(colNo) + dist_updtEFrom = 1 + case(dist_fmtP) call chr_cast(inVal, ejfv(partNo), sErr) - ejfv(partNo) = ejfv(partNo) * dist_colScale(colNo) - case(dist_fmtDEE0, dist_fmtDEE0_NORM) + ejfv(partNo) = ejfv(partNo) * dist_colScale(colNo) + dist_updtEFrom = 2 + case(dist_fmtDEE0) call chr_cast(inVal, ejv(partNo), sErr) - ejv(partNo) = ejv(partNo) * dist_colScale(colNo) + ejv(partNo) = ejv(partNo) * dist_colScale(colNo) + dist_updtEFrom = 1 case(dist_fmtDPP0, dist_fmtDPP0_NORM) call chr_cast(inVal, dpsv(partNo), sErr) + dist_updtEFrom = 3 case(dist_fmtMASS) call chr_cast(inVal, nucm(partNo), sErr) @@ -723,20 +719,22 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) end subroutine dist_saveParticle -subroutine dist_postprParticles(numCols, sErr) +! ================================================================================================ ! +! Post-Processing of Particle Arrays +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-08 +! ================================================================================================ ! +subroutine dist_postprParticles - use mod_pdgid use mod_common use mod_common_main - use numerical_constants use physical_constants - - integer, intent(in) :: numCols - logical, intent(inout) :: sErr + use numerical_constants integer i, j - do i=1,numCols + do i=1,dist_readCols select case(dist_colFormat(i)) case(dist_fmtPX) @@ -756,26 +754,34 @@ subroutine dist_postprParticles(numCols, sErr) return case(dist_fmtYP_NORM) return - case(dist_fmtPX_NORM) - return - case(dist_fmtPY_NORM) - return case(dist_fmtSIGMA_NORM) return - case(dist_fmtDT_NORM) - return - case(dist_fmtE_NORM) - return - case(dist_fmtP_NORM) - return - case(dist_fmtDEE0_NORM) - return case(dist_fmtDPP0_NORM) return end select end do +end subroutine dist_postprParticles + +! ================================================================================================ ! +! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team +! V.K. Berglyd Olsen, BE-ABP-HSS +! Updated: 2019-07-08 +! ================================================================================================ ! +subroutine dist_finaliseDist + + use parpro + use mod_pdgid + use mod_common + use mod_particles + use mod_common_main + use mod_common_track + use numerical_constants + + real(kind=fPrec) chkP, chkE + integer j + if(dist_readIonA .neqv. dist_readIonZ) then write(lerr,"(a)") "DIST> ERROR ION_A and ION_Z columns have to both be present if one of them is" call prror @@ -785,9 +791,12 @@ subroutine dist_postprParticles(numCols, sErr) nqq(1:napx) = nzz(1:napx) end if - mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) pstop(1:napx) = .false. ejf0v(1:napx) = ejfv(1:napx) + mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) + + ! If we have no energy arrays, we set all energies from deltaP = 0, that is reference momentum/energy + call part_updatePartEnergy(dist_updtEFrom) if(dist_readIonA .and. dist_readIonZ .and. .not. dist_readPDGID) then do j=1,napx @@ -795,26 +804,6 @@ subroutine dist_postprParticles(numCols, sErr) end do end if -end subroutine dist_postprParticles - -! ================================================================================================ ! -! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team -! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2018-10-31 -! ================================================================================================ ! -subroutine dist_finaliseDist - - use parpro - use mod_common - use mod_common_track - use mod_common_main - use numerical_constants - - implicit none - - integer :: j - real(kind=fPrec) :: chkP, chkE - ! Check existence of on-momentum particles in the distribution do j=1, napx chkP = (ejfv(j)/nucm(j))/(e0f/nucm0)-one @@ -875,7 +864,7 @@ end subroutine dist_finaliseDist ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2018-10-30 +! Updated: 2019-07-08 ! ================================================================================================ ! subroutine dist_echoDist @@ -905,7 +894,6 @@ subroutine dist_echoDist 19 continue write(lerr,"(a)") "DIST> ERROR Opening file '"//trim(dist_echoFile)//"'" call prror - return end subroutine dist_echoDist From f0a8c32a9e6bb77c28f274fc09b10b5c7a4d6de8 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 11:19:07 +0200 Subject: [PATCH 12/38] Removed updateAngle as an optional parameter in part_updatePartEnergy --- source/collimation.f90 | 2 +- source/main_cr.f90 | 2 +- source/mod_particles.f90 | 20 +++++++------------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/source/collimation.f90 b/source/collimation.f90 index 6e8e36b23..092c59720 100644 --- a/source/collimation.f90 +++ b/source/collimation.f90 @@ -1861,7 +1861,7 @@ subroutine collimate_start yv2(1:napx) = c1e3 * yv2(1:napx) + torbyp(1) end if - call part_updatePartEnergy(1) + call part_updatePartEnergy(1,.false.) do i=1,napx do ieff=1,numeff diff --git a/source/main_cr.f90 b/source/main_cr.f90 index 22fcf36f1..f7ba1ea26 100644 --- a/source/main_cr.f90 +++ b/source/main_cr.f90 @@ -983,7 +983,7 @@ program maincr elseif(rdfort13) then ! Restart from fort.13 call readFort13 - call part_updatePartEnergy(1) + call part_updatePartEnergy(1,.false.) else ! Generated from INIT Distribution Block do ia=1,napx,2 diff --git a/source/mod_particles.f90 b/source/mod_particles.f90 index 6a6f468f6..d336f3739 100644 --- a/source/mod_particles.f90 +++ b/source/mod_particles.f90 @@ -55,7 +55,7 @@ subroutine part_applyClosedOrbit xv2(1:napx) = xv2(1:napx) + clo(2)*real(idz(2),fPrec) yv2(1:napx) = yv2(1:napx) + clop(2)*real(idz(2),fPrec) end if - call part_updatePartEnergy(3) + call part_updatePartEnergy(3,.false.) end subroutine part_applyClosedOrbit @@ -99,7 +99,7 @@ subroutine part_updateRefEnergy(refEnergy) call prror end if - call part_updatePartEnergy(1) + call part_updatePartEnergy(1,.false.) end subroutine part_updateRefEnergy @@ -108,7 +108,7 @@ end subroutine part_updateRefEnergy ! Last modified: 2019-01-10 ! Updates the relevant particle arrays after the particle's energy, momentum or delta has changed. ! ================================================================================================ ! -subroutine part_updatePartEnergy(refArray,updateAngle) +subroutine part_updatePartEnergy(refArray, updateAngle) use crcoall use mod_common @@ -118,21 +118,15 @@ subroutine part_updatePartEnergy(refArray,updateAngle) implicit none - integer, intent(in) :: refArray - logical, optional, intent(in) :: updateAngle - - logical :: doUpdateAngle = .false. + integer, intent(in) :: refArray + logical, intent(in) :: updateAngle !if(part_isTracking .and. refArray /= 1) then ! write(lerr,"(a)") "PART> ERROR During tracking, only energy updates are allowed in part_updatePartEnergy." ! call prror !end if - if(present(updateAngle)) then - doUpdateAngle = updateAngle - end if - - if(doUpdateAngle .and. refArray /= 2) then + if(updateAngle .and. refArray /= 2) then ! If momentum is updated before the call, then ejf0v must be too ejf0v(1:napx) = ejfv(1:napx) end if @@ -162,7 +156,7 @@ subroutine part_updatePartEnergy(refArray,updateAngle) omoidpsv(1:napx) = ((one-mtc(1:napx))*oidpsv(1:napx))*c1e3 rvv(1:napx) = (ejv(1:napx)*e0f)/(e0*ejfv(1:napx)) ! Beta_0 / beta(j) - if(doUpdateAngle) then ! Update particle angles + if(updateAngle) then ! Update particle angles yv1(1:napx) = (ejf0v(1:napx)/ejfv(1:napx))*yv1(1:napx) yv2(1:napx) = (ejf0v(1:napx)/ejfv(1:napx))*yv2(1:napx) end if From 399488bbd4f1cc21e2c8c4fb390d8db38ae7d666 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 11:20:00 +0200 Subject: [PATCH 13/38] DIST block now supports Px/P0 and Py/P0 columns --- source/mod_dist.f90 | 63 +++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 244785d8b..853567cd0 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -60,12 +60,14 @@ module mod_dist integer, parameter :: dist_fmtYP = 14 ! Vertical angle integer, parameter :: dist_fmtPX = 15 ! Horizontal momentum integer, parameter :: dist_fmtPY = 16 ! Vertical momentum - integer, parameter :: dist_fmtSIGMA = 17 ! Longitudinal relative position - integer, parameter :: dist_fmtDT = 18 ! Time delay - integer, parameter :: dist_fmtE = 19 ! Particle energy - integer, parameter :: dist_fmtP = 20 ! Particle momentum - integer, parameter :: dist_fmtDEE0 = 21 ! Relative particle energy (to reference particle) - integer, parameter :: dist_fmtDPP0 = 22 ! Relative particle momentum (to reference particle) + integer, parameter :: dist_fmtPXP0 = 17 ! Relative horizontal momentum + integer, parameter :: dist_fmtPYP0 = 18 ! Relative vertical momentum + integer, parameter :: dist_fmtSIGMA = 19 ! Longitudinal relative position + integer, parameter :: dist_fmtDT = 20 ! Time delay + integer, parameter :: dist_fmtE = 21 ! Particle energy + integer, parameter :: dist_fmtP = 22 ! Particle momentum + integer, parameter :: dist_fmtDEE0 = 23 ! Relative particle energy (to reference particle) + integer, parameter :: dist_fmtDPP0 = 24 ! Relative particle momentum (to reference particle) ! Normalised Coordinates integer, parameter :: dist_fmtX_NORM = 31 ! Normalised horizontal position @@ -293,6 +295,10 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("PY") ! Vertical momentum call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) call dist_appendFormat(dist_fmtPY, uFac) + case("PX/P0","PXP0") ! Relative horizontal momentum + call dist_appendFormat(dist_fmtPX, one) + case("PY/P0","PYP0") ! Relative vertical momentum + call dist_appendFormat(dist_fmtPY, one) case("SIGMA","DS") ! Longitudinal relative position call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) call dist_appendFormat(dist_fmtSIGMA, uFac) @@ -310,19 +316,6 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("DP/P0","DPP0") ! Relative particle momentum (to reference particle) call dist_appendFormat(dist_fmtDPP0, one) - case("X_NORM") ! Normalised horizontal position - call dist_appendFormat(dist_fmtX_NORM, one) - case("Y_NORM") ! Normalised vertical positiom - call dist_appendFormat(dist_fmtY_NORM, one) - case("XP_NORM") ! Normalised horizontal angle - call dist_appendFormat(dist_fmtXP_NORM, one) - case("YP_NORM") ! Normalised vertical angle - call dist_appendFormat(dist_fmtYP_NORM, one) - case("SIGMA_NORM","DS_NORM") ! Normalised longitudinal relative position - call dist_appendFormat(dist_fmtSIGMA_NORM, one) - case("DP/P0_NORM","DPP0_NORM") ! Normalised relative particle momentum (to reference particle) - call dist_appendFormat(dist_fmtDPP0_NORM, one) - case("MASS","M") ! Particle mass call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) call dist_appendFormat(dist_fmtMASS, uFac) @@ -661,56 +654,78 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtNONE) return + case(dist_fmtPartID) call chr_cast(inVal, partID(partNo), sErr) + case(dist_fmtParentID) call chr_cast(inVal, parentID(partNo), sErr) + ! Transverse Coordinates + ! ======================== + case(dist_fmtX, dist_fmtX_NORM) call chr_cast(inVal, xv1(partNo), sErr) xv1(partNo) = xv1(partNo) * dist_colScale(colNo) + case(dist_fmtY, dist_fmtY_NORM) call chr_cast(inVal, xv2(partNo), sErr) xv2(partNo) = xv2(partNo) * dist_colScale(colNo) - case(dist_fmtXP, dist_fmtPX, dist_fmtXP_NORM) + + case(dist_fmtXP, dist_fmtPX, dist_fmtPXP0, dist_fmtXP_NORM) call chr_cast(inVal, yv1(partNo), sErr) yv1(partNo) = yv1(partNo) * dist_colScale(colNo) - case(dist_fmtYP, dist_fmtPY, dist_fmtYP_NORM) + + case(dist_fmtYP, dist_fmtPY, dist_fmtPYP0, dist_fmtYP_NORM) call chr_cast(inVal, yv2(partNo), sErr) yv2(partNo) = yv2(partNo) * dist_colScale(colNo) + ! Longitudinal Coordinates + ! ========================== + case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM) call chr_cast(inVal, sigmv(partNo), sErr) sigmv(partNo) = sigmv(partNo) * dist_colScale(colNo) + case(dist_fmtE) call chr_cast(inVal, ejv(partNo), sErr) ejv(partNo) = ejv(partNo) * dist_colScale(colNo) dist_updtEFrom = 1 + case(dist_fmtP) call chr_cast(inVal, ejfv(partNo), sErr) ejfv(partNo) = ejfv(partNo) * dist_colScale(colNo) dist_updtEFrom = 2 + case(dist_fmtDEE0) call chr_cast(inVal, ejv(partNo), sErr) ejv(partNo) = ejv(partNo) * dist_colScale(colNo) dist_updtEFrom = 1 + case(dist_fmtDPP0, dist_fmtDPP0_NORM) call chr_cast(inVal, dpsv(partNo), sErr) dist_updtEFrom = 3 + ! Ion Columns + ! ============= + case(dist_fmtMASS) call chr_cast(inVal, nucm(partNo), sErr) nucm(partNo) = nucm(partNo) * dist_colScale(colNo) dist_readMass = .true. + case(dist_fmtCHARGE) call chr_cast(inVal, nqq(partNo), sErr) dist_readCharge = .true. + case(dist_fmtIonA) call chr_cast(inVal, naa(partNo), sErr) dist_readIonA = .true. + case(dist_fmtIonZ) call chr_cast(inVal, nzz(partNo), sErr) dist_readIonZ = .true. + case(dist_fmtPDGID) call chr_cast(inVal, pdgid(partNo), sErr) dist_readPDGID = .true. @@ -741,6 +756,10 @@ subroutine dist_postprParticles yv1(1:napx) = (yv1(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtPY) yv2(1:napx) = (yv2(1:napx)/ejfv(1:napx))*c1e3 + case(dist_fmtPXP0) + yv1(1:napx) = ((yv1(1:napx)*e0f)/ejfv(1:napx))*c1e3 + case(dist_fmtPYP0) + yv2(1:napx) = ((yv2(1:napx)*e0f)/ejfv(1:napx))*c1e3 case(dist_fmtDT) sigmv(1:napx) = -(e0f/e0)*(sigmv(1:napx)*clight) case(dist_fmtDEE0) @@ -796,7 +815,7 @@ subroutine dist_finaliseDist mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) ! If we have no energy arrays, we set all energies from deltaP = 0, that is reference momentum/energy - call part_updatePartEnergy(dist_updtEFrom) + call part_updatePartEnergy(dist_updtEFrom,.false.) if(dist_readIonA .and. dist_readIonZ .and. .not. dist_readPDGID) then do j=1,napx From 5ee2f516ea30460a218fcb81a0f92aad5b598ba4 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 11:23:53 +0200 Subject: [PATCH 14/38] Added normalise logical flags for 4D and 6D --- source/mod_dist.f90 | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 853567cd0..b248b202a 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -90,6 +90,8 @@ module mod_dist logical, private, save :: dist_readIonA = .false. logical, private, save :: dist_readCharge = .false. logical, private, save :: dist_readPDGID = .false. + logical, private, save :: dist_norm4D = .false. + logical, private, save :: dist_norm6D = .false. contains @@ -347,6 +349,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle + dist_norm4D = .true. case("6D_NORM") ! 6D normalised coordinates call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position @@ -355,6 +358,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) + dist_norm6D = .true. case("IONS") ! The ion columns call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass @@ -742,6 +746,7 @@ end subroutine dist_saveParticle ! ================================================================================================ ! subroutine dist_postprParticles + use crcoall use mod_common use mod_common_main use physical_constants @@ -751,7 +756,6 @@ subroutine dist_postprParticles do i=1,dist_readCols select case(dist_colFormat(i)) - case(dist_fmtPX) yv1(1:napx) = (yv1(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtPY) @@ -764,23 +768,24 @@ subroutine dist_postprParticles sigmv(1:napx) = -(e0f/e0)*(sigmv(1:napx)*clight) case(dist_fmtDEE0) ejv(1:napx) = (one + ejv(1:napx))*e0 - - case(dist_fmtX_NORM) - return - case(dist_fmtY_NORM) - return - case(dist_fmtXP_NORM) - return - case(dist_fmtYP_NORM) - return - case(dist_fmtSIGMA_NORM) - return - case(dist_fmtDPP0_NORM) - return - end select end do + if(dist_norm4D .and. dist_norm6D) then + write(lerr,"(a)") "DIST> ERROR Cannot use both 4D_NORM and 6D_NORM at the same time" + call prror + end if + + if(dist_norm4D) then + ! Normalise 4D + continue + end if + + if(dist_norm6D) then + ! Normalise 6D + continue + end if + end subroutine dist_postprParticles ! ================================================================================================ ! From 551f9e95d7eed18bb077d866aa02b3599ebe7e5c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 11:33:23 +0200 Subject: [PATCH 15/38] Enforce FORMAT/file column number match, and number of particles read to be equal to napx --- source/mod_dist.f90 | 76 +++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index b248b202a..0c5f20c0c 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -39,13 +39,14 @@ module mod_dist character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution - integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns - real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns - integer, private, save :: dist_nColumns = 0 ! The number of columns in the file - integer, private, save :: dist_readCols = 0 ! The number of columns read from file + integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns + real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns + integer, private, save :: dist_nColumns = 0 ! The number of columns in the file - character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block - integer, private, save :: dist_numPart = 0 ! Number of PARTICLE keywords in block + character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block + integer, private, save :: dist_nParticle = 0 ! Number of PARTICLE keywords in block + + integer, private, save :: dist_numPart = 0 ! Number of actual particles generated or read ! Column formats ! ================ @@ -104,23 +105,25 @@ module mod_dist ! ================================================================================================ ! subroutine dist_generateDist + use crcoall + use mod_common use mod_particles - logical hasParticles - - hasParticles = .false. - - if(dist_numPart > 0) then + if(dist_nParticle > 0) then call dist_parseParticles - hasParticles = .true. end if if(dist_distFile /= " ") then call dist_readDist - hasParticles = .true. end if - if(hasParticles) then + if(dist_numPart /= napx) then + write(lerr,"(2(a,i0),a)") "DIST> ERROR Number of particles read or generated is ",dist_numPart,& + " but the simulation setup requests ",napx," particles" + call prror + end if + + if(dist_numPart > 0) then call dist_postprParticles call dist_finaliseDist call part_applyClosedOrbit @@ -205,9 +208,9 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) iErr = .true. return end if - dist_numPart = dist_numPart + 1 - call alloc(dist_partLine, mInputLn, dist_numPart, " ", "dist_partLine") - dist_partLine(dist_numPart) = trim(inLine) + dist_nParticle = dist_nParticle + 1 + call alloc(dist_partLine, mInputLn, dist_nParticle, " ", "dist_partLine") + dist_partLine(dist_nParticle) = trim(inLine) case("ECHO") if(nSplit >= 2) then @@ -382,8 +385,6 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum call dist_appendFormat(dist_fmtDT, one) ! Time delay - call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge - call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID case default write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" @@ -518,14 +519,15 @@ subroutine dist_parseParticles integer i, j, nSplit logical spErr, cErr - if(dist_numPart > 0) then - do j=1,dist_numPart + if(dist_nParticle > 0) then + do j=1,dist_nParticle call chr_split(dist_partLine(j), lnSplit, nSplit, spErr) if(spErr) goto 20 do i=2,nSplit call dist_saveParticle(j, i-1, lnSplit(i), cErr) end do if(cErr) goto 20 + dist_numPart = dist_numPart + 1 end do end if @@ -553,16 +555,13 @@ subroutine dist_readDist character(len=:), allocatable :: lnSplit(:) character(len=mInputLn) inLine integer i, j, nSplit, lineNo, fUnit - logical spErr, cErr, isFirst + logical spErr, cErr write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" - dist_readCols = dist_nColumns - - isFirst = .true. - lineNo = 0 - cErr = .false. - j = dist_numPart ! PARTICLE definitions in the block are saved first + lineNo = 0 + cErr = .false. + j = dist_nParticle ! PARTICLE definitions in the block are saved first if(dist_hasFormat .eqv. .false.) then call dist_setColumnFormat("OLD_DIST",cErr) @@ -591,22 +590,16 @@ subroutine dist_readDist if(spErr) goto 20 if(nSplit == 0) goto 10 - if(isFirst) then - if(nSplit < dist_nColumns) then - dist_readCols = nSplit - write(lout,"(2(a,i0))") "DIST> WARNING Distribution file has ",nSplit," columns, but format has ",dist_nColumns - end if - isFirst = .false. - end if - if(nSplit < dist_readCols) then + if(nSplit /= dist_nColumns) then write(lerr,"(3(a,i0),a)") "DIST> ERROR Number of columns in file on line ",lineNo," is ",nSplit,& - " but expected ",dist_readCols," columns" + " but FORMAT defines ",dist_nColumns," columns" call prror end if - do i=1,dist_readCols + do i=1,nSplit call dist_saveParticle(j, i, lnSplit(i), cErr) end do if(cErr) goto 20 + dist_numPart = dist_numPart + 1 goto 10 @@ -630,11 +623,6 @@ subroutine dist_readDist call f_close(fUnit) write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_distFile)//"'" - if(j < napx) then - write(lout,"(a,i0)") "DIST> WARNING Read a number of particles LOWER than requested: ",napx - napx = j - end if - end subroutine dist_readDist ! ================================================================================================ ! @@ -754,7 +742,7 @@ subroutine dist_postprParticles integer i, j - do i=1,dist_readCols + do i=1,dist_nColumns select case(dist_colFormat(i)) case(dist_fmtPX) yv1(1:napx) = (yv1(1:napx)/ejfv(1:napx))*c1e3 From c31400612a61fc3311466149e7efeece1fac8bbc Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 11:41:19 +0200 Subject: [PATCH 16/38] Some shuffling of the logic of how particles are counted in DIST --- source/mod_dist.f90 | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 0c5f20c0c..057e6ebb1 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -554,14 +554,14 @@ subroutine dist_readDist character(len=:), allocatable :: lnSplit(:) character(len=mInputLn) inLine - integer i, j, nSplit, lineNo, fUnit + integer i, nSplit, lineNo, fUnit, nRead logical spErr, cErr write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" + nRead = 0 lineNo = 0 cErr = .false. - j = dist_nParticle ! PARTICLE definitions in the block are saved first if(dist_hasFormat .eqv. .false.) then call dist_setColumnFormat("OLD_DIST",cErr) @@ -569,25 +569,26 @@ subroutine dist_readDist call f_requestUnit(dist_distFile, fUnit) call f_open(unit=fUnit,file=dist_distFile,mode='r',err=cErr,formatted=.true.,status="old") - if(cErr) goto 19 + if(cErr) goto 20 10 continue - read(fUnit,"(a)",end=30,err=20) inLine + read(fUnit,"(a)",end=40,err=30) inLine lineNo = lineNo + 1 if(inLine(1:1) == "*") goto 10 if(inLine(1:1) == "#") goto 10 if(inLine(1:1) == "!") goto 10 - j = j + 1 - if(j > napx) then + dist_numPart = dist_numPart + 1 + nRead = nRead + 1 + + if(dist_numPart > napx) then write(lout,"(a,i0,a)") "DIST> Stopping reading file as ",napx," particles have been read, as requested in '"//trim(fort3)//"'" - j = napx - goto 30 + goto 40 end if call chr_split(inLine, lnSplit, nSplit, spErr) - if(spErr) goto 20 + if(spErr) goto 30 if(nSplit == 0) goto 10 if(nSplit /= dist_nColumns) then @@ -596,32 +597,25 @@ subroutine dist_readDist call prror end if do i=1,nSplit - call dist_saveParticle(j, i, lnSplit(i), cErr) + call dist_saveParticle(dist_numPart, i, lnSplit(i), cErr) end do - if(cErr) goto 20 - dist_numPart = dist_numPart + 1 + if(cErr) goto 30 goto 10 -19 continue +20 continue write(lerr,"(a)") "DIST> ERROR Opening file '"//trim(dist_distFile)//"'" call prror return -20 continue +30 continue write(lerr,"(a,i0)") "DIST> ERROR Reading particles from line ",lineNo call prror return -30 continue - if(j == 0) then - write(lerr,"(a)") "DIST> ERROR Reading particles. No particles read from file." - call prror - return - end if - +40 continue call f_close(fUnit) - write(lout,"(a,i0,a)") "DIST> Read ",j," particles from file '"//trim(dist_distFile)//"'" + write(lout,"(a,i0,a)") "DIST> Read ",nRead," particles from file '"//trim(dist_distFile)//"'" end subroutine dist_readDist From bec68a6fdc3e0e9d1368632f234a2c756fc7e65f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 14:02:46 +0200 Subject: [PATCH 17/38] Updates some comments and such --- source/mod_dist.f90 | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 057e6ebb1..46ce27f71 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -39,9 +39,9 @@ module mod_dist character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution - integer, allocatable, private, save :: dist_colFormat(:) ! The format of the file columns - real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the file columns - integer, private, save :: dist_nColumns = 0 ! The number of columns in the file + integer, allocatable, private, save :: dist_colFormat(:) ! The column types in the FORMAT + real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the columns + integer, private, save :: dist_nColumns = 0 ! The number of columns in the FORMAT character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block integer, private, save :: dist_nParticle = 0 ! Number of PARTICLE keywords in block @@ -85,7 +85,7 @@ module mod_dist integer, parameter :: dist_fmtIonZ = 54 ! Ion atomic number integer, parameter :: dist_fmtPDGID = 55 ! Particle PDG ID - ! Flags for columns we've set that we need to track + ! Flags for columns we've set that we need to track for later checks logical, private, save :: dist_readMass = .false. logical, private, save :: dist_readIonZ = .false. logical, private, save :: dist_readIonA = .false. @@ -100,7 +100,7 @@ module mod_dist ! Master Module Subrotuine ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-08 -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! Called from main_cr if dist_enable is true. This should handle everything needed. ! ================================================================================================ ! subroutine dist_generateDist @@ -137,7 +137,7 @@ end subroutine dist_generateDist ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Updated: 2018-10-30 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_parseInputLine(inLine, iLine, iErr) @@ -233,7 +233,7 @@ end subroutine dist_parseInputLine ! Parse File Column Formats ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_setColumnFormat(fmtName, fErr) @@ -508,7 +508,7 @@ end subroutine dist_appendFormat ! Parse PARTICLE Lines from DIST Block ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-08 -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_parseParticles @@ -541,7 +541,7 @@ end subroutine dist_parseParticles ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2018-10-30 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_readDist @@ -623,7 +623,7 @@ end subroutine dist_readDist ! Save Particle Data to Arrays ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-08 -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_saveParticle(partNo, colNo, inVal, sErr) @@ -724,7 +724,7 @@ end subroutine dist_saveParticle ! Post-Processing of Particle Arrays ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_postprParticles @@ -773,7 +773,7 @@ end subroutine dist_postprParticles ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Updated: 2019-07-08 +! Updated: 2019-07-09 ! ================================================================================================ ! subroutine dist_finaliseDist @@ -848,23 +848,6 @@ subroutine dist_finaliseDist write(lout,"(a,2(1x,i0),1x,f15.7,2(1x,i0))") "DIST> Reference particle species [A,Z,M,Q,ID]:", aa0, zz0, nucm0, qq0, pdgid0 write(lout,"(a,1x,f15.7)") "DIST> Reference energy [Z TeV]:", c1m6*e0/qq0 - do j=napx+1,npart - partID(j) = j - parentID(j) = j - pstop(j) = .true. - ejv(j) = zero - dpsv(j) = zero - oidpsv(j) = one - mtc(j) = one - naa(j) = aa0 - nzz(j) = zz0 - nqq(j) = qq0 - pdgid(j) = pdgid0 - nucm(j) = nucm0 - moidpsv(j) = one - omoidpsv(j) = zero - end do - end subroutine dist_finaliseDist ! ================================================================================================ ! From 3a9e8a0c7c57fc68a5a64db798547188c1a46ed4 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 9 Jul 2019 18:24:58 +0200 Subject: [PATCH 18/38] Fix a few minor things after discussions --- source/mod_dist.f90 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 46ce27f71..60b7978cf 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -1,10 +1,13 @@ ! ================================================================================================ ! +! +! Read a beam distribution +! ~~~~~~~~~~~~~~~~~~~~~~~~~~ +! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2018-10-30 -! Read a beam distribution +! Last modified: 2019-07-09 ! -! Format of the input file: +! Format of the original DIST input file: ! id: unique identifier of the particle (integer) ! gen: parent ID (integer) ! weight: statistical weight of the particle (double: >0.0) @@ -20,7 +23,6 @@ ! NOTA BENE: ! - id, gen and weight are assigned by the fluka_mod_init subroutine; ! - z and zp are actually useless (but we never know); -! - in case the file contains less particle than napx, napx is re-assigned ! ! ================================================================================================ ! module mod_dist @@ -45,7 +47,7 @@ module mod_dist character(len=:), allocatable, private, save :: dist_partLine(:) ! PARTICLE definitions in the block integer, private, save :: dist_nParticle = 0 ! Number of PARTICLE keywords in block - + integer, private, save :: dist_numPart = 0 ! Number of actual particles generated or read ! Column formats @@ -304,7 +306,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPX, one) case("PY/P0","PYP0") ! Relative vertical momentum call dist_appendFormat(dist_fmtPY, one) - case("SIGMA","DS") ! Longitudinal relative position + case("SIGMA") ! Longitudinal relative position call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) call dist_appendFormat(dist_fmtSIGMA, uFac) case("DT") ! Time delay From e67fc3a004df764a7b88c53056585f8c38b55609 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 10 Jul 2019 14:21:39 +0200 Subject: [PATCH 19/38] Added DISTlib as submodule --- .gitmodules | 3 +++ lib/DISTlib | 1 + 2 files changed, 4 insertions(+) create mode 160000 lib/DISTlib diff --git a/.gitmodules b/.gitmodules index f4bff585a..7456ce6f5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "lib/NAFFlib"] path = lib/NAFFlib url = https://github.com/SixTrack/NAFFlib +[submodule "lib/DISTlib"] + path = lib/DISTlib + url = https://github.com/SixTrack/DISTlib.git diff --git a/lib/DISTlib b/lib/DISTlib new file mode 160000 index 000000000..973937644 --- /dev/null +++ b/lib/DISTlib @@ -0,0 +1 @@ +Subproject commit 973937644c6e6bd2767d1dca31d9193649ba8044 From 19d1fe9547eb2d1b925c65728e4863456a4b7517 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 10 Jul 2019 18:00:00 +0200 Subject: [PATCH 20/38] Changing around the parsing in DIST. Works for old format now. --- source/mod_dist.f90 | 516 +++++++++++++++++++++++++++++--------------- 1 file changed, 345 insertions(+), 171 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 60b7978cf..d3be42d38 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -59,26 +59,35 @@ module mod_dist ! Physical Coordinates integer, parameter :: dist_fmtX = 11 ! Horizontal position integer, parameter :: dist_fmtY = 12 ! Vertical positiom - integer, parameter :: dist_fmtXP = 13 ! Horizontal angle - integer, parameter :: dist_fmtYP = 14 ! Vertical angle + integer, parameter :: dist_fmtXP = 13 ! Horizontal momentum ratio + integer, parameter :: dist_fmtYP = 14 ! Vertical momentum ratio integer, parameter :: dist_fmtPX = 15 ! Horizontal momentum integer, parameter :: dist_fmtPY = 16 ! Vertical momentum integer, parameter :: dist_fmtPXP0 = 17 ! Relative horizontal momentum integer, parameter :: dist_fmtPYP0 = 18 ! Relative vertical momentum - integer, parameter :: dist_fmtSIGMA = 19 ! Longitudinal relative position - integer, parameter :: dist_fmtDT = 20 ! Time delay - integer, parameter :: dist_fmtE = 21 ! Particle energy - integer, parameter :: dist_fmtP = 22 ! Particle momentum - integer, parameter :: dist_fmtDEE0 = 23 ! Relative particle energy (to reference particle) - integer, parameter :: dist_fmtDPP0 = 24 ! Relative particle momentum (to reference particle) + integer, parameter :: dist_fmtZETA = 19 ! Longitudinal relative position (canonical) + integer, parameter :: dist_fmtSIGMA = 20 ! Longitudinal relative position + integer, parameter :: dist_fmtDT = 21 ! Time delay + integer, parameter :: dist_fmtE = 22 ! Particle energy + integer, parameter :: dist_fmtP = 23 ! Particle momentum + integer, parameter :: dist_fmtDEE0 = 24 ! Relative particle energy (to reference particle) + integer, parameter :: dist_fmtDPP0 = 25 ! Relative particle momentum (to reference particle) + integer, parameter :: dist_fmtPT = 26 ! Delta enery over reference momentum (Pt) ! Normalised Coordinates - integer, parameter :: dist_fmtX_NORM = 31 ! Normalised horizontal position - integer, parameter :: dist_fmtY_NORM = 32 ! Normalised vertical positiom - integer, parameter :: dist_fmtXP_NORM = 33 ! Normalised horizontal angle - integer, parameter :: dist_fmtYP_NORM = 34 ! Normalised vertical angle - integer, parameter :: dist_fmtSIGMA_NORM = 35 ! Normalised longitudinal relative position - integer, parameter :: dist_fmtDPP0_NORM = 36 ! Normalised relative particle momentum (to reference particle) + integer, parameter :: dist_fmtXN = 31 ! Normalised horizontal position + integer, parameter :: dist_fmtYN = 32 ! Normalised vertical position + integer, parameter :: dist_fmtZN = 33 ! Normalised longitudinal position + integer, parameter :: dist_fmtPXN = 34 ! Normalised horizontal momentum + integer, parameter :: dist_fmtPYN = 35 ! Normalised vertical momentum + integer, parameter :: dist_fmtPZN = 36 ! Normalised longitudinal momentum + + integer, parameter :: dist_fmtJX = 41 ! Horizontal action + integer, parameter :: dist_fmtJY = 42 ! Vertical action + integer, parameter :: dist_fmtJZ = 43 ! Longitudinal action + integer, parameter :: dist_fmtPhiX = 44 ! Horizontal action angle + integer, parameter :: dist_fmtPhiY = 45 ! Vertical action angle + integer, parameter :: dist_fmtPhiZ = 46 ! Longitudinal action angle ! Ion Columns integer, parameter :: dist_fmtMASS = 51 ! Particle mass @@ -96,6 +105,15 @@ module mod_dist logical, private, save :: dist_norm4D = .false. logical, private, save :: dist_norm6D = .false. + ! Arrays to send to DISTlib + real(kind=fPrec), allocatable, private, save :: dist_partCol1(:) ! Ends up in array xv1 + real(kind=fPrec), allocatable, private, save :: dist_partCol2(:) ! Ends up in array yv1 + real(kind=fPrec), allocatable, private, save :: dist_partCol3(:) ! Ends up in array xv2 + real(kind=fPrec), allocatable, private, save :: dist_partCol4(:) ! Ends up in array yv2 + real(kind=fPrec), allocatable, private, save :: dist_partCol5(:) ! Ends up in array sigmv + real(kind=fPrec), allocatable, private, save :: dist_partCol6(:) ! Ends up in array dpsv, evj, and ejfv + integer, private, save :: dist_partFmt(6) = 0 ! The format used for each column + contains ! ================================================================================================ ! @@ -108,8 +126,17 @@ module mod_dist subroutine dist_generateDist use crcoall + use mod_alloc use mod_common use mod_particles + use numerical_constants + + call alloc(dist_partCol1, napx, zero, "dist_partCol1") + call alloc(dist_partCol2, napx, zero, "dist_partCol2") + call alloc(dist_partCol3, napx, zero, "dist_partCol3") + call alloc(dist_partCol4, napx, zero, "dist_partCol4") + call alloc(dist_partCol5, napx, zero, "dist_partCol5") + call alloc(dist_partCol6, napx, zero, "dist_partCol6") if(dist_nParticle > 0) then call dist_parseParticles @@ -134,6 +161,13 @@ subroutine dist_generateDist end if end if + call dealloc(dist_partCol1, "dist_partCol1") + call dealloc(dist_partCol2, "dist_partCol2") + call dealloc(dist_partCol3, "dist_partCol3") + call dealloc(dist_partCol4, "dist_partCol4") + call dealloc(dist_partCol5, "dist_partCol5") + call dealloc(dist_partCol6, "dist_partCol6") + end subroutine dist_generateDist ! ================================================================================================ ! @@ -235,7 +269,7 @@ end subroutine dist_parseInputLine ! Parse File Column Formats ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 -! Updated: 2019-07-09 +! Updated: 2019-07-10 ! ================================================================================================ ! subroutine dist_setColumnFormat(fmtName, fErr) @@ -272,121 +306,158 @@ subroutine dist_setColumnFormat(fmtName, fErr) fmtUnit = trim(fmtName(unitPos:fmtLen)) else fmtBase = trim(fmtName) - fmtUnit = "[none]" + fmtUnit = "[1]" end if select case(chr_toUpper(fmtBase)) - case("OFF","SKIP") ! Ignored - call dist_appendFormat(dist_fmtNONE, one) - case("ID") ! Particle ID - call dist_appendFormat(dist_fmtPartID, one) - case("PARENT") ! Parent ID - call dist_appendFormat(dist_fmtParentID, one) + case("OFF","SKIP") + call dist_appendFormat(dist_fmtNONE, one, 0) + case("ID") + call dist_appendFormat(dist_fmtPartID, one, 0) + case("PARENT") + call dist_appendFormat(dist_fmtParentID, one, 0) - case("X") ! Horizontal position + case("X") call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtX, uFac) - case("Y") ! Vertical positiom + call dist_appendFormat(dist_fmtX, uFac, 1) + case("Y") call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtY, uFac) - case("XP") ! Horizontal angle - call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) - call dist_appendFormat(dist_fmtXP, uFac) - case("YP") ! Vertical angle - call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) - call dist_appendFormat(dist_fmtYP, uFac) - case("PX") ! Horizontal momentum + call dist_appendFormat(dist_fmtY, uFac, 3) + + case("XP") + call dist_appendFormat(dist_fmtXP, uFac, 2) + case("YP") + call dist_appendFormat(dist_fmtYP, uFac, 4) + + case("PX") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtPX, uFac) - case("PY") ! Vertical momentum + call dist_appendFormat(dist_fmtPX, uFac, 2) + case("PY") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtPY, uFac) - case("PX/P0","PXP0") ! Relative horizontal momentum - call dist_appendFormat(dist_fmtPX, one) - case("PY/P0","PYP0") ! Relative vertical momentum - call dist_appendFormat(dist_fmtPY, one) - case("SIGMA") ! Longitudinal relative position + call dist_appendFormat(dist_fmtPY, uFac, 4) + + case("PX/P0","PXP0") + call dist_appendFormat(dist_fmtPX, one, 2) + case("PY/P0","PYP0") + call dist_appendFormat(dist_fmtPY, one, 4) + + case("SIGMA") + call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) + call dist_appendFormat(dist_fmtSIGMA, uFac, 5) + case("ZETA") call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtSIGMA, uFac) - case("DT") ! Time delay + call dist_appendFormat(dist_fmtZETA, uFac, 5) + case("DT") call dist_unitScale(fmtName, fmtUnit, 4, uFac, fErr) - call dist_appendFormat(dist_fmtDT, uFac) - case("E") ! Particle energy + call dist_appendFormat(dist_fmtDT, uFac, 5) + + case("E") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtE, uFac) - case("P") ! Particle momentum + call dist_appendFormat(dist_fmtE, uFac, 6) + case("P") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtP, uFac) - case("DE/E0","DEE0") ! Relative particle energy (to reference particle) - call dist_appendFormat(dist_fmtDEE0, one) - case("DP/P0","DPP0") ! Relative particle momentum (to reference particle) - call dist_appendFormat(dist_fmtDPP0, one) + call dist_appendFormat(dist_fmtP, uFac, 6) + case("DE/E0","DEE0") + call dist_appendFormat(dist_fmtDEE0, one, 6) + case("DP/P0","DPP0") + call dist_appendFormat(dist_fmtDPP0, one, 6) + case("DE/P0","DEP0","PT") + call dist_appendFormat(dist_fmtPT, one, 6) + + case("XN") + call dist_appendFormat(dist_fmtXN, one, 1) + case("YN") + call dist_appendFormat(dist_fmtYN, one, 3) + case("ZN") + call dist_appendFormat(dist_fmtZN, one, 5) + case("PXN") + call dist_appendFormat(dist_fmtPXN, one, 2) + case("PYN") + call dist_appendFormat(dist_fmtPYN, one, 4) + case("PZN") + call dist_appendFormat(dist_fmtPZN, one, 6) + + case("JX") + call dist_appendFormat(dist_fmtJX, one, 1) + case("JY") + call dist_appendFormat(dist_fmtJY, one, 3) + case("JZ") + call dist_appendFormat(dist_fmtJZ, one, 5) + case("PHIX") + call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) + call dist_appendFormat(dist_fmtPhiX, uFac, 2) + case("PHIY") + call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) + call dist_appendFormat(dist_fmtPhiY, uFac, 4) + case("PHIZ") + call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) + call dist_appendFormat(dist_fmtPhiZ, uFac, 6) - case("MASS","M") ! Particle mass + case("MASS","M") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtMASS, uFac) - case("CHARGE","Q") ! Particle charge - call dist_appendFormat(dist_fmtCHARGE, one) - case("ION_A") ! Ion atomic mass - call dist_appendFormat(dist_fmtIonA, one) - case("ION_Z") ! Ion atomic number - call dist_appendFormat(dist_fmtIonZ, one) - case("PDGID") ! Particle PDG ID - call dist_appendFormat(dist_fmtPDGID, one) + call dist_appendFormat(dist_fmtMASS, uFac, 0) + case("CHARGE","Q") + call dist_appendFormat(dist_fmtCHARGE, one, 0) + case("ION_A") + call dist_appendFormat(dist_fmtIonA, one, 0) + case("ION_Z") + call dist_appendFormat(dist_fmtIonZ, one, 0) + case("PDGID") + call dist_appendFormat(dist_fmtPDGID, one, 0) case("4D") ! 4D default coordinates - call dist_appendFormat(dist_fmtX, one) ! Horizontal position - call dist_appendFormat(dist_fmtY, one) ! Vertical positiom - call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, one) ! Vertical angle + call dist_appendFormat(dist_fmtX, one, 1) + call dist_appendFormat(dist_fmtPX, one, 2) + call dist_appendFormat(dist_fmtY, one, 3) + call dist_appendFormat(dist_fmtPY, one, 4) case("6D") ! 6D default coordinates - call dist_appendFormat(dist_fmtX, one) ! Horizontal position - call dist_appendFormat(dist_fmtY, one) ! Vertical positiom - call dist_appendFormat(dist_fmtXP, one) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, one) ! Vertical angle - call dist_appendFormat(dist_fmtSIGMA, one) ! Longitudinal relative position - call dist_appendFormat(dist_fmtDPP0, one) ! Relative particle momentum (to reference particle) - - case("4D_NORM") ! 4D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle - dist_norm4D = .true. - - case("6D_NORM") ! 6D normalised coordinates - call dist_appendFormat(dist_fmtX_NORM, one) ! Normalised horizontal position - call dist_appendFormat(dist_fmtY_NORM, one) ! Normalised vertical positiom - call dist_appendFormat(dist_fmtXP_NORM, one) ! Normalised horizontal angle - call dist_appendFormat(dist_fmtYP_NORM, one) ! Normalised vertical angle - call dist_appendFormat(dist_fmtSIGMA_NORM, one) ! Normalised longitudinal relative position - call dist_appendFormat(dist_fmtDPP0_NORM, one) ! Normalised relative particle momentum (to reference particle) - dist_norm6D = .true. + call dist_appendFormat(dist_fmtX, one, 1) + call dist_appendFormat(dist_fmtPX, one, 2) + call dist_appendFormat(dist_fmtY, one, 3) + call dist_appendFormat(dist_fmtPY, one, 4) + call dist_appendFormat(dist_fmtZETA, one, 5) + call dist_appendFormat(dist_fmtDPP0, one, 6) + + case("NORM") ! 6D normalised coordinates + call dist_appendFormat(dist_fmtXN, one, 1) + call dist_appendFormat(dist_fmtPXN, one, 2) + call dist_appendFormat(dist_fmtYN, one, 3) + call dist_appendFormat(dist_fmtPYN, one, 4) + call dist_appendFormat(dist_fmtZN, one, 5) + call dist_appendFormat(dist_fmtPZN, one, 6) + + case("ACTION") ! 6D action + call dist_appendFormat(dist_fmtJX, one, 1) + call dist_appendFormat(dist_fmtPhiX, one, 2) + call dist_appendFormat(dist_fmtJY, one, 3) + call dist_appendFormat(dist_fmtPhiY, one, 4) + call dist_appendFormat(dist_fmtJZ, one, 5) + call dist_appendFormat(dist_fmtPhiZ, one, 6) case("IONS") ! The ion columns - call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass - call dist_appendFormat(dist_fmtCHARGE, one) ! Particle charge - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number - call dist_appendFormat(dist_fmtPDGID, one) ! Particle PDG ID + call dist_appendFormat(dist_fmtMASS, c1e3, 0) + call dist_appendFormat(dist_fmtCHARGE, one, 0) + call dist_appendFormat(dist_fmtIonA, one, 0) + call dist_appendFormat(dist_fmtIonZ, one, 0) + call dist_appendFormat(dist_fmtPDGID, one, 0) case("OLD_DIST") ! The old DIST block file format - call dist_appendFormat(dist_fmtPartID, one) ! Particle ID - call dist_appendFormat(dist_fmtParentID, one) ! Parent ID - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtX, c1e3) ! Horizontal position - call dist_appendFormat(dist_fmtY, c1e3) ! Vertical positiom - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtXP, c1e3) ! Horizontal angle - call dist_appendFormat(dist_fmtYP, c1e3) ! Vertical angle - call dist_appendFormat(dist_fmtNONE, one) ! Ignored - call dist_appendFormat(dist_fmtIonA, one) ! Ion atomic mass - call dist_appendFormat(dist_fmtIonZ, one) ! Ion atomic number - call dist_appendFormat(dist_fmtMASS, c1e3) ! Particle mass - call dist_appendFormat(dist_fmtP, c1e3) ! Particle momentum - call dist_appendFormat(dist_fmtDT, one) ! Time delay + call dist_appendFormat(dist_fmtPartID, one, 0) + call dist_appendFormat(dist_fmtParentID, one, 0) + call dist_appendFormat(dist_fmtNONE, one, 0) + call dist_appendFormat(dist_fmtX, c1e3, 1) + call dist_appendFormat(dist_fmtY, c1e3, 3) + call dist_appendFormat(dist_fmtNONE, one, 0) + call dist_appendFormat(dist_fmtXP, c1e3, 2) + call dist_appendFormat(dist_fmtYP, c1e3, 4) + call dist_appendFormat(dist_fmtNONE, one, 0) + call dist_appendFormat(dist_fmtIonA, one, 0) + call dist_appendFormat(dist_fmtIonZ, one, 0) + call dist_appendFormat(dist_fmtMASS, c1e3, 0) + call dist_appendFormat(dist_fmtP, c1e3, 6) + call dist_appendFormat(dist_fmtDT, one, 5) case default write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" @@ -400,7 +471,7 @@ end subroutine dist_setColumnFormat ! Parse File Column Units ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 -! Updated: 2019-07-08 +! Updated: 2019-07-10 ! ================================================================================================ ! subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) @@ -422,7 +493,7 @@ subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) unitScale = c1e3 case("[mm]") unitScale = one - case("[none]") + case("[1]") unitScale = one case default goto 100 @@ -433,24 +504,24 @@ subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) unitScale = c1e3 case("[mrad]") unitScale = one - case("[none]") + case("[1]") unitScale = one case default goto 100 end select - elseif(unitType == 3) then ! Energy + elseif(unitType == 3) then ! Energy/Momentum/Mass select case(chr_toLower(fmtUnit)) - case("[ev]") + case("[ev]","[ev/c]","[ev/c^2]") unitScale = c1m6 - case("[kev]") + case("[kev]","[kev/c]","[kev/c^2]") unitScale = c1m3 - case("[mev]") + case("[mev]","[mev/c]","[mev/c^2]") unitScale = one - case("[gev]") + case("[gev]","[gev/c]","[gev/c^2]") unitScale = c1e3 - case("[tev]") + case("[tev]","[tev/c]","[tev/c^2]") unitScale = c1e6 - case("[none]") + case("[1]") unitScale = one case default goto 100 @@ -467,7 +538,7 @@ subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) unitScale = c1e9 case("[ps]") unitScale = c1e12 - case("[none]") + case("[1]") unitScale = one case default goto 100 @@ -488,13 +559,15 @@ end subroutine dist_unitScale ! Created: 2019-07-05 ! Updated: 2019-07-05 ! ================================================================================================ ! -subroutine dist_appendFormat(fmtID, colScale) +subroutine dist_appendFormat(fmtID, colScale, partCol) + use crcoall use mod_alloc use numerical_constants integer, intent(in) :: fmtID real(kind=fPrec), intent(in) :: colScale + integer, intent(in) :: partCol dist_nColumns = dist_nColumns + 1 @@ -504,6 +577,29 @@ subroutine dist_appendFormat(fmtID, colScale) dist_colFormat(dist_nColumns) = fmtID dist_colScale(dist_nColumns) = colScale + if(partCol > 0) then + if(dist_partFmt(partCol) == 0) then + dist_partFmt(partCol) = fmtID + else + write(lerr,"(a,i0)") "DIST> ERROR Multiple formats selected for particle coordinate ",partCol + select case(partCol) + case(1) + write(lerr,"(a)") "DIST> Choose one of: X, XN, JX" + case(2) + write(lerr,"(a)") "DIST> Choose one of: PX, PX/P0, PXN. PHIX" + case(3) + write(lerr,"(a)") "DIST> Choose one of: Y, YN, JY" + case(4) + write(lerr,"(a)") "DIST> Choose one of: PY, PY/P0, PYN. PHIY" + case(5) + write(lerr,"(a)") "DIST> Choose one of: SIGMA, ZETA, DT, ZN, JZ" + case(6) + write(lerr,"(a)") "DIST> Choose one of: E, P, DE/E0, DP/P0, PT, PZN, PHIZ" + end select + call prror + end if + end if + end subroutine dist_appendFormat ! ================================================================================================ ! @@ -649,49 +745,48 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtParentID) call chr_cast(inVal, parentID(partNo), sErr) - ! Transverse Coordinates + ! Horizontal Coordinates ! ======================== - case(dist_fmtX, dist_fmtX_NORM) - call chr_cast(inVal, xv1(partNo), sErr) - xv1(partNo) = xv1(partNo) * dist_colScale(colNo) + case(dist_fmtX, dist_fmtXN, dist_fmtJX) + call chr_cast(inVal, dist_partCol1(partNo), sErr) + dist_partCol1(partNo) = dist_partCol1(partNo) * dist_colScale(colNo) + + case(dist_fmtPX, dist_fmtXP, dist_fmtPXP0, dist_fmtPXN, dist_fmtPhiX) + call chr_cast(inVal, dist_partCol2(partNo), sErr) + dist_partCol2(partNo) = dist_partCol2(partNo) * dist_colScale(colNo) - case(dist_fmtY, dist_fmtY_NORM) - call chr_cast(inVal, xv2(partNo), sErr) - xv2(partNo) = xv2(partNo) * dist_colScale(colNo) + ! Vertical Coordinates + ! ======================== - case(dist_fmtXP, dist_fmtPX, dist_fmtPXP0, dist_fmtXP_NORM) - call chr_cast(inVal, yv1(partNo), sErr) - yv1(partNo) = yv1(partNo) * dist_colScale(colNo) + case(dist_fmtY, dist_fmtYN, dist_fmtJY) + call chr_cast(inVal, dist_partCol3(partNo), sErr) + dist_partCol3(partNo) = dist_partCol3(partNo) * dist_colScale(colNo) - case(dist_fmtYP, dist_fmtPY, dist_fmtPYP0, dist_fmtYP_NORM) - call chr_cast(inVal, yv2(partNo), sErr) - yv2(partNo) = yv2(partNo) * dist_colScale(colNo) + case(dist_fmtPY, dist_fmtYP, dist_fmtPYP0, dist_fmtPYN, dist_fmtPhiY) + call chr_cast(inVal, dist_partCol4(partNo), sErr) + dist_partCol4(partNo) = dist_partCol4(partNo) * dist_colScale(colNo) ! Longitudinal Coordinates ! ========================== - case(dist_fmtSIGMA, dist_fmtDT, dist_fmtSIGMA_NORM) - call chr_cast(inVal, sigmv(partNo), sErr) - sigmv(partNo) = sigmv(partNo) * dist_colScale(colNo) + case(dist_fmtSIGMA, dist_fmtZETA, dist_fmtDT, dist_fmtZN, dist_fmtJZ) + call chr_cast(inVal, dist_partCol5(partNo), sErr) + dist_partCol5(partNo) = dist_partCol5(partNo) * dist_colScale(colNo) - case(dist_fmtE) - call chr_cast(inVal, ejv(partNo), sErr) - ejv(partNo) = ejv(partNo) * dist_colScale(colNo) + case(dist_fmtE, dist_fmtDEE0, dist_fmtPT) + call chr_cast(inVal, dist_partCol6(partNo), sErr) + dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) dist_updtEFrom = 1 case(dist_fmtP) - call chr_cast(inVal, ejfv(partNo), sErr) - ejfv(partNo) = ejfv(partNo) * dist_colScale(colNo) + call chr_cast(inVal, dist_partCol6(partNo), sErr) + dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) dist_updtEFrom = 2 - case(dist_fmtDEE0) - call chr_cast(inVal, ejv(partNo), sErr) - ejv(partNo) = ejv(partNo) * dist_colScale(colNo) - dist_updtEFrom = 1 - - case(dist_fmtDPP0, dist_fmtDPP0_NORM) - call chr_cast(inVal, dpsv(partNo), sErr) + case(dist_fmtDPP0, dist_fmtPZN, dist_fmtPhiZ) + call chr_cast(inVal, dist_partCol6(partNo), sErr) + dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) dist_updtEFrom = 3 ! Ion Columns @@ -732,41 +827,120 @@ subroutine dist_postprParticles use crcoall use mod_common + use mod_particles use mod_common_main use physical_constants use numerical_constants - integer i, j - - do i=1,dist_nColumns - select case(dist_colFormat(i)) - case(dist_fmtPX) - yv1(1:napx) = (yv1(1:napx)/ejfv(1:napx))*c1e3 - case(dist_fmtPY) - yv2(1:napx) = (yv2(1:napx)/ejfv(1:napx))*c1e3 - case(dist_fmtPXP0) - yv1(1:napx) = ((yv1(1:napx)*e0f)/ejfv(1:napx))*c1e3 - case(dist_fmtPYP0) - yv2(1:napx) = ((yv2(1:napx)*e0f)/ejfv(1:napx))*c1e3 - case(dist_fmtDT) - sigmv(1:napx) = -(e0f/e0)*(sigmv(1:napx)*clight) - case(dist_fmtDEE0) - ejv(1:napx) = (one + ejv(1:napx))*e0 - end select - end do + logical doAction, doNormal + + doAction = .false. + doNormal = .false. + + select case(dist_partFmt(6)) + case(dist_fmtNONE) + ejv(1:napx) = e0 + call part_updatePartEnergy(1,.false.) + case(dist_fmtE) + ejv(1:napx) = dist_partCol6(1:napx) + call part_updatePartEnergy(1,.false.) + case(dist_fmtP) + ejfv(1:napx) = dist_partCol6(1:napx) + call part_updatePartEnergy(2,.false.) + case(dist_fmtDEE0) + ejv(1:napx) = (one + dist_partCol6(1:napx))*e0 + call part_updatePartEnergy(1,.false.) + case(dist_fmtDPP0) + dpsv(1:napx) = dist_partCol6(1:napx)*c1e3 + call part_updatePartEnergy(3,.false.) + case(dist_fmtPT) + ejv(1:napx) = (one + dist_partCol6(1:napx))*e0f + call part_updatePartEnergy(1,.false.) + case(dist_fmtPZN) + doNormal = .true. + case(dist_fmtPhiZ) + doAction = .true. + end select + + select case(dist_partFmt(5)) + case(dist_fmtNONE) + sigmv(1:napx) = zero + case(dist_fmtZETA) + sigmv(1:napx) = dist_partCol5(1:napx)*rvv(1:napx) + case(dist_fmtSIGMA) + sigmv(1:napx) = dist_partCol5(1:napx) + case(dist_fmtDT) + sigmv(1:napx) = -(e0f/e0)*(dist_partCol5(1:napx)*clight) + case(dist_fmtZN) + doNormal = .true. + case(dist_fmtJZ) + doAction = .true. + end select + + select case(dist_partFmt(1)) + case(dist_fmtNONE) + xv1(1:napx) = zero + case(dist_fmtX) + xv1(1:napx) = dist_partCol1(1:napx) + case(dist_fmtXN) + doNormal = .true. + case(dist_fmtJX) + doAction = .true. + end select + + select case(dist_partFmt(2)) + case(dist_fmtNONE) + yv1(1:napx) = zero + case(dist_fmtXP) + yv1(1:napx) = dist_partCol2(1:napx) + case(dist_fmtPX) + yv1(1:napx) = (dist_partCol2(1:napx)/ejfv(1:napx))*c1e3 + case(dist_fmtPXP0) + yv1(1:napx) = (dist_partCol2(1:napx)/e0f)*c1e3 + case(dist_fmtPXN) + doNormal = .true. + case(dist_fmtPhiX) + doAction = .true. + end select + + select case(dist_partFmt(3)) + case(dist_fmtNONE) + xv2(1:napx) = zero + case(dist_fmtY) + xv2(1:napx) = dist_partCol3(1:napx) + case(dist_fmtYN) + doNormal = .true. + case(dist_fmtJY) + doAction = .true. + end select + + select case(dist_partFmt(4)) + case(dist_fmtNONE) + yv2(1:napx) = zero + case(dist_fmtYP) + yv2(1:napx) = dist_partCol4(1:napx) + case(dist_fmtPY) + yv2(1:napx) = (dist_partCol4(1:napx)/ejfv(1:napx))*c1e3 + case(dist_fmtPYP0) + yv2(1:napx) = (dist_partCol4(1:napx)/e0f)*c1e3 + case(dist_fmtPYN) + doNormal = .true. + case(dist_fmtPhiY) + doAction = .true. + end select - if(dist_norm4D .and. dist_norm6D) then - write(lerr,"(a)") "DIST> ERROR Cannot use both 4D_NORM and 6D_NORM at the same time" + if(doNormal .and. doAction) then + write(lerr,"(a)") "DIST> ERROR Cannot mix normalised and action coordinates" call prror end if - if(dist_norm4D) then - ! Normalise 4D + if(doNormal) then + ! Call DISTlib continue end if - if(dist_norm6D) then - ! Normalise 6D + if(doAction) then + ! Call DISTlib continue end if From 05898b18b96f7cf148b35296cc747a217512c5ab Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 11 Jul 2019 09:23:06 +0200 Subject: [PATCH 21/38] Updated to latest version of DISTlib --- lib/DISTlib | 2 +- lib/dist/demo/CMakeLists.txt | 18 --- lib/dist/demo/buildDemo.sh | 4 - lib/dist/demo/data/tasm.txt | 1 - lib/dist/demo/demodist.f90 | 103 ------------ lib/dist/source/distr.c | 302 ----------------------------------- lib/dist/source/distr.h | 46 ------ lib/dist/source/helper.c | 257 ----------------------------- lib/dist/source/helper.h | 11 -- 9 files changed, 1 insertion(+), 743 deletions(-) delete mode 100644 lib/dist/demo/CMakeLists.txt delete mode 100755 lib/dist/demo/buildDemo.sh delete mode 100644 lib/dist/demo/data/tasm.txt delete mode 100644 lib/dist/demo/demodist.f90 delete mode 100644 lib/dist/source/distr.c delete mode 100644 lib/dist/source/distr.h delete mode 100644 lib/dist/source/helper.c delete mode 100644 lib/dist/source/helper.h diff --git a/lib/DISTlib b/lib/DISTlib index 973937644..61ad79130 160000 --- a/lib/DISTlib +++ b/lib/DISTlib @@ -1 +1 @@ -Subproject commit 973937644c6e6bd2767d1dca31d9193649ba8044 +Subproject commit 61ad79130391b9a8a1208c9509f52a21c1be648e diff --git a/lib/dist/demo/CMakeLists.txt b/lib/dist/demo/CMakeLists.txt deleted file mode 100644 index 0ab2fd733..000000000 --- a/lib/dist/demo/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.5) - -project(hello) -enable_language(Fortran) - -if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") - set(dialect "-ffree-form -std=f2008 -fimplicit-none") - set(bounds "-fbounds-check") -endif() - -set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}") -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}") - -# -# Compile. -# -file(GLOB_RECURSE sources ../source/*.c ../source/*.h ../demo/*.f90) -add_executable(prog ${sources}) \ No newline at end of file diff --git a/lib/dist/demo/buildDemo.sh b/lib/dist/demo/buildDemo.sh deleted file mode 100755 index 9a6371ab5..000000000 --- a/lib/dist/demo/buildDemo.sh +++ /dev/null @@ -1,4 +0,0 @@ -mkdir -p buildDemo -cd buildDemo -cmake ../ -make \ No newline at end of file diff --git a/lib/dist/demo/data/tasm.txt b/lib/dist/demo/data/tasm.txt deleted file mode 100644 index 94eeea27b..000000000 --- a/lib/dist/demo/data/tasm.txt +++ /dev/null @@ -1 +0,0 @@ -5.730893019E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 3.320177742E-01 1.744928751E-01 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 2.976150736E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 -1.705736557E-01 3.360044865E-01 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 1.189182400E+01 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 0.000000000E+00 -1.046989058E-10 8.409138916E-02 diff --git a/lib/dist/demo/demodist.f90 b/lib/dist/demo/demodist.f90 deleted file mode 100644 index 31db1452f..000000000 --- a/lib/dist/demo/demodist.f90 +++ /dev/null @@ -1,103 +0,0 @@ - -subroutine readMatrixFromFile(matrix) - ! opening the file for reading - use, intrinsic :: iso_fortran_env - real(kind=real64), dimension(36) :: reada - real(kind=real64), dimension(6, 6) :: matrix - open (2, file = '../data/tasm.txt', status = 'old') - - - read(2,*) reada - matrix=RESHAPE(reada, shape(matrix) ) - close(2) - -end subroutine readMatrixFromFile - -program demodist - use, intrinsic :: iso_fortran_env - implicit none - - integer i ; - real(kind=real64), dimension(6) :: coordinates - real(kind=real64), dimension(2500,6) :: distribution1 - real(kind=real64), dimension(10002) :: x,xp,y, yp, sigma, delta - real(kind=real64) momentum, mass, one, e1,e2, e3, dp, betx1, zero, pia2, six - real(kind=real64), dimension(6, 6) :: identity, results, testm, tas - real(kind=real64) dim - - call readMatrixFromFile(tas) - dim = 6 - e1 = 1.0d0 - e2 = 2.0d0 - e3 = 0.03d0 - dp = 0.0001d0 - pia2 = 2.00d0*3.1415 - zero = 0.0d0 - momentum = 4000.0 - mass = 938.0 - one =1d0 - six = 6.000d0 - - - - - ! Initialize 3 distributions with dimenstion 6 - - call initializedistribution(3, 6) - ! Set the tas matrix - call settasmatrix(tas) - ! Set the emittance - call setemittance12(e1,e2) - - call setdeltap(dp) - ! Set mass and momentum - call setmassmom(mass, momentum) - - ! Set the parameters to generate the distribution - !1. (1=x, 2=x', 3=y 4=y', 5=ds 6=dp) - !2. Start value of scan - !3. End value of scan - !4. Number of points - !5. type of spacing 0 - constant, 3 - linear spacing - call setparameter(1,zero,six,100,3); - call setparameter(2,zero,zero,1,0); - call setparameter(3,zero,six,100,3); - call setparameter(4,zero,zero,1,0); - call setparameter(5,zero,zero,1,0); - call setparameter(6,zero,zero,1,0); - - !Print the settings mainly for debugging - call printdistsettings() - !Get the filled vectors - call getcoordvectors(x,xp,y, yp, sigma, delta) - - - - !Distribution 2: a matched distribution - - ! Change the distribution to 1 - call setdistribution(1) - call settasmatrix(tas) - call setemittance12(e1,e2) - call setemittance3(e3) - call setmassmom(mass, momentum) - - call setparameter(1,one,one,1,0); - call setparameter(2,zero,pia2,50,3); - call setparameter(3,one,one,1,0); - call setparameter(4,zero,pia2,50,3); - call setparameter(5,one,one,1,0); - call setparameter(6,zero,pia2,100,3); - - - do i = 0, 240!000 - call getcoord(coordinates,i) - - print *, coordinates - enddo - -!e1 from fort.10 1.999999999648927940E+00 -!e2 from fort.10 9.999999998426114534E-01 - - end program demodist - diff --git a/lib/dist/source/distr.c b/lib/dist/source/distr.c deleted file mode 100644 index 5ec571178..000000000 --- a/lib/dist/source/distr.c +++ /dev/null @@ -1,302 +0,0 @@ -#include -#include -#include -#include -#include "helper.h" -#include "distr.h" - - -struct distparam* dist; -struct distparam* diststart; -int dim; -int distn=0; - -void action2canonical_(double acangl[6], double cancord[6]){ - double acoord[6]; - acoord[0]= sqrt((dist->emitt->e1)*acangl[0])*cos(acangl[1]); - acoord[1]=-sqrt((dist->emitt->e1)*acangl[0])*sin(acangl[1]); - acoord[2]= sqrt((dist->emitt->e2)*acangl[2])*cos(acangl[3]); - acoord[3]=-sqrt((dist->emitt->e2)*acangl[2])*sin(acangl[3]); - acoord[4]= sqrt((dist->emitt->e3)*acangl[4])*cos(acangl[5]); - acoord[5]=-sqrt((dist->emitt->e3)*acangl[4]/1000)*sin(acangl[5]); - - //This is the multiplication with the tas matrix - mtrx_vector_mult_pointer(dim,dim, dist->tas, acoord,cancord); -} -void setdistribution_(int *ndist){ - dist = diststart + *ndist; -} -/* -Returns the total number of particles that will be created for the distribution. -*/ -int getnumberdist_(){ - double length = 1; - for(int j =0; jcoord[j]->length; - } - return length; -} - -void setemittance12_(double *e1, double *e2){ - dist->emitt->e1=*e1; - dist->emitt->e2=*e2; - -} - -void setemittance3_(double *e3){ - dist->emitt->e3=*e3; -} - -void calcualteinverse(){ - double invtas[6][6]; - double result[dim][dim]; - for(int i =0; i< dim; i++){ - for(int j =0; j< dim; j++){ - invtas[i][j] = dist->tas[i][j]; - } - } - - cofactor(invtas, 6); - for(int i =0; i< dim; i++){ - for(int j =0; j< dim; j++){ - dist->invtas[i][j]= invtas[i][j]; - } - } - -} - -void addclosedorbit_(double *clo){ - for(int i=0; iclosedorbit[i] = clo[i]; - } - -} - -void setdeltap_(double *dp){ - convertdp2emittance(*dp); -} - -//This emittance is oversimplified but gives a good approximation. -void convertdp2emittance(double dp){ - calcualteinverse(); - dist->emitt->e3 = pow(1000*dp*dist->invtas[5][5],2); - -} - -/* -Initalizes the distributinos -*/ -void initializedistribution_(int *numberOfDist, int *dimension){ - dist = (struct distparam*)malloc((*numberOfDist)*sizeof(struct distparam)); - dim = *dimension; - - for(int i = 0; i <*numberOfDist; i++) - { - struct parameters para_tmp; - (dist + i)->coord = (struct parameters**)malloc(dim*sizeof(struct parameters*)); - (dist + i)->emitt = (struct emittances*)malloc(sizeof(struct emittances)); - (dist + i)->tas = (double**)malloc(dim*sizeof(double*)); - (dist + i)->invtas = (double**)malloc(dim*sizeof(double*)); - (dist + i)->closedorbit = (double*)malloc(dim*sizeof(double)); - (dist + i)->isDistrcalculated = 0; - - for(int k=0; ktas[k] =(double*)malloc(dim*sizeof(double)); - (dist + i)->invtas[k] =(double*)malloc(dim*sizeof(double)); - } - - (dist + i)->mass = 0; - (dist + i)->momentum = 0; - (dist + i)->emitt->e1 = 0; - (dist + i)->emitt->e2 = 0; - (dist + i)->emitt->e3 = 0; - (dist + i)->coordtype =-1; - - for(int j=0; jcoord[j] = (struct parameters*)malloc(sizeof(struct parameters)); - (dist +i)->coord[j]->start=0; - (dist +i)->coord[j]->stop=0; - (dist +i)->coord[j]->length=1; - (dist +i)->coord[j]->type=0; - (dist +i)->closedorbit[j]=0; - } - } - diststart=dist; -} - -void printdistsettings_(int *ndist){ - printf("Printing info about distribution: \n"); - printf("Distribution type (input), 1=normalized coordinates %d \n", dist->coordtype ); - printf("Mass: %f \n", dist ->mass); - printf("Momentum: %f \n", dist ->momentum); - printf("Emttiance, e1, e2, e3: %f, %f, %f \n", dist->emitt->e1, dist->emitt->e2, dist->emitt->e3); - for(int j=0; jcoord[j]->start); - printf("stop: %f \n", (dist)->coord[j]->stop); - printf("length: %d \n", (dist)->coord[j]->length); - printf("type: %d \n", (dist)->coord[j]->type); - printf("######################### \n"); - } - -} - -void settasmatrix_(double tas[6][6]){ - for(int i =0; i< dim; i++){ - for(int j =0; j< dim; j++){ - dist->tas[i][j] = tas[i][j]; - } - } -} - -void getcoordvectors_(double *x, double *xp, double *y, double *yp, double *sigma, double *delta){ - int distlen = getnumberdist_(); - if(dist->isDistrcalculated==0){ - dist2sixcoord_(); - } - for(int i=0; idistout[i][0]; - xp[i] = dist->distout[i][1]; - y[i] = dist->distout[i][2]; - yp[i] = dist->distout[i][3]; - sigma[i] = dist->distout[i][4]; - delta[i] = dist->distout[i][5]; - } - -} -void dist2sixcoord_(){ - int counter = 0; - double tc[6]; - double tmp[6]; - dist->distout = (double**)malloc(getnumberdist_()*sizeof(double*)); - for(int i =0; i< dist->coord[0]->length; i++){ - for(int j =0; j< dist->coord[1]->length; j++){ - for(int k =0; k< dist->coord[2]->length; k++){ - for(int l =0; l< dist->coord[3]->length; l++){ - for(int m =0; m< dist->coord[4]->length; m++){ - for(int n =0; n< dist->coord[5]->length; n++){ - dist->distout[counter] = (double*)malloc(dim*sizeof(double)); - tc[0]=dist->coord[0]->values[i]+dist->closedorbit[0]; - tc[1]=dist->coord[1]->values[j]+dist->closedorbit[1]; - tc[2]=dist->coord[2]->values[k]+dist->closedorbit[2]; - tc[3]=dist->coord[3]->values[l]+dist->closedorbit[3]; - tc[4]=dist->coord[4]->values[m]+dist->closedorbit[4]; - tc[5]=dist->coord[5]->values[n]+dist->closedorbit[5]; - action2sixinternal_(tc, tmp); - for(int p=0; pdistout[counter][p] = tmp[p]; - } - - counter++; - - } - } - } - } - } - } - dist->isDistrcalculated=1; -} - -void getcoord_(double *coordinate, int *initial ){ - - if(dist->isDistrcalculated==0){ - dist2sixcoord_(); - - } - if(*initial >= getnumberdist_()){ - printf("Not generated, total inital coordinates generated is %f:",getnumberdist_() ); - for(int i=0; idistout[*initial][i]; - } -} - -void setmassmom_(double *mass, double *momentum){ - (dist)-> mass = *mass; - (dist)-> momentum = *momentum; -} - -void setparameter_(int *index, double *start, double *stop, int *length, int *type){ - - dist->coord[*index-1]->start = *start; - dist->coord[*index-1]->stop = *stop; - dist->coord[*index-1]->length = *length; - dist->coord[*index-1]->type = *type; - if(*type ==0){ //Constant value - dist->coord[*index-1]->values = (double*)malloc(sizeof(double)); - dist->coord[*index-1]->values = start; - } - - if(*type > 0){ //Allocate space for the array - dist->coord[*index-1]->values = (double*)malloc((*length)*sizeof(double)); - memcpy(dist->coord[*index-1]->values , start, sizeof(double)); - - } - if(*type==1){ //Linearly spaced intervalls - createLinearSpaced(*length, *start, *stop,dist->coord[*index-1]->values); - } - if(*type==2){ //Exponentially spaced - createLinearSpaced(*length, *start, *stop,dist->coord[*index-1]->values); - for(int i=0;i <*length; i++){ - - dist->coord[*index-1]->values[i] = exp(dist->coord[*index-1]->values[i]); - } - } - if(*type==3){ //Spaced with ^2 - createLinearSpaced(*length, *start, *stop,dist->coord[*index-1]->values); - for(int i=0;i <*length; i++){ - dist->coord[*index-1]->values[i] = pow(dist->coord[*index-1]->values[i],2); - - } - - } - -} - -void createtas0coupling_(double betax, double alfax, double betay, double alfay){ - - for (int i = 0; i < 6; i++) - { - for (int k = 0; k < 6; k++) - { - dist->tas [i][k] = 0; - - } - } - - dist->tas[0][0] = sqrt(betax); - dist->tas[2][2] = sqrt(betay); - dist->tas[1][2] =-alfax/sqrt(betax); - dist->tas[4][3] =-alfay/sqrt(betay); - -} - -void action2sixinternal_(double tc[6], double *results){ - double cancord[6]; - if(checkdist) - { - action2canonical_(tc, cancord); - canonical2six_(cancord, &dist->momentum, &dist->mass, results); - } -} - -int checkdist(){ - double eps =1e-16; - if(dist->momentum < eps && dist->momentum < eps ){ - printf("Momentum and mass needs to be set"); - return 0; - } - if(dist->tas[0][0] < eps){ - printf("Tas matrix need to be set"); - return 0; - } - return 1; - -} \ No newline at end of file diff --git a/lib/dist/source/distr.h b/lib/dist/source/distr.h deleted file mode 100644 index 8bcb34944..000000000 --- a/lib/dist/source/distr.h +++ /dev/null @@ -1,46 +0,0 @@ -struct distparam -{ - struct parameters** coord; - struct emittances* emitt; - double mass; - double momentum; - double **tas; - double **invtas; - double *closedorbit; - int coordtype; // This tells which type of coordinates the input is given. // 1-Normalized - double **distout; - int isDistrcalculated; -}; - -struct parameters -{ - double start; - double stop; - int length; - int type; //This gives the type of distribution, constant, linear, gaussian, - double * values; -}; - -struct emittances{ - double e1, e2, e3; -}; - - -void action2canonical_(double tc[6], double cancord[6]); -void setdistribution_(int *ndist); -int getnumberdist_(); -void setemittance12_(double *e1, double *e2); -void setemittance3_(double *e3); -void initializedistribution_(int *numberOfDist, int *dimension); -void printdistsettings_(int *ndist); -void addclosedorbit_(double *clo); -void settasmatrix_(double tas[6][6]); -void dist2sixcoord_(); -void setmassmom_(double *mass, double *momentum); -void setparameter_(int *index, double *start, double *stop, int *length, int *type); -void setdeltap_(double *dp); -void convertdp2emittance(double dp); -void setemittance3_(double *e3); -void createTasWithNoCoupling(double betax, double alfax, double betay, double alfay, double tas[6][6]); -void action2sixinternal_(double tc[6], double results[6]); -int checkdist(); \ No newline at end of file diff --git a/lib/dist/source/helper.c b/lib/dist/source/helper.c deleted file mode 100644 index 590c93d21..000000000 --- a/lib/dist/source/helper.c +++ /dev/null @@ -1,257 +0,0 @@ -#include -#include -#include -#include -#include "helper.h" -void six2canonical_(double * coord, double *ref_momentum, double *mass, double *canonical){ - - double deltap = *(coord+5); - double beta0 = *ref_momentum/momentum2energy(*ref_momentum, *mass); - double beta = (*ref_momentum+deltap)/momentum2energy((*ref_momentum)+deltap, *mass); - double rv = beta0/beta; - - *(canonical+0) = *(coord+0); - *(canonical+1) = *(coord+1)*(1+deltap); - *(canonical+2) = *(coord+2); - *(canonical+3) = *(coord+3)*(1+deltap); - *(canonical+4) = *(coord+4)/rv; - *(canonical+5) = *(coord+5); - -} - -void -canonical2six_(double *canonical, double *ref_momentum, double *mass, double *coord){ - - double deltap = *(canonical+5); - double beta0 = *ref_momentum/momentum2energy(*ref_momentum, *mass); - double beta = (*ref_momentum+deltap)/momentum2energy((*ref_momentum)+deltap, *mass); - double rv = beta0/beta; - *(coord+0) = *(canonical+0); - *(coord+1) = *(canonical+1)/(1+deltap); - *(coord+2) = *(canonical+2); - *(coord+3) = *(canonical+3)/(1+deltap); - *(coord+4) = *(canonical+4)*rv; - *(coord+5) = *(canonical+5); -} -double rationalApproximation(double t) -{ - // Abramowitz and Stegun formula 26.2.23. - // The absolute value of the error should be less than 4.5 e-4. - double c[] = {2.515517, 0.802853, 0.010328}; - double d[] = {1.432788, 0.189269, 0.001308}; - return t - ((c[2]*t + c[1])*t + c[0]) / - (((d[2]*t + d[1])*t + d[0])*t + 1.0); -} - -double normalcdfinv_(double p) -{ - printf("printing %f", p); - if (p <= 0.0 || p >= 1.0) - { - return 0; - } - - // See article above for explanation of this section. - if (p < 0.5) - { - // F^-1(p) = - G^-1(p) - return -rationalApproximation( sqrt(-2.0*log(p)) ); - } - else - { - // F^-1(p) = G^-1(1-p) - return rationalApproximation( sqrt(-2.0*log(1-p)) ); - } -} - -void createLinearSpaced(int length, double start, double stop, double *eqspaced ){ - - double distance = (stop-start)/length; - for(int i; i Date: Thu, 11 Jul 2019 11:33:39 +0200 Subject: [PATCH 22/38] Fixed DIST PY column conversion --- source/mod_dist.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index d3be42d38..d950a7494 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -854,7 +854,7 @@ subroutine dist_postprParticles dpsv(1:napx) = dist_partCol6(1:napx)*c1e3 call part_updatePartEnergy(3,.false.) case(dist_fmtPT) - ejv(1:napx) = (one + dist_partCol6(1:napx))*e0f + ejv(1:napx) = e0 + dist_partCol6(1:napx)*e0f call part_updatePartEnergy(1,.false.) case(dist_fmtPZN) doNormal = .true. From 77d38ee77d3ebcce7df79d047cd38b75c3f9d6a8 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 11 Jul 2019 13:01:31 +0200 Subject: [PATCH 23/38] Fixes from review and some comment updates --- source/mod_dist.f90 | 77 ++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index d950a7494..de90e5815 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -1,28 +1,13 @@ ! ================================================================================================ ! ! -! Read a beam distribution -! ~~~~~~~~~~~~~~~~~~~~~~~~~~ +! Beam Distribution Block +! ~~~~~~~~~~~~~~~~~~~~~~~~~ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Last modified: 2019-07-09 +! Updated: 2019-07-11 ! -! Format of the original DIST input file: -! id: unique identifier of the particle (integer) -! gen: parent ID (integer) -! weight: statistical weight of the particle (double: >0.0) -! x, y, s: particle position [m] -! xp, yp, zp: particle direction (tangents) [] -! aa, zz: mass and atomic number -! m: rest mass [GeV/c2] -! pc: particle momentum [GeV/c] -! dt: time delay with respect to the reference particle [s] -! -! aa,zz and m are now taken into account for hisix! -! -! NOTA BENE: -! - id, gen and weight are assigned by the fluka_mod_init subroutine; -! - z and zp are actually useless (but we never know); +! This module was completely rewritten to support DISTlib in July 2019 ! ! ================================================================================================ ! module mod_dist @@ -37,7 +22,6 @@ module mod_dist logical, private, save :: dist_echo = .false. ! Echo the read distribution? logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader - integer, private, save :: dist_updtEFrom = 3 ! The parameter sent to part_updatePartEnergy after DIST character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution @@ -59,12 +43,12 @@ module mod_dist ! Physical Coordinates integer, parameter :: dist_fmtX = 11 ! Horizontal position integer, parameter :: dist_fmtY = 12 ! Vertical positiom - integer, parameter :: dist_fmtXP = 13 ! Horizontal momentum ratio - integer, parameter :: dist_fmtYP = 14 ! Vertical momentum ratio + integer, parameter :: dist_fmtXP = 13 ! Horizontal momentum ratio Px/|P| + integer, parameter :: dist_fmtYP = 14 ! Vertical momentum ratio Py/|P| integer, parameter :: dist_fmtPX = 15 ! Horizontal momentum integer, parameter :: dist_fmtPY = 16 ! Vertical momentum - integer, parameter :: dist_fmtPXP0 = 17 ! Relative horizontal momentum - integer, parameter :: dist_fmtPYP0 = 18 ! Relative vertical momentum + integer, parameter :: dist_fmtPXP0 = 17 ! Horizontal momentum Px/P0 + integer, parameter :: dist_fmtPYP0 = 18 ! Vertical momentum Py/P0 integer, parameter :: dist_fmtZETA = 19 ! Longitudinal relative position (canonical) integer, parameter :: dist_fmtSIGMA = 20 ! Longitudinal relative position integer, parameter :: dist_fmtDT = 21 ! Time delay @@ -72,7 +56,7 @@ module mod_dist integer, parameter :: dist_fmtP = 23 ! Particle momentum integer, parameter :: dist_fmtDEE0 = 24 ! Relative particle energy (to reference particle) integer, parameter :: dist_fmtDPP0 = 25 ! Relative particle momentum (to reference particle) - integer, parameter :: dist_fmtPT = 26 ! Delta enery over reference momentum (Pt) + integer, parameter :: dist_fmtPT = 26 ! Delta energy over reference momentum (Pt) ! Normalised Coordinates integer, parameter :: dist_fmtXN = 31 ! Normalised horizontal position @@ -102,17 +86,15 @@ module mod_dist logical, private, save :: dist_readIonA = .false. logical, private, save :: dist_readCharge = .false. logical, private, save :: dist_readPDGID = .false. - logical, private, save :: dist_norm4D = .false. - logical, private, save :: dist_norm6D = .false. ! Arrays to send to DISTlib - real(kind=fPrec), allocatable, private, save :: dist_partCol1(:) ! Ends up in array xv1 - real(kind=fPrec), allocatable, private, save :: dist_partCol2(:) ! Ends up in array yv1 - real(kind=fPrec), allocatable, private, save :: dist_partCol3(:) ! Ends up in array xv2 - real(kind=fPrec), allocatable, private, save :: dist_partCol4(:) ! Ends up in array yv2 - real(kind=fPrec), allocatable, private, save :: dist_partCol5(:) ! Ends up in array sigmv - real(kind=fPrec), allocatable, private, save :: dist_partCol6(:) ! Ends up in array dpsv, evj, and ejfv - integer, private, save :: dist_partFmt(6) = 0 ! The format used for each column + real(kind=fPrec), allocatable, private, save :: dist_partCol1(:) ! Ends up in array xv1 + real(kind=fPrec), allocatable, private, save :: dist_partCol2(:) ! Ends up in array yv1 + real(kind=fPrec), allocatable, private, save :: dist_partCol3(:) ! Ends up in array xv2 + real(kind=fPrec), allocatable, private, save :: dist_partCol4(:) ! Ends up in array yv2 + real(kind=fPrec), allocatable, private, save :: dist_partCol5(:) ! Ends up in array sigmv + real(kind=fPrec), allocatable, private, save :: dist_partCol6(:) ! Ends up in array dpsv, evj, and ejfv + integer, private, save :: dist_partFmt(6) = dist_fmtNONE ! The format used for each column contains @@ -270,6 +252,9 @@ end subroutine dist_parseInputLine ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 ! Updated: 2019-07-10 +! +! This routine splits the unit from the format description and adds the format and the scaling +! factor to the list of format columns for later file parsing. ! ================================================================================================ ! subroutine dist_setColumnFormat(fmtName, fErr) @@ -444,6 +429,9 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPDGID, one, 0) case("OLD_DIST") ! The old DIST block file format + ! This is added for the block to be compatible with the old, fixed column DIST file format. + ! The scaling is hardcoded, and the file format has a few columns that are not used. + ! Specifically the weight (column 3), and the z and pz coordinates (columns 6 and 9). call dist_appendFormat(dist_fmtPartID, one, 0) call dist_appendFormat(dist_fmtParentID, one, 0) call dist_appendFormat(dist_fmtNONE, one, 0) @@ -511,15 +499,15 @@ subroutine dist_unitScale(fmtName, fmtUnit, unitType, unitScale, uErr) end select elseif(unitType == 3) then ! Energy/Momentum/Mass select case(chr_toLower(fmtUnit)) - case("[ev]","[ev/c]","[ev/c^2]") + case("[ev]", "[ev/c]", "[ev/c^2]", "[ev/c2]", "[ev/c**2]") unitScale = c1m6 - case("[kev]","[kev/c]","[kev/c^2]") + case("[kev]","[kev/c]","[kev/c^2]","[kev/c2]","[kev/c**2]") unitScale = c1m3 - case("[mev]","[mev/c]","[mev/c^2]") + case("[mev]","[mev/c]","[mev/c^2]","[mev/c2]","[mev/c**2]") unitScale = one - case("[gev]","[gev/c]","[gev/c^2]") + case("[gev]","[gev/c]","[gev/c^2]","[gev/c2]","[gev/c**2]") unitScale = c1e3 - case("[tev]","[tev/c]","[tev/c^2]") + case("[tev]","[tev/c]","[tev/c^2]","[tev/c2]","[tev/c**2]") unitScale = c1e6 case("[1]") unitScale = one @@ -586,11 +574,11 @@ subroutine dist_appendFormat(fmtID, colScale, partCol) case(1) write(lerr,"(a)") "DIST> Choose one of: X, XN, JX" case(2) - write(lerr,"(a)") "DIST> Choose one of: PX, PX/P0, PXN. PHIX" + write(lerr,"(a)") "DIST> Choose one of: XP, PX, PX/P0, PXN, PHIX" case(3) write(lerr,"(a)") "DIST> Choose one of: Y, YN, JY" case(4) - write(lerr,"(a)") "DIST> Choose one of: PY, PY/P0, PYN. PHIY" + write(lerr,"(a)") "DIST> Choose one of: YP, PY, PY/P0, PYN, PHIY" case(5) write(lerr,"(a)") "DIST> Choose one of: SIGMA, ZETA, DT, ZN, JZ" case(6) @@ -777,17 +765,14 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtE, dist_fmtDEE0, dist_fmtPT) call chr_cast(inVal, dist_partCol6(partNo), sErr) dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) - dist_updtEFrom = 1 case(dist_fmtP) call chr_cast(inVal, dist_partCol6(partNo), sErr) dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) - dist_updtEFrom = 2 case(dist_fmtDPP0, dist_fmtPZN, dist_fmtPhiZ) call chr_cast(inVal, dist_partCol6(partNo), sErr) dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) - dist_updtEFrom = 3 ! Ion Columns ! ============= @@ -974,11 +959,11 @@ subroutine dist_finaliseDist end if pstop(1:napx) = .false. - ejf0v(1:napx) = ejfv(1:napx) +! ejf0v(1:napx) = ejfv(1:napx) mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) ! If we have no energy arrays, we set all energies from deltaP = 0, that is reference momentum/energy - call part_updatePartEnergy(dist_updtEFrom,.false.) + call part_updatePartEnergy(3,.false.) if(dist_readIonA .and. dist_readIonZ .and. .not. dist_readPDGID) then do j=1,napx From 0297af1243a6039d8aec6b4812a8ed280c19c747 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 11 Jul 2019 13:36:40 +0200 Subject: [PATCH 24/38] Added DISTlib to build system --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b962b3946..ba951a467 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,8 @@ option(TILT "Allow elements to be tilted (by error)" ON) option(CRLIBM "Use correctly rounded libmath instead of system libmath" ON) option(SIXDA "Build differential algebra version (NOT dynamic aperture!)" ON) option(STF "Single Track File: Write all tracks for postprocessing to fort.90 instead of 32 separate files fort.59 to fort.90. Required for >64 particles" ON) -option(NAFF "Link to external NAFFlib for FMA." ON) +option(NAFF "Link to external NAFFlib for FMA" ON) +option(DISTLIB "Link to external DISTlib for the beam distribution" ON) option(HASHLIB "Build the md5 hash library" ON) option(ZLIB "Build and link zlib. Needed for BOINC and ZIPF block" ON) @@ -277,7 +278,7 @@ set(SIXTRACK_BINARY_NAME_DA "SixDA_${NUM_VERSION}${GIT_BUILD}_${SIXTRACK_FEAT_DA ################################################################################################### list(APPEND PREPRO_FLAGS_TOOLS TILT BOINC BEAMGAS STF MERLINSCATTER G4COLLIMATION FLUKA CR PYTHIA NAFF) -list(APPEND PREPRO_FLAGS_LIB CRLIBM ROUND_NEAR ROUND_UP ROUND_DOWN ROUND_ZERO CERNLIB HDF5 FIO LIBARCHIVE ROOT HASHLIB ZLIB) +list(APPEND PREPRO_FLAGS_LIB CRLIBM ROUND_NEAR ROUND_UP ROUND_DOWN ROUND_ZERO CERNLIB HDF5 FIO LIBARCHIVE ROOT HASHLIB ZLIB DISTLIB) list(APPEND PREPRO_FLAGS_COMPILE GFORTRAN IFORT NAGFOR WIN32 DEBUG MEMUSAGE) ################################################################################################### @@ -908,8 +909,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") endif() -#AppleClang -#Copied from GNU for now +# AppleClang if(${CMAKE_C_COMPILER_ID} MATCHES "AppleClang") if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 ) @@ -968,7 +968,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g") if(LTO) -# set(CMAKE_CXX_LINK_EXECUTABLE "") + # set(CMAKE_CXX_LINK_EXECUTABLE "") set(CMAKE_Fortran_CXX_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -Wl,-flto") endif(LTO) @@ -1231,6 +1231,44 @@ if(MERLINSCATTER) endif(64BIT) endif() +# Build DISTlib +if(DISTLIB) + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/DISTlib/source/distinterface.c) + if(GIT_FOUND) + message(STATUS "Checking out DISTlib submodule") + execute_process( + COMMAND ${GIT_EXECUTABLE} submodule update --init lib/DISTlib + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT + ERROR_QUIET + ) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init lib/DISTlib failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + else() + message(FATAL_ERROR "The git submodules DISTlib is not available. Please download it into lib/DISTlib") + endif() + endif() + + file(GLOB DIST_SOURCES ${CMAKE_SOURCE_DIR}/lib/DISTlib/source/*.c) + add_library(distlib STATIC ${DIST_SOURCES}) + target_include_directories(distlib PRIVATE ${CMAKE_SOURCE_DIR}/lib/DISTlib/source) + if(CRLIBM) + target_include_directories(distlib PRIVATE ${CMAKE_SOURCE_DIR}/source/crlibm) + target_include_directories(distlib PRIVATE ${CMAKE_SOURCE_DIR}/source/roundctl) + target_compile_options(distlib PRIVATE -DCRLIBM) + target_link_libraries(distlib crlibm) + endif() + + if(32BIT) + set_target_properties(distlib PROPERTIES LINK_FLAGS "-m32") + endif(32BIT) + if(64BIT) + set_target_properties(distlib PROPERTIES LINK_FLAGS "-m64") + endif(64BIT) + +endif(DISTLIB) + # Build NAFFlib if(NAFF) if(NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/NAFFlib/NAFFlib/interface/naff_sixtrack_interface.c) @@ -1484,6 +1522,10 @@ if(NAFF) target_link_libraries(SixTrackCore naff) endif(NAFF) +if(DISTLIB) + target_link_libraries(SixTrackCore distlib) +endif(DISTLIB) + #if we are using root, link to all the root libraries if(ROOT) target_link_libraries(SixTrackCore root_output) From b0c22a61587d10ba6beeb5f14bf88d4b37081e0f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Thu, 11 Jul 2019 16:07:28 +0200 Subject: [PATCH 25/38] Finished the DISTlib interface. Not tested the new features. --- CMakeLists.txt | 2 +- source/mod_dist.f90 | 210 ++++++++++++++++++++++++++++++++++------ test/thin6d_ions/fort.3 | 1 - 3 files changed, 182 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba951a467..f18033648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1257,7 +1257,7 @@ if(DISTLIB) target_include_directories(distlib PRIVATE ${CMAKE_SOURCE_DIR}/source/crlibm) target_include_directories(distlib PRIVATE ${CMAKE_SOURCE_DIR}/source/roundctl) target_compile_options(distlib PRIVATE -DCRLIBM) - target_link_libraries(distlib crlibm) + target_link_libraries(distlib crlibm roundctl) endif() if(32BIT) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index de90e5815..03286310f 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -15,15 +15,18 @@ module mod_dist use crcoall use floatPrecision use parpro, only : mFileName + use numerical_constants, only : zero implicit none - logical, public, save :: dist_enable = .false. ! DIST input block given - logical, private, save :: dist_echo = .false. ! Echo the read distribution? - logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not - logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader - character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution - character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution + logical, public, save :: dist_enable = .false. ! DIST input block given + logical, private, save :: dist_echo = .false. ! Echo the read distribution? + logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not + logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader + logical, private, save :: dist_distLib = .false. ! DISTlib is needed to generate the distribution requested + character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution + character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution + real(kind=fPrec), public, save :: dist_beamEmit(3) = zero ! Beam emittance for generator and normalisation integer, allocatable, private, save :: dist_colFormat(:) ! The column types in the FORMAT real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the columns @@ -87,7 +90,7 @@ module mod_dist logical, private, save :: dist_readCharge = .false. logical, private, save :: dist_readPDGID = .false. - ! Arrays to send to DISTlib + ! Temporary particle arrays real(kind=fPrec), allocatable, private, save :: dist_partCol1(:) ! Ends up in array xv1 real(kind=fPrec), allocatable, private, save :: dist_partCol2(:) ! Ends up in array yv1 real(kind=fPrec), allocatable, private, save :: dist_partCol3(:) ! Ends up in array xv2 @@ -96,6 +99,67 @@ module mod_dist real(kind=fPrec), allocatable, private, save :: dist_partCol6(:) ! Ends up in array dpsv, evj, and ejfv integer, private, save :: dist_partFmt(6) = dist_fmtNONE ! The format used for each column +#ifdef DISTLIB + interface + + subroutine distlib_init(numDist) bind(C, name="initializedistribution") + use, intrinsic :: iso_c_binding + integer(kind=C_INT), value, intent(in) :: numDist + end subroutine distlib_init + + subroutine distlib_readFile(fileName, strLen) bind(C, name="readfile_f") + use, intrinsic :: iso_c_binding + character(kind=C_CHAR,len=1), intent(in) :: fileName + integer(kind=C_INT), value, intent(in) :: strLen + end subroutine distlib_readFile + + subroutine distlib_setEnergyMass(energy0, mass0) bind(C, name="sete0andmass0") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), value, intent(in) :: energy0 + real(kind=C_DOUBLE), value, intent(in) :: mass0 + end subroutine distlib_setEnergyMass + + subroutine distlib_setEmittance12(emit1, emit2) bind(C, name="setemitt12") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), value, intent(in) :: emit1 + real(kind=C_DOUBLE), value, intent(in) :: emit2 + end subroutine distlib_setEmittance12 + + subroutine distlib_setEmittance3(emit3) bind(C, name="setemitt3") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), value, intent(in) :: emit3 + end subroutine distlib_setEmittance3 + + subroutine distlib_setTasMatrix(flatTas) bind(C, name="settasmatrix") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), dimension(36), intent(in) :: flatTas + end subroutine distlib_setTasMatrix + + subroutine distlib_setNormalised(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="setnormalizedcoords") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr1 + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr2 + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr3 + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr4 + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr5 + real(kind=C_DOUBLE), dimension(*), intent(in) :: arr6 + integer(kind=C_INT), intent(in) :: arrLen + end subroutine distlib_setNormalised + + subroutine distlib_getPartCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="get6trackcoord") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr1 + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr2 + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr3 + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr4 + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr5 + real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr6 + integer(kind=C_INT), intent(inout) :: arrLen + end subroutine distlib_getPartCoords + + end interface +#endif + contains ! ================================================================================================ ! @@ -111,8 +175,11 @@ subroutine dist_generateDist use mod_alloc use mod_common use mod_particles + use mod_common_main use numerical_constants + integer distLibPart + call alloc(dist_partCol1, napx, zero, "dist_partCol1") call alloc(dist_partCol2, napx, zero, "dist_partCol2") call alloc(dist_partCol3, napx, zero, "dist_partCol3") @@ -120,22 +187,64 @@ subroutine dist_generateDist call alloc(dist_partCol5, napx, zero, "dist_partCol5") call alloc(dist_partCol6, napx, zero, "dist_partCol6") - if(dist_nParticle > 0) then - call dist_parseParticles +#ifdef DISTLIB + if(dist_distLib) then + call distlib_init(1) + call distlib_setEnergyMass(e0, nucm0) + call distlib_setEmittance12(dist_beamEmit(1), dist_beamEmit(2)) + call distlib_setEmittance3(dist_beamEmit(3)) + block + real(kind=fPrec) tmpTas(6,6), flatTas(36) + tmpTas(1:6,1:6) = tas(1:6,1:6) + tmpTas(1:5,6) = tmpTas(1:5,6)*c1m3 + tmpTas(6,1:5) = tmpTas(6,1:5)*c1e3 + flatTas = pack(transpose(tmpTas),.true.) + call distlib_setTasMatrix(flatTas) + end block end if +#endif - if(dist_distFile /= " ") then - call dist_readDist + if(dist_nParticle > 0) then + ! Particles are read from DIST block in fort.3 + call dist_parseParticles + call dist_postprParticles + elseif(dist_distFile /= " ") then + if(dist_distLib) then + ! Particles are read entirely in DISTlib +#ifdef DISTLIB + call distlib_readFile(trim(dist_distFile), len_trim(dist_distFile)) +#endif + else + call dist_readDist + call dist_postprParticles + end if end if - if(dist_numPart /= napx) then - write(lerr,"(2(a,i0),a)") "DIST> ERROR Number of particles read or generated is ",dist_numPart,& - " but the simulation setup requests ",napx," particles" - call prror +#ifdef DISTLIB + if(dist_distLib) then + ! Our final coordinates are taken from DISTlib + distLibPart = napx + call distlib_getPartCoords( & + dist_partCol1, dist_partCol2, dist_partCol3, & + dist_partCol4, dist_partCol5, dist_partCol6, & + distLibPart & + ) + if(distLibPart == napx) then + xv1(1:napx) = dist_partCol1(1:napx) + yv1(1:napx) = dist_partCol2(1:napx) + xv2(1:napx) = dist_partCol3(1:napx) + yv2(1:napx) = dist_partCol4(1:napx) + sigmv(1:napx) = dist_partCol5(1:napx) + dpsv(1:napx) = dist_partCol6(1:napx) + call part_updatePartEnergy(3,.false.) + else + write(lerr,"(2(a,i0))") "DIST> ERROR DISTlib returned ",distLibPart," particles, while SixTrack expected ",napx + call prror + end if end if +#endif if(dist_numPart > 0) then - call dist_postprParticles call dist_finaliseDist call part_applyClosedOrbit if(dist_echo) then @@ -209,9 +318,8 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end if dist_distFile = trim(lnSplit(2)) if(nSplit > 2) call chr_cast(lnSplit(3), dist_libRead, cErr) - if(cErr) then - iErr = .true. - return + if(dist_libRead) then + dist_distLib = .true. end if case("PARTICLE") @@ -243,8 +351,24 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) iErr = .true. return + case("EMIT","EMITTANCE") + if(nSplit /= 3 .and. nSplit /= 4) then + write(lerr,"(a,i0)") "DIST> ERROR EMITTANCE takes 2 or 3 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> EMITTANCE emit1 emit2 [emit3]" + iErr = .true. + return + end if + if(nSplit > 1) call chr_cast(lnSplit(2), dist_beamEmit(1), cErr) + if(nSplit > 2) call chr_cast(lnSplit(3), dist_beamEmit(2), cErr) + if(nSplit > 3) call chr_cast(lnSplit(4), dist_beamEmit(3), cErr) + end select + if(cErr) then + iErr = .true. + return + end if + end subroutine dist_parseInputLine ! ================================================================================================ ! @@ -352,32 +476,44 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("XN") call dist_appendFormat(dist_fmtXN, one, 1) + dist_distLib = .true. case("YN") call dist_appendFormat(dist_fmtYN, one, 3) + dist_distLib = .true. case("ZN") call dist_appendFormat(dist_fmtZN, one, 5) + dist_distLib = .true. case("PXN") call dist_appendFormat(dist_fmtPXN, one, 2) + dist_distLib = .true. case("PYN") call dist_appendFormat(dist_fmtPYN, one, 4) + dist_distLib = .true. case("PZN") call dist_appendFormat(dist_fmtPZN, one, 6) + dist_distLib = .true. case("JX") call dist_appendFormat(dist_fmtJX, one, 1) + dist_distLib = .true. case("JY") call dist_appendFormat(dist_fmtJY, one, 3) + dist_distLib = .true. case("JZ") call dist_appendFormat(dist_fmtJZ, one, 5) + dist_distLib = .true. case("PHIX") call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) call dist_appendFormat(dist_fmtPhiX, uFac, 2) + dist_distLib = .true. case("PHIY") call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) call dist_appendFormat(dist_fmtPhiY, uFac, 4) + dist_distLib = .true. case("PHIZ") call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) call dist_appendFormat(dist_fmtPhiZ, uFac, 6) + dist_distLib = .true. case("MASS","M") call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) @@ -412,6 +548,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPYN, one, 4) call dist_appendFormat(dist_fmtZN, one, 5) call dist_appendFormat(dist_fmtPZN, one, 6) + dist_distLib = .true. case("ACTION") ! 6D action call dist_appendFormat(dist_fmtJX, one, 1) @@ -420,6 +557,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPhiY, one, 4) call dist_appendFormat(dist_fmtJZ, one, 5) call dist_appendFormat(dist_fmtPhiZ, one, 6) + dist_distLib = .true. case("IONS") ! The ion columns call dist_appendFormat(dist_fmtMASS, c1e3, 0) @@ -450,9 +588,18 @@ subroutine dist_setColumnFormat(fmtName, fErr) case default write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" fErr = .true. + return end select +#ifndef DISTLIB + if(dist_distLib) then + write(lerr,"(a)") "DIST> ERROR Format '"//trim(fmtName)//"' requires SixTrack to be built with DISTLIB enabled" + fErr = .true. + return + end if +#endif + end subroutine dist_setColumnFormat ! ================================================================================================ ! @@ -914,20 +1061,25 @@ subroutine dist_postprParticles doAction = .true. end select +#ifdef DISTLIB if(doNormal .and. doAction) then write(lerr,"(a)") "DIST> ERROR Cannot mix normalised and action coordinates" call prror end if if(doNormal) then - ! Call DISTlib - continue + call distlib_setNormalised( & + dist_partCol1, dist_partCol2, dist_partCol3, & + dist_partCol4, dist_partCol5, dist_partCol6, & + napx & + ) end if if(doAction) then ! Call DISTlib continue end if +#endif end subroutine dist_postprParticles @@ -941,7 +1093,6 @@ subroutine dist_finaliseDist use parpro use mod_pdgid use mod_common - use mod_particles use mod_common_main use mod_common_track use numerical_constants @@ -949,6 +1100,13 @@ subroutine dist_finaliseDist real(kind=fPrec) chkP, chkE integer j + ! Finish the ION bits + if(dist_numPart /= napx) then + write(lerr,"(2(a,i0),a)") "DIST> ERROR Number of particles read or generated is ",dist_numPart,& + " but the simulation setup requests ",napx," particles" + call prror + end if + if(dist_readIonA .neqv. dist_readIonZ) then write(lerr,"(a)") "DIST> ERROR ION_A and ION_Z columns have to both be present if one of them is" call prror @@ -957,13 +1115,7 @@ subroutine dist_finaliseDist if(dist_readIonZ .and. .not. dist_readCharge) then nqq(1:napx) = nzz(1:napx) end if - - pstop(1:napx) = .false. -! ejf0v(1:napx) = ejfv(1:napx) - mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) - - ! If we have no energy arrays, we set all energies from deltaP = 0, that is reference momentum/energy - call part_updatePartEnergy(3,.false.) + mtc(1:napx) = (nqq(1:napx)*nucm0)/(qq0*nucm(1:napx)) if(dist_readIonA .and. dist_readIonZ .and. .not. dist_readPDGID) then do j=1,napx diff --git a/test/thin6d_ions/fort.3 b/test/thin6d_ions/fort.3 index 06d1996bc..102f5b003 100644 --- a/test/thin6d_ions/fort.3 +++ b/test/thin6d_ions/fort.3 @@ -75,7 +75,6 @@ HION 208 82 1.93687690162648124E+02 82 NEXT DIST -! FORMAT ID none none x[m] y[m] none xp[rad] yp[rad] none ion_a ion_z mass[GeV] P[GeV] dT[s] READ initial.dat NEXT ENDE==================================================================== From 556f299f8bdc50d0308455cf38ab67e93809f55f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 13 Jul 2019 14:45:43 +0200 Subject: [PATCH 26/38] The array DIST particle array conversion should now be correct (I hope) --- source/mod_dist.f90 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 03286310f..8efd158ad 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -469,7 +469,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtP, uFac, 6) case("DE/E0","DEE0") call dist_appendFormat(dist_fmtDEE0, one, 6) - case("DP/P0","DPP0") + case("DP/P0","DPP0","DELTA") call dist_appendFormat(dist_fmtDPP0, one, 6) case("DE/P0","DEP0","PT") call dist_appendFormat(dist_fmtPT, one, 6) @@ -965,28 +965,32 @@ subroutine dist_postprParticles use numerical_constants logical doAction, doNormal + real(kind=fPrec) beta0 doAction = .false. doNormal = .false. + beta0 = e0f/e0 + + ! Forward energy/momentum must be calculated first select case(dist_partFmt(6)) case(dist_fmtNONE) - ejv(1:napx) = e0 + ejv(1:napx) = e0 call part_updatePartEnergy(1,.false.) case(dist_fmtE) - ejv(1:napx) = dist_partCol6(1:napx) + ejv(1:napx) = dist_partCol6(1:napx) call part_updatePartEnergy(1,.false.) case(dist_fmtP) ejfv(1:napx) = dist_partCol6(1:napx) call part_updatePartEnergy(2,.false.) case(dist_fmtDEE0) - ejv(1:napx) = (one + dist_partCol6(1:napx))*e0 + ejv(1:napx) = (one + dist_partCol6(1:napx))*e0 call part_updatePartEnergy(1,.false.) case(dist_fmtDPP0) - dpsv(1:napx) = dist_partCol6(1:napx)*c1e3 + dpsv(1:napx) = dist_partCol6(1:napx) call part_updatePartEnergy(3,.false.) case(dist_fmtPT) - ejv(1:napx) = e0 + dist_partCol6(1:napx)*e0f + ejv(1:napx) = (dist_partCol6(1:napx)*e0f)*beta0 + e0 call part_updatePartEnergy(1,.false.) case(dist_fmtPZN) doNormal = .true. @@ -998,11 +1002,11 @@ subroutine dist_postprParticles case(dist_fmtNONE) sigmv(1:napx) = zero case(dist_fmtZETA) - sigmv(1:napx) = dist_partCol5(1:napx)*rvv(1:napx) + sigmv(1:napx) = dist_partCol5(1:napx)/rvv(1:napx) case(dist_fmtSIGMA) sigmv(1:napx) = dist_partCol5(1:napx) case(dist_fmtDT) - sigmv(1:napx) = -(e0f/e0)*(dist_partCol5(1:napx)*clight) + sigmv(1:napx) = -beta0*(dist_partCol5(1:napx)*clight) case(dist_fmtZN) doNormal = .true. case(dist_fmtJZ) @@ -1028,7 +1032,7 @@ subroutine dist_postprParticles case(dist_fmtPX) yv1(1:napx) = (dist_partCol2(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtPXP0) - yv1(1:napx) = (dist_partCol2(1:napx)/e0f)*c1e3 + yv1(1:napx) = ((dist_partCol2(1:napx)*e0f)/ejfv(1:napx))*c1e3 case(dist_fmtPXN) doNormal = .true. case(dist_fmtPhiX) @@ -1054,7 +1058,7 @@ subroutine dist_postprParticles case(dist_fmtPY) yv2(1:napx) = (dist_partCol4(1:napx)/ejfv(1:napx))*c1e3 case(dist_fmtPYP0) - yv2(1:napx) = (dist_partCol4(1:napx)/e0f)*c1e3 + yv2(1:napx) = ((dist_partCol4(1:napx)*e0f)/ejfv(1:napx))*c1e3 case(dist_fmtPYN) doNormal = .true. case(dist_fmtPhiY) From 33b9f94b391ef5586729b685f7a4d923f4f40ede Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 13 Jul 2019 14:53:12 +0200 Subject: [PATCH 27/38] Added the spin columns to DIST --- source/mod_dist.f90 | 71 +++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 8efd158ad..e16f42655 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -5,7 +5,7 @@ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS -! Updated: 2019-07-11 +! Updated: 2019-07-12 ! ! This module was completely rewritten to support DISTlib in July 2019 ! @@ -62,26 +62,31 @@ module mod_dist integer, parameter :: dist_fmtPT = 26 ! Delta energy over reference momentum (Pt) ! Normalised Coordinates - integer, parameter :: dist_fmtXN = 31 ! Normalised horizontal position - integer, parameter :: dist_fmtYN = 32 ! Normalised vertical position - integer, parameter :: dist_fmtZN = 33 ! Normalised longitudinal position - integer, parameter :: dist_fmtPXN = 34 ! Normalised horizontal momentum - integer, parameter :: dist_fmtPYN = 35 ! Normalised vertical momentum - integer, parameter :: dist_fmtPZN = 36 ! Normalised longitudinal momentum - - integer, parameter :: dist_fmtJX = 41 ! Horizontal action - integer, parameter :: dist_fmtJY = 42 ! Vertical action - integer, parameter :: dist_fmtJZ = 43 ! Longitudinal action - integer, parameter :: dist_fmtPhiX = 44 ! Horizontal action angle - integer, parameter :: dist_fmtPhiY = 45 ! Vertical action angle - integer, parameter :: dist_fmtPhiZ = 46 ! Longitudinal action angle + integer, parameter :: dist_fmtXN = 41 ! Normalised horizontal position + integer, parameter :: dist_fmtYN = 42 ! Normalised vertical position + integer, parameter :: dist_fmtZN = 43 ! Normalised longitudinal position + integer, parameter :: dist_fmtPXN = 44 ! Normalised horizontal momentum + integer, parameter :: dist_fmtPYN = 45 ! Normalised vertical momentum + integer, parameter :: dist_fmtPZN = 46 ! Normalised longitudinal momentum + + integer, parameter :: dist_fmtJX = 51 ! Horizontal action + integer, parameter :: dist_fmtJY = 52 ! Vertical action + integer, parameter :: dist_fmtJZ = 53 ! Longitudinal action + integer, parameter :: dist_fmtPhiX = 54 ! Horizontal action angle + integer, parameter :: dist_fmtPhiY = 55 ! Vertical action angle + integer, parameter :: dist_fmtPhiZ = 56 ! Longitudinal action angle ! Ion Columns - integer, parameter :: dist_fmtMASS = 51 ! Particle mass - integer, parameter :: dist_fmtCHARGE = 52 ! Particle Charge - integer, parameter :: dist_fmtIonA = 53 ! Ion atomic mass - integer, parameter :: dist_fmtIonZ = 54 ! Ion atomic number - integer, parameter :: dist_fmtPDGID = 55 ! Particle PDG ID + integer, parameter :: dist_fmtMASS = 61 ! Particle mass + integer, parameter :: dist_fmtCHARGE = 62 ! Particle Charge + integer, parameter :: dist_fmtIonA = 63 ! Ion atomic mass + integer, parameter :: dist_fmtIonZ = 64 ! Ion atomic number + integer, parameter :: dist_fmtPDGID = 65 ! Particle PDG ID + + ! Spin + integer, parameter :: dist_fmtSPINX = 71 ! Spin vector x component + integer, parameter :: dist_fmtSPINY = 72 ! Spin vector y component + integer, parameter :: dist_fmtSPINZ = 73 ! Spin vector z component ! Flags for columns we've set that we need to track for later checks logical, private, save :: dist_readMass = .false. @@ -527,6 +532,13 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("PDGID") call dist_appendFormat(dist_fmtPDGID, one, 0) + case("SX") + call dist_appendFormat(dist_fmtSPINX, one, 0) + case("SY") + call dist_appendFormat(dist_fmtSPINY, one, 0) + case("SZ") + call dist_appendFormat(dist_fmtSPINZ, one, 0) + case("4D") ! 4D default coordinates call dist_appendFormat(dist_fmtX, one, 1) call dist_appendFormat(dist_fmtPX, one, 2) @@ -566,6 +578,11 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtIonZ, one, 0) call dist_appendFormat(dist_fmtPDGID, one, 0) + case("SPIN") ! The spin columns + call dist_appendFormat(dist_fmtSPINX, one, 0) + call dist_appendFormat(dist_fmtSPINY, one, 0) + call dist_appendFormat(dist_fmtSPINZ, one, 0) + case("OLD_DIST") ! The old DIST block file format ! This is added for the block to be compatible with the old, fixed column DIST file format. ! The scaling is hardcoded, and the file format has a few columns that are not used. @@ -856,7 +873,7 @@ end subroutine dist_readDist ! Save Particle Data to Arrays ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-08 -! Updated: 2019-07-09 +! Updated: 2019-07-13 ! ================================================================================================ ! subroutine dist_saveParticle(partNo, colNo, inVal, sErr) @@ -945,6 +962,18 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) call chr_cast(inVal, pdgid(partNo), sErr) dist_readPDGID = .true. + ! Spin Columns + ! ============== + + case(dist_fmtSPINX) + call chr_cast(inVal, spin_x(partNo), sErr) + + case(dist_fmtSPINY) + call chr_cast(inVal, spin_y(partNo), sErr) + + case(dist_fmtSPINZ) + call chr_cast(inVal, spin_z(partNo), sErr) + end select end subroutine dist_saveParticle @@ -953,7 +982,7 @@ end subroutine dist_saveParticle ! Post-Processing of Particle Arrays ! V.K. Berglyd Olsen, BE-ABP-HSS ! Created: 2019-07-05 -! Updated: 2019-07-09 +! Updated: 2019-07-13 ! ================================================================================================ ! subroutine dist_postprParticles From 93ad2f069217b4e3eb87b55271c15b5200dc0590 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 16 Jul 2019 14:03:40 +0200 Subject: [PATCH 28/38] Updated the interface to DISTlib. Now supports normalised and action dist from file. --- lib/DISTlib | 2 +- source/mod_dist.f90 | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/DISTlib b/lib/DISTlib index 61ad79130..e3bf9137c 160000 --- a/lib/DISTlib +++ b/lib/DISTlib @@ -1 +1 @@ -Subproject commit 61ad79130391b9a8a1208c9509f52a21c1be648e +Subproject commit e3bf9137cbf65f5eac4628c2d4f207d43fc71afb diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index e16f42655..6720af884 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -105,6 +105,15 @@ module mod_dist integer, private, save :: dist_partFmt(6) = dist_fmtNONE ! The format used for each column #ifdef DISTLIB + + ! Coordiante Types + ! Keep in sync with lib/DISTlib/distinterface.c + integer, parameter :: dist_coordTypeAction = 0 + integer, parameter :: dist_coordTypeNormal = 1 + integer, parameter :: dist_coordTypePhysical = 2 + integer, parameter :: dist_coordTypeMixed = 3 + + ! C interface interface subroutine distlib_init(numDist) bind(C, name="initializedistribution") @@ -140,7 +149,7 @@ subroutine distlib_setTasMatrix(flatTas) bind(C, name="settasmatrix") real(kind=C_DOUBLE), dimension(36), intent(in) :: flatTas end subroutine distlib_setTasMatrix - subroutine distlib_setNormalised(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="setnormalizedcoords") + subroutine distlib_setCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen, cType) bind(C, name="setcoords") use, intrinsic :: iso_c_binding real(kind=C_DOUBLE), dimension(*), intent(in) :: arr1 real(kind=C_DOUBLE), dimension(*), intent(in) :: arr2 @@ -149,9 +158,10 @@ subroutine distlib_setNormalised(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bin real(kind=C_DOUBLE), dimension(*), intent(in) :: arr5 real(kind=C_DOUBLE), dimension(*), intent(in) :: arr6 integer(kind=C_INT), intent(in) :: arrLen - end subroutine distlib_setNormalised + integer(kind=C_INT), intent(in) :: cType + end subroutine distlib_setCoords - subroutine distlib_getPartCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="get6trackcoord") + subroutine distlib_getCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="get6trackcoord") use, intrinsic :: iso_c_binding real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr1 real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr2 @@ -160,7 +170,7 @@ subroutine distlib_getPartCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bin real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr5 real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr6 integer(kind=C_INT), intent(inout) :: arrLen - end subroutine distlib_getPartCoords + end subroutine distlib_getCoords end interface #endif @@ -229,7 +239,7 @@ subroutine dist_generateDist if(dist_distLib) then ! Our final coordinates are taken from DISTlib distLibPart = napx - call distlib_getPartCoords( & + call distlib_getCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & distLibPart & @@ -1101,16 +1111,19 @@ subroutine dist_postprParticles end if if(doNormal) then - call distlib_setNormalised( & + call distlib_setCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & - napx & + napx, dist_coordTypeNormal & ) end if if(doAction) then - ! Call DISTlib - continue + call distlib_setCoords( & + dist_partCol1, dist_partCol2, dist_partCol3, & + dist_partCol4, dist_partCol5, dist_partCol6, & + napx, dist_coordTypeAction & + ) end if #endif From a6a28fec34054598f4b9e4fca9cba2072758e78e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 30 Jul 2019 09:35:12 +0200 Subject: [PATCH 29/38] Added psigma as input column for DIST and made beta0 and gamma0 global variables, replacing old betrel --- source/cheby.f90 | 6 +++--- source/checkpoint_restart.f90 | 8 ++++---- source/common_modules.f90 | 5 +++-- source/elens.f90 | 6 +++--- source/include/kickelens.f90 | 4 ++-- source/mod_dist.f90 | 35 +++++++++++++++-------------------- source/mod_particles.f90 | 3 ++- source/sixtrack.f90 | 9 +++++---- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/source/cheby.f90 b/source/cheby.f90 index 4fa6781ea..7aac5b9f2 100644 --- a/source/cheby.f90 +++ b/source/cheby.f90 @@ -602,7 +602,7 @@ subroutine cheby_kick(i,ix,n) ! last modified: 01-03-2019 ! apply kick of Chebyshev lenses - use mod_common, only : betrel, napx, brho + use mod_common, only : beta0, napx, brho use mod_common_main use mathlib_bouncer use numerical_constants, only : zero, c180e0, pi @@ -650,8 +650,8 @@ subroutine cheby_kick(i,ix,n) ! take into account scaling factor, Brho of beam and its relativistic beta, ! and magnetic rigidity and relativistic beta of particle being tracked - dxp=(((dxp*cheby_scalingFact(icheby(ix)))/(brho*(clight*betrel)))*moidpsv(jj))*rvv(jj) - dyp=(((dyp*cheby_scalingFact(icheby(ix)))/(brho*(clight*betrel)))*moidpsv(jj))*rvv(jj) + dxp=(((dxp*cheby_scalingFact(icheby(ix)))/(brho*(clight*beta0)))*moidpsv(jj))*rvv(jj) + dyp=(((dyp*cheby_scalingFact(icheby(ix)))/(brho*(clight*beta0)))*moidpsv(jj))*rvv(jj) ! apply kicks yv1(jj)=yv1(jj)+dxp diff --git a/source/checkpoint_restart.f90 b/source/checkpoint_restart.f90 index 5d663667a..76d0cdcc5 100644 --- a/source/checkpoint_restart.f90 +++ b/source/checkpoint_restart.f90 @@ -44,7 +44,7 @@ module checkpoint_restart ! C/R Temp Variables and Arrays real(kind=fPrec), private, save :: cre0 - real(kind=fPrec), private, save :: crbetrel + real(kind=fPrec), private, save :: crbeta0 real(kind=fPrec), private, save :: crbrho real(kind=fPrec), private, save :: crnucmda @@ -392,7 +392,7 @@ subroutine crcheck write(crlog,"(a)") "CR_CHECK> * Tracking variables" flush(crlog) read(cr_pntUnit(nPoint),iostat=ioStat) crnumlcr,crnuml,crsixrecs,crbinrec,cril,cr_time,crnapxo, & - crnapx,cre0,crbetrel,crbrho,crnucmda + crnapx,cre0,crbeta0,crbrho,crnucmda if(ioStat /= 0) cycle write(crlog,"(a)") "CR_CHECK> * Particle arrays" @@ -634,7 +634,7 @@ subroutine crpoint write(crlog,"(a)") "CR_POINT> * Tracking variables" flush(crlog) end if - write(cr_pntUnit(nPoint),err=100) crnumlcr,numl,sixrecs,binrec,il,time3,napxo,napx,e0,betrel,brho,nucmda + write(cr_pntUnit(nPoint),err=100) crnumlcr,numl,sixrecs,binrec,il,time3,napxo,napx,e0,beta0,brho,nucmda if(st_debug) then write(crlog,"(a)") "CR_POINT> * Particle arrays" @@ -781,7 +781,7 @@ subroutine crstart napx = crnapx e0 = cre0 e0f = sqrt(e0**2-nucm0**2) - betrel = crbetrel + beta0 = crbeta0 brho = crbrho nucmda = crnucmda diff --git a/source/common_modules.f90 b/source/common_modules.f90 index bd8c45ca2..21da258bd 100644 --- a/source/common_modules.f90 +++ b/source/common_modules.f90 @@ -325,8 +325,7 @@ module mod_common real(kind=fPrec), save :: emitx = zero ! Horisontal emittance real(kind=fPrec), save :: emity = zero ! Vertical emittance real(kind=fPrec), save :: emitz = zero ! Longitudinal emittance - real(kind=fPrec), save :: gammar = one ! Gamma factor - real(kind=fPrec), save :: betrel = zero ! Relativistic beta of beam + real(kind=fPrec), save :: gammar = one ! Inverse Lorentz factor real(kind=fPrec), save :: brho = zero ! magnetic rigitidy of beam [Tm] integer, save :: ibb6d = 0 ! 6D beam-beam switch integer, save :: nbeam = 0 ! Beam-beam elements flag @@ -353,6 +352,8 @@ module mod_common real(kind=fPrec), save :: e0f = zero ! Reference momentum [MeV/c] real(kind=fPrec), save :: nucm0 = pmap ! Reference mass [MeV/c^2] real(kind=fPrec), save :: nucmda = pmap ! Reference mass [MeV/c^2] (DA) + real(kind=fPrec), save :: gamma0 = one ! Reference beam Lorentz factor + real(kind=fPrec), save :: beta0 = zero ! Reference beam relativistic beta integer(kind=int16), save :: aa0 = 1 ! Reference nucleon number integer(kind=int16), save :: zz0 = 1 ! Reference charge multiplicity integer(kind=int16), save :: qq0 = 1 ! Reference charge diff --git a/source/elens.f90 b/source/elens.f90 index aa8155bc4..0b17c20cb 100644 --- a/source/elens.f90 +++ b/source/elens.f90 @@ -452,7 +452,7 @@ subroutine eLensTheta(j) use mathlib_bouncer use numerical_constants, only : zero, one, two, pi, c1e3, c1m3, c1m6 use physical_constants, only: clight, pmae, eps0 - use mod_common, only : e0, betrel, brho, bez, kz, zz0 + use mod_common, only : e0, beta0, brho, bez, kz, zz0 use mod_settings, only : st_quiet implicit none @@ -471,9 +471,9 @@ subroutine eLensTheta(j) elens_theta_r2(j) = ((elens_len(j)*abs(elens_I(j)))/ & ((((two*pi)*((eps0*clight)*clight))*brho)*(elens_r2(j)*c1m3)))*c1e3 if(elens_I(j) < zero) then - elens_theta_r2(j) = elens_theta_r2(j)*(one/(elens_beta_e(j)*betrel)+one) + elens_theta_r2(j) = elens_theta_r2(j)*(one/(elens_beta_e(j)*beta0)+one) else - elens_theta_r2(j) = elens_theta_r2(j)*(one/(elens_beta_e(j)*betrel)-one) + elens_theta_r2(j) = elens_theta_r2(j)*(one/(elens_beta_e(j)*beta0)-one) end if if ( elens_type(j)>=2 ) elens_theta_r2(j) = elens_theta_r2(j) * elens_geo_norm(j) diff --git a/source/include/kickelens.f90 b/source/include/kickelens.f90 index 93b7609e7..7d938820e 100644 --- a/source/include/kickelens.f90 +++ b/source/include/kickelens.f90 @@ -46,9 +46,9 @@ frrelens = (((elens_theta_r2(ielens(ix))*elens_r2(ielens(ix)))/rrelens)*frrelens)*moidpsv(j) if(elens_lThetaR2(ielens(ix))) then if(elens_I(ielens(ix)) < zero) then - frrelens = frrelens*((rvv(j)+elens_beta_e(ielens(ix))*betrel)/(one+elens_beta_e(ielens(ix))*betrel)) + frrelens = frrelens*((rvv(j)+elens_beta_e(ielens(ix))*beta0)/(one+elens_beta_e(ielens(ix))*beta0)) else - frrelens = frrelens*((rvv(j)-elens_beta_e(ielens(ix))*betrel)/(one-elens_beta_e(ielens(ix))*betrel)) + frrelens = frrelens*((rvv(j)-elens_beta_e(ielens(ix))*beta0)/(one-elens_beta_e(ielens(ix))*beta0)) end if endif yv1(j)=yv1(j)-(frrelens*xelens)/rrelens diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 6720af884..7fb3c025b 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -60,6 +60,7 @@ module mod_dist integer, parameter :: dist_fmtDEE0 = 24 ! Relative particle energy (to reference particle) integer, parameter :: dist_fmtDPP0 = 25 ! Relative particle momentum (to reference particle) integer, parameter :: dist_fmtPT = 26 ! Delta energy over reference momentum (Pt) + integer, parameter :: dist_fmtPSIGMA = 27 ! Delta energy over reference momentum, but without beta0 ! Normalised Coordinates integer, parameter :: dist_fmtXN = 41 ! Normalised horizontal position @@ -488,6 +489,8 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtDPP0, one, 6) case("DE/P0","DEP0","PT") call dist_appendFormat(dist_fmtPT, one, 6) + case("PSIGMA") + call dist_appendFormat(dist_fmtPSIGMA, one, 6) case("XN") call dist_appendFormat(dist_fmtXN, one, 1) @@ -746,17 +749,17 @@ subroutine dist_appendFormat(fmtID, colScale, partCol) write(lerr,"(a,i0)") "DIST> ERROR Multiple formats selected for particle coordinate ",partCol select case(partCol) case(1) - write(lerr,"(a)") "DIST> Choose one of: X, XN, JX" + write(lerr,"(a)") "DIST> Choose only one of: X, XN, JX" case(2) - write(lerr,"(a)") "DIST> Choose one of: XP, PX, PX/P0, PXN, PHIX" + write(lerr,"(a)") "DIST> Choose only one of: XP, PX, PX/P0, PXN, PHIX" case(3) - write(lerr,"(a)") "DIST> Choose one of: Y, YN, JY" + write(lerr,"(a)") "DIST> Choose only one of: Y, YN, JY" case(4) - write(lerr,"(a)") "DIST> Choose one of: YP, PY, PY/P0, PYN, PHIY" + write(lerr,"(a)") "DIST> Choose only one of: YP, PY, PY/P0, PYN, PHIY" case(5) - write(lerr,"(a)") "DIST> Choose one of: SIGMA, ZETA, DT, ZN, JZ" + write(lerr,"(a)") "DIST> Choose only one of: SIGMA, ZETA, DT, ZN, JZ" case(6) - write(lerr,"(a)") "DIST> Choose one of: E, P, DE/E0, DP/P0, PT, PZN, PHIZ" + write(lerr,"(a)") "DIST> Choose only one of: E, P, DE/E0, DP/P0, PT, PZN, PHIZ, PSIGMA" end select call prror end if @@ -936,15 +939,7 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) call chr_cast(inVal, dist_partCol5(partNo), sErr) dist_partCol5(partNo) = dist_partCol5(partNo) * dist_colScale(colNo) - case(dist_fmtE, dist_fmtDEE0, dist_fmtPT) - call chr_cast(inVal, dist_partCol6(partNo), sErr) - dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) - - case(dist_fmtP) - call chr_cast(inVal, dist_partCol6(partNo), sErr) - dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) - - case(dist_fmtDPP0, dist_fmtPZN, dist_fmtPhiZ) + case(dist_fmtE, dist_fmtDEE0, dist_fmtPT, dist_fmtPSIGMA, dist_fmtP, dist_fmtDPP0, dist_fmtPZN, dist_fmtPhiZ) call chr_cast(inVal, dist_partCol6(partNo), sErr) dist_partCol6(partNo) = dist_partCol6(partNo) * dist_colScale(colNo) @@ -1004,13 +999,10 @@ subroutine dist_postprParticles use numerical_constants logical doAction, doNormal - real(kind=fPrec) beta0 doAction = .false. doNormal = .false. - beta0 = e0f/e0 - ! Forward energy/momentum must be calculated first select case(dist_partFmt(6)) case(dist_fmtNONE) @@ -1029,6 +1021,9 @@ subroutine dist_postprParticles dpsv(1:napx) = dist_partCol6(1:napx) call part_updatePartEnergy(3,.false.) case(dist_fmtPT) + ejv(1:napx) = dist_partCol6(1:napx)*e0f + e0 + call part_updatePartEnergy(1,.false.) + case(dist_fmtPSIGMA) ejv(1:napx) = (dist_partCol6(1:napx)*e0f)*beta0 + e0 call part_updatePartEnergy(1,.false.) case(dist_fmtPZN) @@ -1111,7 +1106,7 @@ subroutine dist_postprParticles end if if(doNormal) then - call distlib_setCoords( & + call distlib_setCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & napx, dist_coordTypeNormal & @@ -1119,7 +1114,7 @@ subroutine dist_postprParticles end if if(doAction) then - call distlib_setCoords( & + call distlib_setCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & napx, dist_coordTypeAction & diff --git a/source/mod_particles.f90 b/source/mod_particles.f90 index d336f3739..88f2c9235 100644 --- a/source/mod_particles.f90 +++ b/source/mod_particles.f90 @@ -88,7 +88,8 @@ subroutine part_updateRefEnergy(refEnergy) e0 = refEnergy e0f = sqrt(e0**2 - nucm0**2) gammar = nucm0/e0 - betrel = sqrt((one+gammar)*(one-gammar)) + gamma0 = e0/nucm0 + beta0 = sqrt((one+gammar)*(one-gammar)) brho = (e0f/(clight*c1m6))/qq0 ! Also update sigmv with the new beta0 = e0f/e0 diff --git a/source/sixtrack.f90 b/source/sixtrack.f90 index f402b041b..2f3fe7ea8 100644 --- a/source/sixtrack.f90 +++ b/source/sixtrack.f90 @@ -916,16 +916,17 @@ subroutine daten omoidpsv(:) = zero gammar = nucm0/e0 - betrel = sqrt((one+gammar)*(one-gammar)) + gamma0 = e0/nucm0 + beta0 = sqrt((one+gammar)*(one-gammar)) e0f = sqrt(e0**2-nucm0**2) brho = (e0f/(clight*c1m6))/qq0 if(nbeam >= 1) then parbe14 = (((((-one*crad)*partnum)/four)/pi)/sixin_emitNX)*c1e6 end if - crad = (((two*crad)*partnum)*gammar)*c1e6 - emitx = sixin_emitNX*gammar - emity = sixin_emitNY*gammar + crad = (((two*crad)*partnum)*gammar)*c1e6 + emitx = sixin_emitNX*gammar + emity = sixin_emitNY*gammar if(do_coll) then call collimate_postInput(gammar) From f30710b529ebffa8f6cb68a60a77f7138de0bd0e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 30 Jul 2019 18:09:17 +0200 Subject: [PATCH 30/38] Some bug fixes, added tests, and started adding normalised coordinates conversion --- lib/DISTlib | 2 +- source/mod_dist.f90 | 190 ++++++++++++++---- test/CMakeLists.txt | 12 ++ test/dist_file_6d/extra_checks.txt | 1 + test/dist_file_6d/fort.2 | 54 +++++ test/dist_file_6d/fort.3 | 50 +++++ test/dist_file_6d/initial_state.dat.canonical | 33 +++ test/dist_file_6d/partDist.dat | 6 + test/dist_file_6d_direct/extra_checks.txt | 1 + test/dist_file_6d_direct/fort.2 | 54 +++++ test/dist_file_6d_direct/fort.3 | 50 +++++ .../initial_state.dat.canonical | 33 +++ test/dist_file_6d_direct/partDist.dat | 6 + test/dist_file_normalised/extra_checks.txt | 1 + test/dist_file_normalised/fort.2 | 54 +++++ test/dist_file_normalised/fort.3 | 46 +++++ .../initial_state.dat.canonical | 91 +++++++++ test/dist_file_normalised/partDist.dat | 64 ++++++ 18 files changed, 707 insertions(+), 41 deletions(-) create mode 100644 test/dist_file_6d/extra_checks.txt create mode 100644 test/dist_file_6d/fort.2 create mode 100644 test/dist_file_6d/fort.3 create mode 100644 test/dist_file_6d/initial_state.dat.canonical create mode 100644 test/dist_file_6d/partDist.dat create mode 100644 test/dist_file_6d_direct/extra_checks.txt create mode 100644 test/dist_file_6d_direct/fort.2 create mode 100644 test/dist_file_6d_direct/fort.3 create mode 100644 test/dist_file_6d_direct/initial_state.dat.canonical create mode 100644 test/dist_file_6d_direct/partDist.dat create mode 100644 test/dist_file_normalised/extra_checks.txt create mode 100644 test/dist_file_normalised/fort.2 create mode 100644 test/dist_file_normalised/fort.3 create mode 100644 test/dist_file_normalised/initial_state.dat.canonical create mode 100644 test/dist_file_normalised/partDist.dat diff --git a/lib/DISTlib b/lib/DISTlib index e3bf9137c..ea9bccd08 160000 --- a/lib/DISTlib +++ b/lib/DISTlib @@ -1 +1 @@ -Subproject commit e3bf9137cbf65f5eac4628c2d4f207d43fc71afb +Subproject commit ea9bccd0879035afbed1ade658e6741e2cace8ab diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 7fb3c025b..cea6e5336 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -24,9 +24,13 @@ module mod_dist logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader logical, private, save :: dist_distLib = .false. ! DISTlib is needed to generate the distribution requested + logical, private, save :: dist_distLibNorm = .false. ! DISTlib is used to convert normalised coordinates character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution - real(kind=fPrec), public, save :: dist_beamEmit(3) = zero ! Beam emittance for generator and normalisation + real(kind=fPrec), public, save :: dist_beamEmit(2) = zero ! Beam emittance for generator and normalisation + real(kind=fPrec), public, save :: dist_beamLen = zero ! RMS bunch length + real(kind=fPrec), public, save :: dist_beamSpread = zero ! Bunch energy spread + real(kind=fPrec), public, save :: dist_tMat(6,6) = zero ! Cpy of the T matrix, properly scaled integer, allocatable, private, save :: dist_colFormat(:) ! The column types in the FORMAT real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the columns @@ -90,11 +94,13 @@ module mod_dist integer, parameter :: dist_fmtSPINZ = 73 ! Spin vector z component ! Flags for columns we've set that we need to track for later checks - logical, private, save :: dist_readMass = .false. - logical, private, save :: dist_readIonZ = .false. - logical, private, save :: dist_readIonA = .false. - logical, private, save :: dist_readCharge = .false. - logical, private, save :: dist_readPDGID = .false. + logical, private, save :: dist_readMass = .false. + logical, private, save :: dist_readIonZ = .false. + logical, private, save :: dist_readIonA = .false. + logical, private, save :: dist_readCharge = .false. + logical, private, save :: dist_readPDGID = .false. + logical, private, save :: dist_readPartID = .false. + logical, private, save :: dist_readParentID = .false. ! Temporary particle arrays real(kind=fPrec), allocatable, private, save :: dist_partCol1(:) ! Ends up in array xv1 @@ -195,6 +201,7 @@ subroutine dist_generateDist use numerical_constants integer distLibPart + real(kind=fPrec) flatTas(36) call alloc(dist_partCol1, napx, zero, "dist_partCol1") call alloc(dist_partCol2, napx, zero, "dist_partCol2") @@ -203,20 +210,18 @@ subroutine dist_generateDist call alloc(dist_partCol5, napx, zero, "dist_partCol5") call alloc(dist_partCol6, napx, zero, "dist_partCol6") + dist_tMat(1:6,1:6) = tas(1:6,1:6)*c1m3 + dist_tMat(1:5,6) = dist_tMat(1:5,6)*c1m3 + dist_tMat(6,1:5) = dist_tMat(6,1:5)*c1e3 + #ifdef DISTLIB if(dist_distLib) then call distlib_init(1) call distlib_setEnergyMass(e0, nucm0) call distlib_setEmittance12(dist_beamEmit(1), dist_beamEmit(2)) - call distlib_setEmittance3(dist_beamEmit(3)) - block - real(kind=fPrec) tmpTas(6,6), flatTas(36) - tmpTas(1:6,1:6) = tas(1:6,1:6) - tmpTas(1:5,6) = tmpTas(1:5,6)*c1m3 - tmpTas(6,1:5) = tmpTas(6,1:5)*c1e3 - flatTas = pack(transpose(tmpTas),.true.) - call distlib_setTasMatrix(flatTas) - end block + ! call distlib_setEmittance3(dist_beamEmit(3)) + flatTas = pack(transpose(dist_tMat),.true.) + call distlib_setTasMatrix(flatTas) end if #endif @@ -225,7 +230,7 @@ subroutine dist_generateDist call dist_parseParticles call dist_postprParticles elseif(dist_distFile /= " ") then - if(dist_distLib) then + if(dist_libRead) then ! Particles are read entirely in DISTlib #ifdef DISTLIB call distlib_readFile(trim(dist_distFile), len_trim(dist_distFile)) @@ -240,7 +245,7 @@ subroutine dist_generateDist if(dist_distLib) then ! Our final coordinates are taken from DISTlib distLibPart = napx - call distlib_getCoords( & + call distlib_getCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & distLibPart & @@ -288,6 +293,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) use mod_alloc use mod_units use string_tools + use numerical_constants character(len=*), intent(in) :: inLine integer, intent(inout) :: iLine @@ -368,15 +374,35 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) return case("EMIT","EMITTANCE") - if(nSplit /= 3 .and. nSplit /= 4) then - write(lerr,"(a,i0)") "DIST> ERROR EMITTANCE takes 2 or 3 arguments, got ",nSplit-1 - write(lerr,"(a)") "DIST> EMITTANCE emit1 emit2 [emit3]" + if(nSplit /= 3) then + write(lerr,"(a,i0)") "DIST> ERROR EMITTANCE takes 2 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> EMITTANCE emit1[mm mrad] emit2[mm mrad]" + iErr = .true. + return + end if + call chr_cast(lnSplit(2), dist_beamEmit(1), cErr) + call chr_cast(lnSplit(3), dist_beamEmit(2), cErr) + dist_beamEmit(1) = dist_beamEmit(1) * c1m6 + dist_beamEmit(2) = dist_beamEmit(2) * c1m6 + + case("BUNCHLEN") + if(nSplit /= 2) then + write(lerr,"(a,i0)") "DIST> ERROR BUNCHLEN takes 1 argument, got ",nSplit-1 + write(lerr,"(a)") "DIST> BUNCHLEN rms_len[mm]" iErr = .true. return end if - if(nSplit > 1) call chr_cast(lnSplit(2), dist_beamEmit(1), cErr) - if(nSplit > 2) call chr_cast(lnSplit(3), dist_beamEmit(2), cErr) - if(nSplit > 3) call chr_cast(lnSplit(4), dist_beamEmit(3), cErr) + call chr_cast(lnSplit(2), dist_beamLen, cErr) + dist_beamLen = dist_beamLen * c1m3 + + case("ESPREAD") + if(nSplit /= 2) then + write(lerr,"(a,i0)") "DIST> ERROR ESPREAD takes 1 argument, got ",nSplit-1 + write(lerr,"(a)") "DIST> ESPREAD rms_energy_spread" + iErr = .true. + return + end if + call chr_cast(lnSplit(2), dist_beamSpread, cErr) end select @@ -494,22 +520,22 @@ subroutine dist_setColumnFormat(fmtName, fErr) case("XN") call dist_appendFormat(dist_fmtXN, one, 1) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("YN") call dist_appendFormat(dist_fmtYN, one, 3) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("ZN") call dist_appendFormat(dist_fmtZN, one, 5) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("PXN") call dist_appendFormat(dist_fmtPXN, one, 2) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("PYN") call dist_appendFormat(dist_fmtPYN, one, 4) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("PZN") call dist_appendFormat(dist_fmtPZN, one, 6) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("JX") call dist_appendFormat(dist_fmtJX, one, 1) @@ -573,7 +599,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPYN, one, 4) call dist_appendFormat(dist_fmtZN, one, 5) call dist_appendFormat(dist_fmtPZN, one, 6) - dist_distLib = .true. + dist_distLib = dist_distLibNorm case("ACTION") ! 6D action call dist_appendFormat(dist_fmtJX, one, 1) @@ -782,23 +808,27 @@ subroutine dist_parseParticles integer i, j, nSplit logical spErr, cErr + spErr = .false. + cErr = .false. + if(dist_nParticle > 0) then do j=1,dist_nParticle call chr_split(dist_partLine(j), lnSplit, nSplit, spErr) - if(spErr) goto 20 + if(spErr) then + write(lerr,"(a,i0,a)") "DIST> ERROR Could not split PARTICLE definition number ",j," from "//trim(fort3) + call prror + end if do i=2,nSplit call dist_saveParticle(j, i-1, lnSplit(i), cErr) + if(cErr) then + write(lerr,"(a,2(i0,a))") "DIST> ERROR Could not parse PARTICLE definition number ",j,", column ",i," from "//trim(fort3) + call prror + end if end do - if(cErr) goto 20 dist_numPart = dist_numPart + 1 end do end if - return - -20 continue - write(lout,"(a,i0,a)") "DIST> ERROR Could not parse PARTICLE definition number ",j," from "//trim(fort3) - end subroutine dist_parseParticles ! ================================================================================================ ! @@ -906,9 +936,11 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) case(dist_fmtPartID) call chr_cast(inVal, partID(partNo), sErr) + dist_readPartID = .true. case(dist_fmtParentID) call chr_cast(inVal, parentID(partNo), sErr) + dist_readParentID = .true. ! Horizontal Coordinates ! ======================== @@ -1099,13 +1131,13 @@ subroutine dist_postprParticles doAction = .true. end select -#ifdef DISTLIB if(doNormal .and. doAction) then write(lerr,"(a)") "DIST> ERROR Cannot mix normalised and action coordinates" call prror end if - if(doNormal) then +#ifdef DISTLIB + if(doNormal .and. dist_distLibNorm) then call distlib_setCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & @@ -1113,7 +1145,7 @@ subroutine dist_postprParticles ) end if - if(doAction) then + if(doAction .and. dist_distLibNorm) then call distlib_setCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & dist_partCol4, dist_partCol5, dist_partCol6, & @@ -1122,8 +1154,77 @@ subroutine dist_postprParticles end if #endif + if(doNormal .and. .not. dist_distLibNorm) then + call dist_normToPhysical + end if + end subroutine dist_postprParticles +subroutine dist_normToPhysical + + use mod_common + use mod_particles + use mod_common_main + use numerical_constants + + real(kind=fPrec) sqEmitX, sqEmitY, sqEmitZ + + sqEmitX = sqrt(dist_beamEmit(1)) + sqEmitY = sqrt(dist_beamEmit(2)) + sqEmitZ = sqrt(dist_beamLen * dist_beamSpread) + + xv1(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(1,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(1,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(1,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(1,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(1,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(1,6))) * c1e3 + + yv1(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(2,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(2,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(2,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(2,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(2,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(2,6))) * (c1e3*(one+dpsv(1:napx))) + + xv2(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(3,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(3,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(3,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(3,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(3,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(3,6))) * c1e3 + + yv2(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(4,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(4,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(4,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(4,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(4,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(4,6))) * (c1e3*(one+dpsv(1:napx))) + + sigmv(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(5,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(5,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(5,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(5,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(5,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(5,6))) / rvv(1:napx) + + dpsv(1:napx) = ( & + dist_partCol1(1:napx) * (sqEmitX * dist_tMat(6,1)) + & + dist_partCol2(1:napx) * (sqEmitX * dist_tMat(6,2)) + & + dist_partCol3(1:napx) * (sqEmitY * dist_tMat(6,3)) + & + dist_partCol4(1:napx) * (sqEmitY * dist_tMat(6,4)) + & + dist_partCol5(1:napx) * (sqEmitZ * dist_tMat(6,5)) + & + dist_partCol6(1:napx) * (sqEmitZ * dist_tMat(6,6))) + + call part_updatePartEnergy(3,.true.) + +end subroutine dist_normToPhysical + ! ================================================================================================ ! ! A. Mereghetti and D. Sinuela Pastor, for the FLUKA Team ! V.K. Berglyd Olsen, BE-ABP-HSS @@ -1153,6 +1254,15 @@ subroutine dist_finaliseDist call prror end if + if(dist_readParentID .and. .not. dist_readPartID) then + write(lerr,"(a)") "DIST> ERROR If you set particle parent ID you must also set particle ID" + call prror + end if + + if(dist_readPartID .and. .not. dist_readParentID) then + parentID(1:napx) = partID(1:napx) + end if + if(dist_readIonZ .and. .not. dist_readCharge) then nqq(1:napx) = nzz(1:napx) end if diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9c0be5cf0..0f485f503 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -93,6 +93,9 @@ list(APPEND SIXTRACK_TESTS chebythin6d_ramp_DYNK crabs dipedge + dist_file_6d + dist_file_6d_direct + dist_file_normalised distance dump_2_all_ele_highprec dump_all_highprec @@ -260,6 +263,9 @@ set(TESTS_NOFORT10 collimation_new-db_new-block collimation_old-db_new-block collimation_old-db_old-block + dist_file_6d + dist_file_6d_direct + dist_file_normalised dump_2_all_ele_highprec dump_all_highprec dump_binary @@ -328,6 +334,9 @@ set(TESTS_NO_STF_FORT90 crabs orbit6d-element-rotations dipedge + dist_file_6d + dist_file_6d_direct + dist_file_normalised dump_all_highprec dump4 dump5 @@ -601,6 +610,9 @@ set(FAST_TESTS collimation_old-db_old-block collimation_old-db_old-block crabs + dist_file_6d + dist_file_6d_direct + dist_file_normalised dump_2_all_ele_highprec dump_all_highprec dump_binary diff --git a/test/dist_file_6d/extra_checks.txt b/test/dist_file_6d/extra_checks.txt new file mode 100644 index 000000000..3ac9a49e1 --- /dev/null +++ b/test/dist_file_6d/extra_checks.txt @@ -0,0 +1 @@ +initial_state.dat diff --git a/test/dist_file_6d/fort.2 b/test/dist_file_6d/fort.2 new file mode 100644 index 000000000..0fa0481ac --- /dev/null +++ b/test/dist_file_6d/fort.2 @@ -0,0 +1,54 @@ +SINGLE ELEMENTS--------------------------------------------------------- + redip_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_0 0 0.000000000e+00 0.000000000e+00 5.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redip 11 -2.000000000e-02 1.000000000e+00 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + ip5 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_2 0 0.000000000e+00 0.000000000e+00 5.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_3 0 0.000000000e+00 0.000000000e+00 4.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv 11 -1.200000000e-02 9.000000000e-01 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_5 0 0.000000000e+00 0.000000000e+00 5.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qfstart 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_6 0 0.000000000e+00 0.000000000e+00 7.500000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qd 2 1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_7 0 0.000000000e+00 0.000000000e+00 1.000000000e+01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qf 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_11 0 0.000000000e+00 0.000000000e+00 2.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + hkick 1 1.200000000e-04 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + vkick -1 1.330000000e-03 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_13 0 0.000000000e+00 0.000000000e+00 9.600000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_14 0 0.000000000e+00 0.000000000e+00 2.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.1 -12 1.500000000e-01 1.000000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.2 12 1.500000000e-01 1.000000000e+02 1.800000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_15 0 0.000000000e+00 0.000000000e+00 9.980000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 +NEXT +BLOCK DEFINITIONS------------------------------------------------------- + 1 1 + BLOC1 drift_0 + BLOC2 drift_2 + BLOC3 drift_3 + BLOC4 drift_5 + BLOC5 drift_6 + BLOC6 drift_7 + BLOC7 drift_11 + BLOC8 drift_13 + BLOC9 drift_14 + BLOC10 drift_15 +NEXT +STRUCTURE INPUT--------------------------------------------------------- + redip_den BLOC1 redip + BLOC1 redip_den ip5 + BLOC2 redipv_den BLOC3 + redipv BLOC3 redipv_den + BLOC4 qfstart BLOC5 + qd BLOC6 qf + BLOC6 qd BLOC6 + qf BLOC6 qd + BLOC7 hkick BLOC7 + vkick BLOC8 qf + BLOC9 rfcav.1 rfcav.2 + BLOC10 qd BLOC6 + qf BLOC6 qd + BLOC6 qf BLOC6 + qd BLOC6 +NEXT diff --git a/test/dist_file_6d/fort.3 b/test/dist_file_6d/fort.3 new file mode 100644 index 000000000..cdc8e8c74 --- /dev/null +++ b/test/dist_file_6d/fort.3 @@ -0,0 +1,50 @@ +GEOMETRY + +SETTINGS------------------------------------------------------------------------ + DEBUG + INITIALSTATE text +NEXT + +SIMULATION---------------------------------------------------------------------- + PARTICLES 6 + TURNS 1 + LATTICE Thin 6D + 6D_CLORB off + WRITE_TRACKS 100 off + REF_PARTICLE 938.272046 + REF_ENERGY 1500.0 +NEXT + +DIST---------------------------------------------------------------------------- +! FORMAT ID 6D + FORMAT ID X PX Y PY ZETA DELTA + READ partDist.dat +! PARTICLE 6 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +! PARTICLE 5 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +! PARTICLE 4 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +! PARTICLE 3 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +! PARTICLE 2 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 +! PARTICLE 1 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 +NEXT + +ITERATION ERRORS---------------------------------------------------------------- + 100 1e-12 1e-15 + 10 1e-10 1e-10 + 10 1e-09 1e-10 + 1e-09 1e-09 1e-09 1000.0 1000.0 +NEXT + +LINEAR OPTICS CALCULATION------------------------------------------------------- + ELEMENT 0 1 +NEXT + +SYNC---------------------------------------------------------------------------- + 100 0.008066 0.300 0.0 120.000000 938.272081 1 + 1.0 1.0 +NEXT + +BEAM---------------------------------------------------------------------------- + 0.0000e+00 1.24731e+06 1.24731e+06 1.0000e+00 1.0000e-03 1 0 +NEXT + +ENDE============================================================================ diff --git a/test/dist_file_6d/initial_state.dat.canonical b/test/dist_file_6d/initial_state.dat.canonical new file mode 100644 index 000000000..60eb0b346 --- /dev/null +++ b/test/dist_file_6d/initial_state.dat.canonical @@ -0,0 +1,33 @@ +# Tracking +# NPart Start = 6 +# NPart End = 6 +# NPart Allocated = 6 +# NTurns = 1 +# +# Reference Particle +# Mass [MeV] = 9.3827204600000005E+002 +# Energy [MeV] = 1.5000000000000000E+003 +# Momentum [MeV] = 1.1703185753011758E+003 +# Atomic Mass = 1 +# Atomic Number = 1 +# Charge = 1 +# +# Closed Orbit [x, xp, y, yp, sigma, dp] +# 4D Closed Orbit = -1.5498722213546328E+000 -4.3500010391828145E-002 -1.4989124120633555E+001 1.7237369151616875E+000 +# 6D Closed Orbit = -1.5489235141986075E+000 -4.3473605825315342E-002 -1.4989261289375476E+001 1.7237444642071484E+000 -4.2107237160409504E-002 1.5435395404724985E-006 +# +# Tune = 1.1939602242323781E+000 1.1927164443633989E+000 0.0000000000000000E+000 +# TAS(1,1:6) = 5.0575672102869138E+000 -1.8385037714357122E-015 2.8806340225118838E-003 -1.9090655284444659E-003 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(2,1:6) = 2.6897121784231165E-001 1.9771763239125204E-001 2.2671402818887694E-004 1.1266406561199552E-005 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(3,1:6) = -1.9065876524737939E-003 -1.2665562236528053E-003 3.3963723744718655E+000 4.1097020183597299E-016 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(4,1:6) = 1.9713759040716075E-004 -1.0780383367122033E-004 -1.5509220936749352E-001 2.9443110903604275E-001 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(5,1:6) = 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(6,1:6) = 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 +# +# partID parentID lost prim x y xp yp sigma dp p e + 6 6 F T 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 + 5 5 F T 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 + 4 4 F T 1.0000000000000001E-001 1.0000000000000001E-001 1.0000000000000563E-001 1.0000000000000563E-001 1.0000000000000059E-001 1.6375664490350800E-002 1.1894833196371330E+003 1.5150000000000000E+003 + 3 3 F T 1.0000000000000001E-001 1.0000000000000001E-001 1.0000000000000563E-001 1.0000000000000563E-001 1.0000000000000059E-001 1.6375664490350800E-002 1.1894833196371330E+003 1.5150000000000000E+003 + 2 2 F T -1.0000000000000001E-001 -1.0000000000000001E-001 -1.0000000000000708E-001 -1.0000000000000708E-001 -1.0000000000000010E-001 -1.6375664490350800E-002 1.1511538309652185E+003 1.4850958133571467E+003 + 1 1 F T -1.0000000000000001E-001 -1.0000000000000001E-001 -1.0000000000000708E-001 -1.0000000000000708E-001 -1.0000000000000010E-001 -1.6375664490350800E-002 1.1511538309652185E+003 1.4850958133571467E+003 diff --git a/test/dist_file_6d/partDist.dat b/test/dist_file_6d/partDist.dat new file mode 100644 index 000000000..659bb5ae4 --- /dev/null +++ b/test/dist_file_6d/partDist.dat @@ -0,0 +1,6 @@ +6 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +5 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +4 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +3 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +2 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 +1 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 diff --git a/test/dist_file_6d_direct/extra_checks.txt b/test/dist_file_6d_direct/extra_checks.txt new file mode 100644 index 000000000..3ac9a49e1 --- /dev/null +++ b/test/dist_file_6d_direct/extra_checks.txt @@ -0,0 +1 @@ +initial_state.dat diff --git a/test/dist_file_6d_direct/fort.2 b/test/dist_file_6d_direct/fort.2 new file mode 100644 index 000000000..0fa0481ac --- /dev/null +++ b/test/dist_file_6d_direct/fort.2 @@ -0,0 +1,54 @@ +SINGLE ELEMENTS--------------------------------------------------------- + redip_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_0 0 0.000000000e+00 0.000000000e+00 5.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redip 11 -2.000000000e-02 1.000000000e+00 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + ip5 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_2 0 0.000000000e+00 0.000000000e+00 5.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_3 0 0.000000000e+00 0.000000000e+00 4.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv 11 -1.200000000e-02 9.000000000e-01 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_5 0 0.000000000e+00 0.000000000e+00 5.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qfstart 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_6 0 0.000000000e+00 0.000000000e+00 7.500000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qd 2 1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_7 0 0.000000000e+00 0.000000000e+00 1.000000000e+01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qf 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_11 0 0.000000000e+00 0.000000000e+00 2.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + hkick 1 1.200000000e-04 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + vkick -1 1.330000000e-03 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_13 0 0.000000000e+00 0.000000000e+00 9.600000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_14 0 0.000000000e+00 0.000000000e+00 2.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.1 -12 1.500000000e-01 1.000000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.2 12 1.500000000e-01 1.000000000e+02 1.800000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_15 0 0.000000000e+00 0.000000000e+00 9.980000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 +NEXT +BLOCK DEFINITIONS------------------------------------------------------- + 1 1 + BLOC1 drift_0 + BLOC2 drift_2 + BLOC3 drift_3 + BLOC4 drift_5 + BLOC5 drift_6 + BLOC6 drift_7 + BLOC7 drift_11 + BLOC8 drift_13 + BLOC9 drift_14 + BLOC10 drift_15 +NEXT +STRUCTURE INPUT--------------------------------------------------------- + redip_den BLOC1 redip + BLOC1 redip_den ip5 + BLOC2 redipv_den BLOC3 + redipv BLOC3 redipv_den + BLOC4 qfstart BLOC5 + qd BLOC6 qf + BLOC6 qd BLOC6 + qf BLOC6 qd + BLOC7 hkick BLOC7 + vkick BLOC8 qf + BLOC9 rfcav.1 rfcav.2 + BLOC10 qd BLOC6 + qf BLOC6 qd + BLOC6 qf BLOC6 + qd BLOC6 +NEXT diff --git a/test/dist_file_6d_direct/fort.3 b/test/dist_file_6d_direct/fort.3 new file mode 100644 index 000000000..3a9c29790 --- /dev/null +++ b/test/dist_file_6d_direct/fort.3 @@ -0,0 +1,50 @@ +GEOMETRY + +SETTINGS------------------------------------------------------------------------ + DEBUG + INITIALSTATE text +NEXT + +SIMULATION---------------------------------------------------------------------- + PARTICLES 6 + TURNS 1 + LATTICE Thin 6D + 6D_CLORB off + WRITE_TRACKS 100 off + REF_PARTICLE 938.272046 + REF_ENERGY 1500.0 +NEXT + +DIST---------------------------------------------------------------------------- +! FORMAT ID 6D + FORMAT ID X PX Y PY ZETA DELTA +! READ partDist.dat + PARTICLE 6 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 + PARTICLE 5 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 + PARTICLE 4 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 + PARTICLE 3 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 + PARTICLE 2 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 + PARTICLE 1 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 +NEXT + +ITERATION ERRORS---------------------------------------------------------------- + 100 1e-12 1e-15 + 10 1e-10 1e-10 + 10 1e-09 1e-10 + 1e-09 1e-09 1e-09 1000.0 1000.0 +NEXT + +LINEAR OPTICS CALCULATION------------------------------------------------------- + ELEMENT 0 1 +NEXT + +SYNC---------------------------------------------------------------------------- + 100 0.008066 0.300 0.0 120.000000 938.272081 1 + 1.0 1.0 +NEXT + +BEAM---------------------------------------------------------------------------- + 0.0000e+00 1.24731e+06 1.24731e+06 1.0000e+00 1.0000e-03 1 0 +NEXT + +ENDE============================================================================ diff --git a/test/dist_file_6d_direct/initial_state.dat.canonical b/test/dist_file_6d_direct/initial_state.dat.canonical new file mode 100644 index 000000000..60eb0b346 --- /dev/null +++ b/test/dist_file_6d_direct/initial_state.dat.canonical @@ -0,0 +1,33 @@ +# Tracking +# NPart Start = 6 +# NPart End = 6 +# NPart Allocated = 6 +# NTurns = 1 +# +# Reference Particle +# Mass [MeV] = 9.3827204600000005E+002 +# Energy [MeV] = 1.5000000000000000E+003 +# Momentum [MeV] = 1.1703185753011758E+003 +# Atomic Mass = 1 +# Atomic Number = 1 +# Charge = 1 +# +# Closed Orbit [x, xp, y, yp, sigma, dp] +# 4D Closed Orbit = -1.5498722213546328E+000 -4.3500010391828145E-002 -1.4989124120633555E+001 1.7237369151616875E+000 +# 6D Closed Orbit = -1.5489235141986075E+000 -4.3473605825315342E-002 -1.4989261289375476E+001 1.7237444642071484E+000 -4.2107237160409504E-002 1.5435395404724985E-006 +# +# Tune = 1.1939602242323781E+000 1.1927164443633989E+000 0.0000000000000000E+000 +# TAS(1,1:6) = 5.0575672102869138E+000 -1.8385037714357122E-015 2.8806340225118838E-003 -1.9090655284444659E-003 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(2,1:6) = 2.6897121784231165E-001 1.9771763239125204E-001 2.2671402818887694E-004 1.1266406561199552E-005 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(3,1:6) = -1.9065876524737939E-003 -1.2665562236528053E-003 3.3963723744718655E+000 4.1097020183597299E-016 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(4,1:6) = 1.9713759040716075E-004 -1.0780383367122033E-004 -1.5509220936749352E-001 2.9443110903604275E-001 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(5,1:6) = 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 +# TAS(6,1:6) = 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 +# +# partID parentID lost prim x y xp yp sigma dp p e + 6 6 F T 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 + 5 5 F T 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 + 4 4 F T 1.0000000000000001E-001 1.0000000000000001E-001 1.0000000000000563E-001 1.0000000000000563E-001 1.0000000000000059E-001 1.6375664490350800E-002 1.1894833196371330E+003 1.5150000000000000E+003 + 3 3 F T 1.0000000000000001E-001 1.0000000000000001E-001 1.0000000000000563E-001 1.0000000000000563E-001 1.0000000000000059E-001 1.6375664490350800E-002 1.1894833196371330E+003 1.5150000000000000E+003 + 2 2 F T -1.0000000000000001E-001 -1.0000000000000001E-001 -1.0000000000000708E-001 -1.0000000000000708E-001 -1.0000000000000010E-001 -1.6375664490350800E-002 1.1511538309652185E+003 1.4850958133571467E+003 + 1 1 F T -1.0000000000000001E-001 -1.0000000000000001E-001 -1.0000000000000708E-001 -1.0000000000000708E-001 -1.0000000000000010E-001 -1.6375664490350800E-002 1.1511538309652185E+003 1.4850958133571467E+003 diff --git a/test/dist_file_6d_direct/partDist.dat b/test/dist_file_6d_direct/partDist.dat new file mode 100644 index 000000000..659bb5ae4 --- /dev/null +++ b/test/dist_file_6d_direct/partDist.dat @@ -0,0 +1,6 @@ +6 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +5 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 +4 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +3 0.10000000000000e+00 0.11894833196372e+00 0.10000000000000e+00 0.11894833196372e+00 0.99372705908544e-01 1.63756644903508e-02 +2 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 +1 -0.10000000000000e+00 -0.11511538309653e+00 -0.10000000000000e+00 -0.11511538309653e+00 -1.00654674740072e-01 -1.63756644903508e-02 diff --git a/test/dist_file_normalised/extra_checks.txt b/test/dist_file_normalised/extra_checks.txt new file mode 100644 index 000000000..3ac9a49e1 --- /dev/null +++ b/test/dist_file_normalised/extra_checks.txt @@ -0,0 +1 @@ +initial_state.dat diff --git a/test/dist_file_normalised/fort.2 b/test/dist_file_normalised/fort.2 new file mode 100644 index 000000000..0fa0481ac --- /dev/null +++ b/test/dist_file_normalised/fort.2 @@ -0,0 +1,54 @@ +SINGLE ELEMENTS--------------------------------------------------------- + redip_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_0 0 0.000000000e+00 0.000000000e+00 5.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redip 11 -2.000000000e-02 1.000000000e+00 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + ip5 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_2 0 0.000000000e+00 0.000000000e+00 5.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_3 0 0.000000000e+00 0.000000000e+00 4.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv 11 -1.200000000e-02 9.000000000e-01 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_5 0 0.000000000e+00 0.000000000e+00 5.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qfstart 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_6 0 0.000000000e+00 0.000000000e+00 7.500000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qd 2 1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_7 0 0.000000000e+00 0.000000000e+00 1.000000000e+01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qf 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_11 0 0.000000000e+00 0.000000000e+00 2.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + hkick 1 1.200000000e-04 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + vkick -1 1.330000000e-03 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_13 0 0.000000000e+00 0.000000000e+00 9.600000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_14 0 0.000000000e+00 0.000000000e+00 2.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.1 -12 1.500000000e-01 1.000000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.2 12 1.500000000e-01 1.000000000e+02 1.800000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_15 0 0.000000000e+00 0.000000000e+00 9.980000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 +NEXT +BLOCK DEFINITIONS------------------------------------------------------- + 1 1 + BLOC1 drift_0 + BLOC2 drift_2 + BLOC3 drift_3 + BLOC4 drift_5 + BLOC5 drift_6 + BLOC6 drift_7 + BLOC7 drift_11 + BLOC8 drift_13 + BLOC9 drift_14 + BLOC10 drift_15 +NEXT +STRUCTURE INPUT--------------------------------------------------------- + redip_den BLOC1 redip + BLOC1 redip_den ip5 + BLOC2 redipv_den BLOC3 + redipv BLOC3 redipv_den + BLOC4 qfstart BLOC5 + qd BLOC6 qf + BLOC6 qd BLOC6 + qf BLOC6 qd + BLOC7 hkick BLOC7 + vkick BLOC8 qf + BLOC9 rfcav.1 rfcav.2 + BLOC10 qd BLOC6 + qf BLOC6 qd + BLOC6 qf BLOC6 + qd BLOC6 +NEXT diff --git a/test/dist_file_normalised/fort.3 b/test/dist_file_normalised/fort.3 new file mode 100644 index 000000000..b8e22b13b --- /dev/null +++ b/test/dist_file_normalised/fort.3 @@ -0,0 +1,46 @@ +GEOMETRY + +SETTINGS------------------------------------------------------------------------ + DEBUG + INITIALSTATE text +NEXT + +SIMULATION---------------------------------------------------------------------- + PARTICLES 64 + TURNS 1 + LATTICE Thin 6D + 6D_CLORB off + WRITE_TRACKS 100 off + REF_PARTICLE 938.272046 + REF_ENERGY 1500.0 +NEXT + +DIST---------------------------------------------------------------------------- + FORMAT XN PXN YN PYN ZN PZN + READ partDist.dat + EMITTANCE 2.5 2.5 + ! PARTICLE 0.0 0.0 0.0 0.0 0.0 0.0 + ! PARTICLE 0.0 0.0 0.0 0.0 0.0 0.0 +NEXT + +ITERATION ERRORS---------------------------------------------------------------- + 100 1e-12 1e-15 + 10 1e-10 1e-10 + 10 1e-09 1e-10 + 1e-09 1e-09 1e-09 1000.0 1000.0 +NEXT + +LINEAR OPTICS CALCULATION------------------------------------------------------- + ELEMENT 0 1 +NEXT + +SYNC---------------------------------------------------------------------------- + 100 0.008066 0.300 0.0 120.000000 938.272081 1 + 1.0 1.0 +NEXT + +BEAM---------------------------------------------------------------------------- + 0.0000e+00 1.24731e+06 1.24731e+06 1.0000e+00 1.0000e-03 1 0 +NEXT + +ENDE============================================================================ diff --git a/test/dist_file_normalised/initial_state.dat.canonical b/test/dist_file_normalised/initial_state.dat.canonical new file mode 100644 index 000000000..f7cd2d534 --- /dev/null +++ b/test/dist_file_normalised/initial_state.dat.canonical @@ -0,0 +1,91 @@ +# Tracking +# NPart Start = 64 +# NPart End = 64 +# NPart Allocated = 64 +# NTurns = 1 +# +# Reference Particle +# Mass [MeV] = 9.3827208099999996E+002 +# Energy [MeV] = 7.0000000000000000E+006 +# Momentum [MeV] = 6.9999999371175356E+006 +# Atomic Mass = 1 +# Atomic Number = 1 +# Charge = 1 +# +# Closed Orbit [x, xp, y, yp, sigma, dp] +# 4D Closed Orbit = -3.2280334787479100E-005 -4.6741875080442047E-007 -1.0194052248268459E-003 -1.7674013726847821E-005 +# 6D Closed Orbit = 4.9173116536874216E-006 -1.5377097178679476E-008 -1.0147494098421367E-003 -1.7575639394281780E-005 -8.7705956092793479E-005 -7.5229931935567869E-008 +# +# Tune = 6.2306170798050339E+001 6.0316093542966165E+001 2.1119019919086175E-003 +# TAS(1,1:6) = 1.1026611622260727E+001 -1.3841528429557621E-014 -1.8128683388652947E-004 -7.7765797325635752E-004 7.9567458121134797E-005 -1.8808177728675490E-002 +# TAS(2,1:6) = -2.0823074850137233E-001 9.0689689328298656E-002 9.9961774344938424E-006 1.2946448657504582E-005 1.6159506907958524E-006 -2.2856466833874283E-004 +# TAS(3,1:6) = 2.8346682515039556E-004 -1.0424149340585514E-003 1.4780518222381009E+001 1.2442648803037091E-016 1.6177305374236983E-005 -2.3543575887285955E-003 +# TAS(4,1:6) = 8.3292403019612394E-006 -1.1490211112947131E-005 1.7869704968280409E-001 6.7656626111997978E-002 1.1302914017338810E-007 -4.9745402392893697E-005 +# TAS(5,1:6) = 1.6921630830361578E-001 -4.4842304564229732E-002 8.2631251122661977E-003 -4.1986215755472171E-003 2.6289175738882758E+001 -2.4622349634461342E-015 +# TAS(6,1:6) = 9.6737381282840746E-008 4.6508592999757142E-008 -1.0560521644754546E-007 -1.1665645336676098E-008 -1.8818283215480197E-004 3.8038468693897355E-002 +# +# partID parentID lost prim x y xp yp sigma dp p e + 1 1 F T -3.0471361853131367E-002 -7.8699812014283199E-001 5.6504689278208213E-004 -8.5423775794619527E-003 -9.6276794816487236E-004 5.1753595936295518E-012 6.9999999371537631E+006 7.0000000000362275E+006 + 2 2 F T 5.1581717744697032E-003 9.9998451194957969E-002 -1.5844753859955028E-003 6.0187579279339504E-004 9.0816462339509589E-004 -1.3344522153295562E-012 6.9999999371081945E+006 6.9999999999906588E+006 + 3 3 F T 9.2941114826373059E-002 -2.4019415297248485E-002 -2.4057375965491818E-003 1.7516688149500008E-003 1.6083553554512727E-003 2.9416489013894801E-013 6.9999999371195948E+006 7.0000000000020592E+006 + 4 4 F T -2.6370106206964011E-001 -2.9940996461369968E-001 3.5430231251261136E-003 -7.7871989841501012E-004 -3.6795318412109848E-003 -1.4078936533018308E-012 6.9999999371076804E+006 6.9999999999901447E+006 + 5 5 F T 2.1197387135313528E-001 1.0802837245999210E-001 7.6695180672881817E-004 7.8688432240832916E-004 9.8725753636441085E-004 3.6157934053849799E-012 6.9999999371428462E+006 7.0000000000253106E+006 + 6 6 F T -1.2673202270962620E-002 2.0675712749631567E-001 6.4708691915709858E-005 3.7381144101074815E-004 1.3930945419839610E-004 -1.3190188696687159E-012 6.9999999371083025E+006 6.9999999999907669E+006 + 7 7 F T -2.2059747299215901E-001 -4.9795841658744860E-001 5.3701854302629862E-003 -3.7182702677770177E-003 -4.4016891403440674E-003 1.8360359493068671E-012 6.9999999371303879E+006 7.0000000000128523E+006 + 8 8 F T -1.2378363520450637E-001 -3.7289767991267392E-001 -1.5054246268851920E-003 -3.7415104609677444E-003 -2.5531190132087295E-004 -5.3165214879929281E-013 6.9999999371138141E+006 6.9999999999962784E+006 + 9 9 F T -1.6349530041691560E-001 1.1306193989868716E-002 3.5896280084502219E-003 8.3786842844957386E-004 -2.7941750458947124E-003 -1.3859410495601183E-012 6.9999999371078340E+006 6.9999999999902984E+006 + 10 10 F T -2.4297910278965287E-001 -1.3697657121013959E-001 3.9665235720689595E-003 -3.4478231468965913E-003 -3.3867920349862158E-003 -1.1706724868080524E-012 6.9999999371093409E+006 6.9999999999918053E+006 + 11 11 F T -4.9984847217156680E-001 2.5036513076809352E-001 8.2167181520166159E-003 4.6830273297458350E-003 -7.0284776802293468E-003 -7.0938841145719453E-012 6.9999999370678784E+006 6.9999999999503428E+006 + 12 12 F T -1.7042553800923482E-001 -3.0209740029015986E-001 1.8881763061384825E-003 -3.7329626903669058E-003 -2.1214827510865658E-003 -1.2240239662045779E-014 6.9999999371174499E+006 6.9999999999999143E+006 + 13 13 F T -2.0640625755381656E-001 -2.3055004861177501E-002 3.2406419027348021E-003 -2.8583714474080451E-004 -2.8548463160921684E-003 -1.9893050372490053E-012 6.9999999371036105E+006 6.9999999999860749E+006 + 14 14 F T 3.9030019704522308E-002 -6.1403736505329731E-001 -3.8330924609886261E-004 -5.9675681169651072E-003 -9.4069604978878981E-006 4.6527545784935102E-012 6.9999999371501049E+006 7.0000000000325693E+006 + 15 15 F T -3.4698770729825905E-002 -1.3669676917771503E-001 -3.5944015187128973E-004 -3.2722344615792602E-003 -6.8046064145793500E-006 4.2361872917341047E-013 6.9999999371205010E+006 7.0000000000029653E+006 + 16 16 F T -1.7470446457144745E-001 4.3764726602899107E-001 4.4212387316525711E-003 4.1988863252837303E-003 -2.9231926671925731E-003 -3.9035720835263391E-012 6.9999999370902106E+006 6.9999999999726750E+006 + 17 17 F T 6.1872039902877138E-002 -1.8778317092186644E-001 2.5490304308363573E-004 -1.2622291793091425E-003 7.8488345466724900E-005 2.4331467710814481E-012 6.9999999371345676E+006 7.0000000000170320E+006 + 18 18 F T -5.2211585266781158E-001 3.2836137718100361E-001 1.1532768566530096E-002 4.8920076604809983E-003 -8.7128374529840437E-003 -6.2353377391460602E-012 6.9999999370738883E+006 6.9999999999563526E+006 + 19 19 F T -5.7875547754838871E-002 4.9281164299945496E-001 -1.1522980969653255E-004 5.6941874925372999E-003 1.4617593570180371E-006 -4.6103128779261995E-012 6.9999999370852634E+006 6.9999999999677278E+006 + 20 20 F T 2.9119292720168131E-002 -8.0363893035565415E-001 -1.4088822158051407E-003 -9.5482522432741666E-003 4.1180672087265738E-004 5.5207472258324958E-012 6.9999999371561809E+006 7.0000000000386452E+006 + 21 21 F T -1.8671566823532790E-001 -5.1557362689926715E-002 3.6299575747677859E-003 5.1072118393240881E-004 -3.0156043760866703E-003 -1.4192025703808949E-012 6.9999999371076012E+006 6.9999999999900656E+006 + 22 22 F T 2.0763796971990908E-001 -6.9139033644764258E-002 -5.6624994221640889E-003 -2.1700328319742626E-003 4.0915784410024622E-003 1.6453809119621756E-012 6.9999999371290533E+006 7.0000000000115177E+006 + 23 23 F T 5.1166763602224982E-002 1.1749386118325393E-001 -3.4400951525371382E-004 1.0665695018217849E-003 5.6538781699434185E-004 -1.7828175159936243E-014 6.9999999371174108E+006 6.9999999999998752E+006 + 24 24 F T 6.4866188745565809E-002 -5.5196302133670001E-002 -5.1513758293734133E-005 3.0011991631837416E-004 3.2468009464272870E-004 1.3911298468081595E-012 6.9999999371272735E+006 7.0000000000097379E+006 + 25 25 F T 5.5902743948191613E-002 2.9135413256998505E-001 1.3028556184023722E-003 3.7675434955383473E-003 -1.6025565833700504E-004 -4.3160149417039683E-013 6.9999999371145144E+006 6.9999999999969788E+006 + 26 26 F T 3.0754489202710333E-001 -1.1509742779034693E-003 -4.0911109665002525E-003 -6.5119186839639697E-004 3.9098265224745497E-003 3.6891017972739713E-012 6.9999999371433593E+006 7.0000000000258237E+006 + 27 27 F T 1.8799071695128866E-001 1.3678655016880292E-001 -2.5006129896650094E-003 1.3470263916666738E-003 2.4617399889836954E-003 1.2556889340259572E-012 6.9999999371263254E+006 7.0000000000087898E+006 + 28 28 F T 2.0269677104398684E-001 3.5414513516838064E-001 -2.8238766405676921E-003 5.4669650876475852E-003 2.7391976786907139E-003 -4.4889748499720067E-013 6.9999999371143933E+006 6.9999999999968577E+006 + 29 29 F T 1.4875163105933048E-001 3.3343913615853671E-001 -3.8848143823569103E-003 3.3203107118797582E-003 3.0454223671750676E-003 -1.5137983355951835E-012 6.9999999371069390E+006 6.9999999999894034E+006 + 30 30 F T -2.5739712550742727E-001 -5.3359251313351660E-002 5.0541812043842617E-003 8.5067187901198809E-004 -4.1679204325504177E-003 -2.0429226088120971E-012 6.9999999371032352E+006 6.9999999999856995E+006 + 31 31 F T -3.9482867349059364E-001 -1.6545863392417728E-001 1.0311187663799832E-002 -2.0772318233816520E-005 -7.6857132751463973E-003 -1.1662819660597098E-012 6.9999999371093716E+006 6.9999999999918360E+006 + 32 32 F T 2.6871999777814926E-001 -5.7995063293973714E-001 -3.9993563830837435E-003 -6.9839874314259771E-003 3.2661967426186440E-003 7.0405326351754189E-012 6.9999999371668193E+006 7.0000000000492837E+006 + 33 33 F T 5.3050773958961950E-001 1.7254238560545466E-002 -1.2762380154031945E-002 1.8482550544850302E-003 9.4064514711410547E-003 2.8341476660967306E-012 6.9999999371373747E+006 7.0000000000198390E+006 + 34 34 F T 1.1399912617021513E-001 -1.0990550311017692E-001 -3.3261474654313282E-003 -2.4172816889688063E-003 2.3357009880235792E-003 1.3639884458184058E-012 6.9999999371270835E+006 7.0000000000095479E+006 + 35 35 F T -5.1579916631228268E-002 1.3239600203118859E-001 4.5904853246761896E-003 8.0808671296017643E-004 -2.4563755140642012E-003 5.8513667427910156E-013 6.9999999371216316E+006 7.0000000000040960E+006 + 36 36 F T 4.0831379780980420E-002 -3.8908346346664419E-001 2.5812511702643201E-003 -3.4435160029950792E-003 -1.3264514469379122E-003 4.6325315738344786E-012 6.9999999371499633E+006 7.0000000000324277E+006 + 37 37 F T 1.5217388548263022E-001 -1.3419706954789548E-001 -3.0730130844727247E-003 -2.8721877899276914E-003 2.4363102531280473E-003 2.3996191580941054E-012 6.9999999371343330E+006 7.0000000000167973E+006 + 38 38 F T 1.0682334920394243E-001 -3.8908452710065966E-001 -3.6740916782244167E-003 -6.8797883549724312E-003 2.3757271087404656E-003 3.2351485611120127E-012 6.9999999371401817E+006 7.0000000000226460E+006 + 39 39 F T -1.3005518306478475E-001 -4.3614730995671436E-001 5.4596738515368072E-004 -3.6680362368346911E-003 -1.3945734727978699E-003 7.1192959164790187E-013 6.9999999371225191E+006 7.0000000000049835E+006 + 40 40 F T 2.6245785506856234E-001 -5.1272002232144329E-002 -4.8104585479388645E-003 1.6899451171791023E-003 3.7841419094613747E-003 2.3384179597838762E-012 6.9999999371339045E+006 7.0000000000163689E+006 + 41 41 F T -3.5036561269616198E-002 3.1628074325564953E-001 -1.8587921912704868E-003 2.4902588338791753E-003 9.6824654147333186E-004 -3.6372138247935601E-012 6.9999999370920751E+006 6.9999999999745395E+006 + 42 42 F T 9.3145777736440505E-002 -8.4328513823196964E-004 -1.1920932911482130E-004 -1.4851043981271091E-003 7.0965391810984420E-004 1.9106748020286895E-012 6.9999999371309103E+006 7.0000000000133747E+006 + 43 43 F T 3.5975504982455359E-001 -5.8941951316358598E-001 -5.9051599592112288E-003 -5.8160715007159443E-003 4.6708633390061382E-003 7.5901460052179313E-012 6.9999999371706666E+006 7.0000000000531310E+006 + 44 44 F T -2.1446786043658361E-002 -2.0364072362284846E-001 3.1035164096072224E-003 -1.9692980250839952E-003 -1.8076316825668592E-003 2.5582100893675682E-012 6.9999999371354431E+006 7.0000000000179075E+006 + 45 45 F T -4.8223115323909306E-002 1.0447770736143210E-001 3.0991754919423202E-003 1.2901342348134539E-003 -1.7651713083262504E-003 -5.9338553144265410E-014 6.9999999371171203E+006 6.9999999999995846E+006 + 46 46 F T 5.1513529060775234E-002 1.0907920820536053E-001 -4.8422071917646382E-004 2.0751047529173716E-003 5.6337229617496956E-004 -2.1460333233565047E-013 6.9999999371160334E+006 6.9999999999984978E+006 + 47 47 F T -1.2242863942399983E-001 5.8039402819662667E-001 -2.6990437169565961E-004 7.5556082890537255E-003 -3.1061806503962259E-004 -6.6451196756580275E-012 6.9999999370710198E+006 6.9999999999534842E+006 + 48 48 F T -2.5990798489412986E-001 1.1641740987143820E-001 7.5153229671214052E-003 2.4642035430648274E-003 -5.2777629903645049E-003 -1.9648245579249140E-012 6.9999999371037818E+006 6.9999999999862462E+006 + 49 49 F T -1.0156804927961009E-001 -1.3912566181279659E-002 2.3268833046904873E-003 3.5097015194049077E-004 -1.8005460465654259E-003 -6.7893416299369141E-013 6.9999999371127831E+006 6.9999999999952475E+006 + 50 50 F T 3.5711483962502488E-001 4.8504993082974762E-001 -9.7349174180973667E-003 5.8465903489638340E-003 7.2319323119441224E-003 -1.8706279309604746E-012 6.9999999371044412E+006 6.9999999999869056E+006 + 51 51 F T 2.4537577385626877E-001 3.0665808421227203E-001 -6.4610112065294741E-003 5.1931770822071744E-003 4.7488769768426952E-003 -1.2385259892824366E-012 6.9999999371088659E+006 6.9999999999913303E+006 + 52 52 F T -8.0310269796748546E-002 -4.8146918358918145E-001 1.5148366715072505E-003 -5.2370618708557533E-003 -1.5368832145504119E-003 2.6265957761750845E-012 6.9999999371359218E+006 7.0000000000183862E+006 + 53 53 F T 3.0507424019568091E-001 1.0570647445531961E-002 -7.5369661392937033E-003 -5.6652081433657825E-004 5.6088777916556030E-003 1.8027744284860904E-012 6.9999999371301550E+006 7.0000000000126194E+006 + 54 54 F T -4.3262991917235129E-002 3.2104843753016371E-001 1.3044941970955712E-003 4.8808221042958896E-003 -7.8700284396552255E-004 -2.6030466194339747E-012 6.9999999370993143E+006 6.9999999999817787E+006 + 55 55 F T -1.1054536038054048E-001 -2.2053915217768765E-002 2.1316661446951035E-003 3.3561110337993394E-004 -1.7676596229766522E-003 -9.0085502990991280E-013 6.9999999371112296E+006 6.9999999999936940E+006 + 56 56 F T 1.1641300402734639E-001 8.1871499925746638E-001 -1.9342577908749484E-003 1.0240048717374346E-002 2.0929870447780035E-003 -4.7591914451199955E-012 6.9999999370842213E+006 6.9999999999666857E+006 + 57 57 F T -2.0675544208859888E-002 -3.2221470816959902E-001 -3.4463835077868554E-003 -3.2084283621707163E-003 1.3572384960736940E-003 2.7806631406169218E-014 6.9999999371177303E+006 7.0000000000001946E+006 + 58 58 F T -2.5653291768483460E-001 1.0306967210188848E-001 1.8791602150606036E-003 1.4675071999229830E-003 -2.4264397180535306E-003 -4.5529700160311805E-012 6.9999999370856648E+006 6.9999999999681292E+006 + 59 59 F T -3.8923120076246792E-001 -4.3738074196026555E-001 8.3353911302246602E-003 -4.8260930653074435E-003 -6.7333329498841382E-003 1.2838947036819759E-013 6.9999999371184343E+006 7.0000000000008987E+006 + 60 60 F T -4.4766172891005589E-002 2.8291705984413029E-001 -3.3132907966663223E-004 5.2073905473466967E-003 -5.7279370537352908E-005 -3.3328043862418129E-012 6.9999999370942060E+006 6.9999999999766704E+006 + 61 61 F T -1.3031077673569155E-001 -2.8528195336956007E-002 6.4975348753009698E-003 2.3028946423211756E-003 -4.1753662191770140E-003 6.6682696941492878E-013 6.9999999371222034E+006 7.0000000000046678E+006 + 62 62 F T 2.1319873265920022E-001 -1.2287119073054383E-001 -3.8074895310599975E-003 -2.5207276470317723E-003 3.1592162208523089E-003 3.0315880536888601E-012 6.9999999371387567E+006 7.0000000000212211E+006 + 63 63 F T 1.3731171459487607E-001 1.4569328761727496E-001 -1.3960070454629538E-003 1.0917831268028658E-003 1.6384930570999623E-003 8.8555473033235550E-013 6.9999999371237345E+006 7.0000000000061989E+006 + 64 64 F T 3.6625167393310600E-002 2.9468857954513299E-002 -8.3956698579413776E-004 -9.0733455911995615E-004 7.3009675326448362E-004 2.4533697757404800E-013 6.9999999371192530E+006 7.0000000000017174E+006 diff --git a/test/dist_file_normalised/partDist.dat b/test/dist_file_normalised/partDist.dat new file mode 100644 index 000000000..31a9a2dbf --- /dev/null +++ b/test/dist_file_normalised/partDist.dat @@ -0,0 +1,64 @@ +-1.507930303264015e-01 -5.381640309729848e-03 -2.904927962435731e+00 7.895226745701450e-01 4.179896427187180e-02 8.589192590027847e-01 + 2.568635026373987e-02 -8.951382653649338e-01 3.732923518373877e-01 -4.858655666754789e-01 8.130426478434232e-01 -8.117472264076309e-01 + 4.607229283170273e-01 -3.912106738638522e-01 -8.504309266635313e-02 1.653114250031118e+00 1.140375407456443e+00 1.359084438605301e+00 +-1.306120919440800e+00 -8.647042201054531e-01 -1.102869654240987e+00 2.298461411098033e+00 1.108058619899132e+00 8.066021686718333e-01 + 1.050295832446472e+00 2.873840965723989e+00 4.032166238321975e-01 -4.150074090828770e-01 1.605966064770557e+00 8.771898901152771e-01 +-6.273363919563280e-02 -1.046221143471760e-01 7.679235030324844e-01 -1.712179799501308e+00 -1.451001824512050e+00 1.942977486287533e+00 +-1.092620371456864e+00 7.262640956750835e-01 -1.836584785959944e+00 1.863141360580738e+00 -1.390235179374531e-02 -5.268945149075408e-01 +-6.130661805157634e-01 -2.314113577781045e+00 -1.374591382210294e+00 6.235680131945501e-01 -2.816000207268280e-01 -2.973217258123523e-01 +-8.097856538840266e-01 3.031141156401014e-01 4.559158782787897e-02 5.705228059324031e-01 -1.277096420193923e-01 3.282267588671189e-01 +-1.203714373501652e+00 -3.740027062842148e-01 -5.024928721985980e-01 -1.442315260358201e+00 1.839841090134274e+00 -4.642938615707237e-01 +-2.476073809010331e+00 -7.358457002728908e-01 9.290978496446484e-01 1.341696423566064e+00 -1.847095197567779e+00 -6.273761493900244e-01 +-8.441829193263111e-01 -8.005348473429796e-01 -1.112806589900840e+00 -6.067992255804629e-02 -1.195442480129009e+00 6.512138419951254e-01 +-1.022417050179950e+00 -3.952244309661034e-01 -8.145052799726470e-02 -1.333939220488445e-03 -3.856144250044518e-01 1.526917763738045e+00 + 1.935679782110532e-01 2.139198354108646e-01 -2.265666460318178e+00 1.180053354317377e+00 -2.441174104194578e-01 1.886333680189312e+00 +-1.718444974259677e-01 -6.105584349864340e-01 -5.014952135845810e-01 -1.303342132615030e+00 7.973240680863709e-01 1.339957659822843e+00 +-8.653941887217328e-01 6.763952705230166e-01 1.621350166724034e+00 -8.775725434340298e-01 -3.277366253668398e-01 -2.334220557577324e-01 + 3.067320397882060e-01 8.580656282266212e-01 -6.902131107048949e-01 8.182331322623130e-01 9.161183549296148e-01 -7.958629156885925e-01 +-2.586427669908831e+00 1.008284812123901e+00 1.217492450148878e+00 7.490250692998260e-01 -7.692544530237535e-01 -2.561286813466628e-01 +-2.865511748142672e-01 -7.272440598614378e-01 1.825124320682223e+00 -2.087481710511310e-01 8.138783025325332e-01 9.526054669553825e-01 + 1.443834794584951e-01 -5.165509458872254e-01 -2.966473116838344e+00 1.397824194457310e-01 -4.196881886835739e-03 -4.844924425012215e-01 +-9.248029061456703e-01 6.329401117196670e-02 -1.867630778725511e-01 9.200513601425057e-01 6.898489620786791e-01 -3.170099937140110e-01 + 1.028757785222009e+00 -1.048295680194122e+00 -2.518597480742061e-01 -1.072960712182066e+00 -1.053273028012846e+00 2.309950033236836e+00 + 2.536370726802155e-01 3.754265081434737e-01 4.380395806515414e-01 -2.814833440127158e-01 -1.473111148614998e+00 -2.908421051757132e-01 + 3.215713607786120e-01 7.075150769991985e-01 -2.001908500859619e-01 7.854276697887370e-01 -2.453030919196752e+00 -3.631982721524293e-01 + 2.771446866639221e-01 1.421269067139878e+00 1.080690087703311e+00 2.021449447073472e-01 -7.286161490755030e-01 -1.125183855672357e+00 + 1.523759337428315e+00 1.034702161157159e+00 -4.425209646804299e-04 -5.103637179525018e-01 -1.468425920057571e-01 -6.103740622555690e-01 + 9.314926071688399e-01 6.327699990287833e-01 5.093493583120420e-01 -2.434199605769133e-01 1.712485680360274e-01 9.167714850271529e-01 + 1.004447345522717e+00 6.052979908947600e-01 1.312690394162026e+00 9.613116819107066e-01 -4.528177935326974e-02 1.834965790634847e-01 + 7.370837035325202e-01 -6.474305639452992e-01 1.236079033520076e+00 -5.697904279330642e-01 -1.859020569873539e+00 3.879616406745042e-01 +-1.274951688787666e+00 1.171801129867048e-01 -1.934122351238296e-01 1.212151637127349e+00 -1.098977710994524e+00 -9.679648999289787e-01 +-1.955792760779532e+00 1.720519553234614e+00 -6.075987355291211e-01 1.602842369433934e+00 -2.066531837411793e-01 -6.000756765777129e-01 + 1.331416180529105e+00 6.484954755779353e-01 -2.139675103595094e+00 2.652791916869943e-02 9.562231709490482e-01 6.855498028554251e-01 + 2.628490118294824e+00 -1.652250989946546e+00 6.737136069131912e-02 1.328057346129933e+00 9.361693571827481e-01 -3.936727772065526e-01 + 5.648648006842314e-01 -7.061156747930368e-01 -4.024971595471062e-01 -8.746125679940043e-01 -2.291150974679425e+00 -1.088175960863485e+00 +-2.554134354368414e-01 2.178996983846096e+00 4.932539667378597e-01 -6.356550274251206e-01 -3.353469640246312e-01 -4.925579630869214e-01 + 2.024947838813440e-01 2.020082523545007e+00 -1.434123039767101e+00 1.022050140616549e+00 8.093257989894260e-01 -6.087793974855747e-01 + 7.539791025757089e-01 -1.193874591475328e-01 -4.922395881333838e-01 -1.004809714454978e+00 5.439714677914095e-01 -6.671492689011290e-01 + 5.292357727319986e-01 -9.972716799818100e-01 -1.434346040028122e+00 -1.752459293956245e+00 -6.175037978220433e-01 -1.542798801984664e+00 +-6.440927261741158e-01 -1.149745612650435e+00 -1.608275530699789e+00 1.300309549106114e+00 -3.996088711174842e-01 2.364637270142395e-01 + 1.300554426902775e+00 8.857981518127094e-02 -1.857492981318024e-01 1.869243596944661e+00 5.989272598166708e-01 -1.827452262892292e+00 +-1.734741657539861e-01 -1.517668744647916e+00 1.172618724626203e+00 -1.072420445860288e+00 -3.791125508563641e-01 1.729851545453304e+00 + 4.615380033878539e-01 9.883718482309529e-01 7.117839636865046e-04 -1.186614721469762e+00 2.150464913124726e+00 -2.681054036568943e-01 + 1.782493450117376e+00 5.360793936511986e-01 -2.174688099655127e+00 1.061939975412075e+00 7.265469208955482e-01 -8.476640717893797e-01 +-1.060754502552284e-01 1.626185779141589e+00 -7.487595905066341e-01 4.021415632064287e-01 -4.729090365155760e-01 1.167451502583654e+00 +-2.387382344863043e-01 1.318894824334718e+00 3.900086343570718e-01 2.611115678029885e-02 5.779439589169778e-01 -1.452605179831371e+00 + 2.554177264246806e-01 2.949327444159595e-01 4.069338138022511e-01 6.149809619776739e-01 -2.045478789665965e-01 -1.310512648187476e+00 +-6.063083451891955e-01 -1.554730070895493e+00 2.148771368144295e+00 4.392877804597775e-01 7.772604562057472e-01 -4.533788659017239e-01 +-1.287405646275515e+00 1.571061716557141e+00 4.341749592233825e-01 8.576069854086967e-01 3.059918909558664e-01 1.191964799637190e+00 +-5.029982668416715e-01 2.469256698360305e-01 -4.762529282488895e-02 4.235474211717205e-01 -7.885602485509620e-01 -1.603971533584676e+00 + 1.769403034327472e+00 -1.801157868079163e+00 1.796322326136631e+00 -1.005635055677986e-02 -1.812190210934484e+00 -5.880462704998805e-01 + 1.215901392703522e+00 -1.100069406772862e+00 1.137056756162881e+00 1.203821378216563e+00 -4.294728728835649e-01 1.320472826616632e-01 +-3.977079413290807e-01 -2.814447946268111e-04 -1.775706131657967e+00 4.758212824875528e-01 -4.386706241447205e-02 4.671001149440147e-01 + 1.511516726150424e+00 -1.069054288140125e+00 4.273175883230882e-02 -5.563870538592667e-01 -1.780982102891990e-01 6.250249497672357e-01 +-2.140963184513684e-01 2.942285783953251e-01 1.190368403884813e+00 8.112211801488157e-01 -1.925309516002746e+00 -8.651379977041543e-01 +-5.474693237491955e-01 2.721914966347584e-02 -7.772987572284465e-02 4.906275209641282e-01 -1.026996198216310e+00 -1.017133906153028e+00 + 5.769614799648900e-01 1.595359439693886e-01 3.029689677443902e+00 2.802158686705228e-01 3.674826966037525e-02 -2.999976208156480e-01 +-1.022507058937641e-01 -2.310409668674990e+00 -1.187279675476994e+00 5.591974348233174e-01 -1.086344679415197e+00 -5.206851920173047e-01 +-1.270733304622773e+00 -1.785559304948499e+00 3.846054664059968e-01 1.831980754851653e-01 1.325736026753167e+00 -4.372481731520381e-01 +-1.928164776796477e+00 5.940988537840362e-01 -1.612686608536511e+00 3.773658796389027e-01 5.006914731717020e-01 1.642353529633356e+00 +-2.215008294140172e-01 -7.082039082840395e-01 1.049366549302825e+00 1.447151696284457e+00 4.631967626979233e-01 2.670169837844377e-01 +-6.452748351057596e-01 2.432245148003394e+00 -1.014869357986856e-01 2.142237664234142e+00 -6.452739770622351e-01 -4.533291685719869e-02 + 1.056320611075802e+00 1.323635246119172e-01 -4.503678585767712e-01 -8.316181659526767e-01 -1.791316650766221e+00 -1.216825565547681e+00 + 6.803991445342593e-01 7.216489895580257e-01 5.422792128312550e-01 -5.364402389986322e-01 8.993530616771460e-01 -3.729235023038643e-01 + 1.815381122260724e-01 -8.848215018769938e-02 1.126730812490962e-01 -1.015971140111955e+00 -1.282508674600380e+00 1.157119530705739e+00 From dc1f131d86346a8f03f20ec896a96cc3b4c16304 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 30 Jul 2019 19:43:51 +0200 Subject: [PATCH 31/38] Reshuffled parsing of column formats so the FILL keyword can use the same routine --- source/mod_dist.f90 | 288 +++++++++++++++++++++++++++++++------------- 1 file changed, 203 insertions(+), 85 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index cea6e5336..223962d4c 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -41,7 +41,23 @@ module mod_dist integer, private, save :: dist_numPart = 0 ! Number of actual particles generated or read - ! Column formats + type, private :: dist_fillType + integer :: fillTarget = 0 + integer :: fillMethod = 0 + integer :: firstPart = 0 + integer :: lastPart = 0 + integer, allocatable :: iParams(:) + real(kind=fPrec), allocatable :: fParams(:) + end type dist_fillType + + ! Fill Methods + integer, parameter :: dist_fillNONE = 0 ! No fill + integer, parameter :: dist_fillFIXED = 1 ! Fixed value + integer, parameter :: dist_fillGAUSS = 2 ! Gaussian distribution + integer, parameter :: dist_fillNORMAL = 3 ! Normal distribution + integer, parameter :: dist_fillLINEAR = 4 ! Linear fill + + ! Column Formats ! ================ integer, parameter :: dist_fmtNONE = 0 ! Column ignored integer, parameter :: dist_fmtPartID = 1 ! Paricle ID @@ -300,8 +316,9 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) logical, intent(inout) :: iErr character(len=:), allocatable :: lnSplit(:) - integer nSplit, i - logical spErr, cErr + real(kind=fPrec) fmtFac + integer nSplit, i, fmtID, fmtCol + logical spErr, cErr, isValid call chr_split(inLine, lnSplit, nSplit, spErr) if(spErr) then @@ -323,10 +340,20 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) return end if do i=2,nSplit - call dist_setColumnFormat(lnSplit(i),cErr) - if(cErr) then - iErr = .true. - return + call dist_parseColumn(lnSplit(i),cErr,fmtID,fmtFac,fmtCol,isValid) + if(isValid) then + call dist_appendFormat(fmtID,fmtFac,fmtCol) + if(cErr) then + iErr = .true. + return + end if + else + call dist_setMultiColFormat(lnSplit(i), isValid) + if(isValid .eqv. .false.) then + write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(lnSplit(i))//"'" + iErr = .true. + return + end if end if end do dist_hasFormat = .true. @@ -368,11 +395,6 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end if dist_echo = .true. - case default - write(lerr,"(a)") "DIST> ERROR Unknown keyword '"//trim(lnSplit(1))//"'." - iErr = .true. - return - case("EMIT","EMITTANCE") if(nSplit /= 3) then write(lerr,"(a,i0)") "DIST> ERROR EMITTANCE takes 2 arguments, got ",nSplit-1 @@ -404,6 +426,19 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end if call chr_cast(lnSplit(2), dist_beamSpread, cErr) + case("FILL") + if(nSplit < 3) then + write(lerr,"(a,i0)") "DIST> ERROR FILL takes at least 3 argument, got ",nSplit-1 + iErr = .true. + return + end if + call dist_parseFill(lnSplit, nSplit, iErr) + + case default + write(lerr,"(a)") "DIST> ERROR Unknown keyword '"//trim(lnSplit(1))//"'." + iErr = .true. + return + end select if(cErr) then @@ -413,6 +448,24 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) end subroutine dist_parseInputLine +! ================================================================================================ ! +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-30 +! Updated: 2019-07-30 +! ================================================================================================ ! +subroutine dist_parseFill(lnSplit, nSplit, iErr) + + use crcoall + use mod_alloc + use mod_settings + + character(len=:), allocatable, intent(in) :: lnSplit(:) + integer, intent(in) :: nSplit + logical, intent(inout) :: iErr + + +end subroutine dist_parseFill + ! ================================================================================================ ! ! Parse File Column Formats ! V.K. Berglyd Olsen, BE-ABP-HSS @@ -422,7 +475,7 @@ end subroutine dist_parseInputLine ! This routine splits the unit from the format description and adds the format and the scaling ! factor to the list of format columns for later file parsing. ! ================================================================================================ ! -subroutine dist_setColumnFormat(fmtName, fErr) +subroutine dist_parseColumn(fmtName, fErr, fmtID, fmtFac, fmtCol, isValid) use crcoall use string_tools @@ -430,13 +483,21 @@ subroutine dist_setColumnFormat(fmtName, fErr) character(len=*), intent(in) :: fmtName logical, intent(out) :: fErr + integer, intent(out) :: fmtID + real(kind=fPrec), intent(out) :: fmtFac + integer, intent(out) :: fmtCol + logical, intent(out) :: isValid character(len=20) fmtBase character(len=10) fmtUnit real(kind=fPrec) uFac integer c, unitPos, fmtLen - fErr = .false. + fErr = .false. + fmtID = dist_fmtNONE + fmtFac = one + fmtCol = 0 + isValid = .true. fmtLen = len_trim(fmtName) if(fmtLen < 1) then @@ -463,126 +524,190 @@ subroutine dist_setColumnFormat(fmtName, fErr) select case(chr_toUpper(fmtBase)) case("OFF","SKIP") - call dist_appendFormat(dist_fmtNONE, one, 0) + fmtID = dist_fmtNONE case("ID") - call dist_appendFormat(dist_fmtPartID, one, 0) + fmtID = dist_fmtPartID case("PARENT") - call dist_appendFormat(dist_fmtParentID, one, 0) + fmtID = dist_fmtParentID case("X") - call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtX, uFac, 1) + call dist_unitScale(fmtName, fmtUnit, 1, fmtFac, fErr) + fmtID = dist_fmtX + fmtCol = 1 case("Y") - call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtY, uFac, 3) + call dist_unitScale(fmtName, fmtUnit, 1, fmtFac, fErr) + fmtID = dist_fmtY + fmtCol = 3 case("XP") - call dist_appendFormat(dist_fmtXP, uFac, 2) + fmtID = dist_fmtXP + fmtCol = 2 case("YP") - call dist_appendFormat(dist_fmtYP, uFac, 4) + fmtID = dist_fmtYP + fmtCol = 4 case("PX") - call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtPX, uFac, 2) + call dist_unitScale(fmtName, fmtUnit, 3, fmtFac, fErr) + fmtID = dist_fmtPX + fmtCol = 2 case("PY") - call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtPY, uFac, 4) + call dist_unitScale(fmtName, fmtUnit, 3, fmtFac, fErr) + fmtID = dist_fmtPY + fmtCol = 4 case("PX/P0","PXP0") - call dist_appendFormat(dist_fmtPX, one, 2) + fmtID = dist_fmtPX + fmtCol = 2 case("PY/P0","PYP0") - call dist_appendFormat(dist_fmtPY, one, 4) + fmtID = dist_fmtPY + fmtCol = 4 case("SIGMA") - call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtSIGMA, uFac, 5) + call dist_unitScale(fmtName, fmtUnit, 1, fmtFac, fErr) + fmtID = dist_fmtSIGMA + fmtCol = 5 case("ZETA") - call dist_unitScale(fmtName, fmtUnit, 1, uFac, fErr) - call dist_appendFormat(dist_fmtZETA, uFac, 5) + call dist_unitScale(fmtName, fmtUnit, 1, fmtFac, fErr) + fmtID = dist_fmtZETA + fmtCol = 5 case("DT") - call dist_unitScale(fmtName, fmtUnit, 4, uFac, fErr) - call dist_appendFormat(dist_fmtDT, uFac, 5) + call dist_unitScale(fmtName, fmtUnit, 4, fmtFac, fErr) + fmtID = dist_fmtDT + fmtCol = 5 case("E") - call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtE, uFac, 6) + call dist_unitScale(fmtName, fmtUnit, 3, fmtFac, fErr) + fmtID = dist_fmtE + fmtCol = 6 case("P") - call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtP, uFac, 6) + call dist_unitScale(fmtName, fmtUnit, 3, fmtFac, fErr) + fmtID = dist_fmtP + fmtCol = 6 case("DE/E0","DEE0") - call dist_appendFormat(dist_fmtDEE0, one, 6) + fmtID = dist_fmtDEE0 + fmtCol = 6 case("DP/P0","DPP0","DELTA") - call dist_appendFormat(dist_fmtDPP0, one, 6) + fmtID = dist_fmtDPP0 + fmtCol = 6 case("DE/P0","DEP0","PT") - call dist_appendFormat(dist_fmtPT, one, 6) + fmtID = dist_fmtPT + fmtCol = 6 case("PSIGMA") - call dist_appendFormat(dist_fmtPSIGMA, one, 6) + fmtID = dist_fmtPSIGMA + fmtCol = 6 case("XN") - call dist_appendFormat(dist_fmtXN, one, 1) + fmtID = dist_fmtXN + fmtCol = 1 dist_distLib = dist_distLibNorm case("YN") - call dist_appendFormat(dist_fmtYN, one, 3) + fmtID = dist_fmtYN + fmtCol = 3 dist_distLib = dist_distLibNorm case("ZN") - call dist_appendFormat(dist_fmtZN, one, 5) + fmtID = dist_fmtZN + fmtCol = 5 dist_distLib = dist_distLibNorm case("PXN") - call dist_appendFormat(dist_fmtPXN, one, 2) + fmtID = dist_fmtPXN + fmtCol = 2 dist_distLib = dist_distLibNorm case("PYN") - call dist_appendFormat(dist_fmtPYN, one, 4) + fmtID = dist_fmtPYN + fmtCol = 4 dist_distLib = dist_distLibNorm case("PZN") - call dist_appendFormat(dist_fmtPZN, one, 6) + fmtID = dist_fmtPZN + fmtCol = 6 dist_distLib = dist_distLibNorm case("JX") - call dist_appendFormat(dist_fmtJX, one, 1) + fmtID = dist_fmtJX + fmtCol = 1 dist_distLib = .true. case("JY") - call dist_appendFormat(dist_fmtJY, one, 3) + fmtID = dist_fmtJY + fmtCol = 3 dist_distLib = .true. case("JZ") - call dist_appendFormat(dist_fmtJZ, one, 5) + fmtID = dist_fmtJZ + fmtCol = 5 dist_distLib = .true. case("PHIX") - call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) - call dist_appendFormat(dist_fmtPhiX, uFac, 2) + call dist_unitScale(fmtName, fmtUnit, 2, fmtFac, fErr) + fmtID = dist_fmtPhiX + fmtCol = 2 dist_distLib = .true. case("PHIY") - call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) - call dist_appendFormat(dist_fmtPhiY, uFac, 4) + call dist_unitScale(fmtName, fmtUnit, 2, fmtFac, fErr) + fmtID = dist_fmtPhiY + fmtCol = 4 dist_distLib = .true. case("PHIZ") - call dist_unitScale(fmtName, fmtUnit, 2, uFac, fErr) - call dist_appendFormat(dist_fmtPhiZ, uFac, 6) + call dist_unitScale(fmtName, fmtUnit, 2, fmtFac, fErr) + fmtID = dist_fmtPhiZ + fmtCol = 6 dist_distLib = .true. case("MASS","M") - call dist_unitScale(fmtName, fmtUnit, 3, uFac, fErr) - call dist_appendFormat(dist_fmtMASS, uFac, 0) + call dist_unitScale(fmtName, fmtUnit, 3, fmtFac, fErr) + fmtID = dist_fmtMASS case("CHARGE","Q") - call dist_appendFormat(dist_fmtCHARGE, one, 0) + fmtID = dist_fmtCHARGE case("ION_A") - call dist_appendFormat(dist_fmtIonA, one, 0) + fmtID = dist_fmtIonA case("ION_Z") - call dist_appendFormat(dist_fmtIonZ, one, 0) + fmtID = dist_fmtIonZ case("PDGID") - call dist_appendFormat(dist_fmtPDGID, one, 0) + fmtID = dist_fmtPDGID case("SX") - call dist_appendFormat(dist_fmtSPINX, one, 0) + fmtID = dist_fmtSPINX case("SY") - call dist_appendFormat(dist_fmtSPINY, one, 0) + fmtID = dist_fmtSPINY case("SZ") - call dist_appendFormat(dist_fmtSPINZ, one, 0) + fmtID = dist_fmtSPINZ + + case default + isValid = .false. + return + + end select + +#ifndef DISTLIB + if(dist_distLib) then + write(lerr,"(a)") "DIST> ERROR Format '"//trim(fmtName)//"' requires SixTrack to be built with DISTLIB enabled" + fErr = .true. + return + end if +#endif + +end subroutine dist_parseColumn + +! ================================================================================================ ! +! Parse Multi-Column Formats +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-10 +! ================================================================================================ ! +subroutine dist_setMultiColFormat(fmtName, isValid) + + use string_tools + use numerical_constants + + character(len=*), intent(in) :: fmtName + logical, intent(out) :: isValid + + isValid = .false. + + select case(chr_toUpper(fmtName)) case("4D") ! 4D default coordinates call dist_appendFormat(dist_fmtX, one, 1) call dist_appendFormat(dist_fmtPX, one, 2) call dist_appendFormat(dist_fmtY, one, 3) call dist_appendFormat(dist_fmtPY, one, 4) + isValid = .true. case("6D") ! 6D default coordinates call dist_appendFormat(dist_fmtX, one, 1) @@ -591,6 +716,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtPY, one, 4) call dist_appendFormat(dist_fmtZETA, one, 5) call dist_appendFormat(dist_fmtDPP0, one, 6) + isValid = .true. case("NORM") ! 6D normalised coordinates call dist_appendFormat(dist_fmtXN, one, 1) @@ -600,6 +726,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtZN, one, 5) call dist_appendFormat(dist_fmtPZN, one, 6) dist_distLib = dist_distLibNorm + isValid = .true. case("ACTION") ! 6D action call dist_appendFormat(dist_fmtJX, one, 1) @@ -609,6 +736,7 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtJZ, one, 5) call dist_appendFormat(dist_fmtPhiZ, one, 6) dist_distLib = .true. + isValid = .true. case("IONS") ! The ion columns call dist_appendFormat(dist_fmtMASS, c1e3, 0) @@ -616,11 +744,13 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtIonA, one, 0) call dist_appendFormat(dist_fmtIonZ, one, 0) call dist_appendFormat(dist_fmtPDGID, one, 0) + isValid = .true. case("SPIN") ! The spin columns call dist_appendFormat(dist_fmtSPINX, one, 0) call dist_appendFormat(dist_fmtSPINY, one, 0) call dist_appendFormat(dist_fmtSPINZ, one, 0) + isValid = .true. case("OLD_DIST") ! The old DIST block file format ! This is added for the block to be compatible with the old, fixed column DIST file format. @@ -640,23 +770,10 @@ subroutine dist_setColumnFormat(fmtName, fErr) call dist_appendFormat(dist_fmtMASS, c1e3, 0) call dist_appendFormat(dist_fmtP, c1e3, 6) call dist_appendFormat(dist_fmtDT, one, 5) - - case default - write(lerr,"(a)") "DIST> ERROR Unknown column format '"//trim(fmtName)//"'" - fErr = .true. - return - + isValid = .true. end select -#ifndef DISTLIB - if(dist_distLib) then - write(lerr,"(a)") "DIST> ERROR Format '"//trim(fmtName)//"' requires SixTrack to be built with DISTLIB enabled" - fErr = .true. - return - end if -#endif - -end subroutine dist_setColumnFormat +end subroutine dist_setMultiColFormat ! ================================================================================================ ! ! Parse File Column Units @@ -847,8 +964,9 @@ subroutine dist_readDist character(len=:), allocatable :: lnSplit(:) character(len=mInputLn) inLine - integer i, nSplit, lineNo, fUnit, nRead - logical spErr, cErr + real(kind=fPrec) fmtFac + integer i, nSplit, lineNo, fUnit, nRead, fmtID, fmtCol + logical spErr, cErr, isValid write(lout,"(a)") "DIST> Reading particles from '"//trim(dist_distFile)//"'" @@ -857,7 +975,7 @@ subroutine dist_readDist cErr = .false. if(dist_hasFormat .eqv. .false.) then - call dist_setColumnFormat("OLD_DIST",cErr) + call dist_setMultiColFormat("OLD_DIST",isValid) end if call f_requestUnit(dist_distFile, fUnit) From 0219ee79c85abaaad4a0e8cbe2b5d178df1a52fc Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 30 Jul 2019 20:26:23 +0200 Subject: [PATCH 32/38] Finished parsing code for FILL keyword --- source/mod_dist.f90 | 224 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 202 insertions(+), 22 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 223962d4c..00045426a 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -44,18 +44,20 @@ module mod_dist type, private :: dist_fillType integer :: fillTarget = 0 integer :: fillMethod = 0 - integer :: firstPart = 0 - integer :: lastPart = 0 integer, allocatable :: iParams(:) real(kind=fPrec), allocatable :: fParams(:) end type dist_fillType + type(dist_fillType), allocatable, private, save :: dist_fillList(:) + integer, private, save :: dist_nFill = 0 + ! Fill Methods integer, parameter :: dist_fillNONE = 0 ! No fill - integer, parameter :: dist_fillFIXED = 1 ! Fixed value - integer, parameter :: dist_fillGAUSS = 2 ! Gaussian distribution - integer, parameter :: dist_fillNORMAL = 3 ! Normal distribution - integer, parameter :: dist_fillLINEAR = 4 ! Linear fill + integer, parameter :: dist_fillINT = 1 ! Fixed integer value + integer, parameter :: dist_fillFLOAT = 2 ! Fixed float value + integer, parameter :: dist_fillGAUSS = 3 ! Gaussian distribution + integer, parameter :: dist_fillUNIFORM = 4 ! Uniform distribution + integer, parameter :: dist_fillLINEAR = 5 ! Linear fill ! Column Formats ! ================ @@ -457,12 +459,175 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) use crcoall use mod_alloc - use mod_settings + use string_tools + use numerical_constants character(len=:), allocatable, intent(in) :: lnSplit(:) integer, intent(in) :: nSplit logical, intent(inout) :: iErr + type(dist_fillType), allocatable :: tmpFill(:) + real(kind=fPrec), allocatable :: fParams(:) + integer, allocatable :: iParams(:) + + real(kind=fPrec) fmtFac + integer fmtCol, fillMethod, fillTarget, firstPart, lastPart + logical fErr, cErr, isValid + + fErr = .false. + cErr = .false. + + if(allocated(dist_fillList)) then + allocate(tmpFill(dist_nFill+1)) + tmpFill(1:dist_nFill) = dist_fillList(1:dist_nFill) + call move_alloc(tmpFill, dist_fillList) + dist_nFill = dist_nFill + 1 + else + allocate(dist_fillList(1)) + dist_nFill = 1 + end if + + call dist_parseColumn(lnSplit(2), fErr, fillTarget, fmtFac, fmtCol, isValid) + if(fmtCol > 0) then + if(dist_partFmt(fmtCol) == 0) then + dist_partFmt(fmtCol) = fillTarget + end if + if(dist_partFmt(fmtCol) /= fillTarget) then + call dist_multFormatError(fmtCol) + iErr = .true. + return + end if + end if + + select case(chr_toUpper(lnSplit(3))) + + case("NONE") + fillMethod = dist_fillNONE + allocate(iParams(2)) + iParams(1) = 1 + iParams(2) = -1 + + case("INT") + if(nSplit /= 4 .and. nSplit /= 6) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format INT expected 1 or 3 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column INT value [first last]" + iErr = .true. + return + end if + + allocate(iParams(3)) + + fillMethod = dist_fillINT + iParams(1) = 1 + iParams(2) = -1 + iParams(3) = 0 + + if(nSplit > 3) call chr_cast(lnSplit(4), iParams(3), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), iParams(1), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), iParams(2), cErr) + + case("FLOAT") + if(nSplit /= 4 .and. nSplit /= 6) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format FLOAT expected 1 or 3 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column FLOAT value [first last]" + iErr = .true. + return + end if + + allocate(fParams(1)) + allocate(iParams(2)) + + fillMethod = dist_fillFLOAT + fParams(1) = zero + iParams(1) = 1 + iParams(2) = -1 + + if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), iParams(1), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), iParams(2), cErr) + + case("GAUSS") + if(nSplit /= 6 .and. nSplit /= 7 .and. nSplit /= 9) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format GAUSS expected 3, 4 or 6 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column GAUSS scale sigma mu [cut] [first last]" + iErr = .true. + return + end if + + allocate(fParams(4)) + allocate(iParams(2)) + + fillMethod = dist_fillGAUSS + fParams(1) = one + fParams(2) = one + fParams(3) = zero + fParams(4) = zero + iParams(1) = 1 + iParams(2) = -1 + + if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), fParams(2), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), fParams(3), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), fParams(4), cErr) + if(nSplit > 7) call chr_cast(lnSplit(8), iParams(1), cErr) + if(nSplit > 8) call chr_cast(lnSplit(9), iParams(2), cErr) + + case("UNIFORM") + if(nSplit /= 6 .and. nSplit /= 8) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format UNIFORM expected 3 or 5 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column UNIFORM scale lower upper [first last]" + iErr = .true. + return + end if + + allocate(fParams(4)) + allocate(iParams(2)) + + fillMethod = dist_fillUNIFORM + fParams(1) = one + fParams(2) = zero + fParams(3) = one + iParams(1) = 1 + iParams(2) = -1 + + if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), fParams(2), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), fParams(3), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), iParams(1), cErr) + if(nSplit > 7) call chr_cast(lnSplit(8), iParams(2), cErr) + + case("LINEAR") + if(nSplit /= 5 .and. nSplit /= 7) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format LINEAR expected 2 or 4 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column LINEAR lower upper [first last]" + iErr = .true. + return + end if + + allocate(fParams(4)) + allocate(iParams(2)) + + fillMethod = dist_fillLINEAR + fParams(1) = zero + fParams(2) = one + iParams(1) = 1 + iParams(2) = -1 + + if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), fParams(2), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), iParams(1), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), iParams(2), cErr) + + case default + write(lerr,"(a)") "DIST> ERROR Unknown FILL method '"//trim(lnSplit(3))//"'" + iErr = .true. + return + end select + + dist_fillList(dist_nFill)%fillTarget = fillTarget + dist_fillList(dist_nFill)%fillMethod = fillMethod + dist_fillList(dist_nFill)%iParams = iParams + dist_fillList(dist_nFill)%fParams = fParams end subroutine dist_parseFill @@ -889,27 +1054,42 @@ subroutine dist_appendFormat(fmtID, colScale, partCol) if(dist_partFmt(partCol) == 0) then dist_partFmt(partCol) = fmtID else - write(lerr,"(a,i0)") "DIST> ERROR Multiple formats selected for particle coordinate ",partCol - select case(partCol) - case(1) - write(lerr,"(a)") "DIST> Choose only one of: X, XN, JX" - case(2) - write(lerr,"(a)") "DIST> Choose only one of: XP, PX, PX/P0, PXN, PHIX" - case(3) - write(lerr,"(a)") "DIST> Choose only one of: Y, YN, JY" - case(4) - write(lerr,"(a)") "DIST> Choose only one of: YP, PY, PY/P0, PYN, PHIY" - case(5) - write(lerr,"(a)") "DIST> Choose only one of: SIGMA, ZETA, DT, ZN, JZ" - case(6) - write(lerr,"(a)") "DIST> Choose only one of: E, P, DE/E0, DP/P0, PT, PZN, PHIZ, PSIGMA" - end select + call dist_multFormatError(partCol) call prror end if end if end subroutine dist_appendFormat +! ================================================================================================ ! +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-05 +! Updated: 2019-07-05 +! ================================================================================================ ! +subroutine dist_multFormatError(partCol) + + use crcoall + + integer, intent(in) :: partCol + + write(lerr,"(a,i0)") "DIST> ERROR Multiple formats selected for particle coordinate ",partCol + select case(partCol) + case(1) + write(lerr,"(a)") "DIST> Choose only one of: X, XN, JX" + case(2) + write(lerr,"(a)") "DIST> Choose only one of: XP, PX, PX/P0, PXN, PHIX" + case(3) + write(lerr,"(a)") "DIST> Choose only one of: Y, YN, JY" + case(4) + write(lerr,"(a)") "DIST> Choose only one of: YP, PY, PY/P0, PYN, PHIY" + case(5) + write(lerr,"(a)") "DIST> Choose only one of: SIGMA, ZETA, DT, ZN, JZ" + case(6) + write(lerr,"(a)") "DIST> Choose only one of: E, P, DE/E0, DP/P0, PT, PZN, PHIZ, PSIGMA" + end select + +end subroutine dist_multFormatError + ! ================================================================================================ ! ! Parse PARTICLE Lines from DIST Block ! V.K. Berglyd Olsen, BE-ABP-HSS From d8d2e95624704ef5ff722f1cb30c3987579b7ef4 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Tue, 30 Jul 2019 21:30:45 +0200 Subject: [PATCH 33/38] Code builds, but needs testing --- source/mod_dist.f90 | 311 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 287 insertions(+), 24 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 00045426a..fe96278db 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -40,8 +40,11 @@ module mod_dist integer, private, save :: dist_nParticle = 0 ! Number of PARTICLE keywords in block integer, private, save :: dist_numPart = 0 ! Number of actual particles generated or read + integer, private, save :: dist_seedOne = 0 ! Random seeds + integer, private, save :: dist_seedTwo = 0 ! Random seeds type, private :: dist_fillType + character(len=:), allocatable :: fillName integer :: fillTarget = 0 integer :: fillMethod = 0 integer, allocatable :: iParams(:) @@ -58,6 +61,7 @@ module mod_dist integer, parameter :: dist_fillGAUSS = 3 ! Gaussian distribution integer, parameter :: dist_fillUNIFORM = 4 ! Uniform distribution integer, parameter :: dist_fillLINEAR = 5 ! Linear fill + integer, parameter :: dist_fillCOUNT = 6 ! Integer range ! Column Formats ! ================ @@ -533,10 +537,10 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) iErr = .true. return end if - + allocate(fParams(1)) allocate(iParams(2)) - + fillMethod = dist_fillFLOAT fParams(1) = zero iParams(1) = 1 @@ -547,54 +551,50 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) if(nSplit > 5) call chr_cast(lnSplit(6), iParams(2), cErr) case("GAUSS") - if(nSplit /= 6 .and. nSplit /= 7 .and. nSplit /= 9) then - write(lerr,"(a,i0)") "DIST> ERROR FILL format GAUSS expected 3, 4 or 6 arguments, got ",nSplit-3 - write(lerr,"(a)") "DIST> FILL column GAUSS scale sigma mu [cut] [first last]" + if(nSplit /= 5 .and. nSplit /= 6 .and. nSplit /= 8) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format GAUSS expected 2, 3 or 5 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column GAUSS sigma mu [cut] [first last]" iErr = .true. return end if - - allocate(fParams(4)) + + allocate(fParams(3)) allocate(iParams(2)) - + fillMethod = dist_fillGAUSS fParams(1) = one - fParams(2) = one + fParams(2) = zero fParams(3) = zero - fParams(4) = zero iParams(1) = 1 iParams(2) = -1 if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) if(nSplit > 4) call chr_cast(lnSplit(5), fParams(2), cErr) if(nSplit > 5) call chr_cast(lnSplit(6), fParams(3), cErr) - if(nSplit > 6) call chr_cast(lnSplit(7), fParams(4), cErr) - if(nSplit > 7) call chr_cast(lnSplit(8), iParams(1), cErr) - if(nSplit > 8) call chr_cast(lnSplit(9), iParams(2), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), iParams(1), cErr) + if(nSplit > 7) call chr_cast(lnSplit(8), iParams(2), cErr) case("UNIFORM") - if(nSplit /= 6 .and. nSplit /= 8) then - write(lerr,"(a,i0)") "DIST> ERROR FILL format UNIFORM expected 3 or 5 arguments, got ",nSplit-3 - write(lerr,"(a)") "DIST> FILL column UNIFORM scale lower upper [first last]" + if(nSplit /= 5 .and. nSplit /= 7) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format UNIFORM expected 2 or 4 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column UNIFORM lower upper [first last]" iErr = .true. return end if - allocate(fParams(4)) + allocate(fParams(2)) allocate(iParams(2)) fillMethod = dist_fillUNIFORM - fParams(1) = one - fParams(2) = zero - fParams(3) = one + fParams(1) = zero + fParams(2) = one iParams(1) = 1 iParams(2) = -1 if(nSplit > 3) call chr_cast(lnSplit(4), fParams(1), cErr) if(nSplit > 4) call chr_cast(lnSplit(5), fParams(2), cErr) - if(nSplit > 5) call chr_cast(lnSplit(6), fParams(3), cErr) - if(nSplit > 6) call chr_cast(lnSplit(7), iParams(1), cErr) - if(nSplit > 7) call chr_cast(lnSplit(8), iParams(2), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), iParams(1), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), iParams(2), cErr) case("LINEAR") if(nSplit /= 5 .and. nSplit /= 7) then @@ -604,7 +604,7 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) return end if - allocate(fParams(4)) + allocate(fParams(2)) allocate(iParams(2)) fillMethod = dist_fillLINEAR @@ -618,12 +618,46 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) if(nSplit > 5) call chr_cast(lnSplit(6), iParams(1), cErr) if(nSplit > 6) call chr_cast(lnSplit(7), iParams(2), cErr) + case("COUNT") + if(nSplit /= 5 .and. nSplit /= 7) then + write(lerr,"(a,i0)") "DIST> ERROR FILL format COUNT expected 2 or 4 arguments, got ",nSplit-3 + write(lerr,"(a)") "DIST> FILL column COUNT start step [first last]" + iErr = .true. + return + end if + + allocate(iParams(4)) + + fillMethod = dist_fillCOUNT + iParams(1) = 1 + iParams(2) = -1 + iParams(3) = 1 + iParams(4) = 1 + + if(nSplit > 3) call chr_cast(lnSplit(4), iParams(3), cErr) + if(nSplit > 4) call chr_cast(lnSplit(5), iParams(4), cErr) + if(nSplit > 5) call chr_cast(lnSplit(6), iParams(1), cErr) + if(nSplit > 6) call chr_cast(lnSplit(7), iParams(2), cErr) + case default write(lerr,"(a)") "DIST> ERROR Unknown FILL method '"//trim(lnSplit(3))//"'" iErr = .true. return + end select + if(iParams(1) < 1) then + write(lerr,"(a)") "DIST> ERROR First particle cannot be smaller than 1" + iErr = .true. + return + end if + if(iParams(2) /= -1 .and. iParams(1) > iParams(2)) then + write(lerr,"(a)") "DIST> ERROR First particle to fill cannot be after last particle" + iErr = .true. + return + end if + + dist_fillList(dist_nFill)%fillName = trim(lnSplit(2)) dist_fillList(dist_nFill)%fillTarget = fillTarget dist_fillList(dist_nFill)%fillMethod = fillMethod dist_fillList(dist_nFill)%iParams = iParams @@ -1313,6 +1347,235 @@ subroutine dist_saveParticle(partNo, colNo, inVal, sErr) end subroutine dist_saveParticle +! ================================================================================================ ! +! Run the FILLs +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-30 +! Updated: 2019-07-30 +! ================================================================================================ ! +subroutine dist_doFilles + + use crcoall + use mod_common + use mod_common_main + use, intrinsic :: iso_fortran_env, only : int16 + + integer iFill, j, iA, iB, iVal, fM, fT, intVal + + if(dist_nFill == 0) then + return + end if + + do iFill=1,dist_nFill + + iA = dist_fillList(iFill)%iParams(1) + iB = dist_fillList(iFill)%iParams(2) + if(iB == -1) then + iB = napx + end if + + fM = dist_fillList(iFill)%fillMethod + fT = dist_fillList(iFill)%fillTarget + + select case(fT) + + case(dist_fmtNONE) + return + + case(dist_fmtPartID) + dist_readPartID = .true. + if(fM == dist_fillCOUNT) then + iVal = dist_fillList(iFill)%iParams(3) + do j=iA,iB + partID(j) = iVal + iVal = iVal + dist_fillList(iFill)%iParams(4) + end do + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be COUNT" + call prror + end if + + case(dist_fmtParentID) + write(lerr,"(a)") "DiST> ERROR Variable "//trim(dist_fillList(iFill)%fillName)//" cannot be filled automatically" + call prror + + ! Horizontal Coordinates + ! ======================== + + case(dist_fmtX, dist_fmtXN, dist_fmtJX) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol1, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + case(dist_fmtPX, dist_fmtXP, dist_fmtPXP0, dist_fmtPXN, dist_fmtPhiX) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol2, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + ! Vertical Coordinates + ! ======================== + + case(dist_fmtY, dist_fmtYN, dist_fmtJY) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol3, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + case(dist_fmtPY, dist_fmtYP, dist_fmtPYP0, dist_fmtPYN, dist_fmtPhiY) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol4, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + ! Longitudinal Coordinates + ! ========================== + + case(dist_fmtSIGMA, dist_fmtZETA, dist_fmtDT, dist_fmtZN, dist_fmtJZ) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol5, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + case(dist_fmtE, dist_fmtDEE0, dist_fmtPT, dist_fmtPSIGMA, dist_fmtP, dist_fmtDPP0, dist_fmtPZN, dist_fmtPhiZ) + if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then + call dist_fillThis(dist_partCol6, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + call prror + end if + + ! Ion Columns + ! ============= + + case(dist_fmtMASS) + if(fM == dist_fillFLOAT) then + call dist_fillThis(nucm, iA, iB, fM, dist_fillList(iFill)%fParams) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT" + call prror + end if + dist_readMass = .true. + + case(dist_fmtCHARGE) + if(fM == dist_fillINT) then + nqq(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + call prror + end if + dist_readCharge = .true. + + case(dist_fmtIonA) + if(fM == dist_fillINT) then + naa(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + call prror + end if + dist_readIonA = .true. + + case(dist_fmtIonZ) + if(fM == dist_fillINT) then + nzz(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + call prror + end if + dist_readIonZ = .true. + + case(dist_fmtPDGID) + if(fM == dist_fillINT) then + pdgid(iA:iB) = dist_fillList(iFill)%iParams(3) + else + write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + call prror + end if + dist_readPDGID = .true. + + ! Spin Columns + ! ============== + + ! case(dist_fmtSPINX) + ! call chr_cast(inVal, spin_x(partNo), sErr) + + ! case(dist_fmtSPINY) + ! call chr_cast(inVal, spin_y(partNo), sErr) + + ! case(dist_fmtSPINZ) + ! call chr_cast(inVal, spin_z(partNo), sErr) + + end select + end do + +end subroutine dist_doFilles + +! ================================================================================================ ! +! Fill Arrays +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-30 +! Updated: 2019-07-30 +! ================================================================================================ ! +subroutine dist_fillThis(fillArray, iA, iB, fillMethod, fParams) + + use mod_ranecu + + real(kind=fPrec), intent(inout) :: fillArray(*) + integer, intent(in) :: iA, iB + integer, intent(in) :: fillMethod + real(kind=fPrec), intent(in) :: fParams(*) + + integer tmpOne, tmpTwo, nRnd, j + real(kind=fPrec) rndVals(iB-iA+1), dStep + + nRnd = iB-iA+1 + + select case(fillMethod) + + case(dist_fillFLOAT) + fillArray(iA:iB) = fParams(1) + + case(dist_fillGAUSS) + call recuut(tmpOne, tmpTwo) + call recuin(dist_seedOne, dist_seedTwo) + + call ranecu(rndVals, nRnd, 5) + fillArray(iA:iB) = rndVals*fParams(1) + fParams(2) + + call recuut(dist_seedOne, dist_seedTwo) + call recuin(tmpOne, tmpTwo) + + case(dist_fillUNIFORM) + call recuut(tmpOne, tmpTwo) + call recuin(dist_seedOne, dist_seedTwo) + + call ranecu(rndVals, nRnd, -1) + fillArray(iA:iB) = rndVals*(fParams(2)-fParams(1)) + fParams(1) + + call recuut(dist_seedOne, dist_seedTwo) + call recuin(tmpOne, tmpTwo) + + case(dist_fillLINEAR) + dStep = (fParams(2)-fParams(1))/real(iB-iA,kind=fPrec) + do j=iA,iB + fillArray(j) = fParams(1) + dStep*real(j-iA,kind=fPrec) + end do + + end select + +end subroutine dist_fillThis + ! ================================================================================================ ! ! Post-Processing of Particle Arrays ! V.K. Berglyd Olsen, BE-ABP-HSS From 08c1a2fc4303150e67260185b9220d681da08907 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 31 Jul 2019 10:56:18 +0200 Subject: [PATCH 34/38] Let ranecu take sigma cut as a real instead of an integer --- source/dynk.f90 | 12 ++++++------ source/mod_dist.f90 | 4 ++-- source/mod_fluc.f90 | 2 +- source/ranecu.f90 | 45 +++++++++++++++++++++++++-------------------- source/scatter.f90 | 4 ++-- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/source/dynk.f90 b/source/dynk.f90 index 2c9fcc97b..e16660d7b 100644 --- a/source/dynk.f90 +++ b/source/dynk.f90 @@ -2072,7 +2072,7 @@ recursive real(kind=fPrec) function dynk_computeFUN(funNum, turn) result(retval) call recuut(tmpseed1,tmpseed2) call recuin(dynk_iData(dynk_funcs(funNum,3)+3),dynk_iData(dynk_funcs(funNum,3)+4)) ! Run generator for 1 value with current mcut - call ranecu(ranecu_rvec,1,dynk_iData(dynk_funcs(funNum,3)+2)) + call ranecu(ranecu_rvec, 1, 1, real(dynk_iData(dynk_funcs(funNum,3)+2),kind=fPrec)) ! Save our current seeds and load old seeds call recuut(dynk_iData(dynk_funcs(funNum,3)+3),dynk_iData(dynk_funcs(funNum,3)+4)) call recuin(tmpseed1,tmpseed2) @@ -2083,8 +2083,8 @@ recursive real(kind=fPrec) function dynk_computeFUN(funNum, turn) result(retval) ! Save old seeds and load our current seeds call recuut(tmpseed1,tmpseed2) call recuin(dynk_iData(dynk_funcs(funNum,3)+2),dynk_iData(dynk_funcs(funNum,3)+3)) - ! Run generator for 1 value with mcut=-1 - call ranecu( ranecu_rvec, 1, -1 ) + ! Run generator for 1 value in uniform mode + call ranecu(ranecu_rvec, 1, 0) ! Save our current seeds and load old seeds call recuut(dynk_iData(dynk_funcs(funNum,3)+2),dynk_iData(dynk_funcs(funNum,3)+3)) call recuin(tmpseed1,tmpseed2) @@ -2094,14 +2094,14 @@ recursive real(kind=fPrec) function dynk_computeFUN(funNum, turn) result(retval) ! Save old seeds and load our current seeds call recuut(tmpseed1,tmpseed2) call recuin(dynk_iData(dynk_funcs(funNum,3)+2),dynk_iData(dynk_funcs(funNum,3)+3)) - ! Run generator for 1 value with mcut=-1 - call ranecu( ranecu_rvec, 1, -1 ) + ! Run generator for 1 value in uniform mode + call ranecu(ranecu_rvec, 1, 0) ! Save our current seeds and load old seeds call recuut(dynk_iData(dynk_funcs(funNum,3)+2),dynk_iData(dynk_funcs(funNum,3)+3)) call recuin(tmpseed1,tmpseed2) ! routine for switching element (orginially the electron lens) ON or OFF ! when random value is less than P, set ON, else OFF - if (ranecu_rvec(1) .lt. dynk_fData(dynk_funcs(funNum,4))) then + if(ranecu_rvec(1) .lt. dynk_fData(dynk_funcs(funNum,4))) then retval = 1.0 else retval = 0.0 diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index fe96278db..c5aa3ba44 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -1550,7 +1550,7 @@ subroutine dist_fillThis(fillArray, iA, iB, fillMethod, fParams) call recuut(tmpOne, tmpTwo) call recuin(dist_seedOne, dist_seedTwo) - call ranecu(rndVals, nRnd, 5) + call ranecu(rndVals, nRnd, 1) fillArray(iA:iB) = rndVals*fParams(1) + fParams(2) call recuut(dist_seedOne, dist_seedTwo) @@ -1560,7 +1560,7 @@ subroutine dist_fillThis(fillArray, iA, iB, fillMethod, fParams) call recuut(tmpOne, tmpTwo) call recuin(dist_seedOne, dist_seedTwo) - call ranecu(rndVals, nRnd, -1) + call ranecu(rndVals, nRnd, 0) fillArray(iA:iB) = rndVals*(fParams(2)-fParams(1)) + fParams(1) call recuut(dist_seedOne, dist_seedTwo) diff --git a/source/mod_fluc.f90 b/source/mod_fluc.f90 index 54f418c25..c16b49ff9 100644 --- a/source/mod_fluc.f90 +++ b/source/mod_fluc.f90 @@ -144,7 +144,7 @@ subroutine fluc_moreRandomness real(kind=fPrec) :: tmpRnd(newRnd) call recuin(fluc_iSeed1, fluc_iSeed2) - call ranecu(tmpRnd, newRnd, mcut) + call ranecu(tmpRnd, newRnd, 1, real(mcut,kind=fPrec)) call recuut(fluc_iSeed1, fluc_iSeed2) if(nzfz == -1) nzfz = 0 diff --git a/source/ranecu.f90 b/source/ranecu.f90 index 73644473b..140fa5af6 100644 --- a/source/ranecu.f90 +++ b/source/ranecu.f90 @@ -32,29 +32,34 @@ module mod_ranecu contains -! Generate LEN random numbers into RVEC -! If mcut == 0, generate normal distributed random numbers -! If mcut > 0, generate normal distributed random numbers r <= mcut -! If mcut == -1, generate uniformly distributed random numbers -subroutine ranecu(rvec,len,mcut) +! Generate LEN random numbers into RVEC with optional sigma cut if normal +! mode 0 : Generate uniformly distributed random numbers +! mode 1 : Generate normal distributed random numbers +subroutine ranecu(rvec, len, mode, cut) use crcoall use floatPrecision use mathlib_bouncer use numerical_constants - implicit none - real(kind=fPrec), intent(out), dimension(*) :: rvec - integer, intent(in) :: len, mcut + real(kind=fPrec), intent(out) :: rvec(*) + integer, intent(in) :: len + integer, intent(in) :: mode + real(kind=fPrec), optional, intent(in) :: cut + + real(kind=fPrec) rvec0, r(2), docut + integer i, iz, j, k - integer i,iz,j,k - real(kind=fPrec) rvec0 - real(kind=fPrec), dimension(2) :: r + if(present(cut)) then + docut = cut + else + docut = zero + end if - i=1 + i = 1 rvec0 = zero - if(mcut < -1) then - write(lerr,"(a,i0)") "RANECU> ERROR mcut must be greater or equal to -1, got ", mcut + if(mode /= 0 .and. mode /= 1) then + write(lerr,"(a,i0)") "RANECU> ERROR mode must be 0 (uniform) or 1 (normal), got ", mode call prror end if @@ -71,19 +76,19 @@ subroutine ranecu(rvec,len,mcut) r(j) = real(iz,fPrec)*4.656613e-10_fPrec end do - if (mcut >= 0) then ! mcut = -1 => Generate uniform numbers! + if(mode == 1) then ! Convert r(1), r(2) from U(0,1) -> rvec0 as Gaussian with cutoff mcut (#sigmas): - rvec0 = sqrt(((-one*two)*log_mb(r(1))))*cos_mb((two*pi)*r(2)) - else if (mcut == -1) then + rvec0 = sqrt((-one*two)*log_mb(r(1))) * cos_mb(twopi*r(2)) + else rvec0 = r(1) end if - if(abs(rvec0) <= real(mcut,fPrec) .or. mcut == 0 .or. mcut == -1) then + if(mode == 0 .or. docut <= zero .or. abs(rvec0) <= docut) then rvec(i) = rvec0 - i=i+1 + i = i + 1 end if + if(i <= len) goto 10 - return end subroutine ranecu diff --git a/source/scatter.f90 b/source/scatter.f90 index 0fe82a228..21b0c4f37 100644 --- a/source/scatter.f90 +++ b/source/scatter.f90 @@ -911,7 +911,7 @@ subroutine scatter_thin(iElem, ix, turn) end do ! Generate random numbers for probability, branching ratio and phi angle - call ranecu(rndVals, napx*3, -1) + call ranecu(rndVals, napx*3, 0) ! Loop over particles do j=1,napx @@ -1380,7 +1380,7 @@ function scatter_generator_getPPElastic(a, b1, b2, phi, tmin) result(t) maxItt = 1000000 do nItt = nItt + 1 - call ranecu(rndArr, 3, -1) + call ranecu(rndArr, 3, 0) ! Randomly switch between g1 and g3 according to probability if(rndArr(1) > prob3) then From 11c660456faf9bee25044a61f4085a668db152c3 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 31 Jul 2019 14:54:07 +0200 Subject: [PATCH 35/38] DISTlib interface with normalisation now works --- source/mod_dist.f90 | 129 +++++++----- source/postprocessing.f90 | 2 + test/dist_file_normalised/fort.3 | 26 ++- .../initial_state.dat.canonical | 198 +++++++++++------- test/dist_file_normalised/partDist.dat | 64 ------ 5 files changed, 216 insertions(+), 203 deletions(-) delete mode 100644 test/dist_file_normalised/partDist.dat diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index c5aa3ba44..65c431e13 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -24,7 +24,7 @@ module mod_dist logical, private, save :: dist_hasFormat = .false. ! Whether the FORMAT keyword exists in block or not logical, private, save :: dist_libRead = .false. ! Read file with dist library instead of internal reader logical, private, save :: dist_distLib = .false. ! DISTlib is needed to generate the distribution requested - logical, private, save :: dist_distLibNorm = .false. ! DISTlib is used to convert normalised coordinates + logical, private, save :: dist_distLibNorm = .true. ! DISTlib is used to convert normalised coordinates character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution real(kind=fPrec), public, save :: dist_beamEmit(2) = zero ! Beam emittance for generator and normalisation @@ -40,8 +40,8 @@ module mod_dist integer, private, save :: dist_nParticle = 0 ! Number of PARTICLE keywords in block integer, private, save :: dist_numPart = 0 ! Number of actual particles generated or read - integer, private, save :: dist_seedOne = 0 ! Random seeds - integer, private, save :: dist_seedTwo = 0 ! Random seeds + integer, private, save :: dist_seedOne = -1 ! Random seeds + integer, private, save :: dist_seedTwo = -1 ! Random seeds type, private :: dist_fillType character(len=:), allocatable :: fillName @@ -175,30 +175,30 @@ end subroutine distlib_setEmittance3 subroutine distlib_setTasMatrix(flatTas) bind(C, name="settasmatrix") use, intrinsic :: iso_c_binding - real(kind=C_DOUBLE), dimension(36), intent(in) :: flatTas + real(kind=C_DOUBLE), intent(in) :: flatTas(36) end subroutine distlib_setTasMatrix subroutine distlib_setCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen, cType) bind(C, name="setcoords") use, intrinsic :: iso_c_binding - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr1 - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr2 - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr3 - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr4 - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr5 - real(kind=C_DOUBLE), dimension(*), intent(in) :: arr6 - integer(kind=C_INT), intent(in) :: arrLen - integer(kind=C_INT), intent(in) :: cType + real(kind=C_DOUBLE), intent(in) :: arr1(*) + real(kind=C_DOUBLE), intent(in) :: arr2(*) + real(kind=C_DOUBLE), intent(in) :: arr3(*) + real(kind=C_DOUBLE), intent(in) :: arr4(*) + real(kind=C_DOUBLE), intent(in) :: arr5(*) + real(kind=C_DOUBLE), intent(in) :: arr6(*) + integer(kind=C_INT), value, intent(in) :: arrLen + integer(kind=C_INT), value, intent(in) :: cType end subroutine distlib_setCoords subroutine distlib_getCoords(arr1, arr2, arr3, arr4, arr5, arr6, arrLen) bind(C, name="get6trackcoord") use, intrinsic :: iso_c_binding - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr1 - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr2 - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr3 - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr4 - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr5 - real(kind=C_DOUBLE), dimension(*), intent(inout) :: arr6 - integer(kind=C_INT), intent(inout) :: arrLen + real(kind=C_DOUBLE), intent(inout) :: arr1(*) + real(kind=C_DOUBLE), intent(inout) :: arr2(*) + real(kind=C_DOUBLE), intent(inout) :: arr3(*) + real(kind=C_DOUBLE), intent(inout) :: arr4(*) + real(kind=C_DOUBLE), intent(inout) :: arr5(*) + real(kind=C_DOUBLE), intent(inout) :: arr6(*) + integer(kind=C_INT), intent(inout) :: arrLen end subroutine distlib_getCoords end interface @@ -232,7 +232,7 @@ subroutine dist_generateDist call alloc(dist_partCol5, napx, zero, "dist_partCol5") call alloc(dist_partCol6, napx, zero, "dist_partCol6") - dist_tMat(1:6,1:6) = tas(1:6,1:6)*c1m3 + dist_tMat(1:6,1:6) = tas(1:6,1:6) dist_tMat(1:5,6) = dist_tMat(1:5,6)*c1m3 dist_tMat(6,1:5) = dist_tMat(6,1:5)*c1e3 @@ -250,7 +250,6 @@ subroutine dist_generateDist if(dist_nParticle > 0) then ! Particles are read from DIST block in fort.3 call dist_parseParticles - call dist_postprParticles elseif(dist_distFile /= " ") then if(dist_libRead) then ! Particles are read entirely in DISTlib @@ -259,13 +258,15 @@ subroutine dist_generateDist #endif else call dist_readDist - call dist_postprParticles end if end if + call dist_doFills ! Do fills, and if requested, overwrite what is read from file + call dist_postprParticles ! Copy 6D temp arrays to their correct ones, or send to DISTlib #ifdef DISTLIB if(dist_distLib) then ! Our final coordinates are taken from DISTlib + ! The 6D temp arrays were sent to DISTlib in dist_postprParticles distLibPart = napx call distlib_getCoords( & dist_partCol1, dist_partCol2, dist_partCol3, & @@ -314,6 +315,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) use parpro use mod_alloc use mod_units + use mod_ranecu use string_tools use numerical_constants @@ -323,7 +325,7 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) character(len=:), allocatable :: lnSplit(:) real(kind=fPrec) fmtFac - integer nSplit, i, fmtID, fmtCol + integer nSplit, i, fmtID, fmtCol, tmpOne, tmpTwo logical spErr, cErr, isValid call chr_split(inLine, lnSplit, nSplit, spErr) @@ -438,7 +440,19 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) iErr = .true. return end if - call dist_parseFill(lnSplit, nSplit, iErr) + call dist_parseFill(lnSplit, nSplit, cErr) + + case("SEED") + if(nSplit /= 2) then + write(lerr,"(a,i0)") "DIST> ERROR SEED takes 1 argument, got ",nSplit-1 + iErr = .true. + return + end if + call chr_cast(lnSplit(2), dist_seedOne, cErr) + call recuut(tmpOne, tmpTwo) + call recuinit(dist_seedOne) + call recuut(dist_seedOne, dist_seedTwo) + call recuin(tmpOne, tmpTwo) case default write(lerr,"(a)") "DIST> ERROR Unknown keyword '"//trim(lnSplit(1))//"'." @@ -506,8 +520,12 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) select case(chr_toUpper(lnSplit(3))) case("NONE") - fillMethod = dist_fillNONE + + allocate(fParams(1)) allocate(iParams(2)) + + fillMethod = dist_fillNONE + fParams(1) = zero iParams(1) = 1 iParams(2) = -1 @@ -519,9 +537,11 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) return end if + allocate(fParams(1)) allocate(iParams(3)) fillMethod = dist_fillINT + fParams(1) = zero iParams(1) = 1 iParams(2) = -1 iParams(3) = 0 @@ -626,9 +646,11 @@ subroutine dist_parseFill(lnSplit, nSplit, iErr) return end if + allocate(fParams(1)) allocate(iParams(4)) fillMethod = dist_fillCOUNT + fParams(1) = zero iParams(1) = 1 iParams(2) = -1 iParams(3) = 1 @@ -1353,7 +1375,7 @@ end subroutine dist_saveParticle ! Created: 2019-07-30 ! Updated: 2019-07-30 ! ================================================================================================ ! -subroutine dist_doFilles +subroutine dist_doFills use crcoall use mod_common @@ -1366,6 +1388,9 @@ subroutine dist_doFilles return end if + ! If we have fills, we consider all particles generated + dist_numPart = napx + do iFill=1,dist_nFill iA = dist_fillList(iFill)%iParams(1) @@ -1377,6 +1402,11 @@ subroutine dist_doFilles fM = dist_fillList(iFill)%fillMethod fT = dist_fillList(iFill)%fillTarget + if((fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM) .and. dist_seedOne < 1) then + write(lerr,"(a)") "DIST> ERROR Random number fill requested, but no SEED provided in DIST block" + call prror + end if + select case(fT) case(dist_fmtNONE) @@ -1391,12 +1421,12 @@ subroutine dist_doFilles iVal = iVal + dist_fillList(iFill)%iParams(4) end do else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be COUNT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be COUNT" call prror end if case(dist_fmtParentID) - write(lerr,"(a)") "DiST> ERROR Variable "//trim(dist_fillList(iFill)%fillName)//" cannot be filled automatically" + write(lerr,"(a)") "DIST> ERROR Variable "//trim(dist_fillList(iFill)%fillName)//" cannot be filled automatically" call prror ! Horizontal Coordinates @@ -1406,7 +1436,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol1, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1414,7 +1444,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol2, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1425,7 +1455,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol3, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1433,7 +1463,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol4, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1444,7 +1474,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol5, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1452,7 +1482,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT .or. fM == dist_fillGAUSS .or. fM == dist_fillUNIFORM .or. fM == dist_fillLINEAR) then call dist_fillThis(dist_partCol6, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT, GAUSS, UNIFORM or LINEAR" call prror end if @@ -1463,7 +1493,7 @@ subroutine dist_doFilles if(fM == dist_fillFLOAT) then call dist_fillThis(nucm, iA, iB, fM, dist_fillList(iFill)%fParams) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be FLOAT" call prror end if dist_readMass = .true. @@ -1472,7 +1502,7 @@ subroutine dist_doFilles if(fM == dist_fillINT) then nqq(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" call prror end if dist_readCharge = .true. @@ -1481,7 +1511,7 @@ subroutine dist_doFilles if(fM == dist_fillINT) then naa(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" call prror end if dist_readIonA = .true. @@ -1490,7 +1520,7 @@ subroutine dist_doFilles if(fM == dist_fillINT) then nzz(iA:iB) = int(dist_fillList(iFill)%iParams(3), kind=int16) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" call prror end if dist_readIonZ = .true. @@ -1499,7 +1529,7 @@ subroutine dist_doFilles if(fM == dist_fillINT) then pdgid(iA:iB) = dist_fillList(iFill)%iParams(3) else - write(lerr,"(a)") "DiST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" + write(lerr,"(a)") "DIST> ERROR FILL "//trim(dist_fillList(iFill)%fillName)//" must be INT" call prror end if dist_readPDGID = .true. @@ -1507,19 +1537,14 @@ subroutine dist_doFilles ! Spin Columns ! ============== - ! case(dist_fmtSPINX) - ! call chr_cast(inVal, spin_x(partNo), sErr) - - ! case(dist_fmtSPINY) - ! call chr_cast(inVal, spin_y(partNo), sErr) - - ! case(dist_fmtSPINZ) - ! call chr_cast(inVal, spin_z(partNo), sErr) + case(dist_fmtSPINX, dist_fmtSPINY, dist_fmtSPINZ) + write(lerr,"(a)") "DIST> ERROR Variable "//trim(dist_fillList(iFill)%fillName)//" cannot be filled automatically" + call prror end select end do -end subroutine dist_doFilles +end subroutine dist_doFills ! ================================================================================================ ! ! Fill Arrays @@ -1550,7 +1575,7 @@ subroutine dist_fillThis(fillArray, iA, iB, fillMethod, fParams) call recuut(tmpOne, tmpTwo) call recuin(dist_seedOne, dist_seedTwo) - call ranecu(rndVals, nRnd, 1) + call ranecu(rndVals, nRnd, 1, fParams(3)) fillArray(iA:iB) = rndVals*fParams(1) + fParams(2) call recuut(dist_seedOne, dist_seedTwo) @@ -1721,6 +1746,12 @@ subroutine dist_postprParticles end subroutine dist_postprParticles +! ================================================================================================ ! +! Apply normalisation matrix +! V.K. Berglyd Olsen, BE-ABP-HSS +! Created: 2019-07-30 +! Updated: 2019-07-30 +! ================================================================================================ ! subroutine dist_normToPhysical use mod_common diff --git a/source/postprocessing.f90 b/source/postprocessing.f90 index ce081cb0a..1edc31ee6 100644 --- a/source/postprocessing.f90 +++ b/source/postprocessing.f90 @@ -3445,6 +3445,8 @@ subroutine writebin(nthinerr) ! partID(ia)=particle ID that is not changing ! (the particle arrays are compressed to remove lost particles) ! In the case of no lost particles, all partID(i)=i for 1..npart + ! FIXME: This logic assumes partID(ia)+1 exists, which it may very well not! + ! This only works if the largest particle ID is in the last position. if(.not.pstop(partID(ia)).and..not.pstop(partID(ia)+1).and. & & (mod(partID(ia),2).ne.0)) then !Skip odd particle IDs diff --git a/test/dist_file_normalised/fort.3 b/test/dist_file_normalised/fort.3 index b8e22b13b..0488740af 100644 --- a/test/dist_file_normalised/fort.3 +++ b/test/dist_file_normalised/fort.3 @@ -2,25 +2,33 @@ GEOMETRY SETTINGS------------------------------------------------------------------------ DEBUG - INITIALSTATE text + INITIALSTATE text ions NEXT SIMULATION---------------------------------------------------------------------- - PARTICLES 64 - TURNS 1 + PARTICLES 100 + TURNS 10 LATTICE Thin 6D - 6D_CLORB off - WRITE_TRACKS 100 off + 6D_CLORB on + WRITE_TRACKS 100000 off REF_PARTICLE 938.272046 REF_ENERGY 1500.0 NEXT DIST---------------------------------------------------------------------------- - FORMAT XN PXN YN PYN ZN PZN - READ partDist.dat EMITTANCE 2.5 2.5 - ! PARTICLE 0.0 0.0 0.0 0.0 0.0 0.0 - ! PARTICLE 0.0 0.0 0.0 0.0 0.0 0.0 + SEED 12 + FILL ID COUNT 1 1 + FILL XN GAUSS 1.0 0.0 5.0 + FILL PXN GAUSS 1.0 0.0 5.0 + FILL YN GAUSS 1.0 0.0 5.0 + FILL PYN GAUSS 1.0 0.0 5.0 + FILL ZN GAUSS 0.8 0.0 5.0 + FILL PZN GAUSS 0.5 0.0 5.0 + FILL ION_A INT 1 + FILL ION_Z INT 1 + FILL CHARGE INT 1 + FILL MASS FLOAT 938.272046 NEXT ITERATION ERRORS---------------------------------------------------------------- diff --git a/test/dist_file_normalised/initial_state.dat.canonical b/test/dist_file_normalised/initial_state.dat.canonical index f7cd2d534..d4e4cd70c 100644 --- a/test/dist_file_normalised/initial_state.dat.canonical +++ b/test/dist_file_normalised/initial_state.dat.canonical @@ -1,91 +1,127 @@ # Tracking -# NPart Start = 64 -# NPart End = 64 -# NPart Allocated = 64 -# NTurns = 1 +# NPart Start = 100 +# NPart End = 100 +# NPart Allocated = 100 +# NTurns = 10 # # Reference Particle -# Mass [MeV] = 9.3827208099999996E+002 -# Energy [MeV] = 7.0000000000000000E+006 -# Momentum [MeV] = 6.9999999371175356E+006 +# Mass [MeV] = 9.3827204600000005E+002 +# Energy [MeV] = 1.5000000000000000E+003 +# Momentum [MeV] = 1.1703185753011758E+003 # Atomic Mass = 1 # Atomic Number = 1 # Charge = 1 # # Closed Orbit [x, xp, y, yp, sigma, dp] -# 4D Closed Orbit = -3.2280334787479100E-005 -4.6741875080442047E-007 -1.0194052248268459E-003 -1.7674013726847821E-005 -# 6D Closed Orbit = 4.9173116536874216E-006 -1.5377097178679476E-008 -1.0147494098421367E-003 -1.7575639394281780E-005 -8.7705956092793479E-005 -7.5229931935567869E-008 +# 4D Closed Orbit = -1.5498722213546328E+000 -4.3500010391828145E-002 -1.4989124120633555E+001 1.7237369151616875E+000 +# 6D Closed Orbit = -1.5489235141985989E+000 -4.3473605825315120E-002 -1.4989261289375516E+001 1.7237444642071489E+000 -4.2107237039057596E-002 1.5435395404834125E-006 # -# Tune = 6.2306170798050339E+001 6.0316093542966165E+001 2.1119019919086175E-003 -# TAS(1,1:6) = 1.1026611622260727E+001 -1.3841528429557621E-014 -1.8128683388652947E-004 -7.7765797325635752E-004 7.9567458121134797E-005 -1.8808177728675490E-002 -# TAS(2,1:6) = -2.0823074850137233E-001 9.0689689328298656E-002 9.9961774344938424E-006 1.2946448657504582E-005 1.6159506907958524E-006 -2.2856466833874283E-004 -# TAS(3,1:6) = 2.8346682515039556E-004 -1.0424149340585514E-003 1.4780518222381009E+001 1.2442648803037091E-016 1.6177305374236983E-005 -2.3543575887285955E-003 -# TAS(4,1:6) = 8.3292403019612394E-006 -1.1490211112947131E-005 1.7869704968280409E-001 6.7656626111997978E-002 1.1302914017338810E-007 -4.9745402392893697E-005 -# TAS(5,1:6) = 1.6921630830361578E-001 -4.4842304564229732E-002 8.2631251122661977E-003 -4.1986215755472171E-003 2.6289175738882758E+001 -2.4622349634461342E-015 -# TAS(6,1:6) = 9.6737381282840746E-008 4.6508592999757142E-008 -1.0560521644754546E-007 -1.1665645336676098E-008 -1.8818283215480197E-004 3.8038468693897355E-002 +# Tune = 1.1939580566902230E+000 1.1927142768866879E+000 4.5375143182007568E-002 +# TAS(1,1:6) = 5.0575676953128488E+000 -3.3870888240479871E-015 2.8806797574983120E-003 -1.9091230819892593E-003 6.6567796668340036E-004 5.1166711173457773E-002 +# TAS(2,1:6) = 2.6897044343621834E-001 1.9771761320049092E-001 2.2671821888737428E-004 1.1265393279688216E-005 -5.5348174208300581E-004 1.5045674851595922E-003 +# TAS(3,1:6) = -1.9066179617558249E-003 -1.2665946113833268E-003 3.3963739014102718E+000 1.1895196927328681E-015 1.4316453082114900E-003 -7.4438890648758100E-003 +# TAS(4,1:6) = 1.9714155052385097E-004 -1.0780501610546031E-004 -1.5509111235773113E-001 2.9443097664480766E-001 1.4108128451493176E-004 5.6558841502251528E-004 +# TAS(5,1:6) = 7.8669428379806436E-002 1.2937578591225055E-001 -9.7076149174573322E-003 -2.7980431022808196E-002 1.2786197210833075E+001 -4.7046131016399247E-016 +# TAS(6,1:6) = -2.3296675479710709E-004 -1.0281192838804185E-005 5.4702830656052533E-005 -3.2887901422474877E-005 1.4164465116485263E-006 7.8206897813173568E-002 # -# partID parentID lost prim x y xp yp sigma dp p e - 1 1 F T -3.0471361853131367E-002 -7.8699812014283199E-001 5.6504689278208213E-004 -8.5423775794619527E-003 -9.6276794816487236E-004 5.1753595936295518E-012 6.9999999371537631E+006 7.0000000000362275E+006 - 2 2 F T 5.1581717744697032E-003 9.9998451194957969E-002 -1.5844753859955028E-003 6.0187579279339504E-004 9.0816462339509589E-004 -1.3344522153295562E-012 6.9999999371081945E+006 6.9999999999906588E+006 - 3 3 F T 9.2941114826373059E-002 -2.4019415297248485E-002 -2.4057375965491818E-003 1.7516688149500008E-003 1.6083553554512727E-003 2.9416489013894801E-013 6.9999999371195948E+006 7.0000000000020592E+006 - 4 4 F T -2.6370106206964011E-001 -2.9940996461369968E-001 3.5430231251261136E-003 -7.7871989841501012E-004 -3.6795318412109848E-003 -1.4078936533018308E-012 6.9999999371076804E+006 6.9999999999901447E+006 - 5 5 F T 2.1197387135313528E-001 1.0802837245999210E-001 7.6695180672881817E-004 7.8688432240832916E-004 9.8725753636441085E-004 3.6157934053849799E-012 6.9999999371428462E+006 7.0000000000253106E+006 - 6 6 F T -1.2673202270962620E-002 2.0675712749631567E-001 6.4708691915709858E-005 3.7381144101074815E-004 1.3930945419839610E-004 -1.3190188696687159E-012 6.9999999371083025E+006 6.9999999999907669E+006 - 7 7 F T -2.2059747299215901E-001 -4.9795841658744860E-001 5.3701854302629862E-003 -3.7182702677770177E-003 -4.4016891403440674E-003 1.8360359493068671E-012 6.9999999371303879E+006 7.0000000000128523E+006 - 8 8 F T -1.2378363520450637E-001 -3.7289767991267392E-001 -1.5054246268851920E-003 -3.7415104609677444E-003 -2.5531190132087295E-004 -5.3165214879929281E-013 6.9999999371138141E+006 6.9999999999962784E+006 - 9 9 F T -1.6349530041691560E-001 1.1306193989868716E-002 3.5896280084502219E-003 8.3786842844957386E-004 -2.7941750458947124E-003 -1.3859410495601183E-012 6.9999999371078340E+006 6.9999999999902984E+006 - 10 10 F T -2.4297910278965287E-001 -1.3697657121013959E-001 3.9665235720689595E-003 -3.4478231468965913E-003 -3.3867920349862158E-003 -1.1706724868080524E-012 6.9999999371093409E+006 6.9999999999918053E+006 - 11 11 F T -4.9984847217156680E-001 2.5036513076809352E-001 8.2167181520166159E-003 4.6830273297458350E-003 -7.0284776802293468E-003 -7.0938841145719453E-012 6.9999999370678784E+006 6.9999999999503428E+006 - 12 12 F T -1.7042553800923482E-001 -3.0209740029015986E-001 1.8881763061384825E-003 -3.7329626903669058E-003 -2.1214827510865658E-003 -1.2240239662045779E-014 6.9999999371174499E+006 6.9999999999999143E+006 - 13 13 F T -2.0640625755381656E-001 -2.3055004861177501E-002 3.2406419027348021E-003 -2.8583714474080451E-004 -2.8548463160921684E-003 -1.9893050372490053E-012 6.9999999371036105E+006 6.9999999999860749E+006 - 14 14 F T 3.9030019704522308E-002 -6.1403736505329731E-001 -3.8330924609886261E-004 -5.9675681169651072E-003 -9.4069604978878981E-006 4.6527545784935102E-012 6.9999999371501049E+006 7.0000000000325693E+006 - 15 15 F T -3.4698770729825905E-002 -1.3669676917771503E-001 -3.5944015187128973E-004 -3.2722344615792602E-003 -6.8046064145793500E-006 4.2361872917341047E-013 6.9999999371205010E+006 7.0000000000029653E+006 - 16 16 F T -1.7470446457144745E-001 4.3764726602899107E-001 4.4212387316525711E-003 4.1988863252837303E-003 -2.9231926671925731E-003 -3.9035720835263391E-012 6.9999999370902106E+006 6.9999999999726750E+006 - 17 17 F T 6.1872039902877138E-002 -1.8778317092186644E-001 2.5490304308363573E-004 -1.2622291793091425E-003 7.8488345466724900E-005 2.4331467710814481E-012 6.9999999371345676E+006 7.0000000000170320E+006 - 18 18 F T -5.2211585266781158E-001 3.2836137718100361E-001 1.1532768566530096E-002 4.8920076604809983E-003 -8.7128374529840437E-003 -6.2353377391460602E-012 6.9999999370738883E+006 6.9999999999563526E+006 - 19 19 F T -5.7875547754838871E-002 4.9281164299945496E-001 -1.1522980969653255E-004 5.6941874925372999E-003 1.4617593570180371E-006 -4.6103128779261995E-012 6.9999999370852634E+006 6.9999999999677278E+006 - 20 20 F T 2.9119292720168131E-002 -8.0363893035565415E-001 -1.4088822158051407E-003 -9.5482522432741666E-003 4.1180672087265738E-004 5.5207472258324958E-012 6.9999999371561809E+006 7.0000000000386452E+006 - 21 21 F T -1.8671566823532790E-001 -5.1557362689926715E-002 3.6299575747677859E-003 5.1072118393240881E-004 -3.0156043760866703E-003 -1.4192025703808949E-012 6.9999999371076012E+006 6.9999999999900656E+006 - 22 22 F T 2.0763796971990908E-001 -6.9139033644764258E-002 -5.6624994221640889E-003 -2.1700328319742626E-003 4.0915784410024622E-003 1.6453809119621756E-012 6.9999999371290533E+006 7.0000000000115177E+006 - 23 23 F T 5.1166763602224982E-002 1.1749386118325393E-001 -3.4400951525371382E-004 1.0665695018217849E-003 5.6538781699434185E-004 -1.7828175159936243E-014 6.9999999371174108E+006 6.9999999999998752E+006 - 24 24 F T 6.4866188745565809E-002 -5.5196302133670001E-002 -5.1513758293734133E-005 3.0011991631837416E-004 3.2468009464272870E-004 1.3911298468081595E-012 6.9999999371272735E+006 7.0000000000097379E+006 - 25 25 F T 5.5902743948191613E-002 2.9135413256998505E-001 1.3028556184023722E-003 3.7675434955383473E-003 -1.6025565833700504E-004 -4.3160149417039683E-013 6.9999999371145144E+006 6.9999999999969788E+006 - 26 26 F T 3.0754489202710333E-001 -1.1509742779034693E-003 -4.0911109665002525E-003 -6.5119186839639697E-004 3.9098265224745497E-003 3.6891017972739713E-012 6.9999999371433593E+006 7.0000000000258237E+006 - 27 27 F T 1.8799071695128866E-001 1.3678655016880292E-001 -2.5006129896650094E-003 1.3470263916666738E-003 2.4617399889836954E-003 1.2556889340259572E-012 6.9999999371263254E+006 7.0000000000087898E+006 - 28 28 F T 2.0269677104398684E-001 3.5414513516838064E-001 -2.8238766405676921E-003 5.4669650876475852E-003 2.7391976786907139E-003 -4.4889748499720067E-013 6.9999999371143933E+006 6.9999999999968577E+006 - 29 29 F T 1.4875163105933048E-001 3.3343913615853671E-001 -3.8848143823569103E-003 3.3203107118797582E-003 3.0454223671750676E-003 -1.5137983355951835E-012 6.9999999371069390E+006 6.9999999999894034E+006 - 30 30 F T -2.5739712550742727E-001 -5.3359251313351660E-002 5.0541812043842617E-003 8.5067187901198809E-004 -4.1679204325504177E-003 -2.0429226088120971E-012 6.9999999371032352E+006 6.9999999999856995E+006 - 31 31 F T -3.9482867349059364E-001 -1.6545863392417728E-001 1.0311187663799832E-002 -2.0772318233816520E-005 -7.6857132751463973E-003 -1.1662819660597098E-012 6.9999999371093716E+006 6.9999999999918360E+006 - 32 32 F T 2.6871999777814926E-001 -5.7995063293973714E-001 -3.9993563830837435E-003 -6.9839874314259771E-003 3.2661967426186440E-003 7.0405326351754189E-012 6.9999999371668193E+006 7.0000000000492837E+006 - 33 33 F T 5.3050773958961950E-001 1.7254238560545466E-002 -1.2762380154031945E-002 1.8482550544850302E-003 9.4064514711410547E-003 2.8341476660967306E-012 6.9999999371373747E+006 7.0000000000198390E+006 - 34 34 F T 1.1399912617021513E-001 -1.0990550311017692E-001 -3.3261474654313282E-003 -2.4172816889688063E-003 2.3357009880235792E-003 1.3639884458184058E-012 6.9999999371270835E+006 7.0000000000095479E+006 - 35 35 F T -5.1579916631228268E-002 1.3239600203118859E-001 4.5904853246761896E-003 8.0808671296017643E-004 -2.4563755140642012E-003 5.8513667427910156E-013 6.9999999371216316E+006 7.0000000000040960E+006 - 36 36 F T 4.0831379780980420E-002 -3.8908346346664419E-001 2.5812511702643201E-003 -3.4435160029950792E-003 -1.3264514469379122E-003 4.6325315738344786E-012 6.9999999371499633E+006 7.0000000000324277E+006 - 37 37 F T 1.5217388548263022E-001 -1.3419706954789548E-001 -3.0730130844727247E-003 -2.8721877899276914E-003 2.4363102531280473E-003 2.3996191580941054E-012 6.9999999371343330E+006 7.0000000000167973E+006 - 38 38 F T 1.0682334920394243E-001 -3.8908452710065966E-001 -3.6740916782244167E-003 -6.8797883549724312E-003 2.3757271087404656E-003 3.2351485611120127E-012 6.9999999371401817E+006 7.0000000000226460E+006 - 39 39 F T -1.3005518306478475E-001 -4.3614730995671436E-001 5.4596738515368072E-004 -3.6680362368346911E-003 -1.3945734727978699E-003 7.1192959164790187E-013 6.9999999371225191E+006 7.0000000000049835E+006 - 40 40 F T 2.6245785506856234E-001 -5.1272002232144329E-002 -4.8104585479388645E-003 1.6899451171791023E-003 3.7841419094613747E-003 2.3384179597838762E-012 6.9999999371339045E+006 7.0000000000163689E+006 - 41 41 F T -3.5036561269616198E-002 3.1628074325564953E-001 -1.8587921912704868E-003 2.4902588338791753E-003 9.6824654147333186E-004 -3.6372138247935601E-012 6.9999999370920751E+006 6.9999999999745395E+006 - 42 42 F T 9.3145777736440505E-002 -8.4328513823196964E-004 -1.1920932911482130E-004 -1.4851043981271091E-003 7.0965391810984420E-004 1.9106748020286895E-012 6.9999999371309103E+006 7.0000000000133747E+006 - 43 43 F T 3.5975504982455359E-001 -5.8941951316358598E-001 -5.9051599592112288E-003 -5.8160715007159443E-003 4.6708633390061382E-003 7.5901460052179313E-012 6.9999999371706666E+006 7.0000000000531310E+006 - 44 44 F T -2.1446786043658361E-002 -2.0364072362284846E-001 3.1035164096072224E-003 -1.9692980250839952E-003 -1.8076316825668592E-003 2.5582100893675682E-012 6.9999999371354431E+006 7.0000000000179075E+006 - 45 45 F T -4.8223115323909306E-002 1.0447770736143210E-001 3.0991754919423202E-003 1.2901342348134539E-003 -1.7651713083262504E-003 -5.9338553144265410E-014 6.9999999371171203E+006 6.9999999999995846E+006 - 46 46 F T 5.1513529060775234E-002 1.0907920820536053E-001 -4.8422071917646382E-004 2.0751047529173716E-003 5.6337229617496956E-004 -2.1460333233565047E-013 6.9999999371160334E+006 6.9999999999984978E+006 - 47 47 F T -1.2242863942399983E-001 5.8039402819662667E-001 -2.6990437169565961E-004 7.5556082890537255E-003 -3.1061806503962259E-004 -6.6451196756580275E-012 6.9999999370710198E+006 6.9999999999534842E+006 - 48 48 F T -2.5990798489412986E-001 1.1641740987143820E-001 7.5153229671214052E-003 2.4642035430648274E-003 -5.2777629903645049E-003 -1.9648245579249140E-012 6.9999999371037818E+006 6.9999999999862462E+006 - 49 49 F T -1.0156804927961009E-001 -1.3912566181279659E-002 2.3268833046904873E-003 3.5097015194049077E-004 -1.8005460465654259E-003 -6.7893416299369141E-013 6.9999999371127831E+006 6.9999999999952475E+006 - 50 50 F T 3.5711483962502488E-001 4.8504993082974762E-001 -9.7349174180973667E-003 5.8465903489638340E-003 7.2319323119441224E-003 -1.8706279309604746E-012 6.9999999371044412E+006 6.9999999999869056E+006 - 51 51 F T 2.4537577385626877E-001 3.0665808421227203E-001 -6.4610112065294741E-003 5.1931770822071744E-003 4.7488769768426952E-003 -1.2385259892824366E-012 6.9999999371088659E+006 6.9999999999913303E+006 - 52 52 F T -8.0310269796748546E-002 -4.8146918358918145E-001 1.5148366715072505E-003 -5.2370618708557533E-003 -1.5368832145504119E-003 2.6265957761750845E-012 6.9999999371359218E+006 7.0000000000183862E+006 - 53 53 F T 3.0507424019568091E-001 1.0570647445531961E-002 -7.5369661392937033E-003 -5.6652081433657825E-004 5.6088777916556030E-003 1.8027744284860904E-012 6.9999999371301550E+006 7.0000000000126194E+006 - 54 54 F T -4.3262991917235129E-002 3.2104843753016371E-001 1.3044941970955712E-003 4.8808221042958896E-003 -7.8700284396552255E-004 -2.6030466194339747E-012 6.9999999370993143E+006 6.9999999999817787E+006 - 55 55 F T -1.1054536038054048E-001 -2.2053915217768765E-002 2.1316661446951035E-003 3.3561110337993394E-004 -1.7676596229766522E-003 -9.0085502990991280E-013 6.9999999371112296E+006 6.9999999999936940E+006 - 56 56 F T 1.1641300402734639E-001 8.1871499925746638E-001 -1.9342577908749484E-003 1.0240048717374346E-002 2.0929870447780035E-003 -4.7591914451199955E-012 6.9999999370842213E+006 6.9999999999666857E+006 - 57 57 F T -2.0675544208859888E-002 -3.2221470816959902E-001 -3.4463835077868554E-003 -3.2084283621707163E-003 1.3572384960736940E-003 2.7806631406169218E-014 6.9999999371177303E+006 7.0000000000001946E+006 - 58 58 F T -2.5653291768483460E-001 1.0306967210188848E-001 1.8791602150606036E-003 1.4675071999229830E-003 -2.4264397180535306E-003 -4.5529700160311805E-012 6.9999999370856648E+006 6.9999999999681292E+006 - 59 59 F T -3.8923120076246792E-001 -4.3738074196026555E-001 8.3353911302246602E-003 -4.8260930653074435E-003 -6.7333329498841382E-003 1.2838947036819759E-013 6.9999999371184343E+006 7.0000000000008987E+006 - 60 60 F T -4.4766172891005589E-002 2.8291705984413029E-001 -3.3132907966663223E-004 5.2073905473466967E-003 -5.7279370537352908E-005 -3.3328043862418129E-012 6.9999999370942060E+006 6.9999999999766704E+006 - 61 61 F T -1.3031077673569155E-001 -2.8528195336956007E-002 6.4975348753009698E-003 2.3028946423211756E-003 -4.1753662191770140E-003 6.6682696941492878E-013 6.9999999371222034E+006 7.0000000000046678E+006 - 62 62 F T 2.1319873265920022E-001 -1.2287119073054383E-001 -3.8074895310599975E-003 -2.5207276470317723E-003 3.1592162208523089E-003 3.0315880536888601E-012 6.9999999371387567E+006 7.0000000000212211E+006 - 63 63 F T 1.3731171459487607E-001 1.4569328761727496E-001 -1.3960070454629538E-003 1.0917831268028658E-003 1.6384930570999623E-003 8.8555473033235550E-013 6.9999999371237345E+006 7.0000000000061989E+006 - 64 64 F T 3.6625167393310600E-002 2.9468857954513299E-002 -8.3956698579413776E-004 -9.0733455911995615E-004 7.3009675326448362E-004 2.4533697757404800E-013 6.9999999371192530E+006 7.0000000000017174E+006 +# partID parentID lost prim x y xp yp sigma dp p e mass A Z Q PDGid + 1 1 F T 9.3520158313430706E+000 -1.1981858175456182E+001 6.8031653152210159E-001 9.8024405507853551E-001 2.0170775529033316E-001 -6.8217718539169751E-007 1.1703177769365441E+003 1.4999993771061111E+003 9.3827204600000005E+002 1 1 1 2212 + 2 2 F T -4.4205655828209780E+000 1.2765505252389351E+001 2.5773405682946676E-001 -8.3561953789085819E-001 1.8793966396833023E-001 4.1237911937611701E-007 1.1703190579161192E+003 1.5000003765421857E+003 9.3827204600000005E+002 1 1 1 2212 + 3 3 F T -4.4709845408915800E+000 3.7823751397751706E+000 -3.8895729920748079E-001 -4.3130552552892593E-001 -1.2074716951195773E-001 3.0379701502242205E-007 1.1703189308404656E+003 1.5000002773961733E+003 9.3827204600000005E+002 1 1 1 2212 + 4 4 F T -2.2673869889272344E+000 -8.0003441799676249E+000 -1.9753620494689619E-001 1.4488854475402640E-001 -3.2417594227520642E-002 3.9312789449370684E-009 1.1703185799020243E+003 1.5000000035896389E+003 9.3827204600000005E+002 1 1 1 2212 + 5 5 F T 3.3389941940806844E+000 4.5456377512875603E+000 1.2167492739647548E-001 -9.0719398987258582E-001 5.3712736596594250E-002 8.6916421624345366E-010 1.1703185763183749E+003 1.5000000007936314E+003 9.3827204600000005E+002 1 1 1 2212 + 6 6 F T 6.6643495212261179E+000 3.6723674011170107E+000 6.8819835524592021E-001 -1.0053724128778327E+000 3.0520082182422786E-001 -1.7117844405872865E-007 1.1703183749678631E+003 1.4999998436974738E+003 9.3827204600000005E+002 1 1 1 2212 + 7 7 F T -7.7834682414667595E+000 6.3069280918661574E+000 -6.2948788422479474E-001 2.4577059662711379E-001 -2.5833227268297848E-001 4.1173367810882287E-007 1.1703190571607472E+003 1.5000003759528352E+003 9.3827204600000005E+002 1 1 1 2212 + 8 8 F T -1.0979569714397545E+001 -1.8650642091035998E+000 -8.8451637626233237E-001 6.1700817446694489E-001 -3.2199770943525574E-001 4.3161755840200896E-007 1.1703190804312217E+003 1.5000003941087505E+003 9.3827204600000005E+002 1 1 1 2212 + 9 9 F T -6.3041590466301116E+000 -1.1597935243474792E+001 -4.7767496219124378E-001 4.2527995405403801E-001 -1.1534658570865540E-001 1.2215543899625704E-007 1.1703187182619552E+003 1.5000001115397731E+003 9.3827204600000005E+002 1 1 1 2212 + 10 10 F T 9.4751548174285691E+000 -7.3911307606947063E-001 7.6573722931035415E-001 -2.1700828012534451E-001 2.6893651275244024E-001 -4.3384028189075137E-007 1.1703180675698352E+003 1.4999996038617542E+003 9.3827204600000005E+002 1 1 1 2212 + 11 11 F T -1.7390396620457214E+001 -1.4056367406593990E+000 -1.6680035309007284E+000 -6.7993134537890232E-001 -5.3198365586588037E-001 9.0017130106450437E-007 1.1703196287883704E+003 1.5000008219439001E+003 9.3827204600000005E+002 1 1 1 2212 + 12 12 F T -7.6245229835618424E+000 6.4331078289994883E+000 -6.1070584537205160E-002 1.5574059071304634E-002 4.5815021281538353E-002 4.0247035855467042E-007 1.1703190463197125E+003 1.5000003674945242E+003 9.3827204600000005E+002 1 1 1 2212 + 13 13 F T -2.6189173368310634E+001 6.2844256542225834E+000 -1.4363228850760914E+000 5.2331704064660911E-001 -4.1439935650788945E-001 1.2191284025673431E-006 1.1703200020697911E+003 1.5000011131828076E+003 9.3827204600000005E+002 1 1 1 2212 + 14 14 F T 1.3887748944674936E+000 -7.2272120154254509E+000 1.2091600134821803E-001 -9.7144098488520583E-002 8.8869774480948849E-002 -1.3526615985156363E-007 1.1703184169966762E+003 1.4999998764888724E+003 9.3827204600000005E+002 1 1 1 2212 + 15 15 F T -4.1881592482034691E+000 -8.2277901373489115E+000 -2.6518608073872207E-001 1.1100677679912609E+000 -1.0851187969186150E-001 -1.9991031899309733E-008 1.1703185519052997E+003 1.4999999817462478E+003 9.3827204600000005E+002 1 1 1 2212 + 16 16 F T 8.1674099303938821E+000 -4.9431285554082498E+000 1.0825381117732160E+000 3.8473759961361975E-001 4.2931142047078341E-001 -5.0746477630140707E-007 1.1703179814057216E+003 1.4999995366354581E+003 9.3827204600000005E+002 1 1 1 2212 + 17 17 F T 5.6646400872627574E+000 -3.1708889482572284E+000 2.1907108586360971E-001 1.8843073129049218E-001 3.0697663934185108E-002 -3.1269413341469853E-007 1.1703182093494231E+003 1.4999997144799281E+003 9.3827204600000005E+002 1 1 1 2212 + 18 18 F T -3.7452470245186258E+000 7.7016444075404671E+000 -3.8986112379261678E-001 -1.1972954113790799E+000 -9.7332045366559705E-002 4.0144321700731704E-007 1.1703190451176297E+003 1.5000003665566442E+003 9.3827204600000005E+002 1 1 1 2212 + 19 19 F T -5.0274376972545873E+000 -4.1768826288599882E-002 -5.4704299021865965E-001 2.7156281115712499E-001 -2.2370903485253330E-001 2.1520619697820314E-007 1.1703188271609858E+003 1.5000001965041511E+003 9.3827204600000005E+002 1 1 1 2212 + 20 20 F T 1.0991515767071142E+001 2.1162549276517897E+000 9.4330234915922773E-001 -2.5885211198128550E-002 3.0650997659612134E-001 -4.9861265416518607E-007 1.1703179917655248E+003 1.4999995447183032E+003 9.3827204600000005E+002 1 1 1 2212 + 21 21 F T -7.1241232835919976E-001 3.4333680686049588E+000 2.2542078068961394E-001 -4.4620083121283516E-001 1.3952309339486405E-001 1.0696598856231430E-007 1.1703187004854590E+003 1.5000000976703300E+003 9.3827204600000005E+002 1 1 1 2212 + 22 22 F T 9.7617939899084161E-001 4.0352325437655328E+000 -4.5267172483959084E-001 -7.0022087295920221E-001 -2.1648851693466939E-001 1.0420666320089559E-007 1.1703186972561696E+003 1.5000000951507984E+003 9.3827204600000005E+002 1 1 1 2212 + 23 23 F T 8.5315094042246873E+000 -1.0057086443502612E+001 1.3342353565962534E-001 5.3942059899597650E-001 -4.3263102979325653E-002 -5.4762611545194611E-007 1.1703179344041605E+003 1.4999994999642656E+003 9.3827204600000005E+002 1 1 1 2212 + 24 24 F T 2.8521291117996928E+000 -2.3011077838106804E+000 2.8985671928663459E-001 -8.9019709155107596E-001 1.8423959550744495E-001 -6.4242319220624124E-008 1.1703185001171962E+003 1.4999999413405287E+003 9.3827204600000005E+002 1 1 1 2212 + 25 25 F T 1.7158545774247127E+001 -4.4493540527320610E+000 6.1006182201759818E-001 -9.0013042465392365E-002 8.5648104146669096E-002 -8.1351354642867388E-007 1.1703176232311612E+003 1.4999992571833029E+003 9.3827204600000005E+002 1 1 1 2212 + 26 26 F T 1.3530475229619288E+001 -1.2170079584119122E+000 1.1439302161023182E+000 -9.1881511521591108E-001 4.5592987798019829E-001 -5.5574087478163403E-007 1.1703179249073071E+003 1.4999994925547046E+003 9.3827204600000005E+002 1 1 1 2212 + 27 27 F T 1.3102733851169429E+001 2.7072702268598041E+000 9.5535881741140871E-001 -1.2157881409171493E-001 2.8474653009866341E-001 -5.7339684666971494E-007 1.1703179042441950E+003 1.4999994764330922E+003 9.3827204600000005E+002 1 1 1 2212 + 28 28 F T 2.2035810027823618E-002 -6.1699167307788727E+000 -2.9533251370747533E-002 5.6276658900281717E-001 -2.2384848934817271E-002 -1.3050942489156385E-007 1.1703184225635716E+003 1.4999998808322330E+003 9.3827204600000005E+002 1 1 1 2212 + 29 29 F T -1.2172843697297844E+000 3.2513687268345948E-001 5.9385915726693453E-002 -2.0656822428952384E-001 6.2090710123766858E-002 7.6326734326683608E-008 1.1703186646277707E+003 1.5000000696937166E+003 9.3827204600000005E+002 1 1 1 2212 + 30 30 F T 1.0721216482559040E+001 1.2764145242451557E+000 7.7243275390668698E-001 -4.1048858231542841E-002 2.2921125292429673E-001 -4.8559606793908243E-007 1.1703180069990774E+003 1.4999995566037073E+003 9.3827204600000005E+002 1 1 1 2212 + 31 31 F T -7.5761097679210243E+000 2.7198688099383403E+000 -6.3303639209283991E-001 -3.1879418599128900E-001 -2.0109040850023538E-001 4.2658460599266054E-007 1.1703190745410643E+003 1.5000003895131761E+003 9.3827204600000005E+002 1 1 1 2212 + 32 32 F T 8.1691050053297065E+000 8.2572452328084669E+000 8.5621205742578199E-002 3.2514017622423963E-001 -1.4964913977689512E-001 -3.0339441221498351E-007 1.1703182202330595E+003 1.4999997229714752E+003 9.3827204600000005E+002 1 1 1 2212 + 33 33 F T -6.3038964923307041E+000 3.0749394963596548E+000 3.5210860246418313E-001 -1.2852633387057308E+000 3.5245226744455743E-001 4.3243497525373455E-007 1.1703190813878598E+003 1.5000003948551314E+003 9.3827204600000005E+002 1 1 1 2212 + 34 34 F T 2.0001521068106300E+001 -4.5904231525408870E+000 1.4734808777333825E+000 1.0352778108405152E+000 4.0093846770535274E-001 -1.1090383669925478E-006 1.1703172773729741E+003 1.4999989873405639E+003 9.3827204600000005E+002 1 1 1 2212 + 35 35 F T 4.7749700625695990E+000 5.1233021216857191E+000 4.5381419277434713E-002 -5.4431770336081564E-001 -3.6992842140787151E-002 -9.1588095925458378E-008 1.1703184681139260E+003 1.4999999163711818E+003 9.3827204600000005E+002 1 1 1 2212 + 36 36 F T -1.7261251647906651E+001 4.0286565890753732E+000 -5.5331326580344564E-001 -5.0045661595598867E-001 -8.9161989025960744E-003 8.7648775266582045E-007 1.1703196010710737E+003 1.5000008003185142E+003 9.3827204600000005E+002 1 1 1 2212 + 37 37 F T -1.3468463695739853E+001 -4.1189622879632015E+000 1.8142350788319835E-002 -1.5104408994181326E-001 2.4587981313678933E-001 5.5356970020486325E-007 1.1703192231540788E+003 1.5000005054629123E+003 9.3827204600000005E+002 1 1 1 2212 + 38 38 F T -4.2150112448583261E+000 -4.1958706300455004E+000 -2.5217117568560155E-001 -7.5145318837830966E-001 1.4025299784036452E-002 2.3342968038157045E-007 1.1703188484882669E+003 1.5000002131439612E+003 9.3827204600000005E+002 1 1 1 2212 + 39 39 F T 1.3106642351933320E+000 -4.2065649947569215E+000 2.5129115147246245E-001 1.2143318218345082E-001 1.2331662272281707E-001 -1.2981190552736575E-007 1.1703184233798913E+003 1.4999998814691355E+003 9.3827204600000005E+002 1 1 1 2212 + 40 40 F T 7.4748339726638768E+000 -7.6801805754425132E+000 5.3262972687388402E-002 -4.5698108251696495E-001 -7.7372442011114607E-003 -3.5991540156759286E-007 1.1703181540854957E+003 1.4999996713623334E+003 9.3827204600000005E+002 1 1 1 2212 + 41 41 F T -7.0989575847550075E+000 1.5868991688623770E+000 -1.2763383469195586E-001 -1.1490083607580259E-001 4.0982802681929734E-002 3.4432129228354103E-007 1.1703189782667801E+003 1.5000003143987758E+003 9.3827204600000005E+002 1 1 1 2212 + 42 42 F T -2.0539762440715243E+000 -1.9918285241671032E+000 -4.2763433036825854E-001 4.1188161490623626E-001 -2.0680531956952858E-001 4.3050449140012434E-008 1.1703186256839163E+003 1.5000000393092384E+003 9.3827204600000005E+002 1 1 1 2212 + 43 43 F T -6.9946428721643912E+000 2.2987911382263242E+000 -1.0774496043393644E-001 -9.6401660007766388E-001 1.0860975895697969E-001 4.4170870685048891E-007 1.1703190922410804E+003 1.5000004033229500E+003 9.3827204600000005E+002 1 1 1 2212 + 44 44 F T 1.9537160813309125E+001 1.1883328368510386E+000 1.1056174779687504E+000 -4.0796129992549646E-001 2.9470366559987199E-001 -8.4444219520448739E-007 1.1703175870347891E+003 1.4999992289424542E+003 9.3827204600000005E+002 1 1 1 2212 + 45 45 F T 3.7781159910113113E+000 -4.0357216317295457E+000 8.7083625943244619E-002 -8.4895116167479232E-002 1.6818563082010959E-002 -2.0310045317427511E-007 1.1703183376089428E+003 1.4999998145495838E+003 9.3827204600000005E+002 1 1 1 2212 + 46 46 F T 2.6047084481393354E+000 -8.9936767193869347E+000 -6.3728137503878735E-002 8.6040407909822214E-001 -8.4775757988223802E-002 -3.0501818168357817E-007 1.1703182183327319E+003 1.4999997214888162E+003 9.3827204600000005E+002 1 1 1 2212 + 47 47 F T -1.1570368851937353E+001 8.3284827126176864E-001 -8.7523873929228757E-001 1.7120584287254352E-003 -2.7792370831766916E-001 5.5537693823913921E-007 1.1703192252691229E+003 1.5000005071130963E+003 9.3827204600000005E+002 1 1 1 2212 + 48 48 F T -2.8075848629231763E+000 1.3311888845883575E+000 -2.4487007567482594E-002 -6.4069754174586740E-002 2.6889057474787568E-002 1.4467376220159768E-007 1.1703187446155671E+003 1.5000001321011885E+003 9.3827204600000005E+002 1 1 1 2212 + 49 49 F T 5.3953111103130942E+000 -2.9095532159643018E+000 -6.2869083125327713E-002 -3.3520711865539693E-001 -7.1764823592310248E-002 -2.2485746085664787E-007 1.1703183121463126E+003 1.4999997946833259E+003 9.3827204600000005E+002 1 1 1 2212 + 50 50 F T -9.2831464965350143E+000 1.1328461639255019E+001 -7.9588635108091360E-002 -1.9592828013514346E-001 4.9343102546033885E-002 5.5292874546237127E-007 1.1703192224039574E+003 1.5000005048776582E+003 9.3827204600000005E+002 1 1 1 2212 + 51 51 F T -7.7932473444974981E+000 -5.1877787668797097E+000 -6.5482601585535771E-001 6.2919134644358887E-002 -1.9268202341945614E-001 3.0712785246920576E-007 1.1703189347386065E+003 1.5000002804375515E+003 9.3827204600000005E+002 1 1 1 2212 + 52 52 F T -7.1048921882426674E-001 1.0079595904002632E+001 1.9596703608501576E-002 -4.3743344523332045E-001 -3.7213244530964955E-003 1.8993004051559739E-007 1.1703187975798303E+003 1.5000001734245652E+003 9.3827204600000005E+002 1 1 1 2212 + 53 53 F T 1.3740219020116099E+001 -5.4349237951033258E+000 6.5739622718703561E-001 -4.0931199782445826E-001 1.9039189868514875E-001 -6.4311579768056382E-007 1.1703178226508116E+003 1.4999994127729392E+003 9.3827204600000005E+002 1 1 1 2212 + 54 54 F T 1.3102025582035118E+001 -4.9575214450846161E+000 8.6249206067708728E-001 5.4208704506629346E-001 2.3131608170073537E-001 -7.2742056860961245E-007 1.1703177239873723E+003 1.4999993357945227E+003 9.3827204600000005E+002 1 1 1 2212 + 55 55 F T -1.4560124499119198E+001 3.8948427694387204E+000 -5.9954941774561077E-001 -4.4547801629726158E-002 -1.0616309986320600E-001 7.0943247828952741E-007 1.1703194055631830E+003 1.5000006477807894E+003 9.3827204600000005E+002 1 1 1 2212 + 56 56 F T 1.3698598190779900E+000 -2.2830104815926386E-001 1.6812456914556553E-001 -1.0165093332158430E+000 1.4203444027619166E-001 4.3267008891398431E-008 1.1703186259373599E+003 1.5000000395069783E+003 9.3827204600000005E+002 1 1 1 2212 + 57 57 F T 1.0448060885388509E+001 -6.2411665187046008E+000 6.5455583044716437E-001 1.6750805834840296E-001 2.0007049195928978E-001 -5.7393879668852200E-007 1.1703179036099409E+003 1.4999994759382396E+003 9.3827204600000005E+002 1 1 1 2212 + 58 58 F T 9.4533717390975163E+000 -1.0237788471459011E+001 1.1402167587664045E+000 7.7683119222753938E-001 4.4020847953901604E-001 -6.6845461073773745E-007 1.1703177929963281E+003 1.4999993896361500E+003 9.3827204600000005E+002 1 1 1 2212 + 59 59 F T 2.0022551899472727E+001 1.5180482589120776E+000 1.0970585868123628E+000 -7.2438526377478246E-002 2.5627199670479106E-001 -8.9894314593738818E-007 1.1703175232513140E+003 1.4999991791778141E+003 9.3827204600000005E+002 1 1 1 2212 + 60 60 F T 1.1190828137088657E+001 -1.4608609340153920E+000 3.9604554903357592E-001 8.4216635254409655E-001 -2.0109780973941723E-002 -6.1545876128610379E-007 1.1703178550183552E+003 1.4999994380264914E+003 9.3827204600000005E+002 1 1 1 2212 + 61 61 F T -1.2495864727321798E+001 -2.4501613851568225E+000 -8.2815542149977528E-001 2.8224809288521502E-001 -2.4230721990380530E-001 5.2535767974028868E-007 1.1703191901370271E+003 1.5000004797025942E+003 9.3827204600000005E+002 1 1 1 2212 + 62 62 F T -1.4507199416587181E+001 1.4826795291381514E+000 -1.2087562723743142E+000 2.2431018279626921E-001 -4.2428429574732068E-001 6.8209398376544831E-007 1.1703193735684351E+003 1.5000006228180844E+003 9.3827204600000005E+002 1 1 1 2212 + 63 63 F T -1.3328623359571708E+001 9.2687356421263312E-001 -4.3791256615902968E-001 -5.9547447542795373E-001 1.5519792682592397E-002 6.7666406062686789E-007 1.1703193672136952E+003 1.5000006178600361E+003 9.3827204600000005E+002 1 1 1 2212 + 64 64 F T -5.2307971227007863E+000 -3.0615680650899111E+000 1.7229344819865766E-001 1.0041877541880248E-001 1.7627911564225232E-001 1.7245821214286444E-007 1.1703187771322250E+003 1.5000001574710893E+003 9.3827204600000005E+002 1 1 1 2212 + 65 65 F T 2.8097350938896288E+000 2.8020951039841062E+000 -3.2671908436509056E-001 -4.2019559904282194E-001 -1.9355461543665628E-001 -2.6677561081779150E-008 1.1703185440799305E+003 1.4999999756407979E+003 9.3827204600000005E+002 1 1 1 2212 + 66 66 F T -4.4177040389983206E+000 2.5771873201601442E-001 -1.7550234677556567E-001 2.4133332425229492E-001 -4.2652176342641804E-002 1.7618410152061404E-007 1.1703187814927026E+003 1.5000001608731882E+003 9.3827204600000005E+002 1 1 1 2212 + 67 67 F T -9.5173242790020733E+000 1.6857148947917502E+000 -6.8500513794189777E-001 -2.1070292682914180E-001 -2.0067239357365962E-001 4.8980699133635711E-007 1.1703191485313962E+003 1.5000004472413596E+003 9.3827204600000005E+002 1 1 1 2212 + 68 68 F T -1.8128478093493630E+000 9.5332496603374750E+000 -2.2213371734407558E-002 -3.6828302479069613E-001 -1.0569553951388921E-002 2.2605312386237456E-007 1.1703188398553455E+003 1.5000002064084485E+003 9.3827204600000005E+002 1 1 1 2212 + 69 69 F T 2.6177160893619460E+000 7.2388928195992053E+000 -1.4997697733903956E-001 -9.0349784996286941E-001 -8.9597348192149026E-002 7.5517098010168669E-008 1.1703186636802382E+003 1.5000000689544399E+003 9.3827204600000005E+002 1 1 1 2212 + 70 70 F T 6.9072016320666298E+000 -5.5155638520989276E+000 -1.0702406995614608E-001 3.4126109628754830E-001 -1.5252892437912008E-001 -3.9251317425645049E-007 1.1703181159357168E+003 1.4999996415974078E+003 9.3827204600000005E+002 1 1 1 2212 + 71 71 F T -7.8410844283155912E-001 1.3640536883330903E+000 -7.2403427160128195E-002 -8.1109763973462201E-001 2.7348192646642601E-002 1.4358322830564049E-007 1.1703187433392948E+003 1.5000001311054250E+003 9.3827204600000005E+002 1 1 1 2212 + 72 72 F T 3.2765764798252670E+000 3.7388834128802401E-001 2.5646322634029817E-001 3.5091464800532374E-001 5.3561652295803050E-002 -1.9034482510163811E-007 1.1703183525370912E+003 1.4999998261967091E+003 9.3827204600000005E+002 1 1 1 2212 + 73 73 F T -4.7966101412660986E+000 5.2187062170767753E+000 7.3873512339696329E-002 -8.4290414597175822E-001 1.4285543180245863E-001 3.5576812991148464E-007 1.1703189916632266E+003 1.5000003248508506E+003 9.3827204600000005E+002 1 1 1 2212 + 74 74 F T 6.2420221186190723E+000 2.1268216880872535E+000 -3.3195373482889984E-001 -1.7104004485609117E-001 -2.6243773952294563E-001 -2.1033807588641084E-007 1.1703183291386185E+003 1.4999998079409324E+003 9.3827204600000005E+002 1 1 1 2212 + 75 75 F T 5.0784602961769929E+000 -9.9783727342543944E+000 1.3654379892967008E-001 7.5547537130325004E-001 -6.3290645931719687E-003 -4.2163237204821134E-007 1.1703180818569788E+003 1.4999996150087586E+003 9.3827204600000005E+002 1 1 1 2212 + 76 76 F T -6.3069758262776991E+000 -2.4752709147060261E+000 1.5425248989786153E-001 -2.7524758883514983E-001 2.0781311853910753E-001 2.6851872382895959E-007 1.1703188895536261E+003 1.5000002451836663E+003 9.3827204600000005E+002 1 1 1 2212 + 77 77 F T -8.5201201597282115E+000 -3.7121996589839630E+000 -5.0098642299082274E-001 8.8106765671444293E-002 -1.1344026495208280E-001 3.4405547563477329E-007 1.1703189779556899E+003 1.5000003141560594E+003 9.3827204600000005E+002 1 1 1 2212 + 78 78 F T -5.0879280546234773E-001 2.6258632504485790E+000 -4.2968784693195922E-001 -2.8815314993302182E-001 -2.0511571327297054E-001 1.0560311231103132E-007 1.1703186988904597E+003 1.5000000964258918E+003 9.3827204600000005E+002 1 1 1 2212 + 79 79 F T 3.0833173416317988E-001 9.9815876453434649E-001 -1.5241720115357384E-002 -9.0341260601014062E-001 4.9049104523153836E-002 9.9620488170766724E-008 1.1703186918888834E+003 1.5000000909631751E+003 9.3827204600000005E+002 1 1 1 2212 + 80 80 F T -3.6023700706757924E+000 1.7405337290149809E+000 -8.1576663124484305E-002 -8.0177617111490337E-002 8.5636840204228997E-003 1.8836781822448309E-007 1.1703187957515324E+003 1.5000001719981046E+003 9.3827204600000005E+002 1 1 1 2212 + 81 81 F T -5.7889337908134875E-001 -8.3035479448264589E+000 6.2078399533823818E-002 6.3861645697272051E-001 3.9804604680418881E-002 -1.4129239075124470E-007 1.1703184099440664E+003 1.4999998709863391E+003 9.3827204600000005E+002 1 1 1 2212 + 82 82 F T 1.4097210825410755E+000 2.0560130167276269E+000 -2.8557914173465010E-001 -3.2046484086966537E-001 -1.5473697302379574E-001 1.2390305845995737E-008 1.1703185898017809E+003 1.5000000113135518E+003 9.3827204600000005E+002 1 1 1 2212 + 83 83 F T -1.9112348959154826E+000 2.7591085544590404E+000 -8.8530403417980477E-002 3.0299341982231898E-001 -5.4572115195575387E-002 8.3851883946563661E-008 1.1703186734345929E+003 1.5000000765649086E+003 9.3827204600000005E+002 1 1 1 2212 + 84 84 F T -9.7631757342736059E+000 -4.3311131328432344E+000 -1.4877211161700668E-001 5.7949372439930524E-001 5.2007380366154508E-002 3.1770193066207992E-007 1.1703189471136468E+003 1.5000002900927122E+003 9.3827204600000005E+002 1 1 1 2212 + 85 85 F T -4.7794191152957266E+000 9.7325245437991210E+000 -7.0528803976668275E-001 -4.6473483264118576E-001 -3.0868038933373043E-001 4.0298678395365429E-007 1.1703190469240947E+003 1.5000003679660706E+003 9.3827204600000005E+002 1 1 1 2212 + 86 86 F T 4.8794109567290898E+000 -8.5020165676418920E+000 2.3178027682044403E-001 -5.3202192883711652E-001 1.3255438964081429E-001 -2.5750612747624625E-007 1.1703182739369715E+003 1.4999997648719277E+003 9.3827204600000005E+002 1 1 1 2212 + 87 87 F T -8.6521130306441343E+000 -1.1845102704958930E+000 -4.4318458893551071E-001 1.9012589862218590E-001 -1.0379250994954443E-001 3.6322850554593061E-007 1.1703190003942427E+003 1.5000003316628986E+003 9.3827204600000005E+002 1 1 1 2212 + 88 88 F T 1.1108590294402358E+001 3.4623442692075383E+000 5.9310204020979296E-001 -4.4510772245800456E-001 1.4952931445218950E-001 -4.2367852281468299E-007 1.1703180794623306E+003 1.4999996131404248E+003 9.3827204600000005E+002 1 1 1 2212 + 89 89 F T -4.4790919863220511E+000 4.1731348260277930E+000 1.0392439205199504E-003 -5.7386891886417601E-001 8.6831495962421498E-002 3.0414748227448590E-007 1.1703189312506240E+003 1.5000002777161840E+003 9.3827204600000005E+002 1 1 1 2212 + 90 90 F T -9.2186510623170126E-002 -2.9775942898621048E+000 -2.4932779694000326E-001 4.7180835224702733E-002 -1.1258906626156411E-001 -2.1182050918928333E-008 1.1703185505114282E+003 1.4999999806587321E+003 9.3827204600000005E+002 1 1 1 2212 + 91 91 F T -1.4246364726350080E+001 -8.0302841526339428E+000 -5.7607821828216232E-001 2.9034833856812597E-001 -5.6474736856575239E-002 5.2555768133986891E-007 1.1703191903710926E+003 1.5000004798852151E+003 9.3827204600000005E+002 1 1 1 2212 + 92 92 F T 5.0543421538243845E+000 -2.0312780032699611E+000 7.0686342636027333E-001 -2.4901651618477466E-001 3.1490851353227584E-001 -2.5007668080507596E-007 1.1703182826317909E+003 1.4999997716557327E+003 9.3827204600000005E+002 1 1 1 2212 + 93 93 F T 1.7780914343548326E+000 3.9666987095148865E+000 7.6691814726937813E-001 -4.5958218233406628E-001 3.7653379759630601E-001 -2.1616470412801908E-008 1.1703185500030190E+003 1.4999999802620648E+003 9.3827204600000005E+002 1 1 1 2212 + 94 94 F T 1.6975119985949135E+001 2.3657572682551868E+000 9.7816933646853077E-001 5.9966294105277740E-001 1.8663176405463255E-001 -8.2674817798935864E-007 1.1703176077424259E+003 1.4999992450988036E+003 9.3827204600000005E+002 1 1 1 2212 + 95 95 F T 2.4539688144814327E+000 -1.0268280880215945E+001 -3.8053589229405621E-001 4.6791398949971885E-001 -2.0788935730506580E-001 -2.5213430986406756E-007 1.1703182802237095E+003 1.4999997697769181E+003 9.3827204600000005E+002 1 1 1 2212 + 96 96 F T 1.5255763025748492E+000 -9.0308535295696348E+000 2.9244523634930913E-001 5.2620431115944055E-001 1.3825965120635428E-001 -2.3980735212426990E-007 1.1703182946501772E+003 1.4999997810326258E+003 9.3827204600000005E+002 1 1 1 2212 + 97 97 F T 5.2299295802578181E+000 -1.2633110610751896E+000 2.3053376651467009E-001 2.0375817227870027E-001 3.1172129680877046E-002 -2.7514154444747756E-007 1.1703182532979156E+003 1.4999997487690823E+003 9.3827204600000005E+002 1 1 1 2212 + 98 98 F T -3.4228787427290541E+000 -1.2311437188422569E+000 5.6912270131324227E-001 -6.1465469414448715E-001 3.9447966338756690E-001 1.7383126756207011E-007 1.1703187787391373E+003 1.5000001587248223E+003 9.3827204600000005E+002 1 1 1 2212 + 99 99 F T -1.7570678231155156E+001 -4.2512058821219950E-001 -1.0817821459912138E+000 6.9943945689105780E-001 -3.3800682187643777E-001 7.3385607627307409E-007 1.1703194341465735E+003 1.5000006700819110E+003 9.3827204600000005E+002 1 1 1 2212 + 100 100 F T -7.9624052851531451E+000 2.1551441665247317E+000 1.4603227704834507E-002 8.7885321077623368E-001 4.9543738550037769E-002 2.6929499673112317E-007 1.1703188904621127E+003 1.5000002458924787E+003 9.3827204600000005E+002 1 1 1 2212 diff --git a/test/dist_file_normalised/partDist.dat b/test/dist_file_normalised/partDist.dat deleted file mode 100644 index 31a9a2dbf..000000000 --- a/test/dist_file_normalised/partDist.dat +++ /dev/null @@ -1,64 +0,0 @@ --1.507930303264015e-01 -5.381640309729848e-03 -2.904927962435731e+00 7.895226745701450e-01 4.179896427187180e-02 8.589192590027847e-01 - 2.568635026373987e-02 -8.951382653649338e-01 3.732923518373877e-01 -4.858655666754789e-01 8.130426478434232e-01 -8.117472264076309e-01 - 4.607229283170273e-01 -3.912106738638522e-01 -8.504309266635313e-02 1.653114250031118e+00 1.140375407456443e+00 1.359084438605301e+00 --1.306120919440800e+00 -8.647042201054531e-01 -1.102869654240987e+00 2.298461411098033e+00 1.108058619899132e+00 8.066021686718333e-01 - 1.050295832446472e+00 2.873840965723989e+00 4.032166238321975e-01 -4.150074090828770e-01 1.605966064770557e+00 8.771898901152771e-01 --6.273363919563280e-02 -1.046221143471760e-01 7.679235030324844e-01 -1.712179799501308e+00 -1.451001824512050e+00 1.942977486287533e+00 --1.092620371456864e+00 7.262640956750835e-01 -1.836584785959944e+00 1.863141360580738e+00 -1.390235179374531e-02 -5.268945149075408e-01 --6.130661805157634e-01 -2.314113577781045e+00 -1.374591382210294e+00 6.235680131945501e-01 -2.816000207268280e-01 -2.973217258123523e-01 --8.097856538840266e-01 3.031141156401014e-01 4.559158782787897e-02 5.705228059324031e-01 -1.277096420193923e-01 3.282267588671189e-01 --1.203714373501652e+00 -3.740027062842148e-01 -5.024928721985980e-01 -1.442315260358201e+00 1.839841090134274e+00 -4.642938615707237e-01 --2.476073809010331e+00 -7.358457002728908e-01 9.290978496446484e-01 1.341696423566064e+00 -1.847095197567779e+00 -6.273761493900244e-01 --8.441829193263111e-01 -8.005348473429796e-01 -1.112806589900840e+00 -6.067992255804629e-02 -1.195442480129009e+00 6.512138419951254e-01 --1.022417050179950e+00 -3.952244309661034e-01 -8.145052799726470e-02 -1.333939220488445e-03 -3.856144250044518e-01 1.526917763738045e+00 - 1.935679782110532e-01 2.139198354108646e-01 -2.265666460318178e+00 1.180053354317377e+00 -2.441174104194578e-01 1.886333680189312e+00 --1.718444974259677e-01 -6.105584349864340e-01 -5.014952135845810e-01 -1.303342132615030e+00 7.973240680863709e-01 1.339957659822843e+00 --8.653941887217328e-01 6.763952705230166e-01 1.621350166724034e+00 -8.775725434340298e-01 -3.277366253668398e-01 -2.334220557577324e-01 - 3.067320397882060e-01 8.580656282266212e-01 -6.902131107048949e-01 8.182331322623130e-01 9.161183549296148e-01 -7.958629156885925e-01 --2.586427669908831e+00 1.008284812123901e+00 1.217492450148878e+00 7.490250692998260e-01 -7.692544530237535e-01 -2.561286813466628e-01 --2.865511748142672e-01 -7.272440598614378e-01 1.825124320682223e+00 -2.087481710511310e-01 8.138783025325332e-01 9.526054669553825e-01 - 1.443834794584951e-01 -5.165509458872254e-01 -2.966473116838344e+00 1.397824194457310e-01 -4.196881886835739e-03 -4.844924425012215e-01 --9.248029061456703e-01 6.329401117196670e-02 -1.867630778725511e-01 9.200513601425057e-01 6.898489620786791e-01 -3.170099937140110e-01 - 1.028757785222009e+00 -1.048295680194122e+00 -2.518597480742061e-01 -1.072960712182066e+00 -1.053273028012846e+00 2.309950033236836e+00 - 2.536370726802155e-01 3.754265081434737e-01 4.380395806515414e-01 -2.814833440127158e-01 -1.473111148614998e+00 -2.908421051757132e-01 - 3.215713607786120e-01 7.075150769991985e-01 -2.001908500859619e-01 7.854276697887370e-01 -2.453030919196752e+00 -3.631982721524293e-01 - 2.771446866639221e-01 1.421269067139878e+00 1.080690087703311e+00 2.021449447073472e-01 -7.286161490755030e-01 -1.125183855672357e+00 - 1.523759337428315e+00 1.034702161157159e+00 -4.425209646804299e-04 -5.103637179525018e-01 -1.468425920057571e-01 -6.103740622555690e-01 - 9.314926071688399e-01 6.327699990287833e-01 5.093493583120420e-01 -2.434199605769133e-01 1.712485680360274e-01 9.167714850271529e-01 - 1.004447345522717e+00 6.052979908947600e-01 1.312690394162026e+00 9.613116819107066e-01 -4.528177935326974e-02 1.834965790634847e-01 - 7.370837035325202e-01 -6.474305639452992e-01 1.236079033520076e+00 -5.697904279330642e-01 -1.859020569873539e+00 3.879616406745042e-01 --1.274951688787666e+00 1.171801129867048e-01 -1.934122351238296e-01 1.212151637127349e+00 -1.098977710994524e+00 -9.679648999289787e-01 --1.955792760779532e+00 1.720519553234614e+00 -6.075987355291211e-01 1.602842369433934e+00 -2.066531837411793e-01 -6.000756765777129e-01 - 1.331416180529105e+00 6.484954755779353e-01 -2.139675103595094e+00 2.652791916869943e-02 9.562231709490482e-01 6.855498028554251e-01 - 2.628490118294824e+00 -1.652250989946546e+00 6.737136069131912e-02 1.328057346129933e+00 9.361693571827481e-01 -3.936727772065526e-01 - 5.648648006842314e-01 -7.061156747930368e-01 -4.024971595471062e-01 -8.746125679940043e-01 -2.291150974679425e+00 -1.088175960863485e+00 --2.554134354368414e-01 2.178996983846096e+00 4.932539667378597e-01 -6.356550274251206e-01 -3.353469640246312e-01 -4.925579630869214e-01 - 2.024947838813440e-01 2.020082523545007e+00 -1.434123039767101e+00 1.022050140616549e+00 8.093257989894260e-01 -6.087793974855747e-01 - 7.539791025757089e-01 -1.193874591475328e-01 -4.922395881333838e-01 -1.004809714454978e+00 5.439714677914095e-01 -6.671492689011290e-01 - 5.292357727319986e-01 -9.972716799818100e-01 -1.434346040028122e+00 -1.752459293956245e+00 -6.175037978220433e-01 -1.542798801984664e+00 --6.440927261741158e-01 -1.149745612650435e+00 -1.608275530699789e+00 1.300309549106114e+00 -3.996088711174842e-01 2.364637270142395e-01 - 1.300554426902775e+00 8.857981518127094e-02 -1.857492981318024e-01 1.869243596944661e+00 5.989272598166708e-01 -1.827452262892292e+00 --1.734741657539861e-01 -1.517668744647916e+00 1.172618724626203e+00 -1.072420445860288e+00 -3.791125508563641e-01 1.729851545453304e+00 - 4.615380033878539e-01 9.883718482309529e-01 7.117839636865046e-04 -1.186614721469762e+00 2.150464913124726e+00 -2.681054036568943e-01 - 1.782493450117376e+00 5.360793936511986e-01 -2.174688099655127e+00 1.061939975412075e+00 7.265469208955482e-01 -8.476640717893797e-01 --1.060754502552284e-01 1.626185779141589e+00 -7.487595905066341e-01 4.021415632064287e-01 -4.729090365155760e-01 1.167451502583654e+00 --2.387382344863043e-01 1.318894824334718e+00 3.900086343570718e-01 2.611115678029885e-02 5.779439589169778e-01 -1.452605179831371e+00 - 2.554177264246806e-01 2.949327444159595e-01 4.069338138022511e-01 6.149809619776739e-01 -2.045478789665965e-01 -1.310512648187476e+00 --6.063083451891955e-01 -1.554730070895493e+00 2.148771368144295e+00 4.392877804597775e-01 7.772604562057472e-01 -4.533788659017239e-01 --1.287405646275515e+00 1.571061716557141e+00 4.341749592233825e-01 8.576069854086967e-01 3.059918909558664e-01 1.191964799637190e+00 --5.029982668416715e-01 2.469256698360305e-01 -4.762529282488895e-02 4.235474211717205e-01 -7.885602485509620e-01 -1.603971533584676e+00 - 1.769403034327472e+00 -1.801157868079163e+00 1.796322326136631e+00 -1.005635055677986e-02 -1.812190210934484e+00 -5.880462704998805e-01 - 1.215901392703522e+00 -1.100069406772862e+00 1.137056756162881e+00 1.203821378216563e+00 -4.294728728835649e-01 1.320472826616632e-01 --3.977079413290807e-01 -2.814447946268111e-04 -1.775706131657967e+00 4.758212824875528e-01 -4.386706241447205e-02 4.671001149440147e-01 - 1.511516726150424e+00 -1.069054288140125e+00 4.273175883230882e-02 -5.563870538592667e-01 -1.780982102891990e-01 6.250249497672357e-01 --2.140963184513684e-01 2.942285783953251e-01 1.190368403884813e+00 8.112211801488157e-01 -1.925309516002746e+00 -8.651379977041543e-01 --5.474693237491955e-01 2.721914966347584e-02 -7.772987572284465e-02 4.906275209641282e-01 -1.026996198216310e+00 -1.017133906153028e+00 - 5.769614799648900e-01 1.595359439693886e-01 3.029689677443902e+00 2.802158686705228e-01 3.674826966037525e-02 -2.999976208156480e-01 --1.022507058937641e-01 -2.310409668674990e+00 -1.187279675476994e+00 5.591974348233174e-01 -1.086344679415197e+00 -5.206851920173047e-01 --1.270733304622773e+00 -1.785559304948499e+00 3.846054664059968e-01 1.831980754851653e-01 1.325736026753167e+00 -4.372481731520381e-01 --1.928164776796477e+00 5.940988537840362e-01 -1.612686608536511e+00 3.773658796389027e-01 5.006914731717020e-01 1.642353529633356e+00 --2.215008294140172e-01 -7.082039082840395e-01 1.049366549302825e+00 1.447151696284457e+00 4.631967626979233e-01 2.670169837844377e-01 --6.452748351057596e-01 2.432245148003394e+00 -1.014869357986856e-01 2.142237664234142e+00 -6.452739770622351e-01 -4.533291685719869e-02 - 1.056320611075802e+00 1.323635246119172e-01 -4.503678585767712e-01 -8.316181659526767e-01 -1.791316650766221e+00 -1.216825565547681e+00 - 6.803991445342593e-01 7.216489895580257e-01 5.422792128312550e-01 -5.364402389986322e-01 8.993530616771460e-01 -3.729235023038643e-01 - 1.815381122260724e-01 -8.848215018769938e-02 1.126730812490962e-01 -1.015971140111955e+00 -1.282508674600380e+00 1.157119530705739e+00 From 4e75471752a44ef6c6fca30a8982ffbd3ccbba2b Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 31 Jul 2019 14:58:22 +0200 Subject: [PATCH 36/38] Renamed the distlib test to a more accurate name --- test/CMakeLists.txt | 13 +++++++++---- .../extra_checks.txt | 0 .../fort.2 | 0 .../fort.3 | 0 .../initial_state.dat.canonical | 0 5 files changed, 9 insertions(+), 4 deletions(-) rename test/{dist_file_normalised => distlib_normalised}/extra_checks.txt (100%) rename test/{dist_file_normalised => distlib_normalised}/fort.2 (100%) rename test/{dist_file_normalised => distlib_normalised}/fort.3 (100%) rename test/{dist_file_normalised => distlib_normalised}/initial_state.dat.canonical (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0f485f503..f8e7796b2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -95,7 +95,6 @@ list(APPEND SIXTRACK_TESTS dipedge dist_file_6d dist_file_6d_direct - dist_file_normalised distance dump_2_all_ele_highprec dump_all_highprec @@ -222,6 +221,12 @@ if(PYTHIA) ) endif() +if(DISTLIB) + list(APPEND SIXTRACK_TESTS + distlib_normalised + ) +endif() + if(SIXDA) list(APPEND SIXTRACK_DA_TESTS frs_da @@ -265,7 +270,7 @@ set(TESTS_NOFORT10 collimation_old-db_old-block dist_file_6d dist_file_6d_direct - dist_file_normalised + distlib_normalised dump_2_all_ele_highprec dump_all_highprec dump_binary @@ -336,7 +341,7 @@ set(TESTS_NO_STF_FORT90 dipedge dist_file_6d dist_file_6d_direct - dist_file_normalised + distlib_normalised dump_all_highprec dump4 dump5 @@ -612,7 +617,7 @@ set(FAST_TESTS crabs dist_file_6d dist_file_6d_direct - dist_file_normalised + distlib_normalised dump_2_all_ele_highprec dump_all_highprec dump_binary diff --git a/test/dist_file_normalised/extra_checks.txt b/test/distlib_normalised/extra_checks.txt similarity index 100% rename from test/dist_file_normalised/extra_checks.txt rename to test/distlib_normalised/extra_checks.txt diff --git a/test/dist_file_normalised/fort.2 b/test/distlib_normalised/fort.2 similarity index 100% rename from test/dist_file_normalised/fort.2 rename to test/distlib_normalised/fort.2 diff --git a/test/dist_file_normalised/fort.3 b/test/distlib_normalised/fort.3 similarity index 100% rename from test/dist_file_normalised/fort.3 rename to test/distlib_normalised/fort.3 diff --git a/test/dist_file_normalised/initial_state.dat.canonical b/test/distlib_normalised/initial_state.dat.canonical similarity index 100% rename from test/dist_file_normalised/initial_state.dat.canonical rename to test/distlib_normalised/initial_state.dat.canonical From f236927ac553438a8070b2634522f273d0fc181e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 31 Jul 2019 16:52:39 +0200 Subject: [PATCH 37/38] Added the parsing of tmatrx, twiss and dispersion variables to DIST --- source/mod_dist.f90 | 149 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 125 insertions(+), 24 deletions(-) diff --git a/source/mod_dist.f90 b/source/mod_dist.f90 index 65c431e13..3ecd05bbe 100644 --- a/source/mod_dist.f90 +++ b/source/mod_dist.f90 @@ -15,7 +15,7 @@ module mod_dist use crcoall use floatPrecision use parpro, only : mFileName - use numerical_constants, only : zero + use numerical_constants, only : zero, one implicit none @@ -27,10 +27,6 @@ module mod_dist logical, private, save :: dist_distLibNorm = .true. ! DISTlib is used to convert normalised coordinates character(len=mFileName), private, save :: dist_distFile = " " ! File name for reading the distribution character(len=mFileName), private, save :: dist_echoFile = " " ! File name for echoing the distribution - real(kind=fPrec), public, save :: dist_beamEmit(2) = zero ! Beam emittance for generator and normalisation - real(kind=fPrec), public, save :: dist_beamLen = zero ! RMS bunch length - real(kind=fPrec), public, save :: dist_beamSpread = zero ! Bunch energy spread - real(kind=fPrec), public, save :: dist_tMat(6,6) = zero ! Cpy of the T matrix, properly scaled integer, allocatable, private, save :: dist_colFormat(:) ! The column types in the FORMAT real(kind=fPrec), allocatable, private, save :: dist_colScale(:) ! Scaling factor for the columns @@ -55,6 +51,7 @@ module mod_dist integer, private, save :: dist_nFill = 0 ! Fill Methods + ! =============== integer, parameter :: dist_fillNONE = 0 ! No fill integer, parameter :: dist_fillINT = 1 ! Fixed integer value integer, parameter :: dist_fillFLOAT = 2 ! Fixed float value @@ -63,6 +60,22 @@ module mod_dist integer, parameter :: dist_fillLINEAR = 5 ! Linear fill integer, parameter :: dist_fillCOUNT = 6 ! Integer range + ! Normalisation Methods + ! ======================= + integer, parameter :: dist_normNONE = 0 ! No normalisation + integer, parameter :: dist_normSIXTRACK = 1 ! Use SixTrack tas matrix + integer, parameter :: dist_normINPUT = 2 ! Use matrix in DIST block + integer, parameter :: dist_normTWISS = 3 ! Use twiss in DIST block + + integer, private, save :: dist_normMethod = dist_normSIXTRACK ! Flag for source of normalisation matrix + integer, private, save :: dist_tMatRow = 0 ! How many T-matrix rows we've read + real(kind=fPrec), private, save :: dist_tMat(6,6) = zero ! T-matrix to use for normalisation + real(kind=fPrec), private, save :: dist_twBeta(2) = one ! Twiss beta + real(kind=fPrec), private, save :: dist_twAlpha(2) = zero ! Twiss alpha + real(kind=fPrec), private, save :: dist_bDisp(4) = zero ! Dispersion + real(kind=fPrec), private, save :: dist_beamEmit(3) = zero ! Beam emittance + integer, private, save :: dist_emit3Unit = 0 ! Flag for converting longitudinal emittance + ! Column Formats ! ================ integer, parameter :: dist_fmtNONE = 0 ! Column ignored @@ -173,6 +186,22 @@ subroutine distlib_setEmittance3(emit3) bind(C, name="setemitt3") real(kind=C_DOUBLE), value, intent(in) :: emit3 end subroutine distlib_setEmittance3 + subroutine distlib_setTwiss(betaX, alphaX, betaY, alphaY) bind(C, name="settwisstas") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), value, intent(in) :: betaX + real(kind=C_DOUBLE), value, intent(in) :: alphaX + real(kind=C_DOUBLE), value, intent(in) :: betaY + real(kind=C_DOUBLE), value, intent(in) :: alphaY + end subroutine distlib_setTwiss + + subroutine distlib_setDispersion(dX, dPx, dY, dPy) bind(C, name="setdisptas") + use, intrinsic :: iso_c_binding + real(kind=C_DOUBLE), value, intent(in) :: dX + real(kind=C_DOUBLE), value, intent(in) :: dPx + real(kind=C_DOUBLE), value, intent(in) :: dY + real(kind=C_DOUBLE), value, intent(in) :: dPy + end subroutine distlib_setDispersion + subroutine distlib_setTasMatrix(flatTas) bind(C, name="settasmatrix") use, intrinsic :: iso_c_binding real(kind=C_DOUBLE), intent(in) :: flatTas(36) @@ -220,9 +249,10 @@ subroutine dist_generateDist use mod_common use mod_particles use mod_common_main + use physical_constants use numerical_constants - integer distLibPart + integer i, distLibPart real(kind=fPrec) flatTas(36) call alloc(dist_partCol1, napx, zero, "dist_partCol1") @@ -232,18 +262,47 @@ subroutine dist_generateDist call alloc(dist_partCol5, napx, zero, "dist_partCol5") call alloc(dist_partCol6, napx, zero, "dist_partCol6") - dist_tMat(1:6,1:6) = tas(1:6,1:6) - dist_tMat(1:5,6) = dist_tMat(1:5,6)*c1m3 - dist_tMat(6,1:5) = dist_tMat(6,1:5)*c1e3 + ! If the T matrix hasn't been set from input, we set it here + if(dist_normMethod == dist_normSIXTRACK) then + dist_tMat(1:6,1:6) = tas(1:6,1:6) + dist_tMat(1:5,6) = dist_tMat(1:5,6)*c1m3 + dist_tMat(6,1:5) = dist_tMat(6,1:5)*c1e3 + end if + if(dist_normMethod == dist_normINPUT .and. dist_tMatRow /= 6) then + write(lerr,"(a,i0,a)") "DIST> ERROR The T-matrix must be 6 rows, but only ",dist_tMatRow," rows were given" + call prror + end if + + ! Scale longitudinal emittance + select case(dist_emit3Unit) + case(1) ! Micrometre + dist_beamEmit(3) = dist_beamEmit(3)*c1m6 + case(2) ! eV s + dist_beamEmit(3) = dist_beamEmit(3)*((clight*beta0)/((four*pi)*e0)) + end select + write(lout,"(a,1pe13.6,a)") "DIST> EMITTANCE X = ",dist_beamEmit(1)," m" + write(lout,"(a,1pe13.6,a)") "DIST> EMITTANCE Y = ",dist_beamEmit(2)," m" + write(lout,"(a,1pe13.6,a)") "DIST> EMITTANCE Z = ",dist_beamEmit(3)," m" #ifdef DISTLIB if(dist_distLib) then call distlib_init(1) call distlib_setEnergyMass(e0, nucm0) call distlib_setEmittance12(dist_beamEmit(1), dist_beamEmit(2)) - ! call distlib_setEmittance3(dist_beamEmit(3)) - flatTas = pack(transpose(dist_tMat),.true.) - call distlib_setTasMatrix(flatTas) + call distlib_setEmittance3(dist_beamEmit(3)) + select case(dist_normMethod) + case(dist_normSIXTRACK, dist_normINPUT) + do i=1,6 + write(lout,"(a,i0,a,6(1x,1pe13.6))") "DIST> TMATRIX(",i,",1:6) =",dist_tMat(i,1:6) + end do + flatTas = pack(transpose(dist_tMat),.true.) + call distlib_setTasMatrix(flatTas) + case(dist_normTWISS) + call distlib_setTwiss(dist_twBeta(1), dist_twAlpha(1), dist_twBeta(2), dist_twAlpha(2)) + call distlib_setDispersion(dist_bDisp(1), dist_bDisp(2), dist_bDisp(3), dist_bDisp(4)) + write(lout,"(a,2(1x,1pe13.6))") "DIST> BETA X/Y =",dist_twBeta + write(lout,"(a,2(1x,1pe13.6))") "DIST> ALPHA X/Y =",dist_twAlpha + end select end if #endif @@ -415,24 +474,49 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) dist_beamEmit(1) = dist_beamEmit(1) * c1m6 dist_beamEmit(2) = dist_beamEmit(2) * c1m6 - case("BUNCHLEN") - if(nSplit /= 2) then - write(lerr,"(a,i0)") "DIST> ERROR BUNCHLEN takes 1 argument, got ",nSplit-1 - write(lerr,"(a)") "DIST> BUNCHLEN rms_len[mm]" + case("LONGEMIT") + if(nSplit /= 3) then + write(lerr,"(a,i0)") "DIST> ERROR LONGEMIT takes 2 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> LONGEMIT emit3 unit[eVs|um]" iErr = .true. return end if - call chr_cast(lnSplit(2), dist_beamLen, cErr) - dist_beamLen = dist_beamLen * c1m3 + call chr_cast(lnSplit(2), dist_beamEmit(3), cErr) + select case(chr_toLower(lnSplit(3))) + case("um","µm") + dist_emit3Unit = 1 + case("evs") + dist_emit3Unit = 2 + case default + write(lerr,"(a)") "DIST> ERROR Unknown or unsupported unit '"//trim(lnSplit(3))//"' for LONGEMIT" + iErr = .true. + return + end select - case("ESPREAD") - if(nSplit /= 2) then - write(lerr,"(a,i0)") "DIST> ERROR ESPREAD takes 1 argument, got ",nSplit-1 - write(lerr,"(a)") "DIST> ESPREAD rms_energy_spread" + case("TWISS") + if(nSplit /= 5) then + write(lerr,"(a,i0)") "DIST> ERROR TWISS takes 4 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> TWISS betaX[m] alphaX[1] betaY[m] alphaY[1]" iErr = .true. return end if - call chr_cast(lnSplit(2), dist_beamSpread, cErr) + call chr_cast(lnSplit(2), dist_twBeta(1), cErr) + call chr_cast(lnSplit(3), dist_twAlpha(1), cErr) + call chr_cast(lnSplit(4), dist_twBeta(2), cErr) + call chr_cast(lnSplit(5), dist_twAlpha(2), cErr) + dist_normMethod = dist_normTWISS + + case("DISPERSION") + if(nSplit /= 5) then + write(lerr,"(a,i0)") "DIST> ERROR DISPERSION takes 4 arguments, got ",nSplit-1 + write(lerr,"(a)") "DIST> DISPERSION dx dpx dy dpy" + iErr = .true. + return + end if + call chr_cast(lnSplit(2), dist_bDisp(1), cErr) + call chr_cast(lnSplit(3), dist_bDisp(2), cErr) + call chr_cast(lnSplit(4), dist_bDisp(3), cErr) + call chr_cast(lnSplit(5), dist_bDisp(4), cErr) case("FILL") if(nSplit < 3) then @@ -454,6 +538,23 @@ subroutine dist_parseInputLine(inLine, iLine, iErr) call recuut(dist_seedOne, dist_seedTwo) call recuin(tmpOne, tmpTwo) + case("TMATRIX") + if(nSplit /= 7) then + write(lerr,"(a,i0)") "DIST> ERROR TMATRIX takes 6 arguments, got ",nSplit-1 + iErr = .true. + return + end if + dist_tMatRow = dist_tMatRow + 1 + if(dist_tMatRow > 6) then + write(lerr,"(a)") "DIST> ERROR Only 6 rows for the TMATRIX can be given" + iErr = .true. + return + end if + do i=1,6 + call chr_cast(lnSplit(i+1), dist_tMat(dist_tMatRow,i), cErr) + end do + dist_normMethod = dist_normINPUT + case default write(lerr,"(a)") "DIST> ERROR Unknown keyword '"//trim(lnSplit(1))//"'." iErr = .true. @@ -1763,7 +1864,7 @@ subroutine dist_normToPhysical sqEmitX = sqrt(dist_beamEmit(1)) sqEmitY = sqrt(dist_beamEmit(2)) - sqEmitZ = sqrt(dist_beamLen * dist_beamSpread) + sqEmitZ = sqrt(dist_beamEmit(3)) xv1(1:napx) = ( & dist_partCol1(1:napx) * (sqEmitX * dist_tMat(1,1)) + & From 5536a62afd3532f949edfeb97d1281c94630f6c6 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Wed, 31 Jul 2019 16:53:06 +0200 Subject: [PATCH 38/38] Added two more tests for distlib --- lib/DISTlib | 2 +- test/CMakeLists.txt | 8 ++ test/distlib_tmatrix/extra_checks.txt | 1 + test/distlib_tmatrix/fort.2 | 54 ++++++++ test/distlib_tmatrix/fort.3 | 61 +++++++++ .../initial_state.dat.canonical | 127 ++++++++++++++++++ test/distlib_twiss/extra_checks.txt | 1 + test/distlib_twiss/fort.2 | 54 ++++++++ test/distlib_twiss/fort.3 | 62 +++++++++ .../distlib_twiss/initial_state.dat.canonical | 127 ++++++++++++++++++ 10 files changed, 496 insertions(+), 1 deletion(-) create mode 100644 test/distlib_tmatrix/extra_checks.txt create mode 100644 test/distlib_tmatrix/fort.2 create mode 100644 test/distlib_tmatrix/fort.3 create mode 100644 test/distlib_tmatrix/initial_state.dat.canonical create mode 100644 test/distlib_twiss/extra_checks.txt create mode 100644 test/distlib_twiss/fort.2 create mode 100644 test/distlib_twiss/fort.3 create mode 100644 test/distlib_twiss/initial_state.dat.canonical diff --git a/lib/DISTlib b/lib/DISTlib index ea9bccd08..a0bf08f7d 160000 --- a/lib/DISTlib +++ b/lib/DISTlib @@ -1 +1 @@ -Subproject commit ea9bccd0879035afbed1ade658e6741e2cace8ab +Subproject commit a0bf08f7d81b7b2494d6046b9ad95df040b0bee1 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f8e7796b2..b842d8a14 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -224,6 +224,8 @@ endif() if(DISTLIB) list(APPEND SIXTRACK_TESTS distlib_normalised + distlib_tmatrix + distlib_twiss ) endif() @@ -271,6 +273,8 @@ set(TESTS_NOFORT10 dist_file_6d dist_file_6d_direct distlib_normalised + distlib_tmatrix + distlib_twiss dump_2_all_ele_highprec dump_all_highprec dump_binary @@ -342,6 +346,8 @@ set(TESTS_NO_STF_FORT90 dist_file_6d dist_file_6d_direct distlib_normalised + distlib_tmatrix + distlib_twiss dump_all_highprec dump4 dump5 @@ -618,6 +624,8 @@ set(FAST_TESTS dist_file_6d dist_file_6d_direct distlib_normalised + distlib_tmatrix + distlib_twiss dump_2_all_ele_highprec dump_all_highprec dump_binary diff --git a/test/distlib_tmatrix/extra_checks.txt b/test/distlib_tmatrix/extra_checks.txt new file mode 100644 index 000000000..3ac9a49e1 --- /dev/null +++ b/test/distlib_tmatrix/extra_checks.txt @@ -0,0 +1 @@ +initial_state.dat diff --git a/test/distlib_tmatrix/fort.2 b/test/distlib_tmatrix/fort.2 new file mode 100644 index 000000000..0fa0481ac --- /dev/null +++ b/test/distlib_tmatrix/fort.2 @@ -0,0 +1,54 @@ +SINGLE ELEMENTS--------------------------------------------------------- + redip_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_0 0 0.000000000e+00 0.000000000e+00 5.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redip 11 -2.000000000e-02 1.000000000e+00 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + ip5 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_2 0 0.000000000e+00 0.000000000e+00 5.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_3 0 0.000000000e+00 0.000000000e+00 4.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv 11 -1.200000000e-02 9.000000000e-01 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_5 0 0.000000000e+00 0.000000000e+00 5.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qfstart 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_6 0 0.000000000e+00 0.000000000e+00 7.500000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qd 2 1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_7 0 0.000000000e+00 0.000000000e+00 1.000000000e+01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qf 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_11 0 0.000000000e+00 0.000000000e+00 2.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + hkick 1 1.200000000e-04 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + vkick -1 1.330000000e-03 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_13 0 0.000000000e+00 0.000000000e+00 9.600000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_14 0 0.000000000e+00 0.000000000e+00 2.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.1 -12 1.500000000e-01 1.000000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.2 12 1.500000000e-01 1.000000000e+02 1.800000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_15 0 0.000000000e+00 0.000000000e+00 9.980000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 +NEXT +BLOCK DEFINITIONS------------------------------------------------------- + 1 1 + BLOC1 drift_0 + BLOC2 drift_2 + BLOC3 drift_3 + BLOC4 drift_5 + BLOC5 drift_6 + BLOC6 drift_7 + BLOC7 drift_11 + BLOC8 drift_13 + BLOC9 drift_14 + BLOC10 drift_15 +NEXT +STRUCTURE INPUT--------------------------------------------------------- + redip_den BLOC1 redip + BLOC1 redip_den ip5 + BLOC2 redipv_den BLOC3 + redipv BLOC3 redipv_den + BLOC4 qfstart BLOC5 + qd BLOC6 qf + BLOC6 qd BLOC6 + qf BLOC6 qd + BLOC7 hkick BLOC7 + vkick BLOC8 qf + BLOC9 rfcav.1 rfcav.2 + BLOC10 qd BLOC6 + qf BLOC6 qd + BLOC6 qf BLOC6 + qd BLOC6 +NEXT diff --git a/test/distlib_tmatrix/fort.3 b/test/distlib_tmatrix/fort.3 new file mode 100644 index 000000000..ed2d7f83c --- /dev/null +++ b/test/distlib_tmatrix/fort.3 @@ -0,0 +1,61 @@ +GEOMETRY + +SETTINGS------------------------------------------------------------------------ + DEBUG + INITIALSTATE text ions +NEXT + +SIMULATION---------------------------------------------------------------------- + PARTICLES 100 + TURNS 10 + LATTICE Thin 6D + 6D_CLORB on + WRITE_TRACKS 100000 off + REF_PARTICLE 938.272046 + REF_ENERGY 1500.0 +NEXT + +DIST---------------------------------------------------------------------------- + EMITTANCE 2.5 2.5 + LONGEMIT 1.0 um + SEED 12 + FILL ID COUNT 1 1 + FILL XN GAUSS 1.0 0.0 5.0 + FILL PXN GAUSS 1.0 0.0 5.0 + FILL YN GAUSS 1.0 0.0 5.0 + FILL PYN GAUSS 1.0 0.0 5.0 + FILL ZN FLOAT 0.0 + FILL PZN FLOAT 0.0 + FILL ION_A INT 1 + FILL ION_Z INT 1 + FILL CHARGE INT 1 + FILL MASS FLOAT 938.272046 + TMATRIX 1.0 0.0 0.0 0.0 0.0 0.0 + TMATRIX 0.5 -1.0 0.0 0.0 0.0 0.0 + TMATRIX 0.0 0.0 1.0 0.0 0.0 0.0 + TMATRIX 0.0 0.0 0.5 -1.0 0.0 0.0 + TMATRIX 0.0 0.0 0.0 0.0 1.0 0.0 + TMATRIX 0.0 0.0 0.0 0.0 0.0 1.0 +NEXT + +ITERATION ERRORS---------------------------------------------------------------- + 100 1e-12 1e-15 + 10 1e-10 1e-10 + 10 1e-09 1e-10 + 1e-09 1e-09 1e-09 1000.0 1000.0 +NEXT + +LINEAR OPTICS CALCULATION------------------------------------------------------- + ELEMENT 0 1 +NEXT + +SYNC---------------------------------------------------------------------------- + 100 0.008066 0.300 0.0 120.000000 938.272081 1 + 1.0 1.0 +NEXT + +BEAM---------------------------------------------------------------------------- + 0.0000e+00 1.24731e+06 1.24731e+06 1.0000e+00 1.0000e-03 1 0 +NEXT + +ENDE============================================================================ diff --git a/test/distlib_tmatrix/initial_state.dat.canonical b/test/distlib_tmatrix/initial_state.dat.canonical new file mode 100644 index 000000000..0b1cd41f1 --- /dev/null +++ b/test/distlib_tmatrix/initial_state.dat.canonical @@ -0,0 +1,127 @@ +# Tracking +# NPart Start = 100 +# NPart End = 100 +# NPart Allocated = 100 +# NTurns = 10 +# +# Reference Particle +# Mass [MeV] = 9.3827204600000005E+002 +# Energy [MeV] = 1.5000000000000000E+003 +# Momentum [MeV] = 1.1703185753011758E+003 +# Atomic Mass = 1 +# Atomic Number = 1 +# Charge = 1 +# +# Closed Orbit [x, xp, y, yp, sigma, dp] +# 4D Closed Orbit = -1.5498722213546328E+000 -4.3500010391828145E-002 -1.4989124120633555E+001 1.7237369151616875E+000 +# 6D Closed Orbit = -1.5489235141985989E+000 -4.3473605825315120E-002 -1.4989261289375516E+001 1.7237444642071489E+000 -4.2107237039057596E-002 1.5435395404834125E-006 +# +# Tune = 1.1939580566902230E+000 1.1927142768866879E+000 4.5375143182007568E-002 +# TAS(1,1:6) = 5.0575676953128488E+000 -3.3870888240479871E-015 2.8806797574983120E-003 -1.9091230819892593E-003 6.6567796668340036E-004 5.1166711173457773E-002 +# TAS(2,1:6) = 2.6897044343621834E-001 1.9771761320049092E-001 2.2671821888737428E-004 1.1265393279688216E-005 -5.5348174208300581E-004 1.5045674851595922E-003 +# TAS(3,1:6) = -1.9066179617558249E-003 -1.2665946113833268E-003 3.3963739014102718E+000 1.1895196927328681E-015 1.4316453082114900E-003 -7.4438890648758100E-003 +# TAS(4,1:6) = 1.9714155052385097E-004 -1.0780501610546031E-004 -1.5509111235773113E-001 2.9443097664480766E-001 1.4108128451493176E-004 5.6558841502251528E-004 +# TAS(5,1:6) = 7.8669428379806436E-002 1.2937578591225055E-001 -9.7076149174573322E-003 -2.7980431022808196E-002 1.2786197210833075E+001 -4.7046131016399247E-016 +# TAS(6,1:6) = -2.3296675479710709E-004 -1.0281192838804185E-005 5.4702830656052533E-005 -3.2887901422474877E-005 1.4164465116485263E-006 7.8206897813173568E-002 +# +# partID parentID lost prim x y xp yp sigma dp p e mass A Z Q PDGid + 1 1 F T 1.8516771234109954E+000 -3.5264536334731083E+000 1.0106976095782504E-005 -3.2340521391000303E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 2 2 F T -8.7651408160518784E-001 3.7590060420735671E+000 -2.9299316588618716E+000 2.7360366798409204E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 3 3 F T -8.8498415335523806E-001 1.1128690616248955E+000 3.2205918074700396E-001 1.4347983298320544E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 4 4 F T -4.4725643280093641E-001 -2.3559503378569446E+000 1.6427284974227366E-001 -4.2923581887643109E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 5 5 F T 6.5853805272772314E-001 1.3386442302741632E+000 6.1113094775085597E-001 3.0459143720127004E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 6 6 F T 1.3160081067641709E+000 1.0826299975435614E+000 -1.0313626235328963E+000 3.3859316807865656E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 7 7 F T -1.5393472539799771E+000 1.8556879533782134E+000 3.2223906133441876E-001 -8.8499911617885507E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 8 8 F T -2.1699233528142425E+000 -5.5091936726813151E-001 4.3623287938418109E-001 -2.0817558111701380E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 9 9 F T -1.2446685909614397E+000 -3.4157660799291683E+000 9.6456246467957446E-002 -1.3536164155611423E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 10 10 F T 1.8732623984406669E+000 -2.1607263289196427E-001 -3.8820403627625011E-001 7.4359148369560424E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 11 11 F T -3.4392068260624962E+000 -4.1719572330345139E-001 2.0374568151551342E+000 2.3195407672593507E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 12 12 F T -1.5082289550105275E+000 1.8939130664699206E+000 -2.4947644811431058E+000 -1.0520223909827144E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 13 13 F T -5.1782277763095053E+000 1.8473440108766082E+000 -2.3666538652028009E+000 -1.8301862569554053E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 14 14 F T 2.7525767402945983E-001 -2.1276761344160589E+000 -1.0199843844490393E-001 3.8694737779446703E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 15 15 F T -8.2577583112146713E-001 -2.4230657251977075E+000 -1.9765402787409816E-001 -3.7058742765596229E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 16 16 F T 1.6159209942779111E+000 -1.4532837573503279E+000 -2.4705838534753721E+000 -1.2679602210804573E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 17 17 F T 1.1206196712347134E+000 -9.3313592523298361E-001 9.7571367607893633E-001 -6.1411996587981454E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 18 18 F T -7.4289872140483781E-001 2.2668315351768888E+000 5.9217271295836171E-001 4.0056947119829287E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 19 19 F T -9.9368941361984331E-001 -1.3383593547248126E-002 9.1819009740721014E-001 -9.2212041736870964E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 20 20 F T 2.1730158033625231E+000 6.2498883675721240E-001 -7.2759678552564566E-001 7.1989175691234183E-002 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 21 21 F T -1.4180743247119013E-001 1.0113093557840083E+000 -1.4028265071419921E+000 1.4878347637484277E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 22 22 F T 1.9167531738025134E-001 1.1872562910462672E+000 2.6473360976798554E+000 2.3475227407149530E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 23 23 F T 1.6886685272718986E+000 -2.9607804503070190E+000 2.4633617354222865E+000 -1.7511569936642344E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 24 24 F T 5.6304259631481490E-001 -6.7694147336574995E-001 -4.1951102400764861E-001 3.0416765429914214E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 25 25 F T 3.3930164895511927E+000 -1.3086960520001452E+000 3.2252131089864657E+000 3.4355581419298653E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 26 26 F T 2.6742465932321684E+000 -3.5602328174209075E-001 -8.1116424176447421E-001 3.1311723024543929E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 27 27 F T 2.5902658466023629E+000 7.9904767424094947E-001 -1.2146067938286712E-002 3.9281010585468507E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 28 28 F T 5.7519925064895569E-003 -1.8166734513554115E+000 1.5804296130359236E-001 -1.8627157474207352E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 29 29 F T -2.4098594280210386E-001 9.5829547187496603E-002 -7.4860909320076163E-001 6.9862995566590891E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 30 30 F T 2.1196435413697157E+000 3.7738817316651962E-001 3.7026206600053589E-002 1.3036766270517292E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 31 31 F T -1.4986798791938096E+000 7.9954014978091470E-001 4.1449109437515830E-001 1.0607832866994082E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 32 32 F T 1.6147388157353220E+000 2.4314420868222286E+000 2.5738986070557459E+000 -1.1676095783567706E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 33 33 F T -1.2484113615819656E+000 9.0595588508667346E-001 -4.1025649472985988E+000 4.3389042918806107E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 34 34 F T 3.9565973518225852E+000 -1.3485723257097033E+000 -9.3067911552743937E-002 -3.4782315356138360E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 35 35 F T 9.4286627315276350E-001 1.5085982746238924E+000 1.5262298335510098E+000 1.8093751453778584E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 36 36 F T -3.4140349410736759E+000 1.1849353955906310E+000 -3.5515884845117847E+000 1.6650865080680370E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 37 37 F T -2.6627746209188570E+000 -1.2128620560799586E+000 -5.0469791505658268E+000 5.4230270870119390E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 38 38 F T -8.3391179879401633E-001 -1.2359172569018209E+000 -2.7757872004163608E-001 2.5847742619013276E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 39 39 F T 2.5976386921200473E-001 -1.2380573591998876E+000 -7.8913434115006098E-001 -3.7947962442824196E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 40 40 F T 1.4782021508610950E+000 -2.2611069196007718E+000 2.4778747445043008E+000 1.6141895633679952E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 41 41 F T -1.4039506452753987E+000 4.6691653752220141E-001 -1.9658136638017143E+000 3.7635507199737106E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 42 42 F T -4.0537370890888424E-001 -5.8728564120402871E-001 1.4080949049896625E+000 -1.3828798247191250E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 43 43 F T -1.3844915114694316E+000 6.7655860507248156E-001 -2.0301222829396233E+000 3.2546559638423567E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 44 44 F T 3.8623013422690784E+000 3.5217679924581463E-001 1.5937738396486589E+000 1.3786334479713025E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 45 45 F T 7.4735367415291976E-001 -1.1880390379900201E+000 9.4850061155619536E-001 3.2082545169857085E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 46 46 F T 5.1709666284426847E-001 -2.6481143029026559E+000 1.2813639320895274E+000 -2.8507056821316130E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 47 47 F T -2.2878215199984853E+000 2.4344230060659919E-001 1.7079037954037143E-001 -1.3377032412047213E-002 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 48 48 F T -5.5535270882154064E-001 3.9186778071528289E-001 -9.0886811786571320E-001 2.0652049621922891E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 49 49 F T 1.0666671649876871E+000 -8.5672510600695984E-001 2.3013037890162775E+000 1.1627688516161307E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 50 50 F T -1.8369831809213366E+000 3.3352068926972107E+000 -3.0110569699476963E+000 5.7423923281537470E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 51 51 F T -1.5402604982543344E+000 -1.5287639911927287E+000 4.4467508597679062E-001 -1.7339164292792894E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 52 52 F T -1.4214143780955649E-001 2.9677801459737316E+000 -3.6014373505634267E-001 1.4061062014568779E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 53 53 F T 2.7168314842543930E+000 -1.5988261026581778E+000 1.7274466547447473E+000 1.4348995355074718E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 54 54 F T 2.5918133383385364E+000 -1.4578837831314215E+000 4.5789986426852275E-001 -1.8007082660137061E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 55 55 F T -2.8793597559283364E+000 1.1454780457766831E+000 -2.3230003141964604E+000 1.1841013259120917E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 56 56 F T 2.6957505119283032E-001 -6.6887274536589825E-002 -3.4909101499464679E-001 3.4542463830522641E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 57 57 F T 2.0667222719397231E+000 -1.8362499175889992E+000 5.3219657454306268E-001 -5.1860351510440938E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 58 58 F T 1.8712663924715547E+000 -3.0120760092429397E+000 -2.2890248359891707E+000 -2.5577723963401628E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 59 59 F T 3.9586686928351722E+000 4.4924445605341606E-001 1.8165212847282006E+000 2.3660298123776341E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 60 60 F T 2.2139278903030672E+000 -4.2925691635377067E-001 2.1153121242843129E+000 -2.8469830706032098E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 61 61 F T -2.4700956905499032E+000 -7.2310031827187427E-001 -4.0752568233993125E-001 -9.4063174170788111E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 62 62 F T -2.8682872283679868E+000 4.3411265636170071E-001 7.7801237094438525E-001 -7.7456599012148419E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 63 63 F T -2.6362454932506862E+000 2.7193238615295034E-001 -2.6893650201084540E+000 2.0129189787094148E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 64 64 F T -1.0337881147623871E+000 -9.0115307815113055E-001 -2.7956881120812507E+000 -3.1848251493522928E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 65 65 F T 5.5470582109671784E-001 8.2443891632174671E-001 2.6853035970136991E+000 1.4063451010988548E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 66 66 F T -8.7320224215737507E-001 7.5502282756236050E-002 -7.3670796654609938E-001 -8.2237437986539297E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 67 67 F T -1.8822519691616346E+000 4.9493387051018395E-001 -3.6591381527323615E-002 7.0146002501410420E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 68 68 F T -3.5995524601415968E-001 2.8068279481749014E+000 -5.5407184851888325E-001 1.1753732537412618E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 69 69 F T 5.1563523325194349E-001 2.1311033375256949E+000 1.7201499204255108E+000 3.0125004492397180E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 70 70 F T 1.3667550569719067E+000 -1.6240839146310742E+000 3.0821316112196095E+000 -1.1138170644544461E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 71 71 F T -1.5622537025680500E-001 4.0147546401402362E-001 7.5873602605659146E-002 2.7440104895546145E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 72 72 F T 6.4826496074581519E-001 1.1060325748830477E-001 -9.0903422477610824E-002 -1.1945162763922061E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 73 73 F T -9.5005243977033593E-001 1.5366396991258797E+000 -2.1394419158168589E+000 2.8204767432876681E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 74 74 F T 1.2337424653465154E+000 6.2564394226060405E-001 3.9748569088231043E+000 5.6623764222410855E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 75 75 F T 1.0061882801780322E+000 -2.9376356704808897E+000 1.1779789524638407E+000 -2.4863831568724737E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 76 76 F T -1.2471194657343765E+000 -7.2857424294601991E-001 -3.1011883837680587E+000 9.5259229479825980E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 77 77 F T -1.6841090504226206E+000 -1.0940245900615366E+000 -6.0049843909579559E-001 -2.7101984121831529E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 78 78 F T -1.0125631319321758E-001 7.7232102350206422E-001 1.9857184274199176E+000 9.5869748527660781E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 79 79 F T 5.9697215557456967E-002 2.9386395492603623E-001 1.8831860283538737E-001 3.0605719442730766E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 80 80 F T -7.1256568614429860E-001 5.1227563331345805E-001 -9.1246145702558368E-001 2.5793042444341968E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 81 81 F T -1.1273562974899895E-001 -2.4447153684708338E+000 -5.2645883435389362E-001 -2.1038398124109525E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 82 82 F T 2.7809957618608816E-001 6.0483146507077001E-001 1.9623985027357131E+000 1.0730963648469707E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 83 83 F T -3.7780860704569169E-001 8.1218112665766795E-001 -2.5409012905244244E-001 -1.0510829773795654E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 84 84 F T -1.9291926921148701E+000 -1.2756011828439082E+000 -2.8379662793128388E+000 -1.9360396191347700E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 85 85 F T -9.4666125491603259E-001 2.8641806697898140E+000 1.8092834172417278E+000 1.5020065681078201E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 86 86 F T 9.6501976061740058E-001 -2.5027723686462542E+000 6.1997328532782447E-001 1.8745913119800575E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 87 87 F T -1.7103522541397782E+000 -3.4968554107600858E-001 -9.4077053313059089E-001 -6.3756329911350273E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 88 88 F T 2.1954797734776057E+000 1.0206606938753475E+000 1.0857925003618514E+000 1.4859194887266132E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 89 89 F T -8.8681261474517159E-001 1.2286565378228429E+000 -1.6537270185286099E+000 1.9151767134445417E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 90 90 F T -1.7841914180296493E-002 -8.7716887754748074E-001 1.2268140139783128E+000 -1.3634054861305128E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 91 91 F T -2.8155910219775162E+000 -2.3656076156172827E+000 -2.3271444321157970E+000 -9.2507941411599570E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 92 92 F T 9.9926425019423293E-001 -5.9668500967677041E-001 -1.7168575455912272E+000 8.6157296153089558E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 93 93 F T 3.5054809503207834E-001 1.1693866704231259E+000 -3.2254172503259921E+000 1.5286265860169892E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 94 94 F T 3.3568891980047106E+000 6.9857989874872062E-001 1.2987156313131829E+000 -2.0532600175390634E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 95 95 F T 4.8692784576286990E-001 -3.0239971045436227E+000 2.8270442915691816E+000 -1.5070543720159417E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 96 96 F T 3.0330256735348732E-001 -2.6584000625164772E+000 -9.1787451115838770E-001 -1.7162702715911757E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 97 97 F T 1.0344786499016927E+000 -3.7146788765322453E-001 7.5814776908723880E-001 -6.8132323308591047E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 98 98 F T -6.7743689806263230E-001 -3.6145064656062575E-001 -4.1392948374161200E+000 2.0954255060444344E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 99 99 F T -3.4731913142939081E+000 -1.2739708591855864E-001 -9.9010537180413283E-001 -2.3742096756147206E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 100 100 F T -1.5734624457360278E+000 6.3448482809661366E-001 -3.0001752083277289E+000 -3.0037574058210272E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 diff --git a/test/distlib_twiss/extra_checks.txt b/test/distlib_twiss/extra_checks.txt new file mode 100644 index 000000000..3ac9a49e1 --- /dev/null +++ b/test/distlib_twiss/extra_checks.txt @@ -0,0 +1 @@ +initial_state.dat diff --git a/test/distlib_twiss/fort.2 b/test/distlib_twiss/fort.2 new file mode 100644 index 000000000..0fa0481ac --- /dev/null +++ b/test/distlib_twiss/fort.2 @@ -0,0 +1,54 @@ +SINGLE ELEMENTS--------------------------------------------------------- + redip_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_0 0 0.000000000e+00 0.000000000e+00 5.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redip 11 -2.000000000e-02 1.000000000e+00 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + ip5 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_2 0 0.000000000e+00 0.000000000e+00 5.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv_den 0 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_3 0 0.000000000e+00 0.000000000e+00 4.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + redipv 11 -1.200000000e-02 9.000000000e-01 -1.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_5 0 0.000000000e+00 0.000000000e+00 5.500000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qfstart 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_6 0 0.000000000e+00 0.000000000e+00 7.500000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qd 2 1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_7 0 0.000000000e+00 0.000000000e+00 1.000000000e+01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + qf 2 -1.175570505e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_11 0 0.000000000e+00 0.000000000e+00 2.000000000e-01 0.000000000e+00 0.000000000e+00 0.000000000e+00 + hkick 1 1.200000000e-04 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + vkick -1 1.330000000e-03 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_13 0 0.000000000e+00 0.000000000e+00 9.600000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_14 0 0.000000000e+00 0.000000000e+00 2.000000000e-02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.1 -12 1.500000000e-01 1.000000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 + rfcav.2 12 1.500000000e-01 1.000000000e+02 1.800000000e+02 0.000000000e+00 0.000000000e+00 0.000000000e+00 + drift_15 0 0.000000000e+00 0.000000000e+00 9.980000000e+00 0.000000000e+00 0.000000000e+00 0.000000000e+00 +NEXT +BLOCK DEFINITIONS------------------------------------------------------- + 1 1 + BLOC1 drift_0 + BLOC2 drift_2 + BLOC3 drift_3 + BLOC4 drift_5 + BLOC5 drift_6 + BLOC6 drift_7 + BLOC7 drift_11 + BLOC8 drift_13 + BLOC9 drift_14 + BLOC10 drift_15 +NEXT +STRUCTURE INPUT--------------------------------------------------------- + redip_den BLOC1 redip + BLOC1 redip_den ip5 + BLOC2 redipv_den BLOC3 + redipv BLOC3 redipv_den + BLOC4 qfstart BLOC5 + qd BLOC6 qf + BLOC6 qd BLOC6 + qf BLOC6 qd + BLOC7 hkick BLOC7 + vkick BLOC8 qf + BLOC9 rfcav.1 rfcav.2 + BLOC10 qd BLOC6 + qf BLOC6 qd + BLOC6 qf BLOC6 + qd BLOC6 +NEXT diff --git a/test/distlib_twiss/fort.3 b/test/distlib_twiss/fort.3 new file mode 100644 index 000000000..1a427f527 --- /dev/null +++ b/test/distlib_twiss/fort.3 @@ -0,0 +1,62 @@ +GEOMETRY + +SETTINGS------------------------------------------------------------------------ + DEBUG + INITIALSTATE text ions +NEXT + +SIMULATION---------------------------------------------------------------------- + PARTICLES 100 + TURNS 10 + LATTICE Thin 6D + 6D_CLORB on + WRITE_TRACKS 100000 off + REF_PARTICLE 938.272046 + REF_ENERGY 1500.0 +NEXT + +DIST---------------------------------------------------------------------------- + EMITTANCE 2.5 2.5 + LONGEMIT 1.0 um + TWISS 1.0 -0.5 1.0 -0.5 + SEED 12 + FILL ID COUNT 1 1 + FILL XN GAUSS 1.0 0.0 5.0 + FILL PXN GAUSS 1.0 0.0 5.0 + FILL YN GAUSS 1.0 0.0 5.0 + FILL PYN GAUSS 1.0 0.0 5.0 + FILL ZN FLOAT 0.0 + FILL PZN FLOAT 0.0 + FILL ION_A INT 1 + FILL ION_Z INT 1 + FILL CHARGE INT 1 + FILL MASS FLOAT 938.272046 + ! TMATRIX 1.0 0.0 0.0 0.0 0.0 0.0 + ! TMATRIX 0.5 -1.0 0.0 0.0 0.0 0.0 + ! TMATRIX 0.0 0.0 1.0 0.0 0.0 0.0 + ! TMATRIX 0.0 0.0 0.5 -1.0 0.0 0.0 + ! TMATRIX 0.0 0.0 0.0 0.0 1.0 0.0 + ! TMATRIX 0.0 0.0 0.0 0.0 0.0 1.0 +NEXT + +ITERATION ERRORS---------------------------------------------------------------- + 100 1e-12 1e-15 + 10 1e-10 1e-10 + 10 1e-09 1e-10 + 1e-09 1e-09 1e-09 1000.0 1000.0 +NEXT + +LINEAR OPTICS CALCULATION------------------------------------------------------- + ELEMENT 0 1 +NEXT + +SYNC---------------------------------------------------------------------------- + 100 0.008066 0.300 0.0 120.000000 938.272081 1 + 1.0 1.0 +NEXT + +BEAM---------------------------------------------------------------------------- + 0.0000e+00 1.24731e+06 1.24731e+06 1.0000e+00 1.0000e-03 1 0 +NEXT + +ENDE============================================================================ diff --git a/test/distlib_twiss/initial_state.dat.canonical b/test/distlib_twiss/initial_state.dat.canonical new file mode 100644 index 000000000..0b1cd41f1 --- /dev/null +++ b/test/distlib_twiss/initial_state.dat.canonical @@ -0,0 +1,127 @@ +# Tracking +# NPart Start = 100 +# NPart End = 100 +# NPart Allocated = 100 +# NTurns = 10 +# +# Reference Particle +# Mass [MeV] = 9.3827204600000005E+002 +# Energy [MeV] = 1.5000000000000000E+003 +# Momentum [MeV] = 1.1703185753011758E+003 +# Atomic Mass = 1 +# Atomic Number = 1 +# Charge = 1 +# +# Closed Orbit [x, xp, y, yp, sigma, dp] +# 4D Closed Orbit = -1.5498722213546328E+000 -4.3500010391828145E-002 -1.4989124120633555E+001 1.7237369151616875E+000 +# 6D Closed Orbit = -1.5489235141985989E+000 -4.3473605825315120E-002 -1.4989261289375516E+001 1.7237444642071489E+000 -4.2107237039057596E-002 1.5435395404834125E-006 +# +# Tune = 1.1939580566902230E+000 1.1927142768866879E+000 4.5375143182007568E-002 +# TAS(1,1:6) = 5.0575676953128488E+000 -3.3870888240479871E-015 2.8806797574983120E-003 -1.9091230819892593E-003 6.6567796668340036E-004 5.1166711173457773E-002 +# TAS(2,1:6) = 2.6897044343621834E-001 1.9771761320049092E-001 2.2671821888737428E-004 1.1265393279688216E-005 -5.5348174208300581E-004 1.5045674851595922E-003 +# TAS(3,1:6) = -1.9066179617558249E-003 -1.2665946113833268E-003 3.3963739014102718E+000 1.1895196927328681E-015 1.4316453082114900E-003 -7.4438890648758100E-003 +# TAS(4,1:6) = 1.9714155052385097E-004 -1.0780501610546031E-004 -1.5509111235773113E-001 2.9443097664480766E-001 1.4108128451493176E-004 5.6558841502251528E-004 +# TAS(5,1:6) = 7.8669428379806436E-002 1.2937578591225055E-001 -9.7076149174573322E-003 -2.7980431022808196E-002 1.2786197210833075E+001 -4.7046131016399247E-016 +# TAS(6,1:6) = -2.3296675479710709E-004 -1.0281192838804185E-005 5.4702830656052533E-005 -3.2887901422474877E-005 1.4164465116485263E-006 7.8206897813173568E-002 +# +# partID parentID lost prim x y xp yp sigma dp p e mass A Z Q PDGid + 1 1 F T 1.8516771234109954E+000 -3.5264536334731083E+000 1.0106976095782504E-005 -3.2340521391000303E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 2 2 F T -8.7651408160518784E-001 3.7590060420735671E+000 -2.9299316588618716E+000 2.7360366798409204E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 3 3 F T -8.8498415335523806E-001 1.1128690616248955E+000 3.2205918074700396E-001 1.4347983298320544E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 4 4 F T -4.4725643280093641E-001 -2.3559503378569446E+000 1.6427284974227366E-001 -4.2923581887643109E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 5 5 F T 6.5853805272772314E-001 1.3386442302741632E+000 6.1113094775085597E-001 3.0459143720127004E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 6 6 F T 1.3160081067641709E+000 1.0826299975435614E+000 -1.0313626235328963E+000 3.3859316807865656E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 7 7 F T -1.5393472539799771E+000 1.8556879533782134E+000 3.2223906133441876E-001 -8.8499911617885507E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 8 8 F T -2.1699233528142425E+000 -5.5091936726813151E-001 4.3623287938418109E-001 -2.0817558111701380E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 9 9 F T -1.2446685909614397E+000 -3.4157660799291683E+000 9.6456246467957446E-002 -1.3536164155611423E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 10 10 F T 1.8732623984406669E+000 -2.1607263289196427E-001 -3.8820403627625011E-001 7.4359148369560424E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 11 11 F T -3.4392068260624962E+000 -4.1719572330345139E-001 2.0374568151551342E+000 2.3195407672593507E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 12 12 F T -1.5082289550105275E+000 1.8939130664699206E+000 -2.4947644811431058E+000 -1.0520223909827144E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 13 13 F T -5.1782277763095053E+000 1.8473440108766082E+000 -2.3666538652028009E+000 -1.8301862569554053E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 14 14 F T 2.7525767402945983E-001 -2.1276761344160589E+000 -1.0199843844490393E-001 3.8694737779446703E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 15 15 F T -8.2577583112146713E-001 -2.4230657251977075E+000 -1.9765402787409816E-001 -3.7058742765596229E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 16 16 F T 1.6159209942779111E+000 -1.4532837573503279E+000 -2.4705838534753721E+000 -1.2679602210804573E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 17 17 F T 1.1206196712347134E+000 -9.3313592523298361E-001 9.7571367607893633E-001 -6.1411996587981454E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 18 18 F T -7.4289872140483781E-001 2.2668315351768888E+000 5.9217271295836171E-001 4.0056947119829287E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 19 19 F T -9.9368941361984331E-001 -1.3383593547248126E-002 9.1819009740721014E-001 -9.2212041736870964E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 20 20 F T 2.1730158033625231E+000 6.2498883675721240E-001 -7.2759678552564566E-001 7.1989175691234183E-002 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 21 21 F T -1.4180743247119013E-001 1.0113093557840083E+000 -1.4028265071419921E+000 1.4878347637484277E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 22 22 F T 1.9167531738025134E-001 1.1872562910462672E+000 2.6473360976798554E+000 2.3475227407149530E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 23 23 F T 1.6886685272718986E+000 -2.9607804503070190E+000 2.4633617354222865E+000 -1.7511569936642344E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 24 24 F T 5.6304259631481490E-001 -6.7694147336574995E-001 -4.1951102400764861E-001 3.0416765429914214E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 25 25 F T 3.3930164895511927E+000 -1.3086960520001452E+000 3.2252131089864657E+000 3.4355581419298653E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 26 26 F T 2.6742465932321684E+000 -3.5602328174209075E-001 -8.1116424176447421E-001 3.1311723024543929E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 27 27 F T 2.5902658466023629E+000 7.9904767424094947E-001 -1.2146067938286712E-002 3.9281010585468507E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 28 28 F T 5.7519925064895569E-003 -1.8166734513554115E+000 1.5804296130359236E-001 -1.8627157474207352E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 29 29 F T -2.4098594280210386E-001 9.5829547187496603E-002 -7.4860909320076163E-001 6.9862995566590891E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 30 30 F T 2.1196435413697157E+000 3.7738817316651962E-001 3.7026206600053589E-002 1.3036766270517292E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 31 31 F T -1.4986798791938096E+000 7.9954014978091470E-001 4.1449109437515830E-001 1.0607832866994082E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 32 32 F T 1.6147388157353220E+000 2.4314420868222286E+000 2.5738986070557459E+000 -1.1676095783567706E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 33 33 F T -1.2484113615819656E+000 9.0595588508667346E-001 -4.1025649472985988E+000 4.3389042918806107E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 34 34 F T 3.9565973518225852E+000 -1.3485723257097033E+000 -9.3067911552743937E-002 -3.4782315356138360E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 35 35 F T 9.4286627315276350E-001 1.5085982746238924E+000 1.5262298335510098E+000 1.8093751453778584E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 36 36 F T -3.4140349410736759E+000 1.1849353955906310E+000 -3.5515884845117847E+000 1.6650865080680370E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 37 37 F T -2.6627746209188570E+000 -1.2128620560799586E+000 -5.0469791505658268E+000 5.4230270870119390E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 38 38 F T -8.3391179879401633E-001 -1.2359172569018209E+000 -2.7757872004163608E-001 2.5847742619013276E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 39 39 F T 2.5976386921200473E-001 -1.2380573591998876E+000 -7.8913434115006098E-001 -3.7947962442824196E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 40 40 F T 1.4782021508610950E+000 -2.2611069196007718E+000 2.4778747445043008E+000 1.6141895633679952E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 41 41 F T -1.4039506452753987E+000 4.6691653752220141E-001 -1.9658136638017143E+000 3.7635507199737106E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 42 42 F T -4.0537370890888424E-001 -5.8728564120402871E-001 1.4080949049896625E+000 -1.3828798247191250E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 43 43 F T -1.3844915114694316E+000 6.7655860507248156E-001 -2.0301222829396233E+000 3.2546559638423567E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 44 44 F T 3.8623013422690784E+000 3.5217679924581463E-001 1.5937738396486589E+000 1.3786334479713025E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 45 45 F T 7.4735367415291976E-001 -1.1880390379900201E+000 9.4850061155619536E-001 3.2082545169857085E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 46 46 F T 5.1709666284426847E-001 -2.6481143029026559E+000 1.2813639320895274E+000 -2.8507056821316130E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 47 47 F T -2.2878215199984853E+000 2.4344230060659919E-001 1.7079037954037143E-001 -1.3377032412047213E-002 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 48 48 F T -5.5535270882154064E-001 3.9186778071528289E-001 -9.0886811786571320E-001 2.0652049621922891E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 49 49 F T 1.0666671649876871E+000 -8.5672510600695984E-001 2.3013037890162775E+000 1.1627688516161307E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 50 50 F T -1.8369831809213366E+000 3.3352068926972107E+000 -3.0110569699476963E+000 5.7423923281537470E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 51 51 F T -1.5402604982543344E+000 -1.5287639911927287E+000 4.4467508597679062E-001 -1.7339164292792894E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 52 52 F T -1.4214143780955649E-001 2.9677801459737316E+000 -3.6014373505634267E-001 1.4061062014568779E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 53 53 F T 2.7168314842543930E+000 -1.5988261026581778E+000 1.7274466547447473E+000 1.4348995355074718E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 54 54 F T 2.5918133383385364E+000 -1.4578837831314215E+000 4.5789986426852275E-001 -1.8007082660137061E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 55 55 F T -2.8793597559283364E+000 1.1454780457766831E+000 -2.3230003141964604E+000 1.1841013259120917E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 56 56 F T 2.6957505119283032E-001 -6.6887274536589825E-002 -3.4909101499464679E-001 3.4542463830522641E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 57 57 F T 2.0667222719397231E+000 -1.8362499175889992E+000 5.3219657454306268E-001 -5.1860351510440938E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 58 58 F T 1.8712663924715547E+000 -3.0120760092429397E+000 -2.2890248359891707E+000 -2.5577723963401628E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 59 59 F T 3.9586686928351722E+000 4.4924445605341606E-001 1.8165212847282006E+000 2.3660298123776341E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 60 60 F T 2.2139278903030672E+000 -4.2925691635377067E-001 2.1153121242843129E+000 -2.8469830706032098E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 61 61 F T -2.4700956905499032E+000 -7.2310031827187427E-001 -4.0752568233993125E-001 -9.4063174170788111E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 62 62 F T -2.8682872283679868E+000 4.3411265636170071E-001 7.7801237094438525E-001 -7.7456599012148419E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 63 63 F T -2.6362454932506862E+000 2.7193238615295034E-001 -2.6893650201084540E+000 2.0129189787094148E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 64 64 F T -1.0337881147623871E+000 -9.0115307815113055E-001 -2.7956881120812507E+000 -3.1848251493522928E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 65 65 F T 5.5470582109671784E-001 8.2443891632174671E-001 2.6853035970136991E+000 1.4063451010988548E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 66 66 F T -8.7320224215737507E-001 7.5502282756236050E-002 -7.3670796654609938E-001 -8.2237437986539297E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 67 67 F T -1.8822519691616346E+000 4.9493387051018395E-001 -3.6591381527323615E-002 7.0146002501410420E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 68 68 F T -3.5995524601415968E-001 2.8068279481749014E+000 -5.5407184851888325E-001 1.1753732537412618E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 69 69 F T 5.1563523325194349E-001 2.1311033375256949E+000 1.7201499204255108E+000 3.0125004492397180E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 70 70 F T 1.3667550569719067E+000 -1.6240839146310742E+000 3.0821316112196095E+000 -1.1138170644544461E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 71 71 F T -1.5622537025680500E-001 4.0147546401402362E-001 7.5873602605659146E-002 2.7440104895546145E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 72 72 F T 6.4826496074581519E-001 1.1060325748830477E-001 -9.0903422477610824E-002 -1.1945162763922061E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 73 73 F T -9.5005243977033593E-001 1.5366396991258797E+000 -2.1394419158168589E+000 2.8204767432876681E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 74 74 F T 1.2337424653465154E+000 6.2564394226060405E-001 3.9748569088231043E+000 5.6623764222410855E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 75 75 F T 1.0061882801780322E+000 -2.9376356704808897E+000 1.1779789524638407E+000 -2.4863831568724737E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 76 76 F T -1.2471194657343765E+000 -7.2857424294601991E-001 -3.1011883837680587E+000 9.5259229479825980E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 77 77 F T -1.6841090504226206E+000 -1.0940245900615366E+000 -6.0049843909579559E-001 -2.7101984121831529E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 78 78 F T -1.0125631319321758E-001 7.7232102350206422E-001 1.9857184274199176E+000 9.5869748527660781E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 79 79 F T 5.9697215557456967E-002 2.9386395492603623E-001 1.8831860283538737E-001 3.0605719442730766E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 80 80 F T -7.1256568614429860E-001 5.1227563331345805E-001 -9.1246145702558368E-001 2.5793042444341968E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 81 81 F T -1.1273562974899895E-001 -2.4447153684708338E+000 -5.2645883435389362E-001 -2.1038398124109525E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 82 82 F T 2.7809957618608816E-001 6.0483146507077001E-001 1.9623985027357131E+000 1.0730963648469707E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 83 83 F T -3.7780860704569169E-001 8.1218112665766795E-001 -2.5409012905244244E-001 -1.0510829773795654E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 84 84 F T -1.9291926921148701E+000 -1.2756011828439082E+000 -2.8379662793128388E+000 -1.9360396191347700E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 85 85 F T -9.4666125491603259E-001 2.8641806697898140E+000 1.8092834172417278E+000 1.5020065681078201E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 86 86 F T 9.6501976061740058E-001 -2.5027723686462542E+000 6.1997328532782447E-001 1.8745913119800575E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 87 87 F T -1.7103522541397782E+000 -3.4968554107600858E-001 -9.4077053313059089E-001 -6.3756329911350273E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 88 88 F T 2.1954797734776057E+000 1.0206606938753475E+000 1.0857925003618514E+000 1.4859194887266132E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 89 89 F T -8.8681261474517159E-001 1.2286565378228429E+000 -1.6537270185286099E+000 1.9151767134445417E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 90 90 F T -1.7841914180296493E-002 -8.7716887754748074E-001 1.2268140139783128E+000 -1.3634054861305128E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 91 91 F T -2.8155910219775162E+000 -2.3656076156172827E+000 -2.3271444321157970E+000 -9.2507941411599570E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 92 92 F T 9.9926425019423293E-001 -5.9668500967677041E-001 -1.7168575455912272E+000 8.6157296153089558E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 93 93 F T 3.5054809503207834E-001 1.1693866704231259E+000 -3.2254172503259921E+000 1.5286265860169892E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 94 94 F T 3.3568891980047106E+000 6.9857989874872062E-001 1.2987156313131829E+000 -2.0532600175390634E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 95 95 F T 4.8692784576286990E-001 -3.0239971045436227E+000 2.8270442915691816E+000 -1.5070543720159417E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 96 96 F T 3.0330256735348732E-001 -2.6584000625164772E+000 -9.1787451115838770E-001 -1.7162702715911757E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 97 97 F T 1.0344786499016927E+000 -3.7146788765322453E-001 7.5814776908723880E-001 -6.8132323308591047E-001 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 98 98 F T -6.7743689806263230E-001 -3.6145064656062575E-001 -4.1392948374161200E+000 2.0954255060444344E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 99 99 F T -3.4731913142939081E+000 -1.2739708591855864E-001 -9.9010537180413283E-001 -2.3742096756147206E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212 + 100 100 F T -1.5734624457360278E+000 6.3448482809661366E-001 -3.0001752083277289E+000 -3.0037574058210272E+000 0.0000000000000000E+000 0.0000000000000000E+000 1.1703185753011758E+003 1.5000000000000000E+003 9.3827204600000005E+002 1 1 1 2212