36 std::vector<Vector3D>
compute(
const std::vector<Complex>& exchange_correlation_potential_g) {
37 std::vector<Vector3D> forces(crystal_structure_.
number_of_atoms(), {0.0, 0.0, 0.0});
53 for (
int atom_index = 0; atom_index < crystal_structure_.
number_of_atoms(); atom_index++) {
55 const auto& pseudopotential =
57 if (!pseudopotential.has_nonlinear_core_correction) {
64 for (
int g_vector_index = first_nonzero_g_index;
67 const auto& g_vector = planewave_basis_.
g_vectors()[g_vector_index];
70 Real g_vector_magnitude = std::sqrt(g_vector.magnitude_squared) *
72 Real core_charge_density_value =
76 for (
int direction = 0; direction < 3; direction++) {
77 Real g_direction = g_vector.g_cart[direction] *
83 Complex contribution = exchange_correlation_potential_g[g_vector_index] *
85 forces[atom_index][direction] += half_sphere_scale * g_direction *
87 core_charge_density_value;