Commit 9d40aabc authored by Iker Hurtado's avatar Iker Hurtado
Browse files

Various changes and bugfixing

- Remove the temporary scaling factors applied to some calc types (VASP and exciting) (issue 100)
- Remove grouping disabling for some codes (VASP and FHI-aims)
- Bugfixing: multiple entries in methodology page (issue 109)
- Improvement: the band gap is shown with 6 digits behind the comma, 2 would be enough
parent 4242ab90
Pipeline #24501 passed with stages
in 7 seconds
......@@ -622,10 +622,14 @@
}
function J2eV(energy){
function J2eV(energy, decimals){
let result= energy/1.602176565e-19;
if (result < 0.01) return result.toFixed(6);
else return result.toFixed(3);
if (decimals === undefined){
if (result < 0.01) return result.toFixed(6);
else return result.toFixed(3);
}else{
return result.toFixed(decimals);
}
}
function eV2J(energy){
......@@ -984,8 +988,11 @@
let representative = getCalc(getCalcReprIntId(groupId));
let codeNameTrimed= representative.code_name.trim();
//console.log('isInAnyGroup', calcId, groupData.calcs);
/***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims'
&& groupData.calcs.has(calcId)) thereIs = true;//return true;
&& groupData.calcs.has(calcId)) thereIs = true; */
if (groupData.calcs.has(calcId)) thereIs = true;
});
return thereIs;
}
......@@ -1967,8 +1974,8 @@
let functionalType = representative.functional_type;
//console.log('GROUP CODE:',codeNameTrimed);
//***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims')
/***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims') */
if (calcTree.has(functionalType)){
let functionalMap= calcTree.get(functionalType);
......@@ -2875,7 +2882,7 @@
if (e.target.status === 200){
let dosData= JSON.parse(e.target.response).dos;
/*** Temporary fix */
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
......@@ -2901,8 +2908,9 @@
if (calcWithDOS.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
this.dosPlotter.setPoints(dosData, factor);//paintPointsLine(dosData);
this.dosPlotter.setPoints(dosData/*, factor*/);//paintPointsLine(dosData);
this.dosCalcIdBox.innerHTML = 'From calculation <b>'+calcWithDOS.id+
'</b><br><span style="font-size: 0.8em">('+calcWithDOS.functional_type+' - '+calcWithDOS.code_name+')</span>';
if (dosData.dos_values.length === 2)
......@@ -3826,7 +3834,7 @@
}
setPoints(points, volume){
setPoints(points/*, volume*/){
this.pointsSpin1 = [];
this.pointsSpin2 = [];
......@@ -3838,19 +3846,18 @@
let pointsY= points.dos_energies;
let pointsXInPlotRange = [];
let pointsYInPlotRange = [];
console.log('setPoints volume',volume);
// console.log('setPoints volume',volume);
for (var i = 0; i < pointsY.length; i++) {
let energy = pointsY[i]/E_FACTOR;
let dos_value_spin1 = pSpin1[i]/(E_FACTOR*volume);
let dos_value_spin1 = pSpin1[i]/(E_FACTOR/**volume*/);
pointsXInPlotRange.push(dos_value_spin1);
if (pSpin2 !== null) pointsXInPlotRange.push(pSpin2[i]);
pointsYInPlotRange.push(energy);
//console.log('POINTS : ',pointsX[i], energy);
this.pointsSpin1.push({x: dos_value_spin1, y: energy});
if (pSpin2 !== null)
this.pointsSpin2.push({x: pSpin2[i]/(E_FACTOR*volume), y: energy});
this.pointsSpin2.push({x: pSpin2[i]/(E_FACTOR/**volume*/), y: energy});
}
let maxDosVal = Math.max.apply(null, pointsXInPlotRange);
......@@ -5593,7 +5600,7 @@
let calc = DataStore.getCalc(calcId);
/*** Temporary fix */
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
......@@ -5618,7 +5625,7 @@
if (calc.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
if (!this.bsDosPlotter.isAttached())
this.bsDosPlotter.attach(this.element.querySelector('.calc-bs-dos-plotter')
......@@ -5645,12 +5652,12 @@
//***util.addBandGapData(calcData, bsData);
//console.log(calcData.dos_json);
this.bsDosPlotter.setUpAndData(bsData, dosData, factor);
this.bsDosPlotter.setUpAndData(bsData, dosData /*, factor*/);
if (calc.has_band_structure){
this.bandGapField.style.display = 'block';
this.bandGapValue.textContent= util.J2eV(calc.band_gap)+' eV ';
this.bandGapValue.textContent= util.J2eV(calc.band_gap, 2)+' eV ';
// console.log('calc.brillouin_zone_json',calc.brillouin_zone_json);
if (calc.brillouin_zone_json !== null){
this.lowerSection.style.display = 'block';
......@@ -5827,9 +5834,9 @@
stats.max = Math.max.apply(null, array);
stats.equal = (stats.min === stats.max);
stats.label = 'band gap';
stats.html = util.getAverage(stats.data).toFixed(3)+
' &nbsp; <span style="font-size: 0.9em">['+stats.min.toFixed(3)
+' , '+stats.max.toFixed(3)+']</span>';
stats.html = util.getAverage(stats.data).toFixed(2)+
' &nbsp; <span style="font-size: 0.9em">['+stats.min.toFixed(2)
+' , '+stats.max.toFixed(2)+']</span>';
this.functionalBandGapMap.set(functionalName, stats);
......@@ -5930,7 +5937,7 @@
}
setUpAndData(dispData, dosData, volume){
setUpAndData(dispData, dosData/*, volume*/){
this.hasDispData = (dispData !== undefined && dispData !== null);
this.hasDosData = (dosData !== undefined && dosData !== null);
......@@ -5961,7 +5968,7 @@
if (this.hasDosData){
this.dosPlotter.setPoints(dosData, volume);
this.dosPlotter.setPoints(dosData/*, volume*/);
if (this.hasDispData){
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
......@@ -6361,6 +6368,8 @@
updateSelection( leafIds ){
this.sortedCalcs = [];
DataStore.getCalculations().forEach( c => {
let calcType = c.run_type;
......
......@@ -211,10 +211,14 @@ function getCellDataForViewer(matData){
}
function J2eV(energy){
function J2eV(energy, decimals){
let result= energy/1.602176565e-19;
if (result < 0.01) return result.toFixed(6);
else return result.toFixed(3);
if (decimals === undefined){
if (result < 0.01) return result.toFixed(6);
else return result.toFixed(3);
}else{
return result.toFixed(decimals);
}
}
function eV2J(energy){
......
......@@ -32,7 +32,7 @@ class BSDOSPlotter{
}
setUpAndData(dispData, dosData, volume){
setUpAndData(dispData, dosData/*, volume*/){
this.hasDispData = (dispData !== undefined && dispData !== null);
this.hasDosData = (dosData !== undefined && dosData !== null);
......@@ -63,7 +63,7 @@ class BSDOSPlotter{
if (this.hasDosData){
this.dosPlotter.setPoints(dosData, volume);
this.dosPlotter.setPoints(dosData/*, volume*/);
if (this.hasDispData){
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
......
......@@ -24,7 +24,7 @@ class DOSPlotter extends InteractivePlotterBase{
}
setPoints(points, volume){
setPoints(points/*, volume*/){
this.pointsSpin1 = [];
this.pointsSpin2 = [];
......@@ -36,19 +36,18 @@ class DOSPlotter extends InteractivePlotterBase{
let pointsY= points.dos_energies;
let pointsXInPlotRange = [];
let pointsYInPlotRange = [];
console.log('setPoints volume',volume);
// console.log('setPoints volume',volume);
for (var i = 0; i < pointsY.length; i++) {
let energy = pointsY[i]/E_FACTOR;
let dos_value_spin1 = pSpin1[i]/(E_FACTOR*volume);
let dos_value_spin1 = pSpin1[i]/(E_FACTOR/**volume*/);
pointsXInPlotRange.push(dos_value_spin1);
if (pSpin2 !== null) pointsXInPlotRange.push(pSpin2[i]);
pointsYInPlotRange.push(energy);
//console.log('POINTS : ',pointsX[i], energy);
this.pointsSpin1.push({x: dos_value_spin1, y: energy});
if (pSpin2 !== null)
this.pointsSpin2.push({x: pSpin2[i]/(E_FACTOR*volume), y: energy});
this.pointsSpin2.push({x: pSpin2[i]/(E_FACTOR/**volume*/), y: energy});
}
let maxDosVal = Math.max.apply(null, pointsXInPlotRange);
......
......@@ -118,8 +118,11 @@ function isInAnyNotDisabledGroup(calcId){
let representative = getCalc(getCalcReprIntId(groupId));
let codeNameTrimed= representative.code_name.trim();
//console.log('isInAnyGroup', calcId, groupData.calcs);
/***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims'
&& groupData.calcs.has(calcId)) thereIs = true;//return true;
&& groupData.calcs.has(calcId)) thereIs = true; */
if (groupData.calcs.has(calcId)) thereIs = true;
});
return thereIs;
}
......
......@@ -263,7 +263,7 @@ class ElectronicStructDetails extends DetailsViewBase{
let calc = DataStore.getCalc(calcId);
/*** Temporary fix */
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
......@@ -288,7 +288,7 @@ class ElectronicStructDetails extends DetailsViewBase{
if (calc.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
if (!this.bsDosPlotter.isAttached())
this.bsDosPlotter.attach(this.element.querySelector('.calc-bs-dos-plotter')
......@@ -315,12 +315,12 @@ class ElectronicStructDetails extends DetailsViewBase{
//***util.addBandGapData(calcData, bsData);
//console.log(calcData.dos_json);
this.bsDosPlotter.setUpAndData(bsData, dosData, factor);
this.bsDosPlotter.setUpAndData(bsData, dosData /*, factor*/);
if (calc.has_band_structure){
this.bandGapField.style.display = 'block';
this.bandGapValue.textContent= util.J2eV(calc.band_gap)+' eV ';
this.bandGapValue.textContent= util.J2eV(calc.band_gap, 2)+' eV ';
// console.log('calc.brillouin_zone_json',calc.brillouin_zone_json);
if (calc.brillouin_zone_json !== null){
this.lowerSection.style.display = 'block';
......@@ -497,9 +497,9 @@ class SummaryByFunctionalsComponent{
stats.max = Math.max.apply(null, array);
stats.equal = (stats.min === stats.max);
stats.label = 'band gap';
stats.html = util.getAverage(stats.data).toFixed(3)+
' &nbsp; <span style="font-size: 0.9em">['+stats.min.toFixed(3)
+' , '+stats.max.toFixed(3)+']</span>';
stats.html = util.getAverage(stats.data).toFixed(2)+
' &nbsp; <span style="font-size: 0.9em">['+stats.min.toFixed(2)
+' , '+stats.max.toFixed(2)+']</span>';
this.functionalBandGapMap.set(functionalName, stats);
......
......@@ -364,6 +364,8 @@ class MethodologyDetails extends DetailsViewBase {
updateSelection( leafIds ){
this.sortedCalcs = [];
DataStore.getCalculations().forEach( c => {
let calcType = c.run_type;
......
......@@ -16,8 +16,8 @@ function buildCalcTree(calcs, calcsInGroups){
let functionalType = representative.functional_type;
//console.log('GROUP CODE:',codeNameTrimed);
//***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims')
/***** Exception: disable grouping for some codes
if (codeNameTrimed !== 'VASP' && codeNameTrimed !== 'FHI-aims') */
if (calcTree.has(functionalType)){
let functionalMap= calcTree.get(functionalType);
......
......@@ -443,7 +443,7 @@ class Overview {
if (e.target.status === 200){
let dosData= JSON.parse(e.target.response).dos;
/*** Temporary fix */
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
......@@ -469,8 +469,9 @@ class Overview {
if (calcWithDOS.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
this.dosPlotter.setPoints(dosData, factor);//paintPointsLine(dosData);
this.dosPlotter.setPoints(dosData/*, factor*/);//paintPointsLine(dosData);
this.dosCalcIdBox.innerHTML = 'From calculation <b>'+calcWithDOS.id+
'</b><br><span style="font-size: 0.8em">('+calcWithDOS.functional_type+' - '+calcWithDOS.code_name+')</span>';
if (dosData.dos_values.length === 2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment