5 Commits

10 changed files with 354 additions and 4934 deletions

View File

@@ -5,9 +5,10 @@
<link rel="stylesheet" href="ZGUI.css"> <link rel="stylesheet" href="ZGUI.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="TrimSPelec.js"></script> <script src="TrimSPelec.js"></script>
<!script src="TrimSPWeb.js"></script>
<script src="TrimSPlib.js"></script> <script src="TrimSPlib.js"></script>
<script src="myplots.js"></script> <script src="myplots.js"></script>
<!script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<title>Trim.SP</title> <title>Trim.SP</title>
</head> </head>
<body onresize="resizePl()" onload="adjust_table();adjust_scans();"> <body onresize="resizePl()" onload="adjust_table();adjust_scans();">
@@ -62,6 +63,7 @@
<option value="Mg-31">Mg-31</option> <option value="Mg-31">Mg-31</option>
<option value="H">H</option> <option value="H">H</option>
<option value="He">He</option> <option value="He">He</option>
<option value="Ar">Ar</option>
</select> </select>
</td> </td>
</tr> </tr>

View File

@@ -1425,7 +1425,20 @@ function startSequence() {
iScan++; iScan++;
} }
let seq_file = All["fileNamePrefix"]+"_Seq_Results.dat"; let data = readAsciiFile(All["workPath"]+"/"+"fort.33");
let LComp = "";
let chem_formula = "";
let place_holder = "";
let re = new RegExp(place_holder,"g");
for (let i=1;i<=All["numLayer"];i++) {
LComp = "L"+i+"Comp";
chem_formula = All[LComp];
place_holder = "impL"+i;
re = new RegExp(place_holder,"g");
data = data.replace(re, chem_formula);
}
let seq_file = All["workPath"]+"/"+All["fileNamePrefix"]+"_Seq_Results.dat";
writeAsciiFile(seq_file, data);
// Remove redundant files and change the name fort.33 // Remove redundant files and change the name fort.33
if (!webOrApp) { if (!webOrApp) {

View File

@@ -4,26 +4,70 @@ function writeAsciiFile(filename,content) {
// Write string content into ascii file filename // Write string content into ascii file filename
// Go via CGI script // Go via CGI script
//console.log(filename, content); //console.log(filename, content);
// Prepare CGI args // Prepare CGI args use POST for long files
let cgiargs = "?fn="+filename; let cgiargs = "fn="+filename; // POST
let lines = content.split(/\n/); let lines = content.split(/\n/);
let prefix = filename.split(/\//); let prefix = filename.split(/\//);
for (let i=0; i<lines.length; i++) { for (let i=0; i<lines.length; i++) {
cgiargs += "&line" + i + "=" + lines[i]; cgiargs += "&line" + i + "=" + lines[i].replace(/\s\s+/g, ' ');
} }
var xhttp; var xhttp;
xhttp = new XMLHttpRequest(); xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() { xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) { if (this.readyState == 4 && this.status == 200) {
//console.log("resptext=",xhttp.responseText); console.log("response=",xhttp.responseText);
} else if (this.readyState == 4) { } else if (this.readyState == 4) {
console.log(xhttp.status, xhttp.statusText); console.log(xhttp.status, xhttp.statusText);
} }
} }
let request = "/cgi-bin/singleTrimSP.cgi"+cgiargs; let request = "/cgi-bin/singleTrimSP.cgi"; //POST
xhttp.open("GET", request, false); xhttp.open("POST", request, false); //POST
xhttp.send();
//Send the proper header information along with the request
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); //POST
xhttp.send(cgiargs); //POST
// Now you can add a link to the files
let d = document.getElementById("linkDiv");
if (!d) {
d = document.createElement("div");
d.id = "linkDiv";
document.body.appendChild(d);
}
let htmlLink = "Download files: <a href='";
htmlLink += "/tmp/" + prefix[2] + ".tgz'>";
htmlLink += prefix[2] + ".tgz</a>";
d.innerHTML = htmlLink;
return(1);
}
function writeAsciiFile2(filename,content) {
// Write string content into ascii file filename
// Go via CGI script
//console.log(filename, content);
// Prepare CGI args use GET for short files
let cgiargs = "?fn="+filename; // GET
let lines = content.split(/\n/);
let prefix = filename.split(/\//);
for (let i=0; i<lines.length; i++) {
cgiargs += "&line" + i + "=" + lines[i].replace(/\s\s+/g, ' ');
}
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log("response=",xhttp.responseText);
} else if (this.readyState == 4) {
console.log(xhttp.status, xhttp.statusText);
}
}
let request = "/cgi-bin/singleTrimSP.cgi"+cgiargs; // GET
xhttp.open("GET", request, false); //GET
//Send the proper header information along with the request
xhttp.send(); // GET
// Now you can add a link to the files // Now you can add a link to the files
let d = document.getElementById("linkDiv"); let d = document.getElementById("linkDiv");
if (!d) { if (!d) {
@@ -60,6 +104,7 @@ function readAsciiFile(filename) {
filename += "?" + Date(); filename += "?" + Date();
//filename = "http://musruser.psi.ch" + filename; //filename = "http://musruser.psi.ch" + filename;
xhttp.open("GET", filename, false); xhttp.open("GET", filename, false);
xhttp.overrideMimeType("text/plain");
xhttp.send(); xhttp.send();
return(xhttp.responseText); return(xhttp.responseText);
} }

View File

@@ -115,7 +115,7 @@ C NJ(I) is the number of elements in layer I
INTEGER*4 ICSUM,ICSUMS,ICDI,ISPA,ISPAT INTEGER*4 ICSUM,ICSUMS,ICDI,ISPA,ISPAT
INTEGER*4 KK0,KK0R,KK2,KKR,KDEE1,KDEE2 INTEGER*4 KK0,KK0R,KK2,KKR,KDEE1,KDEE2
INTEGER*4 NE,NA,NG,NA1,NG1 INTEGER*4 NE,NA,NG,NA1,NG1
INTEGER*4 LJ,INEL,IH,IH1,IY,IY2,IY3 INTEGER*4 JMAX,LJ,INEL,IH,IH1,IY,IY2,IY3
INTEGER*4 JL,KK1,IVMIN,IVMAX,NPA,IREC1,IREC,MAXA,NALL,NSA,KIS INTEGER*4 JL,KK1,IVMIN,IVMAX,NPA,IREC1,IREC,MAXA,NALL,NSA,KIS
INTEGER*4 IA,IAG,IAGS,IG,IESP,IESLOG INTEGER*4 IA,IAG,IAGS,IG,IESP,IESLOG
INTEGER*4 IPOT,IPOTR,IRL,ICDIR,ICSBR,ICSUMR,KOI,IGG,KIST INTEGER*4 IPOT,IPOTR,IRL,ICDIR,ICSBR,ICSUMR,KOI,IGG,KIST
@@ -397,9 +397,13 @@ C if there is no input argument take defailt file names
write (*,*) innam write (*,*) innam
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)
OPEN(UNIT=99,file=errnam,STATUS='replace') OPEN(UNIT=99,file=errnam,STATUS='replace')
OPEN(UNIT=11,file=innam,STATUS='unknown',ERR=8000) OPEN(UNIT=11,file=innam,STATUS='unknown',ERR=1359)
C First line: properties of projectile C First line: properties of projectile
C Ordered as: Z, mass number (amu), imp. energy, dist. of imp. energy, angle, dist. angles, C Ordered as: Z, mass number (amu), imp. energy, dist. of imp. energy, angle, dist. angles,
READ(11,*) Z1,M1,E0,Esig,ALPHA,ALPHASIG,EF,ESB,SHEATH,ERC READ(11,*) Z1,M1,E0,Esig,ALPHA,ALPHASIG,EF,ESB,SHEATH,ERC
@@ -441,12 +445,12 @@ C value A-5 of the ziegler tables
read(11,*) (CH5(I,j), j = 1, NJ(I)) read(11,*) (CH5(I,j), j = 1, NJ(I))
ENDDO ENDDO
CLOSE(UNIT=11) 1359 CLOSE(UNIT=11)
C open statement for output files, removed from line 2449 ff to here C open statement for output files, removed from line 2449 ff to here
OPEN(UNIT=21,FILE=outnam) OPEN(UNIT=21,FILE=outnam)
OPEN(UNIT=22,FILE=rgenam,STATUS='replace') 6001 OPEN(UNIT=22,FILE=rgenam,STATUS='replace')
WRITE(21,1000) WRITE(21,1000)
1000 FORMAT(1H1/,6X,'* TrimSPNL v1.1.0 *') 1000 FORMAT(1H1/,6X,'* TrimSPNL v1.1.0 *')
@@ -526,12 +530,9 @@ C Loop over all defined layers
Z2(I)=Z2(I)+CO(I,J)*ZT(I,J) Z2(I)=Z2(I)+CO(I,J)*ZT(I,J)
M2(I)=M2(I)+CO(I,J)*MT(I,J) M2(I)=M2(I)+CO(I,J)*MT(I,J)
ENDDO ENDDO
C this is the atomic density
ARHO(I) = RHO(I)*AN/M2(I) ARHO(I) = RHO(I)*AN/M2(I)
C this is the mean free path
LM(I) = ARHO(I)**(-1.D0/3.D0) LM(I) = ARHO(I)**(-1.D0/3.D0)
ASIG(I) = LM(I)*ARHO(I) ASIG(I) = LM(I)*ARHO(I)
C this is the maximum impact parameter
PDMAX(I) = LM(I)/DSQRT(PI) PDMAX(I) = LM(I)/DSQRT(PI)
K2(I) = .133743D0*Z2(I)**(2.D0/3.D0)/DSQRT(M2(I)) K2(I) = .133743D0*Z2(I)**(2.D0/3.D0)/DSQRT(M2(I))
AM(I) = CA*ABC*(Z2(I)**(-1.D0/3.D0)) AM(I) = CA*ABC*(Z2(I)**(-1.D0/3.D0))
@@ -634,11 +635,12 @@ C ZBL POTENTIAL (IPOTR=3)
ALPHA = CVMGT( .001D0, ALPHA, EQUAL(ALPHA,0.D0)) ALPHA = CVMGT( .001D0, ALPHA, EQUAL(ALPHA,0.D0))
ALPHA = CVMGT( 179.999D0, ALPHA, EQUAL(ALPHA,180.D0)) ALPHA = CVMGT( 179.999D0, ALPHA, EQUAL(ALPHA,180.D0))
IF(ALPHA.GE.90.0.AND.X0.LE.0.0) then IF(ALPHA.GE.90.0.AND.X0.LE.0.0) GO TO 8881
WRITE(*,*) 'ERROR : If ALPHA>=90 then X0 must be <=0.' GO TO 8882
C Exit program 8881 WRITE(6,8883)
8883 FORMAT(1X,'ERROR : IF ALPHA.GE.90. THEN IT MUST BE X0.LE.0.')
GO TO 8000 GO TO 8000
endif 8882 CONTINUE
C SET CONSTANT DISTANCES C SET CONSTANT DISTANCES
@@ -658,15 +660,17 @@ C SET CONSTANT DISTANCES
RT = TT-RD RT = TT-RD
IF(E0.LT.0.D0) then IF(E0.GE.0.D0) GO TO 51
C
C SET CONSTANTS FOR MAXWELLIAN DISTRIBUTION C SET CONSTANTS FOR MAXWELLIAN DISTRIBUTION
C
TI = -1.D0*E0 TI = -1.D0*E0
ZARG = DSQRT(TI/(M1*2.D0)) ZARG = DSQRT(TI/(M1*2.D0))
VELC = SHEATH/M1 VELC = SHEATH/M1
endif C
C NUMBERS FOR VECTORIZED LOOPS C NUMBERS FOR VECTORIZED LOOPS
NUM = MIN( 64, NH) C
51 NUM = MIN( 64, NH)
IH = NUM IH = NUM
IH1 = NUM IH1 = NUM
C C

