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){ ...@@ -171,7 +171,7 @@ function getSubscriptedFormula(formula){
function getSearchURL(){ function getSearchURL(){
return API_BASE_URL+'materials'; return API_BASE_URL+'materials/';
} }
function getSuggestionURL(quantity){ function getSuggestionURL(quantity){
......
...@@ -114,30 +114,10 @@ class PropertiesBox { ...@@ -114,30 +114,10 @@ class PropertiesBox {
</div> </div>
<div class="results-panel props-tab-panel" > <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 class="field" style="background-color: #CCC; padding: 10px;">
<div style="font-weight: bold; padding-bottom: 6px" >Results containing...</div> <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"> <input type="checkbox" class="has-band-structure-field" value="Band structure">
<span info-sys-data="has-band-structure">Band structure</span><br> <span info-sys-data="has-band-structure">Band structure</span><br>
<input type="checkbox" class="has-dos-field" value="DOS"> <input type="checkbox" class="has-dos-field" value="DOS">
...@@ -156,6 +136,30 @@ class PropertiesBox { ...@@ -156,6 +136,30 @@ class PropertiesBox {
<div style="clear: both;"></div> <div style="clear: both;"></div>
</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>
<div class="method-panel props-tab-panel" > <div class="method-panel props-tab-panel" >
...@@ -306,7 +310,7 @@ class PropertiesBox { ...@@ -306,7 +310,7 @@ class PropertiesBox {
this.addPropsFromCheckboxes(propsMap,['material-type', 'crystal-system'], reset); this.addPropsFromCheckboxes(propsMap,['material-type', 'crystal-system'], reset);
// this.addMassDensityProps(propsMap, reset); // this.addMassDensityProps(propsMap, reset);
}else if (tabString === 'results'){ }else if (tabString === 'results'){
// this.addBandgapProps(propsMap, reset); this.addBandgapProps(propsMap, reset);
this.addPropsFromCheckboxes(propsMap,['has-band-structure', 'has-dos', this.addPropsFromCheckboxes(propsMap,['has-band-structure', 'has-dos',
'has-fermi-surface', 'has-thermal-properties'], reset); 'has-fermi-surface', 'has-thermal-properties'], reset);
...@@ -361,18 +365,25 @@ class PropertiesBox { ...@@ -361,18 +365,25 @@ class PropertiesBox {
label = minField.value+' < '+label; label = minField.value+' < '+label;
fieldName += ':'+minField.value; fieldName += ':'+minField.value;
if (reset) minField.value = ''; if (reset) minField.value = '';
} else {
fieldName += ':';
} }
if (maxField.value !== ''){ if (maxField.value !== ''){
label += ' < '+maxField.value; label += ' < '+maxField.value;
fieldName += ':'+maxField.value; fieldName += ':'+maxField.value;
if (reset) maxField.value = ''; if (reset) maxField.value = '';
} else {
fieldName += ':';
} }
if (label !== 'Band Gap'){
let val = document.querySelector('input[name="band-gap-type"]:checked').value; propsMap.set(fieldName, [label]);
if (val === 'd') fieldName += ':True'; //if (label !== 'Band Gap'){
else if (val === 'i') fieldName += ':False'; //let val = document.querySelector('input[name="band-gap-type"]:checked').value;
propsMap.set(fieldName, [label+' '+val]); //if (val === 'd') fieldName += ':True';
} //else if (val === 'i') fieldName += ':False';
//propsMap.set(fieldName, [label+' '+val]);
//}
} }
......
...@@ -177,22 +177,29 @@ class SearchMod { ...@@ -177,22 +177,29 @@ class SearchMod {
let elements = []; let elements = [];
queryObj.search_by = {}; queryObj.search_by = {};
this.searchQuery.forEach( (item, i) => { this.searchQuery.forEach( (item, i) => {
if (this.queryTypes[i] === 'F') queryObj.search_by.formula = item; if (this.queryTypes[i] === 'F') {
else if (this.queryTypes[i] === 'E') elements.push(item); queryObj.search_by.formula = item;
else if (this.queryTypes[i] !== 'S'){ // property } else if (this.queryTypes[i] === 'E') {
/*if (this.queryTypes[i].indexOf('band-gap') === 0){ // special case 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(':'); let bandGapData = this.queryTypes[i].split(':');
queryObj.band_gap = {"min": util.eV2J(bandGapData[1]), queryObj.band_gap = {
"max": util.eV2J(bandGapData[2])}; "min": parseFloat(bandGapData[1]),
queryObj.band_gap_direct = bandGapData[3]; "max": parseFloat(bandGapData[2])
}else if (this.queryTypes[i].indexOf('mass-density') === 0){ // special case };
let massDensity = this.queryTypes[i].split(':'); //queryObj.band_gap_direct = bandGapData[3];
queryObj.mass_density = {"min": massDensity[1], "max": massDensity[2]}; //}else if (this.queryTypes[i].indexOf('mass-density') === 0){ // special case
}else */ //let massDensity = this.queryTypes[i].split(':');
if (this.queryTypes[i].indexOf('has') === 0) {// boolean fields //queryObj.mass_density = {"min": massDensity[1], "max": massDensity[2]};
queryObj[replaceDashes(this.queryTypes[i])] = true; //}else */
} else // general fields } else {
queryObj[replaceDashes(this.queryTypes[i])] = item.split(' | '); if (this.queryTypes[i].indexOf('has') === 0) {// boolean fields
queryObj[replaceDashes(this.queryTypes[i])] = true;
} else {// general fields
queryObj[replaceDashes(this.queryTypes[i])] = item.split(' | ');
}
}
} }
}); });
......
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