diff --git a/TrimSPlib.js b/TrimSPlib.js index b968108..f9e2800 100644 --- a/TrimSPlib.js +++ b/TrimSPlib.js @@ -1,3 +1,6 @@ +// This is an object that contains all GUI ids and values +var All = new Object(); + // This is an object that contains all elements and their parameters // To replace all other functions const elemPars = { @@ -1057,7 +1060,6 @@ function prep_cfg(toggle) { let strtmp = ""; let valtmp = ""; - let All = new Object(); All['trimPath']=document.getElementById("trimPath").value; // Prepare Layers section @@ -1147,7 +1149,7 @@ function setValues(content) { } -function CreateInpFile(All) { +function CreateInpFile() { // Create and return input file for the Trim.SP simulation binary // Takes object All as input for all relevant parameters @@ -1160,8 +1162,8 @@ function CreateInpFile(All) { TemplateFile=TemplateFile+"\n"+"N_Layers=numLayer"; // Then loop over the layers and for each give the following structure - // chemical formula, thickness, density, correction factor - var TemplateLayer = "L1Comp L1d L1rho L1CK\n"; + // chemical formula, thickness, density, correction factor, number of elements + var TemplateLayer = "L1Comp L1d L1rho L1CK L1Elem\n"; // Z number of elements TemplateLayer += "L1ELZ1 L1ELZ2 L1ELZ3 L1ELZ4 L1ELZ5\n"; // A number of elements @@ -1217,6 +1219,11 @@ function CreateInpFile(All) { if (Comp == "" || typeof Comp == 'undefined') {Check++;} // Write composition to results file header + // Number of elements + let LElem = "L"+i+"Elem"; + All[LElem] = Object.keys(LElComp).length; + console.log(LElem,All[LElem]); + // Densities of layers let Lrho="layer"+i+"rho"; let rho = 1*All[Lrho]; @@ -1308,7 +1315,7 @@ function sum(array){ return sum_array; } -function startSequence(All) { +function startSequence() { let cmd = ''; let trimBin = All['trimPath']+"/trimspNL"; let randStr = ''; @@ -1396,7 +1403,7 @@ function startSequence(All) { document.getElementById("pBar").innerHTML = Progress + "%"; // Single run: Start - let eingabe1=CreateInpFile(All); + let eingabe1=CreateInpFile(); if (eingabe1=="ERROR") {return(0);} let FILENAME=All["workPath"]+"/"+All["fileNamePrefix"]+"_"+ScanName+SValue; writeAsciiFile(FILENAME+".inp",eingabe1); @@ -1577,12 +1584,12 @@ function startSim() { // Switch to plots tab document.getElementById("btnPlots").click(); // Clear plots first - Plotly.purge("plotFrac") - Plotly.purge("plotRge") + Plotly.purge("plotFrac"); + Plotly.purge("plotRge"); // start simulation sequence - startSequence(All) - //CreateInpFile(All); + startSequence(); + //CreateInpFile(); // document.location = // // "http://musruser.psi.ch/cgi-bin/TrimSP.cgi?TrimSPcfg="+TrimSPcfg+'go=start'; diff --git a/fortran/trimspNL.F b/fortran/trimspNL.F index 639f3ec..50f5b48 100644 --- a/fortran/trimspNL.F +++ b/fortran/trimspNL.F @@ -77,7 +77,6 @@ C Maximum number of elements in each layer, was limited to 5. INTEGER I,J,IV INTEGER tryE,negE INTEGER depth_interval_flag - INTEGER nel(MAXEL) INTEGER*4 seconds_start_total,seconds_stop_total INTEGER*4 NREC1,NREC2,NE1,K,NGIK,ICW INTEGER*4 ISEED,ISEED2,ISEED3 @@ -106,6 +105,7 @@ C Maximum number of elements in each layer, was limited to 5. & ,MAXNLm15),MEAGS(MAXD2,12,22,MAXNLm15) ,MEASL(75,21,MAXNLm15) INTEGER*4 MEAST(MAXD2,22,MAXNLm15),MAGST(62,22,MAXNLm15),MEASTL(75 & ,21,MAXNLm15) +C NJ(I) is the number of elements in layer I INTEGER*4 NJ(MAXNL),JT(MAXNL),ILD(MAXNL),NJJ INTEGER*4 LLL(64),JJJ(64),IK(64) INTEGER*4 me(5000),nli(MAXNL),irpl(MAXNL) @@ -408,41 +408,41 @@ C Here we read the NLayers structure C Chemical formula (chem), Thickness (DX), density (RHO), and correction factor C (CK, it is always 1.0??), number of elements (nel) C Possibly add the number of elements in the layer - READ(11,*) chem(I),DX(I),RHO(I),CK(I),nel(I) + READ(11,*) chem(I),DX(I),RHO(I),CK(I),NJ(I) C Replace the following lines with read(11,*) (a(i,j), j = 1, 5) C Atomic numbers C READ(11,*) ZT(I,1),ZT(I,2),ZT(I,3),ZT(I,4),ZT(I,5) - read(11,*) (ZT(I,j), j = 1, nel(I)) + read(11,*) (ZT(I,j), j = 1, NJ(I)) C Mass numbers (amu) C READ(11,*) MT(I,1),MT(I,2),MT(I,3),MT(I,4),MT(I,5) - read(11,*) (MT(I,j), j = 1, nel(I)) + read(11,*) (MT(I,j), j = 1, NJ(I)) C Concentration (stoichiometry) C READ(11,*) CO(I,1),CO(I,2),CO(I,3),CO(I,4),CO(I,5) - read(11,*) (CO(I,j), j = 1, nel(I)) + read(11,*) (CO(I,j), j = 1, NJ(I)) C Surface binding energy C READ(11,*) SBE(I,1),SBE(I,2),SBE(I,3),SBE(I,4),SBE(I,5) - read(11,*) (SBE(I,j), j = 1, nel(I)) + read(11,*) (SBE(I,j), j = 1, NJ(I)) C Displacement energy, always 30 eV?? C READ(11,*) ED(I,1),ED(I,2),ED(I,3),ED(I,4),ED(I,5) - read(11,*) (ED(I,j), j = 1, nel(I)) + read(11,*) (ED(I,j), j = 1, NJ(I)) C Bulk binding energy, usually zero C READ(11,*) BE(I,1),BE(I,2),BE(I,3),BE(I,4),BE(I,5) - read(11,*) (BE(I,j), j = 1, nel(I)) + read(11,*) (BE(I,j), j = 1, NJ(I)) C value A-1 of the ziegler tables C READ(11,*) CH1(I,1),CH1(I,2),CH1(I,3),CH1(I,4),CH1(I,5) - read(11,*) (CH1(I,j), j = 1, nel(I)) + read(11,*) (CH1(I,j), j = 1, NJ(I)) C value A-2 of the ziegler tables C READ(11,*) CH2(I,1),CH2(I,2),CH2(I,3),CH2(I,4),CH2(I,5) - read(11,*) (CH2(I,j), j = 1, nel(I)) + read(11,*) (CH2(I,j), j = 1, NJ(I)) C value A-3 of the ziegler tables C READ(11,*) CH3(I,1),CH3(I,2),CH3(I,3),CH3(I,4),CH3(I,5) - read(11,*) (CH3(I,j), j = 1, nel(I)) + read(11,*) (CH3(I,j), j = 1, NJ(I)) C value A-4 of the ziegler tables C READ(11,*) CH4(I,1),CH4(I,2),CH4(I,3),CH4(I,4),CH4(I,5) - read(11,*) (CH4(I,j), j = 1, nel(I)) + read(11,*) (CH4(I,j), j = 1, NJ(I)) C value A-5 of the ziegler tables C READ(11,*) CH5(I,1),CH5(I,2),CH5(I,3),CH5(I,4),CH5(I,5) - read(11,*) (CH5(I,j), j = 1, nel(I)) + read(11,*) (CH5(I,j), j = 1, NJ(I)) ENDDO 1359 CLOSE(UNIT=11) @@ -465,6 +465,7 @@ C Get simulation start time WRITE(21,*) WRITE(21,1050)day_start,month_start,year_start,hour_start & ,min_start,sec_start + WRITE(*,*) 'Version 1.0.1' WRITE(*,1050)day_start,month_start,year_start,hour_start & ,min_start,sec_start 1050 FORMAT(1x,' Start: ',A2,'.',A4,1x,A4,1x,A2 @@ -497,7 +498,7 @@ C CALCULATION OF CHARGE AND MASS DEPENDENT CONSTANTS ABC=AB*FP L=NLayers - + C Checks wether depth interval is an integer denominator of layer thickness or not C If not, calculated implantation profile is not correct. C CW is depth increment and DX(K) is the thickness of layer K @@ -511,20 +512,17 @@ C If the thickness of layer K is not an integer multiples of depth increment ENDDO 44 CONTINUE -C DO I=1,L + DO I=1,L C This loop finds out how many elements are in the layer. C I can be removed in the number is know from the input file. -C DO J=1,JMAX -C IF(EQUAL(CO(I,J),0.D0)) GOTO 156 -C ENDDO -C J=JMAX+1 -C I am guessing NJ(I) is the number of elements in layer I -C 156 NJ(I)=J-1 +C DO J=1,JMAX +C IF(EQUAL(CO(I,J),0.D0)) GOTO 156 C ENDDO +C J=JMAX+1 +C I am guessing NJ(I) is the number of elements in layer I +C 156 NJ(I)=J-1 -C This is the number of elements in layer I - NJ(I) = nel(I) - + ENDDO JT(1) = 0 JT(2) = NJ(1) LJ= NJ(1)+NJ(2) @@ -2704,7 +2702,7 @@ C size! enddo im1=1 20 im1=min0(im1+2,MAXD) - DO 11 I=1,im1 + DO I=1,im1 WRITE(21,700) D1,D2,IRP(I),RIRP(I),IPL(I),ION(I),DENT(I), & DMGN(I),ELGD(I),PHON(I),CASMOT(I),ICDT(I) Dmid=(D2-D1)/2+D1 @@ -2712,7 +2710,8 @@ C size! 700 FORMAT(1X,F6.0,1H-,F6.0,I10,E12.4,I10,1P1E14.4,5E12.4,I8) 701 FORMAT(1X, F16.4, 2X, I10) D1=D2 - 11 D2=D2+CW + D2=D2+CW + ENDDO WRITE(21,604) D2-CW,IRP(MAXD1),RIRP(MAXD1) 604 FORMAT(1X,F6.0,1H-,3X,3HSUT,I10,E12.4) WRITE(21,710) IIRP,TRIRP,IIPL,TION,TDENT,TDMGN,TELGD,TPHON,TCASMO @@ -2848,8 +2847,9 @@ C 1543 FORMAT(1X,' LOGENERGY',5X,1P1E12.4,5E14.4) WRITE(21,1545) PL1S,PL2S,PL3S,PL4S,PL5S,PL6S 1545 FORMAT(1X,' PATHLENGTH',5X,1P1E12.4,7E14.4) - DO 1510 I=1,20 - 1510 AI(I)=0.05D0*DBLE(I) + DO I=1,20 + AI(I)=0.05D0*DBLE(I) + ENDDO IF(IB.EQ.0) GO TO 1512 WRITE(21,1514) 1514 FORMAT(//5X,'POLAR ANGULAR DISTRIBUTION OF BACKSCATTERED ', @@ -3104,8 +3104,9 @@ C WRITE(21,1601) 1601 FORMAT(///5X,'POLAR ANGULAR DISTRIBUTION OF ALL BACKWARD ', & 'SPUTTERED PARTICLES'//) - DO 1603 I=1,20 - 1603 RKADS(I)=KADS(I)*20.D0/ISPA + DO I=1,20 + RKADS(I)=KADS(I)*20.D0/ISPA + ENDDO WRITE(21,1518) (AI(I),I=1,20),(KADS(I),I=1,20),(RKADS(I),I=1,20) DO I=1,20 DO J=1,NJ(1) @@ -3122,8 +3123,9 @@ C WRITE(21,1606) 1606 FORMAT(///5X,'POLAR ANGULAR DISTRIBUTION OF SPUTTERED ', & 'PARTICLES ; LAYER 1'//) - DO 1608 I=1,20 - 1608 RKADSL(I,1)=KADSL(I,1)*20.D0/ISPAL(1) + DO I=1,20 + RKADSL(I,1)=KADSL(I,1)*20.D0/ISPAL(1) + ENDDO WRITE(21,1518) (AI(I),I=1,20),(KADSL(I,1),I=1,20),(RKADSL(I,1),I & =1,20) DO 1618 J=1,NJ(1) @@ -3131,8 +3133,9 @@ C WRITE(21,1616) J 1616 FORMAT(///5X,'POLAR ANGULAR DISTRIBUTION OF SPUTTERED ', & 'PARTICLES ; LAYER 1 ; SPECIES ',I1//) - DO 1620 I=1,20 - 1620 RKADSJ(I,J)=KADSJ(I,J)*20.D0/IBSP(J) + DO I=1,20 + RKADSJ(I,J)=KADSJ(I,J)*20.D0/IBSP(J) + ENDDO WRITE(21,1518) (AI(I),I=1,20),(KADSJ(I,J),I=1,20),(RKADSJ(I,J) & ,I=1,20) 1618 CONTINUE @@ -3141,8 +3144,9 @@ C WRITE(21,1610) 1610 FORMAT(///5X,'POLAR ANGULAR DISTRIBUTION OF SPUTTERED ', & 'PARTICLES ; LAYER 2'//) - DO 1612 I=1,20 - 1612 RKADSL(I,2)=KADSL(I,2)*20.D0/ISPAL(2) + DO I=1,20 + RKADSL(I,2)=KADSL(I,2)*20.D0/ISPAL(2) + ENDDO WRITE(21,1518) (AI(I),I=1,20),(KADSL(I,2),I=1,20) & ,(RKADSL(I,2),I=1,20) IF(NJ(2).EQ.1) GO TO 1622 @@ -3151,8 +3155,9 @@ C WRITE(21,1626) J-NJ(1) 1626 FORMAT(///5X,'POLAR ANGULAR DISTRIBUTION OF SPUTTERED ', & 'PARTICLES ; LAYER 2 ; SPECIES ',I1//) - DO 1628 I=1,20 - 1628 RKADSJ(I,J)=KADSJ(I,J)*20.D0/IBSP(J) + DO I=1,20 + RKADSJ(I,J)=KADSJ(I,J)*20.D0/IBSP(J) + ENDDO WRITE(21,1518) (AI(I),I=1,20),(KADSJ(I,J),I=1,20) & ,(RKADSJ(I,J),I=1,20) 1624 CONTINUE @@ -3495,11 +3500,13 @@ C C BACKWARD SPUTTERING : MATRICES , ENERGY - ANGLE CORRELATIONS C IF(ISPA.LT.10000) GO TO 1900 - DO 1850 J=1,JT(3) + DO J=1,JT(3) EASL(2,J)=DBLE(MEASL(2,21,J))/(DBLE(NH)*0.1) - DO 1850 IESLOG=3,74 - 1850 EASL(IESLOG,J)=DBLE(MEASL(IESLOG,21,J))/(TEMPNH*10.D0 + DO IESLOG=3,74 + EASL(IESLOG,J)=DBLE(MEASL(IESLOG,21,J))/(TEMPNH*10.D0 & **((IESLOG-1)/12.D0)) + ENDDO + ENDDO DO 1852 J=1,NJ(1) WRITE(21,1854) J 1854 FORMAT(//,' LOG ENERGY - COS OF EMISSION ANGLE (0.05 STEPS) (BAC @@ -3597,11 +3604,13 @@ C IF(ISPAT.LT.10000) GO TO 2000 JTJ=JT(3) IF(L.EQ.3) JTJ=LJ-NJ(1) - DO 1950 J=1,JTJ + DO J=1,JTJ EASTL(2,J)=DBLE(MEASTL(2,21,J))/(DBLE(NH)*0.1D0) - DO 1950 IESLOG=3,74 - 1950 EASTL(IESLOG,J)=DBLE(MEASTL(IESLOG,21,J))/(TEMPNH*10.D0 + DO IESLOG=3,74 + EASTL(IESLOG,J)=DBLE(MEASTL(IESLOG,21,J))/(TEMPNH*10.D0 & **((IESLOG-1)/12.D0)) + ENDDO + ENDDO IF(L.EQ.3) GO TO 1953 DO 1952 J=1,NJ(1) WRITE(21,1954) J @@ -4160,6 +4169,8 @@ C REAL*8 FUNCTION CVMGT(A, B, C) +C this function returns A if C is tuer and B otherwise +C why is it needed?? IMPLICIT NONE REAL*8 A,B LOGICAL C @@ -4500,9 +4511,10 @@ C Entry to input and float integer seeds from previous run ENTRY RLUXIN(ISDEXT) NOTYET = .FALSE. TWOM24 = 1. - DO 195 I= 1, 24 + DO I= 1, 24 NEXT(I) = I-1 - 195 TWOM24 = TWOM24 * 0.5 + TWOM24 = TWOM24 * 0.5 + ENDDO NEXT(1) = 24 TWOM12 = TWOM24 * 4096. WRITE(6,'(A)') ' FULL INITIALIZATION OF RANLUX WITH 25 INTEGERS:' diff --git a/trimspNL b/trimspNL index 3cbb71d..eb58964 100755 Binary files a/trimspNL and b/trimspNL differ