Skip to content

Commit 646430c

Browse files
committed
add Mesh, NumericalIntegration and MolecularHamiltonianSubTerms
1 parent 52d6b9a commit 646430c

File tree

2 files changed

+91
-49
lines changed

2 files changed

+91
-49
lines changed

src/nomad_simulations/schema_packages/model_method.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,3 +1221,16 @@ class DMFT(ModelMethodElectronic):
12211221

12221222
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
12231223
super().normalize(archive, logger)
1224+
1225+
1226+
class MolecularHamiltonianSubTerms(BaseModelMethod):
1227+
type=Quantity(
1228+
type=MEnum('coulomb', 'exchange'),
1229+
description="""
1230+
Typical sub-terms of the molecular hamiltonian.
1231+
Relativistic effects, SOC, .....
1232+
""",
1233+
)
1234+
1235+
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
1236+
super().normalize(archive, logger)

src/nomad_simulations/schema_packages/numerical_settings.py

Lines changed: 78 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -52,66 +52,45 @@ class Smearing(NumericalSettings):
5252

5353
class Mesh(ArchiveSection):
5454
"""
55-
A base section used to specify the settings of a sampling mesh.
56-
It supports uniformly-spaced meshes and symmetry-reduced representations.
55+
A base section used to define the mesh or space partitioning over which a discrete numerical integration is performed.
5756
"""
5857

