59 bool bare_coulomb_tail,
64 if (bare_coulomb_tail)
66 (cell_volume * q_value * q_value);
68 std::exp(-q_value * q_value * 0.25) / (cell_volume * q_value * q_value);
77 bool bare_coulomb_tail,
84 if (bare_coulomb_tail)
85 return 2.0 * coulomb_over_q_squared / q_value;
86 return coulomb_over_q_squared * std::exp(-q_value * q_value * 0.25) *
87 (2.0 / q_value + 0.5 * q_value);
105 std::vector<Real> single_q{q_value};
106 std::vector<Real> tabulated;
108 paw.reciprocal_potential_grid_spacing,
112 return tabulated[0] / cell_volume;
116 std::vector<Real> integrand(mesh_size);
117 for (
int radial_index = 0; radial_index < mesh_size; radial_index++) {
119 Real screened_potential =
123 integrand[radial_index] = at_zero_q
124 ? screened_potential * radius
125 : screened_potential * std::sin(q_value * radius) / q_value;
127 Real integrated_sum =
146 pseudopotential, mesh_size, q_value, cell_volume) +
148 pseudopotential.
valence_charge, bare_coulomb_tail, q_value, cell_volume);
152 if (bare_coulomb_tail)
154 pseudopotential, mesh_size, q_value, cell_volume);
156 std::vector<Real> integrand(mesh_size);
157 for (
int radial_index = 0; radial_index < mesh_size; radial_index++) {
158 integrand[radial_index] =
164 Real integrated_sum =
185 const std::vector<int>& mesh_sizes,
186 const std::vector<Real>& g_vector_magnitudes,
189 int number_of_species_types =
static_cast<int>(pseudopotential_set.
size());
195 result.
per_species.resize(number_of_species_types);
196 for (
int type_index = 0; type_index < number_of_species_types; type_index++) {
197 result.
per_species[type_index].resize(number_of_g_vectors);
198 for (
int g_vector_index = 0; g_vector_index < number_of_g_vectors; g_vector_index++) {
199 Real q_value = g_vector_magnitudes[g_vector_index];
201 pseudopotential_set[type_index], mesh_sizes[type_index], q_value, cell_volume);
206 result.
total.resize(number_of_g_vectors,
Complex(0.0, 0.0));
207 for (
int g_vector_index = 0; g_vector_index < number_of_g_vectors; g_vector_index++) {
208 for (
int type_index = 0; type_index < number_of_species_types; type_index++) {
209 Complex structure_factor(0.0, 0.0);
210 for (
int atom_index = 0; atom_index < crystal_structure.
number_of_atoms();
215 const auto& g_vector = planewave_basis.
g_vectors()[g_vector_index];
220 result.
total[g_vector_index] +=
221 result.
per_species[type_index][g_vector_index] * structure_factor;
Vector3D convert_from_crystal_to_cartesian(int atom_index) const
int species_type_index(int atom_index) const
int number_of_atoms() const
PAW pseudopotential — extends ultrasoft with one-center (on-site) data.
bool has_reciprocal_local_potential() const
int number_of_g_vectors() const
const std::vector< GVector > & g_vectors() const
Base class for all pseudopotential types.
std::vector< Real > radial_grid_derivative
std::vector< Real > radial_grid
PotentialLocal potential_local
constexpr Real electron_charge_squared_rydberg
constexpr double zero_vector_magnitude_threshold
Real calculate_local_potential_short_range_at_q(const Pseudopotential &pseudopotential, int mesh_size, Real q_value, Real cell_volume)
Real simpson_rule(const std::vector< Real > &function_values, const std::vector< Real > &integration_factors, int number_of_grid_points)
Real calculate_local_potential_long_range_derivative_at_q(Real valence_charge, bool bare_coulomb_tail, Real q_value, Real cell_volume)
Complex compute_phase_factor(Real phase)
Compute e^{-iφ} = cos(φ) - i·sin(φ) (standard structure factor phase).
bool local_potential_is_tabulated_reciprocally(const Pseudopotential &pseudopotential)
Real calculate_local_potential_long_range_at_q(Real valence_charge, bool bare_coulomb_tail, Real q_value, Real cell_volume)
void resample_uniform_reciprocal_table(const std::vector< Real > &samples, Real spacing, int angular_momentum, const std::vector< Real > &q_values, std::vector< Real > &result)
Real calculate_local_potential_at_q(const Pseudopotential &pseudopotential, int mesh_size, Real q_value, Real cell_volume)
std::complex< double > Complex
LocalPotentialTabulationResult tabulate_local_potential_in_g_space(const Crystal &crystal_structure, const PlanewaveBasis &planewave_basis, const PseudopotentialSet &pseudopotential_set, const std::vector< int > &mesh_sizes, const std::vector< Real > &g_vector_magnitudes, Real cell_volume)
Result of local potential tabulation: per-species V_loc(G) and total with structure factors.
std::vector< std::vector< Real > > per_species
std::vector< Complex > total
std::vector< Real > radial_values