46 const std::vector<Real>& measures,
48 std::vector<Real> weighted(mesh_size);
49 for (
int index = 0; index < mesh_size; index++)
50 weighted[index] = values[index] * measures[index];
52 std::vector<Real> cumulative(mesh_size, 0.0);
56 for (
int index = 2; index < mesh_size; index += 2) {
58 cumulative[index - 2] +
59 (weighted[index - 2] + 4.0 * weighted[index - 1] + weighted[index]) / 3.0;
61 for (
int index = 1; index < mesh_size; index += 2) {
62 if (index + 1 < mesh_size) {
64 cumulative[index - 1] +
65 (5.0 * weighted[index - 1] + 8.0 * weighted[index] - weighted[index + 1]) / 12.0;
68 cumulative[index - 1] + (weighted[index - 1] + weighted[index]) / 2.0;
85 const std::vector<Real>& radial_grid,
86 const std::vector<Real>& radial_grid_derivative,
87 const std::vector<Real>& density_r_squared,
89 std::vector<Real>& potential) {
90 potential.assign(mesh_size, 0.0);
94 std::vector<Real> inner_integrand(mesh_size);
95 std::vector<Real> outer_integrand(mesh_size);
96 for (
int index = 0; index < mesh_size; index++) {
97 Real radius = radial_grid[index];
98 Real radius_to_l = std::pow(radius, angular_momentum);
99 inner_integrand[index] = density_r_squared[index] * radius_to_l;
100 outer_integrand[index] = density_r_squared[index] / (radius_to_l * radius);
103 std::vector<Real> inner =
105 std::vector<Real> outer_cumulative =
107 Real outer_total = outer_cumulative[mesh_size - 1];
110 for (
int index = 0; index < mesh_size; index++) {
111 Real radius = radial_grid[index];
112 Real radius_to_l = std::pow(radius, angular_momentum);
113 Real outer = outer_total - outer_cumulative[index];
115 prefactor * (inner[index] / (radius_to_l * radius) + radius_to_l * outer);
128 const std::vector<std::vector<Real>>& density_channels,
129 const std::vector<Real>& radial_grid_derivative,
132 for (
size_t channel = 0; channel < potential_channels.size(); channel++) {
133 std::vector<Real> integrand(mesh_size);
134 for (
int index = 0; index < mesh_size; index++) {
136 potential_channels[channel][index] * density_channels[channel][index];
139 energy += cumulative[mesh_size - 1];
void solve_radial_hartree(int angular_momentum, const std::vector< Real > &radial_grid, const std::vector< Real > &radial_grid_derivative, const std::vector< Real > &density_r_squared, int mesh_size, std::vector< Real > &potential)
generated::Energy energy(const std::string &name, Real value_in_ry)
One of Q3's energies that ESSE has no property for, as an ESSE energy in rydberg.