Commit cd404da9 authored by Iker Hurtado's avatar Iker Hurtado
Browse files

Some refactoring

parent 9d40aabc
Pipeline #24583 passed with stages
in 7 seconds
......@@ -986,7 +986,7 @@
groups.forEach( (groupData, groupId) => {
let representative = getCalc(getCalcReprIntId(groupId));
let codeNameTrimed= representative.code_name.trim();
//let codeNameTrimed= representative.code_name.trim();
//console.log('isInAnyGroup', calcId, groupData.calcs);
/***** Exception: disable grouping for some codes
......@@ -1996,7 +1996,8 @@
calcs.forEach( calc => {
//if (!DataStore.isInAnyGroup(calc.id)) addToCalcTree(calc, calc.id+'');
//****** Exception: disable grouping for some codes
if (!DataStore.isInAnyNotDisabledGroup(calc.id)) addToCalcTree(calc, calc.id+'');
if (!DataStore.isInAnyNotDisabledGroup(calc.id))
addToCalcTree(calc, calc.id+'');
});
......@@ -2882,35 +2883,7 @@
if (e.target.status === 200){
let dosData= JSON.parse(e.target.response).dos;
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
function calculateOriginalVolume(cellData){ // (A x B) . C
let aVector = util.getNumberArray(cellData.a);
let bVector = util.getNumberArray(cellData.b);
let cVector = util.getNumberArray(cellData.c);
let cp = crossProduct(aVector, bVector);
//console.log(aVector, bVector, cp );
// dot product
return (cp[0]*cVector[0] + cp[1]*cVector[1] + cp[2]*cVector[2]);
}
function crossProduct(v1, v2) {
let vR = [];
vR[0] = ( (v1[1] * v2[2]) - (v1[2] * v2[1]) );
vR[1] = - ( (v1[0] * v2[2]) - (v1[2] * v2[0]) );
vR[2] = ( (v1[0] * v2[1]) - (v1[1] * v2[0]) );
return vR;
}
if (calcWithDOS.code_name !== 'VASP'){
if (calcWithDOS.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
this.dosPlotter.setPoints(dosData/*, factor*/);//paintPointsLine(dosData);
this.dosPlotter.setPoints(dosData);//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)
......@@ -3834,7 +3807,7 @@
}
setPoints(points/*, volume*/){
setPoints(points){
this.pointsSpin1 = [];
this.pointsSpin2 = [];
......@@ -3846,18 +3819,17 @@
let pointsY= points.dos_energies;
let pointsXInPlotRange = [];
let pointsYInPlotRange = [];
// 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);
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), y: energy});
}
let maxDosVal = Math.max.apply(null, pointsXInPlotRange);
......@@ -5600,33 +5572,6 @@
let calc = DataStore.getCalc(calcId);
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
function calculateOriginalVolume(cellData){ // (A x B) . C
let aVector = util.getNumberArray(cellData.a);
let bVector = util.getNumberArray(cellData.b);
let cVector = util.getNumberArray(cellData.c);
let cp = crossProduct(aVector, bVector);
// dot product
return (cp[0]*cVector[0] + cp[1]*cVector[1] + cp[2]*cVector[2]);
}
function crossProduct(v1, v2) {
let vR = [];
vR[0] = ( (v1[1] * v2[2]) - (v1[2] * v2[1]) );
vR[1] = - ( (v1[0] * v2[2]) - (v1[2] * v2[0]) );
vR[2] = ( (v1[0] * v2[1]) - (v1[1] * v2[0]) );
return vR;
}
if (calc.code_name !== 'VASP'){
if (calc.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
if (!this.bsDosPlotter.isAttached())
this.bsDosPlotter.attach(this.element.querySelector('.calc-bs-dos-plotter')
,undefined,360);
......@@ -5652,7 +5597,7 @@
//***util.addBandGapData(calcData, bsData);
//console.log(calcData.dos_json);
this.bsDosPlotter.setUpAndData(bsData, dosData /*, factor*/);
this.bsDosPlotter.setUpAndData(bsData, dosData );
if (calc.has_band_structure){
......@@ -5937,7 +5882,7 @@
}
setUpAndData(dispData, dosData/*, volume*/){
setUpAndData(dispData, dosData){
this.hasDispData = (dispData !== undefined && dispData !== null);
this.hasDosData = (dosData !== undefined && dosData !== null);
......@@ -5968,7 +5913,7 @@
if (this.hasDosData){
this.dosPlotter.setPoints(dosData/*, volume*/);
this.dosPlotter.setPoints(dosData);
if (this.hasDispData){
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
......
......@@ -32,7 +32,7 @@ class BSDOSPlotter{
}
setUpAndData(dispData, dosData/*, volume*/){
setUpAndData(dispData, dosData){
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);
if (this.hasDispData){
this.dosPlotter.setRepaintListener( (yZoom, yOffset) => {
......
......@@ -24,7 +24,7 @@ class DOSPlotter extends InteractivePlotterBase{
}
setPoints(points/*, volume*/){
setPoints(points){
this.pointsSpin1 = [];
this.pointsSpin2 = [];
......@@ -36,18 +36,17 @@ class DOSPlotter extends InteractivePlotterBase{
let pointsY= points.dos_energies;
let pointsXInPlotRange = [];
let pointsYInPlotRange = [];
// 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);
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), y: energy});
}
let maxDosVal = Math.max.apply(null, pointsXInPlotRange);
......
......@@ -116,7 +116,7 @@ function isInAnyNotDisabledGroup(calcId){
groups.forEach( (groupData, groupId) => {
let representative = getCalc(getCalcReprIntId(groupId));
let codeNameTrimed= representative.code_name.trim();
//let codeNameTrimed= representative.code_name.trim();
//console.log('isInAnyGroup', calcId, groupData.calcs);
/***** Exception: disable grouping for some codes
......
......@@ -263,33 +263,6 @@ class ElectronicStructDetails extends DetailsViewBase{
let calc = DataStore.getCalc(calcId);
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
function calculateOriginalVolume(cellData){ // (A x B) . C
let aVector = util.getNumberArray(cellData.a);
let bVector = util.getNumberArray(cellData.b);
let cVector = util.getNumberArray(cellData.c);
let cp = crossProduct(aVector, bVector);
// dot product
return (cp[0]*cVector[0] + cp[1]*cVector[1] + cp[2]*cVector[2]);
}
function crossProduct(v1, v2) {
let vR = [];
vR[0] = ( (v1[1] * v2[2]) - (v1[2] * v2[1]) );
vR[1] = - ( (v1[0] * v2[2]) - (v1[2] * v2[0]) );
vR[2] = ( (v1[0] * v2[1]) - (v1[1] * v2[0]) );
return vR;
}
if (calc.code_name !== 'VASP'){
if (calc.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
if (!this.bsDosPlotter.isAttached())
this.bsDosPlotter.attach(this.element.querySelector('.calc-bs-dos-plotter')
,undefined,360);
......@@ -315,7 +288,7 @@ class ElectronicStructDetails extends DetailsViewBase{
//***util.addBandGapData(calcData, bsData);
//console.log(calcData.dos_json);
this.bsDosPlotter.setUpAndData(bsData, dosData /*, factor*/);
this.bsDosPlotter.setUpAndData(bsData, dosData );
if (calc.has_band_structure){
......
......@@ -38,7 +38,8 @@ function buildCalcTree(calcs, calcsInGroups){
calcs.forEach( calc => {
//if (!DataStore.isInAnyGroup(calc.id)) addToCalcTree(calc, calc.id+'');
//****** Exception: disable grouping for some codes
if (!DataStore.isInAnyNotDisabledGroup(calc.id)) addToCalcTree(calc, calc.id+'');
if (!DataStore.isInAnyNotDisabledGroup(calc.id))
addToCalcTree(calc, calc.id+'');
});
......
......@@ -443,35 +443,7 @@ class Overview {
if (e.target.status === 200){
let dosData= JSON.parse(e.target.response).dos;
/*** Temporary fix
let factor = calculateOriginalVolume(DataStore.getMaterialData().cell);
//setFermiVizContent(this.fermiBox, '');
function calculateOriginalVolume(cellData){ // (A x B) . C
let aVector = util.getNumberArray(cellData.a);
let bVector = util.getNumberArray(cellData.b);
let cVector = util.getNumberArray(cellData.c);
let cp = crossProduct(aVector, bVector);
//console.log(aVector, bVector, cp );
// dot product
return (cp[0]*cVector[0] + cp[1]*cVector[1] + cp[2]*cVector[2]);
}
function crossProduct(v1, v2) {
let vR = [];
vR[0] = ( (v1[1] * v2[2]) - (v1[2] * v2[1]) );
vR[1] = - ( (v1[0] * v2[2]) - (v1[2] * v2[0]) );
vR[2] = ( (v1[0] * v2[1]) - (v1[1] * v2[0]) );
return vR;
}
if (calcWithDOS.code_name !== 'VASP'){
if (calcWithDOS.code_name === 'exciting') factor = 735;
else factor = 1;
}
*/
this.dosPlotter.setPoints(dosData/*, factor*/);//paintPointsLine(dosData);
this.dosPlotter.setPoints(dosData);//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