Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-gui
Commits
8d5f9b72
Commit
8d5f9b72
authored
Oct 21, 2020
by
Lauri Himanen
Browse files
Added band gap search field.
parent
526060e1
Pipeline
#84807
skipped with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
client/bundle.js
View file @
8d5f9b72
This source diff could not be displayed because it is too large. You can
view the blob
instead.
client/src/common/util.js
View file @
8d5f9b72
...
...
@@ -171,7 +171,7 @@ function getSubscriptedFormula(formula){
function
getSearchURL
(){
return
API_BASE_URL
+
'
materials
'
;
return
API_BASE_URL
+
'
materials
/
'
;
}
function
getSuggestionURL
(
quantity
){
...
...
client/src/search-mod/PropertiesBox.view.js
View file @
8d5f9b72
...
...
@@ -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">
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; widt
h
: 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]);
//}
}
...
...
client/src/search-mod/SearchMod.js
View file @
8d5f9b72
...
...
@@ -177,22 +177,29 @@ 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 */
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
(
'
|
'
);
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
queryObj
[
replaceDashes
(
this
.
queryTypes
[
i
])]
=
item
.
split
(
'
|
'
);
}
}
}
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment