diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..943af75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,118 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* \ No newline at end of file diff --git a/Readme.md b/Readme.md index 48e8f03..d86185b 100644 --- a/Readme.md +++ b/Readme.md @@ -2,40 +2,83 @@ ### Contents ### -This is the fortran source code and GUI of TrimSP Monte-Carlo simulations. +This repository contains the [Fortran] source code and an accompanying +graphical user interface ([GUI]) for TrimSP - +an application for performing [Monte Carlo] simulations of ion implantation. -* This code is specifically tuned to simulate implantation of low energy projectiles in materials. -* The code is maintained by the Low Energy Muons group at PSI. -* The GUI is written in Node.js, JavaScript and Electron. -* The binary (statically linked) from the fortran code is also included. -* RPM and DEB packages are also included +* This code is specifically tuned to simulate implantation of low-energy projectiles in materials. +* The code is maintained by the Low Energy Muons ([LEM]) group at the Paul Scherrer Institute ([PSI]). +* The [GUI] is written in [Node.js], [JavaScript] and [Electron]. +* The binary (statically linked) from the [Fortran] code is also included. +* [RPM] and [DEB] packages are also included. + +Further information can be found in the following publications: + +- J. P. Biersack and W. Eckstein, + Sputtering studies with the Monte Carlo program TRIM.SP, + Appl. Phys. A 34 (2), 73-94 (1984). + +- W. Eckstein, + Computer Simulation of Ion-Solid Interactions, + Springer Series in Materials Science Vol. 10 + (Springer-Verlag, Berlin, Heidelberg, 1991). + +- W. Eckstein, + Backscattering and sputtering with the Monte-Carlo program TRIM.SP, + Radiat. Eff. Defects Solids 130-131 (1), 239-250 (1994). + +- E. Morenzoni et al., + Implantation studies of keV positive muons in thin metallic layers, + Nucl. Instrum. Methods Phys. Res., Sect. B 192 (3), 245-266 (2002). + ### Supported platforms ### -* Linux +* [Linux] * Online at: http://musruser.psi.ch/cgi-bin/TrimSP.cgi ### Installation ### + ###### Fortran code compilation ###### -Install gfortran compiler, then: +Install the `gfortran` compiler, then: - cd trimsp/fortran - make - make install +```bash +cd trimsp/fortran +make +make install +``` -This will install the `trimspNL` in `/usr/local/bin`, but can be moved to any other directory in your `PATH`. +This will install the `trimspNL` binary in `/usr/local/bin`, +but it can be moved to any other directory in your `PATH`. ###### Running the GUI ###### -Install Node.js (nodejs, nodejs-libs and npm), then +Install [Node.js] (`nodejs`, `nodejs-libs` and `npm`), +then run: - cd trimsp - npm install - npm start +```bash +cd trimsp +npm install +npm start +``` -You do not need to run `npm install` every time. Next time you can simply run `npm start` only. +Note: you do not need to run `npm install` every time. +Next time you can simply run `npm start` only. ### Contact ### + Zaher Salman + +[Fortran]: https://fortran-lang.org/ +[Node.js]: https://nodejs.org/en/ +[JavaScript]: https://www.javascript.com/ +[Electron]: https://www.electronjs.org/ +[PSI]: https://www.psi.ch/en +[LEM]: https://www.psi.ch/en/low-energy-muons +[RPM]: https://rpm.org/ +[DEB]: https://en.wikipedia.org/wiki/Deb_(file_format) +[Linux]: https://en.wikipedia.org/wiki/Linux +[Monte Carlo]: https://en.wikipedia.org/wiki/Monte_Carlo_method +[GUI]: https://en.wikipedia.org/wiki/Graphical_user_interface diff --git a/TrimSP.html b/TrimSP.html index 55bc118..75af87f 100644 --- a/TrimSP.html +++ b/TrimSP.html @@ -24,7 +24,7 @@ - +
@@ -51,7 +51,7 @@
- +
Layer #CompositionDensity [g/cm3]Thickness [A]
Layer #CompositionDensity [g/cm3]Thickness [Å]
@@ -61,22 +61,23 @@ Projectile parameters Projectile Number of projectiles - Starting depth [A] - Depth increment [A] + Starting depth [Å] + Depth increment [Å] Energy [eV] Energy sigma [eV] - Angel [deg] + Angle [deg] Angle sigma [deg] Random seed @@ -89,22 +90,22 @@ Enable scan on @@ -134,61 +135,188 @@
- + - + - + - + - + - + - + - + - + - + - + - + @@ -196,12 +324,34 @@ - +
EF +
+ EF + Cutoff energy of projectiles (in eV); + must be greater than zero. + Used for low projectile energies (< 1000 eV) and ESB = 0. + EF should be of the order of ~0.2 eV, + but not above SBE (for sputtering data). + With increasing projectile energy, + EF can be increased to save computing time. +
+
KK0 +
+ KK0 + Maximum order of weak (simultaneous) collisions between projectile and target atoms: +
    +
  1. No weak collisions included.
  2. +
  3. ???
  4. +
  5. Sufficient for most calculations.
  6. +
  7. Only useful for very heavy particles; increases computing time.
  8. +
  9. Only useful for very heavy particles; increases computing time.
  10. +
