Loading...
Searching...
No Matches
init.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * DispersionCalculator — abstract interface for dispersion (van der Waals)
5 * correction schemes.
6 *
7 * A dispersion correction is geometry-only: it depends on the crystal
8 * structure but not on the electronic state, contributing an additive energy
9 * plus its analytical gradients (forces and stress). Concrete schemes
10 * (D3(BJ) today; D3 zero-damping, D4, TS, ... in the future) implement this
11 * interface and are selected by name through create_dispersion_calculator()
12 * (factory.hpp), so orchestrators never branch on the scheme themselves --
13 * "none" resolves to NullDispersionCalculator (null.hpp), which contributes
14 * exact zeros, removing the need for any if/else at the call sites.
15 */
16
17#include <string>
18#include <vector>
19
21
22namespace q3 {
23
24/**
25 * Analytical gradients of a dispersion energy correction.
26 *
27 * `forces` are physical forces (F = -dE/dR, Ry/bohr), one entry per atom.
28 * `stress` follows Q3's Nielsen-Martin convention (sigma = -(1/Omega)
29 * dE/dstrain, Ry/bohr^3, not yet converted to kbar -- that happens in the
30 * stress orchestrator alongside every other contribution).
31 */
33 std::vector<Vector3D> forces;
35};
36
38 public:
39 virtual ~DispersionCalculator() = default;
40
41 /// Total dispersion energy correction, in Rydberg.
42 [[nodiscard]] virtual Real compute_energy() const = 0;
43
44 /// Analytical energy gradients (forces and stress) -- see DispersionGradients.
45 [[nodiscard]] virtual DispersionGradients compute_gradients() const = 0;
46
47 /**
48 * Scheme name as accepted by the input ("none", "d3bj", ...). Reporting
49 * code uses `name() != "none"` to decide whether to print dispersion rows.
50 */
51 [[nodiscard]] virtual std::string name() const = 0;
52};
53
54} // namespace q3
virtual std::string name() const =0
virtual DispersionGradients compute_gradients() const =0
Analytical energy gradients (forces and stress) – see DispersionGradients.
virtual Real compute_energy() const =0
Total dispersion energy correction, in Rydberg.
virtual ~DispersionCalculator()=default
double Real
std::vector< Vector3D > forces
Definition init.hpp:33
3×3 matrix stored row-major: row i = mat[i]