Highlight calculated density values
This commit is contained in:
+34
-10
@@ -3090,6 +3090,24 @@ function showTransientWarning(message, targetElement, duration = 4000) {
|
||||
}, duration);
|
||||
}
|
||||
|
||||
function markDensityEstimated(fieldId, isEstimated) {
|
||||
const field = document.getElementById(fieldId);
|
||||
if (!field) { return; }
|
||||
field.classList.toggle('estimated-density', isEstimated);
|
||||
if (isEstimated) {
|
||||
field.title = 'Calculated density estimate';
|
||||
} else {
|
||||
field.removeAttribute('title');
|
||||
}
|
||||
}
|
||||
|
||||
function clearDensityEstimateHighlight() {
|
||||
if (this && this.classList) {
|
||||
this.classList.remove('estimated-density');
|
||||
this.removeAttribute('title');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function rho_fun()
|
||||
{
|
||||
@@ -3099,16 +3117,19 @@ function rho_fun()
|
||||
var rhoLi = "L"+irow+"rho";
|
||||
|
||||
var rho = 0;
|
||||
var estimatedDensity = 0;
|
||||
|
||||
if (elemPars[chem]) {
|
||||
rho = elemPars[chem].rho;
|
||||
markDensityEstimated(rhoLi, false);
|
||||
} else {
|
||||
// Did not find density in elements list
|
||||
if (isFinite(rhos[chem])) {
|
||||
// Found in densities list of compositions
|
||||
rho = rhos[chem];
|
||||
} else {
|
||||
// suggest a material density based on composition (when it's undefined)
|
||||
markDensityEstimated(rhoLi, false);
|
||||
} else {
|
||||
// suggest a material density based on composition (when it's undefined)
|
||||
let layer_formula = parse_formula(chem);
|
||||
|
||||
// determine the stoichiometry sum (for normalization)
|
||||
@@ -3141,10 +3162,12 @@ function rho_fun()
|
||||
rho = total_molar_mass / total_molar_volume;
|
||||
}
|
||||
if (rho > 0) {
|
||||
showTransientWarning("Warning: Estimated density from additive elemental molar volumes; please verify manually.", document.getElementById(rhoLi));
|
||||
estimatedDensity = 1;
|
||||
showTransientWarning("Warning: Estimated density from additive elemental molar volumes; please verify manually.", document.getElementById(rhoLi));
|
||||
}
|
||||
markDensityEstimated(rhoLi, estimatedDensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set value in appropriate cell
|
||||
document.getElementById(rhoLi).value = rho;
|
||||
}
|
||||
@@ -3194,11 +3217,12 @@ function adjust_table()
|
||||
if (Comps[i-1]) {compCell.value = Comps[i-1];}else{compCell.value = 'SrTiO3';}
|
||||
compL.appendChild(compCell);
|
||||
var rhoL = row.insertCell(2);
|
||||
var rhoCell = document.createElement("input");
|
||||
rhoCell.id = "L"+i+"rho";
|
||||
rhoCell.name = "L"+i+"rho";
|
||||
rhoCell.size = 5;
|
||||
rhoL.appendChild(rhoCell);
|
||||
var rhoCell = document.createElement("input");
|
||||
rhoCell.id = "L"+i+"rho";
|
||||
rhoCell.name = "L"+i+"rho";
|
||||
rhoCell.size = 5;
|
||||
rhoCell.oninput = clearDensityEstimateHighlight;
|
||||
rhoL.appendChild(rhoCell);
|
||||
if (Rhos[i-1]) {rhoCell.value = Rhos[i-1];}else{rhoCell.value = '5.12';}
|
||||
var thickL = row.insertCell(3);
|
||||
var thickCell = document.createElement("input");
|
||||
|
||||
@@ -92,6 +92,11 @@ td {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.estimated-density {
|
||||
background-color: #fff4cc;
|
||||
border: 1px solid #c5a100;
|
||||
}
|
||||
|
||||
.group_name {
|
||||
padding-left:1em;
|
||||
padding-right:1em;
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "TrimSP",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "TrimSP",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"license": "GPL2",
|
||||
"dependencies": {
|
||||
"plotly.js-dist": "^1.58.4"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TrimSP",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "Trim.SP simulation to calculate stopping profile of implanted probes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user