From 7115fd3b04a02575d22cc130bb42b6cb738983c0 Mon Sep 17 00:00:00 2001 From: salman Date: Tue, 14 Apr 2026 17:25:34 +0200 Subject: [PATCH] Add comments to TrimSP Fortran core --- fortran/trimspNL.F | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fortran/trimspNL.F b/fortran/trimspNL.F index b490cac..699dde7 100644 --- a/fortran/trimspNL.F +++ b/fortran/trimspNL.F @@ -401,7 +401,9 @@ C LMAX is maximum number of layers and JMAX is maximum number of C elements per layer. JMAX=5 -C This part reads the input file (new format) +C This part reads the input file (new format). +C The JavaScript/Electron frontend writes this sequential block layout, +C so the READ order below must stay in sync with CreateInpFile(). OPEN(UNIT=99,file=errnam,STATUS='replace') OPEN(UNIT=11,file=innam,STATUS='unknown',ERR=1359) C First line: properties of projectile @@ -814,6 +816,9 @@ C ENDDO C C PROJECTILE LOOP +C Each pass transports one projectile history. The state vectors +C X/Y/Z, E, direction cosines, current layer index, etc. are updated +C in-place until the particle stops, backscatters or transmits. C 1 CONTINUE NPROJ=NPROJ+1 @@ -829,6 +834,10 @@ C KK1=KK0 C C COLLISION LOOP (INCLUDES WEAK SIMULTANEOUS COLL. FOR KK1.LT.4) +C KK controls the treatment of weak simultaneous collisions. +C For every active projectile we choose a collision partner, sample an +C impact parameter, solve the scattering geometry for the selected +C interatomic potential and then update the projectile state. C DO 245 KK=KK1,0,-1 C @@ -3374,6 +3383,10 @@ C & I0,3x)) & ,1x)) inquire(FILE='fort.33',EXIST=FORT33) +C fort.33 is the compact per-run summary consumed by the GUI for scan +C plots (fractions stopped in each layer, backscattering, transmission, +C mean depth, etc.). The header line is written once, then each run +C appends a single summary row. if (.not.FORT33) then open(33) WRITE(33,7802) (chem(k),k=1,NLayers)