Commit 8d5f9b72 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Added band gap search field.

parent 526060e1
Pipeline #84807 skipped with stage
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -171,7 +171,7 @@ function getSubscriptedFormula(formula){
function getSearchURL(){
return API_BASE_URL+'materials';
return API_BASE_URL+'materials/';
}
function getSuggestionURL(quantity){
......
......@@ -114,30 +114,10 @@ class PropertiesBox {
</div>
<div class="results-panel props-tab-panel" >
<!--
<div style="float: left; width: 47%;">
<div class="field">
<div class="field-title"><span info-sys-data="band-gap">Band gap</span> <span style="font-weight: normal;">(eV)</span></div>
Min: <input type="text" class="band-gap-min-field">&nbsp;&nbsp;
Max: <input type="text" class="band-gap-max-field">
</div>
</div>
<div style="float: left; width: 5%;"> </div>
<div style="float: right; width: 47%;">
<div class="field" style="padding-top: 28px;">
<input type="radio" name="band-gap-type" value="d"> Direct<br>
<input type="radio" name="band-gap-type" value="i"> Indirect<br>
<input type="radio" name="band-gap-type" value="d/i" checked> Both<br>
</div>
</div>
-->
<div style="clear: both;"></div>
<div class="field" style="background-color: #CCC; padding: 10px;">
<div style="font-weight: bold; padding-bottom: 6px" >Results containing...</div>
<div style="float: left; width: 47%;">
<div style="float: left; widt: 47%;">
<input type="checkbox" class="has-band-structure-field" value="Band structure">
<span info-sys-data="has-band-structure">Band structure</span><br>
<input type="checkbox" class="has-dos-field" value="DOS">
......@@ -156,6 +136,30 @@ class PropertiesBox {
<div style="clear: both;"></div>
</div>
<div style="float: left; width: 47%;">
<div class="field">
<div class="field-title"><span info-sys-data="band-gap">Band gap</span> <span style="font-weight: normal;">(eV)</span></div>
<div style="display: flex; height: 20px; align-items: center; margin-top: 5px">
<input type="text" class="band-gap-min-field">
<p style="padding: 5px">-</p>
<input type="text" class="band-gap-max-field">
</div>
</div>
</div>
<!--<div style="float: left; width: 5%;"> </div> -->
<!--
<div style="float: right; width: 47%;">
<div class="field" style="padding-top: 28px;">
<input type="radio" name="band-gap-type" value="d"> Direct<br>
<input type="radio" name="band-gap-type" value="i"> Indirect<br>
<input type="radio" name="band-gap-type" value="d/i" checked> Both<br>
</div>
</div>
-->
<div style="clear: both;"></div>
</div>
<div class="method-panel props-tab-panel" >
......@@ -306,7 +310,7 @@ class PropertiesBox {
this.addPropsFromCheckboxes(propsMap,['material-type', 'crystal-system'], reset);
// this.addMassDensityProps(propsMap, reset);
}else if (tabString === 'results'){
// this.addBandgapProps(propsMap, reset);
this.addBandgapProps(propsMap, reset);
this.addPropsFromCheckboxes(propsMap,['has-band-structure', 'has-dos',
'has-fermi-surface', 'has-thermal-properties'], reset);
......@@ -361,18 +365,25 @@ class PropertiesBox {
label = minField.value+' < '+label;
fieldName += ':'+minField.value;
if (reset) minField.value = '';
} else {
fieldName += ':';
}
if (maxField.value !== ''){
label += ' < '+maxField.value;
fieldName += ':'+maxField.value;
if (reset) maxField.value = '';
} else {
fieldName += ':';
}
if (label !== 'Band Gap'){
let val = document.querySelector('input[name="band-gap-type"]:checked').value;
if (val === 'd') fieldName += ':True';
else if (val === 'i') fieldName += ':False';
propsMap.set(fieldName, [label+' '+val]);
}
propsMap.set(fieldName, [label]);
//if (label !== 'Band Gap'){
//let val = document.querySelector('input[name="band-gap-type"]:checked').value;
//if (val === 'd') fieldName += ':True';
//else if (val === 'i') fieldName += ':False';
//propsMap.set(fieldName, [label+' '+val]);
//}
}
......
......@@ -177,23 +177,30 @@ class SearchMod {
let elements = [];
queryObj.search_by = {};
this.searchQuery.forEach( (item, i) => {
if (this.queryTypes[i] === 'F') queryObj.search_by.formula = item;
else if (this.queryTypes[i] === 'E') elements.push(item);
else if (this.queryTypes[i] !== 'S'){ // property
/*if (this.queryTypes[i].indexOf('band-gap') === 0){ // special case
if (this.queryTypes[i] === 'F') {
queryObj.search_by.formula = item;
} else if (this.queryTypes[i] === 'E') {
elements.push(item);
} else if (this.queryTypes[i] !== 'S') { // property
if (this.queryTypes[i].indexOf('band-gap') === 0) { // special case
let bandGapData = this.queryTypes[i].split(':');
queryObj.band_gap = {"min": util.eV2J(bandGapData[1]),
"max": util.eV2J(bandGapData[2])};
queryObj.band_gap_direct = bandGapData[3];
}else if (this.queryTypes[i].indexOf('mass-density') === 0){ // special case
let massDensity = this.queryTypes[i].split(':');
queryObj.mass_density = {"min": massDensity[1], "max": massDensity[2]};
}else */
queryObj.band_gap = {
"min": parseFloat(bandGapData[1]),
"max": parseFloat(bandGapData[2])
};
//queryObj.band_gap_direct = bandGapData[3];
//}else if (this.queryTypes[i].indexOf('mass-density') === 0){ // special case
//let massDensity = this.queryTypes[i].split(':');
//queryObj.mass_density = {"min": massDensity[1], "max": massDensity[2]};
//}else */
} else {
if (this.queryTypes[i].indexOf('has') === 0) {// boolean fields
queryObj[replaceDashes(this.queryTypes[i])] = true;
} else // general fields
} else {// general fields
queryObj[replaceDashes(this.queryTypes[i])] = item.split(' | ');
}
}
}
});
if (elements.length > 0)
......
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