Loading...
Searching...
No Matches
null.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * NullDispersionCalculator — the "no dispersion correction" scheme.
5 *
6 * Null Object implementation of DispersionCalculator: contributes exactly
7 * zero energy, zero forces, and zero stress. Selected by
8 * create_dispersion_calculator("none", ...) so that orchestrators (SCF
9 * energy hookup, force and stress assembly) can call the dispersion
10 * interface unconditionally instead of branching on the scheme name.
11 */
12
13#include <string>
14#include <vector>
15
19
20namespace q3 {
21
23 public:
24 explicit NullDispersionCalculator(const Crystal& crystal_structure)
25 : number_of_atoms_(crystal_structure.number_of_atoms()) {}
26
27 [[nodiscard]] Real compute_energy() const override {
28 return 0.0;
29 }
30
31 [[nodiscard]] DispersionGradients compute_gradients() const override {
32 return {std::vector<Vector3D>(static_cast<std::size_t>(number_of_atoms_), {0.0, 0.0, 0.0}),
33 Matrix3x3{}};
34 }
35
36 [[nodiscard]] std::string name() const override {
37 return "none";
38 }
39
40 private:
41 int number_of_atoms_;
42};
43
44} // namespace q3
NullDispersionCalculator(const Crystal &crystal_structure)
Definition null.hpp:24
std::string name() const override
Definition null.hpp:36
DispersionGradients compute_gradients() const override
Analytical energy gradients (forces and stress) – see DispersionGradients.
Definition null.hpp:31
Real compute_energy() const override
Total dispersion energy correction, in Rydberg.
Definition null.hpp:27
double Real
3×3 matrix stored row-major: row i = mat[i]