11from nomad .datamodel .metainfo .annotations import Mapper
22from nomad .metainfo import SchemaPackage
33from nomad .parsing .file_parser .mapping_parser import MAPPING_ANNOTATION_KEY
4- from nomad_simulations .schema_packages import general
4+ from nomad_simulations .schema_packages import (
5+ general ,
6+ model_method ,
7+ model_system ,
8+ outputs ,
9+ )
510
611m_package = SchemaPackage ()
712
@@ -12,10 +17,128 @@ class Program(general.Program):
1217 )
1318
1419
20+ class AtomsState (model_system .AtomsState ):
21+ model_system .AtomsState .chemical_symbol .m_annotations .setdefault (
22+ MAPPING_ANNOTATION_KEY , {}
23+ ).update (dict (out = Mapper (mapper = '.@' )))
24+
25+
26+ class AtomicCell (model_system .AtomicCell ):
27+ model_system .AtomicCell .lattice_vectors .m_annotations .setdefault (
28+ MAPPING_ANNOTATION_KEY , {}
29+ ).update (dict (out = Mapper (mapper = '.@' )))
30+
31+
32+ class ModelSystem (model_system .ModelSystem ):
33+ model_system .ModelSystem .positions .m_annotations .setdefault (
34+ MAPPING_ANNOTATION_KEY , {}
35+ ).update (dict (out = Mapper (mapper = '.labels_positions[1]' )))
36+ model_system .AtomsState .m_def .m_annotations .setdefault (
37+ MAPPING_ANNOTATION_KEY , {}
38+ ).update (dict (out = Mapper (mapper = '.labels_positions[0]' )))
39+ model_system .AtomicCell .m_def .m_annotations .setdefault (
40+ MAPPING_ANNOTATION_KEY , {}
41+ ).update (dict (out = Mapper (mapper = '.lattice_vectors' )))
42+
43+
44+ class XCFunctional (model_method .XCFunctional ):
45+ model_method .XCFunctional .libxc_name .m_annotations .setdefault (
46+ MAPPING_ANNOTATION_KEY , {}
47+ ).update (dict (out = Mapper (mapper = '.@' )))
48+
49+
50+ class DFT (model_method .DFT ):
51+ model_method .DFT .xc_functionals .m_annotations .setdefault (
52+ MAPPING_ANNOTATION_KEY , {}
53+ ).update (
54+ dict (
55+ out = Mapper (
56+ mapper = ('get_xc_functionals' , ['.model_parameters.dft_potential' ])
57+ )
58+ )
59+ )
60+
61+
62+ class TotalEnergy (outputs .TotalEnergy ):
63+ outputs .TotalEnergy .value .m_annotations .setdefault (
64+ MAPPING_ANNOTATION_KEY , {}
65+ ).update (dict (out = Mapper (mapper = '.value || .energy_total' )))
66+ outputs .TotalEnergy .contributions .m_annotations .setdefault (
67+ MAPPING_ANNOTATION_KEY , {}
68+ ).update (dict (out = Mapper (mapper = ('get_contributions' , ['.energies' ]))))
69+
70+
71+ class TotalForce (outputs .TotalForce ):
72+ outputs .TotalForce .value .m_annotations .setdefault (
73+ MAPPING_ANNOTATION_KEY , {}
74+ ).update (dict (out = Mapper (mapper = '.value || .forces_total' )))
75+ outputs .TotalForce .contributions .m_annotations .setdefault (
76+ MAPPING_ANNOTATION_KEY , {}
77+ ).update (dict (out = Mapper (mapper = ('get_contributions' , ['.forces' ]))))
78+
79+
80+ class ElectronicEigenvalues (outputs .ElectronicEigenvalues ):
81+ outputs .ElectronicEigenvalues .value .m_annotations .setdefault (
82+ MAPPING_ANNOTATION_KEY , {}
83+ ).update (dict (out = Mapper (mapper = '.eigenvalues' )))
84+ outputs .ElectronicEigenvalues .occupation .m_annotations .setdefault (
85+ MAPPING_ANNOTATION_KEY , {}
86+ ).update (dict (out = Mapper (mapper = '.occupations' )))
87+
88+
89+ class Outputs (outputs .Outputs ):
90+ outputs .Outputs .total_energies .m_annotations .setdefault (
91+ MAPPING_ANNOTATION_KEY , {}
92+ ).update (dict (out = Mapper (mapper = '.@' )))
93+ outputs .Outputs .total_forces .m_annotations .setdefault (
94+ MAPPING_ANNOTATION_KEY , {}
95+ ).update (dict (out = Mapper (mapper = '.@' )))
96+ outputs .Outputs .electronic_eigenvalues .m_annotations .setdefault (
97+ MAPPING_ANNOTATION_KEY , {}
98+ ).update (
99+ dict (
100+ out = Mapper (
101+ mapper = ('get_eigenvalues' , ['.eigenvalues || .band_energy_ranges' ])
102+ )
103+ )
104+ )
105+
106+
15107class Simulation (general .Simulation ):
16108 general .Simulation .program .m_annotations .setdefault (
17109 MAPPING_ANNOTATION_KEY , {}
18110 ).update (dict (out = Mapper (mapper = '.@' )))
111+ model_method .DFT .m_def .m_annotations .setdefault (MAPPING_ANNOTATION_KEY , {}).update (
112+ dict (
113+ out = Mapper (
114+ mapper = '.geometry_optimization || molecular_dynamics || .single_point'
115+ )
116+ )
117+ )
118+ general .Simulation .model_system .m_annotations .setdefault (
119+ MAPPING_ANNOTATION_KEY , {}
120+ ).update (
121+ dict (
122+ out = Mapper (
123+ mapper =
124+ '.geometry_optimization.step '
125+ '|| molecular_dynamics.step '
126+ '|| .single_point'
127+ )
128+ )
129+ )
130+ general .Simulation .outputs .m_annotations .setdefault (
131+ MAPPING_ANNOTATION_KEY , {}
132+ ).update (
133+ dict (
134+ out = Mapper (
135+ mapper =
136+ '.geometry_optimization.step '
137+ '|| molecular_dynamics.step '
138+ '|| .single_point'
139+ )
140+ )
141+ )
19142
20143
21144Simulation .m_def .m_annotations .setdefault (MAPPING_ANNOTATION_KEY , {}).update (
0 commit comments