+
+
ESB +
+ ESB + Surface binding energy for projectiles (in eV). + This value is zero for the noble gases, + but ESB should be larger than zero if the projectile is an active + chemically species. + ESB = SBE for self-sputtering calculations. +
+
KK0R +
+ KK0R + Maximum order of weak (simultaneous) collisions between target atoms: +
    +
  1. No weak collisions included.
  2. +
  3. ???
  4. +
  5. Sufficient for most calculations.
  6. +
  7. Only useful for very heavy particles; increases computing time.
  8. +
  9. Only useful for very heavy particles; increases computing time.
  10. +
+
+
SHEATH +
+ SHEATH + Sheath potential (in eV); + typically 3 * kT (i.e., 3 * |projectile energy|). +
+
KDEE1 +
+ KDEE1 + Inelastic energy loss model for projectiles: +
    +
  1. Nonlocal (Lindhard-Scharff).
  2. +
  3. Local (Oen-Robinson).
  4. +
  5. + Equipartition of local and nonlocal models (i.e., options 1 & 2). +
  6. +
  7. + Nonlocal (Anderson-Ziegler tables for hydrogen); + must be used for hydrogen-like projectile with energies > 10 keV. +
  8. +
  9. + Nonlocal (Ziegler tables for helium); + must be used for helium-like projectiles with energies > 50 keV. +
  10. +
+ Note: options 1, 2, and 3 can only be used at energies below the stopping power maximum. +
+
ERC +
+ ERC + Recoil cutoff energy (in eV); + usually equal to the surface binding energy. +
+
KDEE2 +
+ KDEE2 + Inelastic energy loss for target atoms: +
    +
  1. Nonlocal (Lindhard-Scharff).
  2. +
  3. Local (Oen-Robinson).
  4. +
  5. + Equipartition of local and nonlocal models (i.e., options 1 & 2). +
  6. +
+ Note: options 1, 2, and 3 can only be used at energies below the stopping power maximum. +
+
RD +
+ RD + Depth (in Å) to which recoils are followed. + RD = 50 is usually sufficient for sputtering + (if the projectile energy is not too high). + Use RD = 100 * CW (i.e., the depth increment) + for following the full collision cascade. +
+
IPOT +
+ IPOT + Interaction potential between projectile and target atoms: +
    +
  1. Krypton-Carbon (Kr-C) potential.
  2. +
  3. Molière potential.
  4. +
  5. Ziegler-Biersack-Littmark (ZBL) potential.
  6. +
+
+
CA +
+ CA + Correction factor to the Firsov screening length for + collisions between projectile and target atoms + (only used in the application of the Molière potential); + usually on the order of ~1.0. +
+
IPOTR +
+ IPOTR + Interaction potential between target atoms: +
    +
  1. Krypton-Carbon (Kr-C) potential.
  2. +
  3. Molière potential.
  4. +
  5. Ziegler-Biersack-Littmark (ZBL) potential.
  6. +
