33 std::vector<Vector3D>
compute(
const std::vector<Complex>& charge_density_g) {
34 std::vector<Vector3D> forces(crystal_structure_.
number_of_atoms(), {0.0, 0.0, 0.0});
45 for (
int atom_index = 0; atom_index < crystal_structure_.
number_of_atoms(); atom_index++) {
50 for (
int g_vector_index = first_nonzero_g_index;
53 const auto& g_vector = planewave_basis_.
g_vectors()[g_vector_index];
62 charge_density_g[g_vector_index];
63 Complex exp_i_phase(std::cos(phase), std::sin(phase));
65 for (
int direction = 0; direction < 3; direction++) {
66 Real g_cartesian_component =
67 g_vector.g_cart[direction] *
69 Complex contribution = vloc_rho * exp_i_phase;
70 forces[atom_index][direction] += half_sphere_scale *
72 g_cartesian_component * contribution.imag();