From e292afff59430365d38e44243dd0850f6acd6642 Mon Sep 17 00:00:00 2001 From: salman Date: Thu, 18 Jun 2026 15:12:34 +0200 Subject: [PATCH] Add comments to subroutines. --- fortran/trimspNL.F | 395 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 395 insertions(+) diff --git a/fortran/trimspNL.F b/fortran/trimspNL.F index eabb5c2..bf243a9 100644 --- a/fortran/trimspNL.F +++ b/fortran/trimspNL.F @@ -2716,6 +2716,24 @@ C======================================================================= C C Write transmission matrix and energy-angle correlation tables. C +C----------------------------------------------------------------------- +C Argument dictionary: writeTransmissionMatrixSummary +C +C nTrans,nPrimary transmitted and incident projectile counts +C transLogMatrix log-energy/cos-angle transmission matrix +C transLogEnergy transmitted energy sums for log matrix +C tempNh,energyLog matrix axis labels and normalization rows +C alpha beam incidence angle for angular output +C nAzimuthBins azimuthal-angle bin count +C azimuthBinWidth azimuthal-angle bin width +C maxDepthBins first dimension of transmission matrices +C transEnergyAngle energy-angle transmission counts +C transEnergyPolar transmitted energy sums per polar bin +C transAngleMatrix azimuth-polar transmission counts +C transEnergy total transmitted projectile energy +C nPolarBins polar-angle bin count +C maxDepthBins2 first dimension of angle matrix +C----------------------------------------------------------------------- subroutine writeTransmissionMatrixSummary(nTrans,nPrimary, & transLogMatrix,transLogEnergy,tempNh,energyLog,alpha, & nAzimuthBins,azimuthBinWidth,maxDepthBins,transEnergyAngle, @@ -2812,6 +2830,25 @@ C C C Write backscattering matrix and energy-angle correlation tables. C +C----------------------------------------------------------------------- +C Argument dictionary: writeBackscatterMatrixSummary +C +C nBackscatter,nPrimary backscattered and incident counts +C backLogMatrix log-energy/cos-angle backscatter matrix +C backLogEnergy reflected energy sums for log matrix +C tempNh,energyLog matrix axis labels and normalization rows +C alpha beam incidence angle for angular output +C nAzimuthBins azimuthal-angle bin count +C azimuthBinWidth azimuthal-angle bin width +C maxDepthBins first dimension of backscatter matrices +C backEnergyAngle energy-angle backscatter counts +C backEnergyPolar reflected energy sums per polar bin +C initialEnergy incident projectile energy +C backAngleMatrix azimuth-polar backscatter counts +C backEnergy total backscattered projectile energy +C nPolarBins polar-angle bin count +C maxDepthBins2 first dimension of angle matrix +C----------------------------------------------------------------------- subroutine writeBackscatterMatrixSummary(nBackscatter,nPrimary, & backLogMatrix,backLogEnergy,tempNh,energyLog,alpha, & nAzimuthBins,azimuthBinWidth,maxDepthBins,backEnergyAngle, @@ -2917,6 +2954,20 @@ C C C Write forward sputtering matrix and energy-angle correlation tables. C +C----------------------------------------------------------------------- +C Argument dictionary: writeForwardSputterMatrixSummary +C +C ISPAT,NH forward sputtered count and primaries +C JT,NJ,LJ species indexing and total species count +C EASTL forward sputtered energy by layer +C MEASTL log-energy/cos-angle layer matrix +C TEMPNH,ELOG matrix axis labels and normalization rows +C MEAST species-resolved log-energy/cos matrix +C MAXD1,MAXD2 first dimensions of matrix arrays +C MAGST species-resolved angle matrix +C L,MAXNL number of layers and layer array bound +C MAXNLm15 species array bound excluding projectile +C----------------------------------------------------------------------- subroutine writeForwardSputterMatrixSummary(ISPAT,NH,JT,NJ,LJ, & EASTL,MEASTL,TEMPNH,ELOG,MEAST,MAXD1,MAGST,L,MAXNL, & MAXD2,MAXNLm15) @@ -3052,6 +3103,23 @@ C C C Write backward sputtering matrix and energy-angle correlation tables. C +C----------------------------------------------------------------------- +C Argument dictionary: writeBackwardSputterMatrixSummary +C +C ISPA,NH backward sputtered count and primaries +C JT,NJ species indexing by layer +C EASL backward sputtered energy by layer +C MEASL log-energy/cos-angle layer matrix +C TEMPNH,ELOG matrix axis labels and normalization rows +C MEAS species-resolved log-energy/cos matrix +C ALPHA,NGIK,DGI incidence and angular-bin information +C MEAGS,MEAGB energy-angle sputtering matrices +C MEAGT scratch-style matrix storage +C MAGSA,MAGS azimuth-polar sputtering matrices +C L,ISPAL layer count and sputtered count per layer +C MAXNL,MAXD2 array bounds +C MAXNLm15 species array bound excluding projectile +C----------------------------------------------------------------------- subroutine writeBackwardSputterMatrixSummary(ISPA,NH,JT,NJ, & EASL,MEASL,TEMPNH,ELOG,MEAS,MAXD1,ALPHA,NGIK,DGI, & MEAGS,MAGSA,MAGS,L,ISPAL,MAXNL,MAXD2,MAXNLm15) @@ -3170,6 +3238,19 @@ C C C Write angular distributions for transmission sputtered particles. C +C----------------------------------------------------------------------- +C Argument dictionary: writeTransmissionSputterAngularSummary +C +C ispat total transmission-sputtered particles +C nLayers,nSpecies layer count and total target species count +C nj,jt elements per layer and cumulative species map +C ispal,ispalt,itsp layer/species sputtered-particle counts +C kadst,kdstj,kdstl angular histograms for transmitted sputter +C rkadst,rkdstj,rkdstl normalized angular histograms +C angleBins angular-bin centers +C maxNl,maxNl5 layer and species array bounds +C maxNlm15 species bound excluding projectile +C----------------------------------------------------------------------- subroutine writeTransmissionSputterAngularSummary(ispat,nLayers, & nj,jt,nSpecies,ispal,ispalt,itsp,kadst,kdstj,kdstl, & rkadst,rkdstj,rkdstl,angleBins,maxNl,maxNl5,maxNlm15) @@ -3302,6 +3383,28 @@ C C C Write transmission sputtering yields and energy summaries. C +C----------------------------------------------------------------------- +C Argument dictionary: writeTransmissionSputterYieldSummary +C +C ispat total transmission-sputtered particles +C nLayers,nSpecies layer count and total target species count +C nProjectiles incident projectile count +C initialEnergy incident projectile energy +C totalEnergy total forward sputtered energy +C itsp,etsp species counts and energies +C ispalt,espalt layer counts and energies +C ispipt,ispist ion-in primary/secondary counters +C ispopt,ispost ion-out primary/secondary counters +C espipt,espist ion-in primary/secondary energies +C espopt,espost ion-out primary/secondary energies +C ript,rist,ropt,rost normalized ion-in/out counters +C reipt,reist,reopt normalized energy counters +C reost normalized secondary out energy +C espmipt,espmist sputtered-energy moment sums, ion-in +C espmopt,espmost sputtered-energy moment sums, ion-out +C spyt,spet,reyt,emspt yield, energy, reflection, mean energies +C maxNl,maxNl5 layer and species array bounds +C----------------------------------------------------------------------- subroutine writeTransmissionSputterYieldSummary(ispat,nLayers, & nj,jt,nSpecies,nProjectiles,initialEnergy,totalEnergy, & itsp,etsp,ispalt,espalt,ispipt,ispist,ispopt,ispost, @@ -3465,6 +3568,20 @@ C======================================================================= C======================================================================= C WRITE BACKWARD SPUTTERING ANGULAR SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeBackwardSputterAngularSummary +C +C ISPA total backward sputtered particles +C L number of target layers +C NJ,JT elements per layer and cumulative species map +C IBSP species-resolved sputtered counts +C ISPAL layer-resolved sputtered counts +C KADS,KADSJ,KADSL angular histograms for backward sputter +C RKADS,RKADSJ,RKADSL normalized angular histograms +C AI angular-bin centers +C MAXNL layer array bound +C MAXNLm15 species array bound excluding projectile +C----------------------------------------------------------------------- subroutine writeBackwardSputterAngularSummary(ISPA,L,NJ,JT,IBSP, & ISPAL,KADS,KADSJ,KADSL,RKADS,RKADSJ,RKADSL,AI,MAXNL, & MAXNLm15) @@ -3546,6 +3663,35 @@ C C======================================================================= C WRITE BACKWARD SPUTTERING YIELD SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeBackwardSputterYieldSummary +C +C ISPA,L sputtered count and layer count +C NJ,JT,LJ composition indexing and species count +C HN,EMV projectile count and incident energy +C IBSP,IBSPL,EBSP species counts, layer ids, energies +C ISPAL,ESPAL layer-resolved counts and energies +C ESPA total backward sputtered energy +C ISPIP,ISPIS ion-in primary/secondary counters +C ISPOP,ISPOS ion-out primary/secondary counters +C ESPIP,ESPIS ion-in primary/secondary energies +C ESPOP,ESPOS ion-out primary/secondary energies +C RIP,RIS,ROP,ROS normalized ion-in/out counters +C REIP,REIS,REOP,REOS normalized ion-in/out energy counters +C RIPJ,RISJ,ROPJ,ROSJ species-resolved normalized counters +C REIPJ,REISJ,REOPJ species-resolved energy counters +C REOSJ species-resolved secondary out energy +C ESPMIP,ESPMIS sputtered-energy moments, ion-in +C ESPMOP,ESPMOS sputtered-energy moments, ion-out +C SPY,SPE,REY,EMSP yield, energy, reflection, mean energy +C SPE2S-SPE6S total energy moment sums +C SPE1SL-SPE6SL layer energy moment sums +C FIESB,SEESB,THESB energy moments returned by MOMENTS +C FOESB,SGMESB fourth moment and sigma +C DFIESB,DSEESB,DTHESB derived moment outputs +C MAXNL,MAXNL5 layer and species array bounds +C MAXNLm15 species bound excluding projectile +C----------------------------------------------------------------------- subroutine writeBackwardSputterYieldSummary(ISPA,L,NJ,JT,LJ,HN, & EMV,IBSP,IBSPL,EBSP,ISPAL,ESPAL,ESPA,ISPIP,ISPIS,ISPOP, & ISPOS,ESPIP,ESPIS,ESPOP,ESPOS,RIP,RIS,ROP,ROS,REIP, @@ -3794,6 +3940,23 @@ C======================================================================= end C WRITE TRANSMISSION SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeTransmissionSummary +C +C nTrans,nPrimary transmitted and incident projectile counts +C transEnergy total transmitted projectile energy +C initialEnergy incident projectile energy +C elasticLossSum total transmitted elastic loss +C elasticLossSquare squared elastic-loss accumulator +C inElasticLossSum total transmitted inelastic loss +C inElasticLossSquare squared inelastic-loss accumulator +C energyMoment2-6 transmitted-energy moment accumulators +C pathMoment1-6 transmitted pathlength moment accumulators +C angleBins,angleX angular-bin centers and normalized counts +C angleDistribution transmitted angular histogram +C meanTransEnergy returned mean transmitted energy +C transEnergySigma returned transmitted energy sigma +C----------------------------------------------------------------------- subroutine writeTransmissionSummary(nTrans,nPrimary,transEnergy, & initialEnergy,elasticLossSum,elasticLossSquare, & inElasticLossSum,inElasticLossSquare,energyMoment2, @@ -3905,6 +4068,26 @@ C======================================================================= C======================================================================= C WRITE BACKSCATTERING SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeBackscatterSummary +C +C nBackscatter total backscattered projectiles +C nBackLayer layer-resolved backscattered counts +C nPrimary incident projectile count +C backEnergySum total backscattered projectile energy +C energyUnit output energy conversion factor +C elasticLossSum total backscatter elastic loss +C elasticLossSquare squared elastic-loss accumulator +C inElasticLossSum total backscatter inelastic loss +C inElasticLossSquare squared inelastic-loss accumulator +C energyMoment2-6 backscattered-energy moments +C logEnergyMoment1-6 log-energy moment accumulators +C pathMoment1-6 pathlength moment accumulators +C angleBins,angleX angular-bin centers and normalized counts +C angleDistribution backscatter angular histogram +C meanBackEnergy returned mean backscattered energy +C backEnergySigma returned backscattered energy sigma +C----------------------------------------------------------------------- subroutine writeBackscatterSummary(nBackscatter,nBackLayer, & nPrimary,backEnergySum,energyUnit,elasticLossSum, & elasticLossSquare,inElasticLossSum,inElasticLossSquare, @@ -4048,6 +4231,36 @@ C======================================================================= C======================================================================= C WRITE IMPLANTATION PROFILE AND RECOIL DEPTH TABLES C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeImplantationProfile +C +C depth_interval_flag flag from depth/bin consistency check +C YH depth-bin centers +C MAXD,MAXD1 depth array bounds +C LJ total target species count +C NJ,L elements per layer and number of layers +C XX,CW layer boundaries and depth-bin width +C IRL,IRP,RIRP range histogram count and normalized values +C IPL,ION,DENT pathlength, implanted count and density +C DMGN,ELGD,PHON damage, elastic loss and phonon arrays +C CASMOT,ICD cascade and displacement counters +C ICDT,ICDR,ICDTR total/recoil displacement counters +C ICDIRI,ICDIRN direct/indirect recoil counters +C IIRP,TRIRP,IIPL recoil range and pathlength arrays +C TION,TDENT total implantation density arrays +C TDMGN,TELGD,TPHON total damage/loss/phonon arrays +C TCASMO,ICDTT total cascade/displacement counters +C TIONR,TDENTR recoil implantation density arrays +C TELGDR,TDMGNR,TPHONR recoil loss/damage/phonon arrays +C ICDTTR total recoil displacement counters +C ELE,ELI,ELP,ELD element-resolved loss/damage arrays +C ELET,ELIT,ELPT,ELDT total element-resolved loss arrays +C ICDJT,ICDJTR,ICDITR species displacement counters +C ILD,DLI layer damage and layer dose arrays +C IONR,DENTR recoil count and density arrays +C DMGNR,ELGDR,PHONR recoil damage/loss/phonon arrays +C MAXNL,MAXNL5 layer and species array bounds +C----------------------------------------------------------------------- subroutine writeImplantationProfile(depth_interval_flag,YH, & MAXD,MAXD1,LJ,NJ,L,XX,CW,IRL,IRP,RIRP,IPL,ION,DENT, & DMGN,ELGD,PHON,CASMOT,ICD,ICDT,ICDR,ICDTR,ICDIRI, @@ -4251,6 +4464,45 @@ C size! C======================================================================= C WRITE INPUT AND BEAM SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeInputSummary +C +C inputName input base name used for the run +C outputName,rangeName .out and .rge file names +C zProjectile projectile atomic number +C massProjectile projectile mass +C energy0,energySigma incident energy and energy spread +C alpha,alphaSigma incidence angle and angular spread +C finalEnergy final-energy cutoff +C surfaceEnergy surface barrier energy +C sheath sheath potential +C recoilCutoff recoil cutoff energy +C nProjectiles requested number of projectiles +C ri,ri2,ri3 random-number seeds +C xStart,rd initial depth and random depth width +C depthBin depth-bin width +C ca collision-accuracy parameter +C kk0,kk0r primary and recoil start modes +C stoppingPrimary inelastic model for projectiles +C stoppingRecoil inelastic model for recoils +C potentialPrimary interaction potential for projectiles +C potentialRecoil interaction potential for recoils +C recoilMode recoil-layer mode flag +C nLayers number of target layers +C layerThickness target layer thicknesses +C density target layer mass densities +C correction layer correction factors +C nElements elements per layer +C zTarget,massTarget target atomic numbers and masses +C concentration target concentration fractions +C surfaceBinding surface binding energies +C displacementEnergy displacement energies +C bulkBinding bulk binding energies +C ch1-ch5 Ziegler stopping coefficients +C ti,zArg,velc,emx energy-loss table metadata +C maxNl,maxEl layer and element array bounds +C secondsStartTotal timestamp from start of run +C----------------------------------------------------------------------- subroutine writeInputSummary(inputName,outputName,rangeName, & zProjectile,massProjectile,energy0,energySigma,alpha, & alphaSigma,finalEnergy,surfaceEnergy,sheath,recoilCutoff, @@ -4438,6 +4690,32 @@ C How many seconds are needed for the simulation ?? C======================================================================= C WRITE TARGET SETUP AND PRECOMPUTED TABLES C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeTargetSetupSummary +C +C hlm,hlmt layer thickness metadata +C su,sut stopping or scaling setup values +C xc,rt,sfe collision and surface-energy setup values +C inelasticMode inelastic-loss mode flag +C nLayers,nSpecies layer count and total target species count +C nProj active projectile count after setup +C kib,kit,maxActive projectile/recoil stack limits +C nAll,nPrimary total and primary particle counters +C nSecondary secondary particle counter +C kis,kist sputtering/cascade setup counters +C layerEps0 layer reduced energy values +C layerZ,layerMass weighted layer atomic numbers and masses +C layerArealDensity layer areal density values +C layerLm layer mean free path values +C layerPdMax maximum projected depth values +C layerASig angular/straggling setup values +C layerBinding layer binding setup values +C layerBoundary cumulative layer boundaries +C nElements elements per layer +C a1,kor1 species table and index map +C a,kor species-pair tables and index maps +C maxNl,maxSpecies layer and species array bounds +C----------------------------------------------------------------------- subroutine writeTargetSetupSummary(hlm,hlmt,su,sut,xc,rt,sfe, & inelasticMode,nLayers,nSpecies,nProj,kib,kit,maxActive,nAll, & nPrimary,nSecondary,kis,kist,layerEps0,layerZ,layerMass, @@ -4548,6 +4826,36 @@ C C======================================================================= C WRITE INTEGRAL PARTICLE SUMMARY C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeIntegralSummary +C +C nImplanted implanted projectile count +C implantedEnergy total final energy of implanted particles +C nBackscatter backscattered projectile count +C backEnergy total backscattered projectile energy +C nTransmitted transmitted projectile count +C transEnergy total transmitted projectile energy +C nBackSputter backward sputtered particle count +C backSputterEnergy total backward sputtered energy +C nTransSputter transmission sputtered particle count +C transSputterEnergy total transmission sputtered energy +C tryEnergy count of tried particles/energy retries +C negativeEnergy count of negative-energy events +C reducedEnergy Thomas-Fermi reduced energy +C reflectionCoeff scaled particle reflection coefficient +C nLayers number of target layers +C layerBoundary cumulative layer boundaries +C binWidth depth-bin width +C implantedProfile implanted-particle depth histogram +C implantedLayerBins layer assignment of depth bins +C layerBinEnd final depth-bin index per layer +C numberInLayer returned implanted count per layer +C depthIntervalFlag flag from depth/bin consistency check +C meanElasticCollisions mean projectile elastic collisions +C meanDisplacingCollisions mean displacement collisions +C meanSurfaceCollisions mean surface collisions +C maxNl,maxD layer and depth array bounds +C----------------------------------------------------------------------- subroutine writeIntegralSummary(nImplanted,implantedEnergy, & nBackscatter,backEnergy,nTransmitted,transEnergy, & nBackSputter,backSputterEnergy,nTransSputter, @@ -4617,6 +4925,29 @@ C C======================================================================= C SET UP MATRIX TABLE AXES C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: setupMatrixTableAxes +C +C energyBinWidth energy-axis bin width for matrix tables +C angleBinWidth polar-angle bin width +C polarBinWidth azimuthal-angle bin width +C nProjectiles projectile count used for normalization +C nPolarBinsMinusOne polar-bin upper index +C nAngleBinsMinusOne angular-bin upper index +C nAzimuthBins azimuthal-bin count +C maxDepthBin matrix depth/energy upper index +C jt cumulative species map +C meab,magb backscatter matrix axis arrays +C ema,meat,magt,emat transmission matrix axis arrays +C mepb,mept pathlength matrix axis arrays +C mags,magst,magsa sputtering angular matrix axes +C meas,meast sputtering log-energy matrix axes +C measl,meastl layer sputtering matrix axes +C meags,meagb,meagt energy-angle matrix axes +C energyLog,tempNh log-energy and normalization labels +C maxNl,maxD2 layer and matrix array bounds +C maxSpeciesMinusFirstLayer species-bound for sputter matrices +C----------------------------------------------------------------------- subroutine setupMatrixTableAxes(energyBinWidth,angleBinWidth, & polarBinWidth,nProjectiles,nPolarBinsMinusOne, & nAngleBinsMinusOne,nAzimuthBins,maxDepthBin,jt,meab,magb, @@ -4724,6 +5055,30 @@ C C======================================================================= C WRITE GUI SEQUENCE SUMMARY FILE C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: writeSequenceSummary +C +C seqNam .seq output file name for the GUI +C chem layer names/formulas +C nLayers number of layers +C e0KeV,esigKeV incident energy and spread in keV +C alpha,alphaSig incidence angle and angular spread +C nProjectiles incident projectile count +C nImplanted implanted projectile count +C nBackscatter backscattered projectile count +C nTransmitted transmitted projectile count +C tryEnergy count of tried/retried particles +C negativeEnergy count of negative-energy events +C meanRange,rangeSigma implantation range statistics +C meanBackEnergy mean backscattered energy +C backEnergySigma backscattered-energy sigma +C meanTransEnergy mean transmitted energy +C transEnergySigma transmitted-energy sigma +C reducedEnergy Thomas-Fermi reduced energy +C reflectionCoeff scaled particle reflection coefficient +C numberInLayer implanted count per layer +C maxNl layer array bound +C----------------------------------------------------------------------- subroutine writeSequenceSummary(seqNam,chem,nLayers,e0KeV, & esigKeV,alpha,alphaSig,nProjectiles,nImplanted, & nBackscatter,nTransmitted,tryEnergy,negativeEnergy, @@ -4766,6 +5121,46 @@ C C======================================================================= C READ GUI-GENERATED INPUT FILE C======================================================================= +C----------------------------------------------------------------------- +C Argument dictionary: readGuiInput +C +C inputName,errorName input base name and .err file name +C projectileZ projectile atomic number +C projectileMass projectile mass +C initialEnergy incident projectile energy +C energySigma incident energy spread +C incidentAngle incidence angle +C angleSigma angular spread +C cutoffEnergy final-energy cutoff +C surfaceBarrier surface barrier energy +C sheathPotential sheath potential +C recoilCutoff recoil cutoff energy +C nProjectiles requested projectile count +C seed1,seed2,seed3 random-number seeds +C initialDepth initial projectile depth +C randomDepth random initial-depth width +C depthBinWidth depth-bin width +C collisionAccuracy collision accuracy parameter +C primaryMode,recoilMode primary and recoil start modes +C stoppingPrimary projectile inelastic-loss model +C stoppingRecoil recoil inelastic-loss model +C potentialPrimary projectile interaction potential +C potentialRecoil recoil interaction potential +C recoilLayerMode recoil layer mode flag +C nLayers number of target layers +C chem layer names/formulas +C layerThickness target layer thicknesses +C layerDensity target layer mass densities +C correctionFactor layer correction factors +C nElements elements per layer +C atomicNumber target atomic numbers +C atomicMass target atomic masses +C concentration concentration fractions +C surfaceBinding surface binding energies +C displacementEnergy displacement energies +C bulkBinding bulk binding energies +C zieglerA1-zieglerA5 Ziegler stopping coefficients +C----------------------------------------------------------------------- subroutine readGuiInput(inputName,errorName,projectileZ, & projectileMass,initialEnergy,energySigma,incidentAngle, & angleSigma,cutoffEnergy,surfaceBarrier,sheathPotential,