File diff suppressed because it is too large Load Diff

20
main.js
View File

@@ -34,8 +34,10 @@ function createWindow () {
console.log(result.canceled); console.log(result.canceled);
console.log(result.filePaths); console.log(result.filePaths);
if (!result.canceled) { if (!result.canceled) {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('openFile',result.filePaths); focusedWindow.webContents.send('openFile',result.filePaths);
});
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@@ -51,9 +53,11 @@ function createWindow () {
defaultPath : app.getPath('temp'), defaultPath : app.getPath('temp'),
properties:["openDirectory"]} properties:["openDirectory"]}
).then(result => { ).then(result => {
setImmediate(function() {
console.log(result.filePaths) console.log(result.filePaths)
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('selectFolder',result.filePaths); focusedWindow.webContents.send('selectFolder',result.filePaths);
});
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}) })
@@ -63,8 +67,10 @@ function createWindow () {
label: 'Save', label: 'Save',
accelerator: 'CmdOrCtrl+S', accelerator: 'CmdOrCtrl+S',
click () { click () {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('saveFile',''); focusedWindow.webContents.send('saveFile','');
});
} }
}, },
{ {
@@ -80,8 +86,10 @@ function createWindow () {
], ],
properties: ['showOverwriteConfirmation']} properties: ['showOverwriteConfirmation']}
).then(result => { ).then(result => {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('saveFile',result.filePath); focusedWindow.webContents.send('saveFile',result.filePath);
});
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}) })
@@ -91,11 +99,13 @@ function createWindow () {
label: 'Print', label: 'Print',
accelerator: 'CmdOrCtrl+P', accelerator: 'CmdOrCtrl+P',
click () { click () {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
const options = {}; const options = {};
focusedWindow.webContents.print(options, (success, errorType) => { focusedWindow.webContents.print(options, (success, errorType) => {
if (!success) console.log(errorType) if (!success) console.log(errorType)
}) });
});
} }
}, },
{ {
@@ -124,8 +134,10 @@ function createWindow () {
console.log(result.canceled); console.log(result.canceled);
console.log(result.filePaths); console.log(result.filePaths);
if (!result.canceled) { if (!result.canceled) {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('plotProf',result.filePaths); focusedWindow.webContents.send('plotProf',result.filePaths);
});
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@@ -147,8 +159,10 @@ function createWindow () {
console.log(result.canceled); console.log(result.canceled);
console.log(result.filePaths); console.log(result.filePaths);
if (!result.canceled) { if (!result.canceled) {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('plotFrac',result.filePaths); focusedWindow.webContents.send('plotFrac',result.filePaths);
});
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@@ -170,8 +184,10 @@ function createWindow () {
console.log(result.canceled); console.log(result.canceled);
console.log(result.filePaths); console.log(result.filePaths);
if (!result.canceled) { if (!result.canceled) {
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('plotMean',result.filePaths); focusedWindow.webContents.send('plotMean',result.filePaths);
});
} }
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@@ -231,9 +247,11 @@ ipcMain.on('browseFolder', (event, args) => {
properties:["openDirectory"]} properties:["openDirectory"]}
).then(result => { ).then(result => {
console.log(result) console.log(result)
setImmediate(function() {
var focusedWindow = BrowserWindow.getFocusedWindow(); var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('browseFolder',result.filePaths); focusedWindow.webContents.send('browseFolder',result.filePaths);
app.setPath('temp',result.filePaths[0]); app.setPath('temp',result.filePaths[0]);
});
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}) })

View File

@@ -1,6 +1,6 @@
{ {
"name": "TrimSP", "name": "TrimSP",
"version": "1.1.0", "version": "1.0.2",
"description": "Trim.SP simulation to calculate stopping profile of implanted probes.", "description": "Trim.SP simulation to calculate stopping profile of implanted probes.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
@@ -13,7 +13,7 @@
"SRIM" "SRIM"
], ],
"author": "Zaher Salman", "author": "Zaher Salman",
"license": "GPL3", "license": "GPL2",
"devDependencies": { "devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.57", "@electron-forge/cli": "^6.0.0-beta.57",
"@electron-forge/maker-deb": "^6.0.0-beta.57", "@electron-forge/maker-deb": "^6.0.0-beta.57",

BIN
trimspNL

Binary file not shown.