59-
spacing = Quantity(
60-
type=MEnum('Equidistant', 'Logarithmic', 'Tan'),
61-
shape=['dimensionality'],
58+
dimensionality = Quantity(
59+
type=np.int32,
60+
default=3,
6261
description="""
63-
Identifier for the spacing of the Mesh. Defaults to 'Equidistant' if not defined. It can take the values:
64-
65-
| Name | Description |
66-
| --------- | -------------------------------- |
67-
| `'Equidistant'` | Equidistant grid (also known as 'Newton-Cotes') |
68-
| `'Logarithmic'` | log distance grid |
69-
| `'Tan'` | Non-uniform tan mesh for grids. More dense at low abs values of the points, while less dense for higher values |
62+
Dimensionality of the mesh: 1, 2, or 3. Defaults to 3.
7063
""",
7164
)
7265

73-
quadrature = Quantity(
74-
type=MEnum(
75-
'Gauss-Legendre',
76-
'Gauss-Laguerre',
77-
'Clenshaw-Curtis',
78-
'Newton-Cotes',
79-
'Gauss-Hermite',
80-
),
66+
kind = Quantity(
67+
type=MEnum('equidistant', 'logarithmic', 'tan'),
68+
shape=['dimensionality'],
8169
description="""
82-
Quadrature rule used for integration of the Mesh. This quantity is relevant for 1D meshes:
70+
Kind of mesh identifying the spacing in each of the dimensions specified by `dimensionality`. It can take the values:
8371
8472
| Name | Description |
8573
| --------- | -------------------------------- |
86-
| `'Gauss-Legendre'` | Quadrature rule for integration using Legendre polynomials |
87-
| `'Gauss-Laguerre'` | Quadrature rule for integration using Laguerre polynomials |
88-
| `'Clenshaw-Curtis'` | Quadrature rule for integration using Chebyshev polynomials using discrete cosine transformations |
89-
| `'Gauss-Hermite'` | Quadrature rule for integration using Hermite polynomials |
90-
""",
91-
) # ! @JosePizarro3 I think that this is separate from the spacing
92-
93-
n_points = Quantity(
94-
type=np.int32,
95-
description="""
96-
Number of points in the mesh.
74+
| `'equidistant'` | Equidistant grid (also known as 'Newton-Cotes') |
75+
| `'logarithmic'` | log distance grid |
76+
| `'Tan'` | Non-uniform tan mesh for grids. More dense at low abs values of the points, while less dense for higher values |
9777
""",
9878
)
9979

100-
dimensionality = Quantity(
80+
grid = Quantity(
10181
type=np.int32,
102-
default=3,
82+
shape=['dimensionality'],
10383
description="""
104-
Dimensionality of the mesh: 1, 2, or 3. Defaults to 3.
84+
Amount of mesh point sampling along each axis.
10585
""",
10686
)
10787

108-
grid = Quantity(
88+
n_points = Quantity(
10989
type=np.int32,
110-
shape=['dimensionality'],
11190
description="""
112-
Amount of mesh point sampling along each axis. See `type` for the axes definition.
91+
Number of points in the mesh.
11392
""",
114-
) # ? @JosePizzaro3: should the mesh also contain its boundary information
93+
)
11594

11695
points = Quantity(
11796
type=np.complex128,
@@ -126,23 +105,73 @@ class Mesh(ArchiveSection):
126105
shape=['n_points'],
127106
description="""
128107
The amount of times the same point reappears. A value larger than 1, typically indicates
129-
a symmetry operation that was applied to the `Mesh`. This quantity is equivalent to `weights`:
130-
131-
multiplicities = n_points * weights
108+
a symmetry operation that was applied to the `Mesh`.
132109
""",
133110
)
134111

135-
weights = Quantity(
136-
type=np.float64,
137-
shape=['n_points'],
112+
pruning = Quantity(
113+
type=MEnum('fixed', 'adaptive'),
138114
description="""
139-
Weight of each point. A value smaller than 1, typically indicates a symmetry operation that was
140-
applied to the mesh. This quantity is equivalent to `multiplicities`:
115+
Pruning method applied for reducing the amount of points in the Mesh. This is typically
116+
used for numerical integration near the core levels in atoms.
117+
In the fixed grid methods, the number of angular grid points is predetermined for
118+
ranges of radial grid points, while in the adaptive methods, the angular grid is adjusted
119+
on-the-fly for each radial point according to some accuracy criterion.
120+
"""
121+
)
122+
123+
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
124+
super().normalize(archive, logger)
141125

142-
weights = multiplicities / n_points
126+
if self.dimensionality not in [1, 2, 3]:
127+
logger.error('`dimensionality` meshes different than 1, 2, or 3 are not supported.')
128+
129+
130+
class NumericalIntegration(NumericalSettings):
131+
"""
132+
Numerical integration settings used to resolve the following type of integrals by discrete
133+
numerical integration:
134+
135+
```math
136+
\int_{\vec{r}_a}^{\vec{r}_b} d^3 \vec{r} F(\vec{r}) \approx \sum_{n=a}^{b} w(\vec{r}_n) F(\vec{r}_n)
137+
```
138+
139+
Here, $F$ can be any type of function which would define the type of rules that can be applied
140+
to solve such integral (e.g., 1D Gaussian quadrature rule or multi-dimensional `angular` rules like the
141+
Lebedev quadrature rule).
142+
143+
These multidimensional integral has a `Mesh` defined over which the integration is performed, i.e., the
144+
$\vec{r}_n$ points.
145+
"""
146+
147+
coordinate = Quantity(
148+
type=MEnum('all', 'radial', 'angular'),
149+
description="""
150+
Coordinate over which the integration is performed. `all` means the integration is performed in
151+
all the space. `radial` and `angular` describe cases where the integration is performed for
152+
functions which can be splitted into radial and angular distributions (e.g., orbital wavefunctions).
143153
""",
144154
)
145155

156+
integration_rule = Quantity(
157+
type=str, # ? extend to MEnum?
158+
description="""
159+
Integration rule used. This can be any 1D Gaussian quadrature rule or multi-dimensional `angular` rules,
160+
e.g., Lebedev quadrature rule (see e.g., Becke, Chem. Phys. 88, 2547 (1988)).
161+
"""
162+
)
163+
164+
weight_partitioning = Quantity(
165+
type=str,
166+
description="""
167+
Approximation applied to the weight when doing the numerical integration.
168+
See e.g., C. W. Murray, N. C. Handy
169+
and G. J. Laming, Mol. Phys. 78, 997 (1993).
170+
"""
171+
)
172+
173+
mesh = SubSection(sub_section=Mesh.m_def)
174+
146175
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
147176
super().normalize(archive, logger)
148177

@@ -908,4 +937,4 @@ class GTOIntegralDecomposition(NumericalSettings):
908937
)
909938

910939
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
911-
super().normalize(archive, logger)
940+
super().normalize(archive, logger)

0 commit comments

Comments
 (0)