+
+
IRL - +
+ IRL + Collision recoils: +
    +
  1. + No recoils are generated (i.e., no sputtering effects); + used to speed up the calculation if only projectile ranges are of interest. +
  2. +
  3. Calculate collision recoils.
  4. +
+
+
+
+

+ For further details see: +

+

+ W. Eckstein, Computer Simulation of Ion-Solid Interactions,
+ Springer Series in Materials Science, Vol. 10 (Springer-Verlag, Berlin, 1991).
+ + https://doi.org/10.1007/978-3-642-73513-4 + +

diff --git a/TrimSPlib.js b/TrimSPlib.js index 32ff5b6..d98d44a 100644 --- a/TrimSPlib.js +++ b/TrimSPlib.js @@ -47,9 +47,10 @@ function parse_formula (mf) { function Zof(Element) { var ElementsZ = { - "Muon":1, - "Li8":3, - "B12":5, + "muon":1, + "lithium-8":3, + "boron-12":5, + "magnesium-31":12, "H":1, "He":2, "Li":3, @@ -150,9 +151,10 @@ function Zof(Element) function Massof(Element) { var ElementsA = { - "Muon":0.113, - "Li8":8.0, - "B12":12.0, + "muon":0.1134289259, + "lithium-8":8.02248624, + "boron-12":12.0143526, + "magnesium-31":30.996648, "H":1.00800, "He":4.00300, "Li":6.93900, @@ -349,9 +351,9 @@ function Elastof(Element) { return Elast[Element]; } -function Stopicru(Element) +function StoppingCoefficients(Element) { - var Stopicru = { + var StoppingCoefficientsICRU = { "H":"1.25400,1.44000,242.60001,12000.00000,0.11590", "He":"1.22900,1.39700,484.50000,5873.00000,0.05225", "Li":"1.41100,1.60000,725.59998,3013.00000,0.04578", @@ -446,7 +448,75 @@ function Stopicru(Element) "U":"7.29000,8.20400,19180.00000,586.29999,0.00267", "":"0.00000,0.00000,0.00000,0.00000,0.00000" }; - return Stopicru[Element]; + + // Updated Anderson-Ziegler table values for hydrogen projectiles using + // up-to-date stopping data from the IAEA database (https://www-nds.iaea.org/stopping/). + // For further details on their determination, see e.g.: + // R. M. L. McFadden at al., arXiv:2212.11081 [cond-mat.supr-con] + // https://doi.org/10.48550/arXiv.2212.11081 + var StoppingCoefficientsIAEA = { + "H": "1.21941306,1.39705253,316.72610292,3622.08960714,0.03609996", + "Li": "2.55867734,2.98398784,672.22623329,223.63937274,0.05756479", + "Be": "2.13846776,2.43024550,1353.80005691,500.78353377,0.01143076", + "B": "2.92598306,3.33271910,1523.83401267,574.31712932,0.01671298", + "C": "2.51057212,2.84874359,1325.63086028,2111.57332043,0.03815981", + "N": "3.03231463,3.44621744,1287.27189959,3445.25706665,0.06909550", + "O": "2.58218404,2.91913321,2066.69556610,1937.28839450,0.01708201", + "Mg": "4.32219620,4.95332934,2711.05757349,99.32422512,0.01692829", + "Al": "4.16266645,4.73942640,3007.21967155,192.15430476,0.01478852", + "Si": "4.56277193,5.17964542,3812.93366288,249.45105835,0.00951865", + "Cl": "5.18954121,5.87010049,5726.20198003,338.90592713,0.00527894", + "Ca": "7.38419020,8.41800474,4257.94547049,311.84732092,0.01482602", + "Sc": "6.27366940,7.11486087,5202.32117316,349.64931132,0.00808596", + "Ti": "4.89215322,5.52996090,4733.05002706,821.54929980,0.01141794", + "V": "4.39418898,4.95984106,5216.28902299,873.00768319,0.00982301", + "Cr": "4.22355616,4.76724205,4805.40719904,1062.25237873,0.01508696", + "Mn": "3.45870888,3.89580224,5452.18588822,1778.16054656,0.01057380", + "Fe": "3.69846643,4.16916938,5392.90710239,1040.38447053,0.01152298", + "Co": "3.55890909,4.00775461,6796.04145497,933.86447935,0.00558368", + "Ni": "3.42262695,3.86234880,4759.65515188,520.18934465,0.02026669", + "Cu": "3.54912421,4.02142201,4344.22605325,128.32905834,0.02886218", + "Zn": "4.31895518,4.91763977,5346.03925560,46.16548699,0.01518164", + "Ga": "4.11015447,4.63998531,7681.41419449,149.38563152,0.00628772", + "Ge": "5.80984815,6.60667983,6039.04808738,87.19744473,0.01158192", + "Se": "5.58734301,6.31119973,8423.01872583,221.61559131,0.00530434", + "Br": "6.28480648,7.09489448,11732.76411988,150.96205589,0.00281298", + "Kr": "6.47378266,7.31581518,9199.06183849,216.98680923,0.00437111", + "Rb": "8.48759187,9.62951209,7271.11124671,272.67996745,0.00818815", + "Sr": "8.66447838,9.84912713,5979.31960977,334.15705556,0.01184544", + "Y": "7.54854264,8.54789357,6885.34110669,429.53252110,0.00930644", + "Zr": "6.24168401,7.04236496,10674.06252597,269.66181445,0.00339805", + "Nb": "5.96194954,6.72632300,10250.57513827,275.25886405,0.00386599", + "Mo": "5.58867862,6.29983727,9573.16605660,523.57577519,0.00473082", + "Pd": "4.74762031,5.34871025,8086.17802763,942.05721488,0.00842671", + "Ag": "5.42052240,6.17824432,4642.18214950,90.75350922,0.06061521", + "Cd": "4.89128643,5.50754704,11831.77188508,396.06905848,0.00412049", + "In": "5.98978289,6.77050040,6343.54720062,564.65410792,0.02270520", + "Sn": "6.73191335,7.61854414,6946.18830598,347.19391310,0.01677246", + "Sb": "7.92400389,8.99628409,5736.29881090,403.11722206,0.02973016", + "Xe": "8.96826400,10.16224223,8543.27304860,283.90067433,0.01019984", + "La": "8.16949326,9.21144395,13933.96869212,429.99442382,0.00347440", + "Nd": "8.60801371,10.26060598,6798.65217629,7.06731816,0.02713704", + "Gd": "8.38379061,9.50012183,10804.38767518,110.71066098,0.00761735", + "Tb": "8.69907359,10.36476708,5985.09307671,7.76175759,0.04237031", + "Dy": "6.69350026,7.81543484,5289.65107666,12.11560717,0.05746489", + "Er": "4.31497049,4.85346547,12995.54504003,691.00380321,0.00499022", + "Yb": "6.38304258,7.21491284,12327.74719685,82.30064162,0.00516845", + "Lu": "7.00205766,8.09268611,4589.67801229,31.06321362,0.11142124", + "Hf": "5.32763157,6.00140558,13853.49562768,206.93150053,0.00411522", + "Ta": "5.15280708,5.80545310,12417.25115167,231.48549646,0.00530723", + "W": "4.81261962,5.41579909,15245.84079976,286.09077182,0.00344862", + "Re": "4.26021967,4.80273372,3191.05524918,76051.48730893,0.00003161", + "Ir": "4.16543126,4.68849191,6887.94139926,4263.90641919,0.00000004", + "Pt": "4.62228847,5.20033612,16308.49878855,266.02263275,0.00309560", + "Au": "4.84253074,5.44769072,15602.21662947,412.25485588,0.00331383", + "Pb": "9.42473604,17.46235676,11946.86905435,0.00000001,0.00652912", + "Bi": "10.25823796,12.26670424,7765.05387481,7.37274504,0.02310050" + }; + + // prefer using stopping coefficients derived from data in the IAEA database; + // however, if they are unavailable, return those from ICRU Report 49 + return (Element in StoppingCoefficientsIAEA) ? StoppingCoefficientsIAEA[Element] : StoppingCoefficientsICRU[Element]; } @@ -579,6 +649,27 @@ function rho_fun() "":"" } document.getElementById(rhoLi).value = rhos[chem]; + + // suggest a material density based on composition (when it's undefined) + if (!isFinite(document.getElementById(rhoLi).value)) { + let layer_formula = parse_formula(chem); + + // determine the stoichiometry sum (for normalization) + let stoichiometry_sum = 0; + for (key of Object.keys(layer_formula)) { + stoichiometry_sum = stoichiometry_sum + layer_formula[key]; + } + + // determine the density using on a weighted average of the elemental densities + let density_estimate = 0; + for (key of Object.keys(layer_formula)) { + if (layer_formula[key] != null) { + density_estimate = density_estimate + (layer_formula[key] / stoichiometry_sum) * rhos[key]; + } + } + + document.getElementById(rhoLi).value = density_estimate; + } } function openTab(event, tabName) { @@ -676,7 +767,7 @@ function ProjSmartDefaults() var sigEnergy = document.getElementById("sigEnergy"); var sigAngle = document.getElementById("sigAngle"); - if (Proj == "Muon") { + if (Proj == "muon") { sigEnergy.value = "450"; sigAngle.value = "15"; } else { @@ -899,7 +990,7 @@ function CreateInpFile(All) { All[LEkey+"E"+NEl]=ElE; // sprintf("%8.4f",$ElE); All["L"+i+"030"+NEl]=El030; // sprintf("%8.4f",$El030); - let ElST = Stopicru(El); + let ElST = StoppingCoefficients(El); let ElSTs = ElST.split(','); let j=1; for (let iElST of ElSTs) { diff --git a/ZGUI.css b/ZGUI.css index 36482d3..806521d 100644 --- a/ZGUI.css +++ b/ZGUI.css @@ -3,7 +3,7 @@ } td { - white-space: nowrap; + white-space: wrap; } .guitable { diff --git a/fortran/Makefile b/fortran/Makefile index 06bdfd5..0c45fd8 100644 --- a/fortran/Makefile +++ b/fortran/Makefile @@ -7,19 +7,19 @@ # generator in the code. Use gfortran which is now # a standard part of gcc in moder systems. # -FC=gfortran -#DEBUG = -g -O -fbacktrace -ffpe-trap='underflow' -DEBUG = -#WARN= -Wall -W -WARN= -DIALECT = + +FC = gfortran +DEBUG = # -g -O -fbacktrace -ffpe-trap='underflow' +WARN = # -Wall -Wextra +DIALECT = -std=gnu prefix = /usr/local -OPS=-c $(DIALECT) $(WARN) $(DEBUG) +# OPS = -c $(DIALECT) $(WARN) $(DEBUG) +FCFLAGS = $(DIALECT) $(WARN) $(DEBUG) -O3 -mcmodel=medium all : trimspNL trimspNL : trimspNL.F - $(FC) -o $@ $< + $(FC) $(FCFLAGS) -o $@ $< clean: rm -f *.o *~ \#* .#* trimspNL diff --git a/fortran/trimspNL.F b/fortran/trimspNL.F index fd8b70e..40c43e5 100644 --- a/fortran/trimspNL.F +++ b/fortran/trimspNL.F @@ -55,7 +55,7 @@ C and maximum number of points in the depth distribution MAXD C This is the only point where the number of layers and depth C profile are changed. All other parameters should be changed C accordingly. - PARAMETER (MAXD=500) + PARAMETER (MAXD=10000) PARAMETER (MAXNL=100) C Maximum number of elements in each layer, was limited to 5. PARAMETER (MAXEL=20) @@ -2739,7 +2739,7 @@ C size! Dmid=(D2-D1)/2+D1 WRITE(22,701) Dmid,IRP(I) 700 FORMAT(1X,F6.0,1H-,F6.0,I10,E12.4,I10,1P1E14.4,5E12.4,I8) - 701 FORMAT(1X,F6.0,2x,I10) + 701 FORMAT(1X, F16.4, 2X, I10) D1=D2 11 D2=D2+CW WRITE(21,604) D2-CW,IRP(MAXD1),RIRP(MAXD1) diff --git a/trimspNL b/trimspNL-static similarity index 100% rename from trimspNL rename to trimspNL-static