forked from stfc/aiida-mlip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
descriptors_parser.py
41 lines (30 loc) · 1.13 KB
/
descriptors_parser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Parsers provided by aiida_mlip."""
from aiida.common import exceptions
from aiida.orm.nodes.process.process import ProcessNode
from aiida.plugins import CalculationFactory
from aiida_mlip.parsers.sp_parser import SPParser
DescriptorsCalc = CalculationFactory("mlip.descriptors")
class DescriptorsParser(SPParser):
"""
Parser class for parsing output of descriptors calculation.
Inherits from SPParser.
Parameters
----------
node : aiida.orm.nodes.process.process.ProcessNode
ProcessNode of calculation.
Raises
------
exceptions.ParsingError
If the ProcessNode being passed was not produced by a DescriptorsCalc.
"""
def __init__(self, node: ProcessNode):
"""
Check that the ProcessNode being passed was produced by a `Descriptors`.
Parameters
----------
node : aiida.orm.nodes.process.process.ProcessNode
ProcessNode of calculation.
"""
super().__init__(node)
if not issubclass(node.process_class, DescriptorsCalc):
raise exceptions.ParsingError("Can only parse `Descriptors` calculations")