File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
emmet-api/emmet/api/routes/materials/phonon Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change
1
+ from fastapi import Query
1
2
from emmet .core .mpid import MPID
2
3
3
4
from maggma .api .query_operator import QueryOperator
@@ -19,3 +20,22 @@ def query(
19
20
),
20
21
) -> STORE_PARAMS :
21
22
return {"criteria" : {"task_id" : str (task_id )}}
23
+
24
+
25
+ class PhononMethodQuery (QueryOperator ):
26
+ """
27
+ Method to query phonon method
28
+ """
29
+
30
+ def query (
31
+ self ,
32
+ phonon_method : str = Query (
33
+ None ,
34
+ description = "Phonon Method to search for" ,
35
+ ),
36
+ ) -> STORE_PARAMS :
37
+ crit = {}
38
+ if phonon_method in {"dfpt" , "phonopy" , "pheasy" }:
39
+ crit = {"phonon_method" : phonon_method }
40
+
41
+ return {"criteria" : crit }
Original file line number Diff line number Diff line change 1
- from maggma .api .query_operator import PaginationQuery , SparseFieldsQuery
1
+ from maggma .api .query_operator import PaginationQuery , SparseFieldsQuery , NumericQuery
2
2
from maggma .api .resource import ReadOnlyResource
3
3
4
4
from emmet .core .phonon import PhononBSDOSDoc
5
- from emmet .api .routes .materials .materials .query_operators import MultiMaterialIDQuery
5
+ from emmet .api .routes .materials .materials .query_operators import (
6
+ MultiMaterialIDQuery ,
7
+ ElementsQuery ,
8
+ FormulaQuery ,
9
+ ChemsysQuery ,
10
+ SymmetryQuery ,
11
+ )
12
+ from emmet .api .routes .materials .phonon .query_operators import PhononMethodQuery
6
13
from emmet .api .core .global_header import GlobalHeaderProcessor
7
14
from emmet .api .core .settings import MAPISettings
8
15
@@ -13,6 +20,12 @@ def phonon_bsdos_resource(phonon_bs_store):
13
20
PhononBSDOSDoc ,
14
21
query_operators = [
15
22
MultiMaterialIDQuery (),
23
+ FormulaQuery (),
24
+ ChemsysQuery (),
25
+ ElementsQuery (),
26
+ SymmetryQuery (),
27
+ PhononMethodQuery (),
28
+ NumericQuery (model = PhononBSDOSDoc , excluded_fields = ["composition" ]),
16
29
PaginationQuery (),
17
30
SparseFieldsQuery (
18
31
PhononBSDOSDoc , default_fields = ["material_id" , "last_updated" ]
You can’t perform that action at this time.
0 commit comments