Loading...
Searching...
No Matches
q3::EwaldForceCalculator Class Reference

#include <ewald.hpp>

Public Member Functions

 EwaldForceCalculator (const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis)
 
std::vector< Vector3D > compute () const
 

Detailed Description

Definition at line 29 of file ewald.hpp.

Constructor & Destructor Documentation

◆ EwaldForceCalculator()

q3::EwaldForceCalculator::EwaldForceCalculator ( const Crystal &  crystal_structure,
const PlanewaveBasis &  planewave_basis 
)
inline

Definition at line 31 of file ewald.hpp.

Member Function Documentation

◆ compute()

std::vector< Vector3D > q3::EwaldForceCalculator::compute ( ) const
inline

factor = 2 · exp(-G²/4α) / G², doubled again on a half sphere.

The 2 is not about the sphere, and it is not the Rydberg e² either — that is applied separately below. It is the factor from differentiating a modulus squared: ∂|ρ(G)|²/∂τ = 2 Re[ρ* ∂ρ/∂τ]. So it is correct for the full-sphere G list Q3 normally builds. Gamma-only stores only the positive half sphere (g_vectors_grid.hpp), and the summand here is even under G → −G (the imaginary part is odd and G_α is odd), so the missing half contributes exactly as much again.

Without this the Ewald force is exactly half at Gamma while the Ewald energy — which depends only on geometry — is unchanged: measured -0.02549078 against a −dE_ewald/dy of -0.05098040.

F_{G,α} = +(e²⋅2π/Ω) factor Z_i G_α Im[S(G) e^{-iGτ_i}] complex_product = S(G) × conj(e^{iGτ_i}) = S(G) × e^{-iGτ_i}. Im[S e^{-iGτ}] = -Im[e^{+iGτ} S*] (conjugate of correct formula), combined with the F = -∂E/∂τ sign, the result is +=.

The image loop is sized for a separation in the home cell, and positions outside [0, 1) are legal input; see Crystal::home_cell_separation().

Definition at line 34 of file ewald.hpp.

References q3::Crystal::cell_volume(), q3::PlanewaveBasis::charge_density_energy_cutoff(), q3::compute_phase_factor(), q3::Crystal::convert_from_crystal_to_cartesian(), q3::math::tolerances::ewald_convergence_threshold, q3::PlanewaveBasis::first_nonzero_g_index(), q3::PlanewaveBasis::g_vectors(), q3::Crystal::home_cell_separation(), q3::PlanewaveBasis::is_gamma_only(), q3::Crystal::lattice_parameter(), q3::Crystal::lattice_vectors(), q3::Vector3D::norm(), q3::Crystal::number_of_atoms(), q3::PlanewaveBasis::number_of_g_vectors(), q3::Crystal::species_type_index(), q3::Crystal::two_pi_over_lattice_parameter(), q3::Crystal::two_pi_over_lattice_parameter_squared(), q3::Crystal::valence_charge(), and q3::math::tolerances::zero_vector_magnitude_threshold.

Referenced by q3::ForceCalculator::compute_forces().


The documentation for this class was generated from the following file: