ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
sccs_response.h
Go to the documentation of this file.
1#ifndef SCCS_RESPONSE_H
2#define SCCS_RESPONSE_H
3
4#include "sccs_cavity.h"
5#include "sccs_sa.h"
7
8#include <vector>
9
10namespace ModulePW
11{
12class PW_Basis;
13}
14
15namespace ModuleSccs
16{
17class CoulombOperator;
18
20
22{
23 int iterations = 0;
24 double residual_rms = 0.0;
25 double residual_max = 0.0;
26 bool warm_started = false;
27 std::vector<double> potential; // Hartree; zero mean only for periodic cells
28 std::vector<ModuleBase::Vector3<double>> gradient; // Hartree/Bohr; empty with lowpass
29};
30
32{
33 // Dielectric boundary; with the solvent-aware filling it is s_sa, while
34 // dsolute_drho stays ds/dn of the local boundary s.
35 std::vector<double> solute;
36 std::vector<double> dsolute_drho;
37 FilledCavity solvent_aware; // empty without the filling
38 std::vector<double> epsilon;
39 std::vector<ModuleBase::Vector3<double>> grad_log_epsilon;
41 // Hartree: reaction-energy derivative with respect to the dielectric
42 // boundary (s_sa when filled); the discrete derivative with lowpass on an
43 // open boundary, otherwise the continuum derivative L eps |grad v|^2/(8 pi)
44 // with L = ln(eps_bulk).
45 std::vector<double> boundary_potential;
46 // Hartree: the same derivative with respect to the cavity density.
47 std::vector<double> cavity_potential;
48 std::vector<double> restart_potential; // unshifted solution for explicit warm starts
49 double far_field_polarization_charge = 0.0; // open-boundary screened charge minus solute charge
50};
51
52// Chain a derivative with respect to the boundary to the cavity density,
53// through the solvent-aware adjoint when the boundary is filled; probe_kernel
54// is the one the response was solved with.
56 const SccsResponse &response,
57 const std::vector<double> &probe_kernel,
58 const ModulePW::PW_Basis &basis,
59 const std::vector<double> &boundary_potential,
60 std::vector<double> &density_potential);
61
62// Periodic sqrt-CG response with chain-rule cavity derivatives, as Environ's
63// CG solver with the sqrt preconditioner, without the solvent-aware filling;
64// charge is ions minus electrons.
65// All ranks in the PW pool must call together with the same configuration.
66// initial_potential is empty on all ranks for a cold start, otherwise a local grid.
67// A solver breakdown or missed tolerance stops the run with WARNING_QUIT.
68// No state or INPUT globals are read or retained.
70 const std::vector<double> &cavity_density,
71 const std::vector<double> &solute_charge,
72 const CavityParameters &cavity,
73 const PolarizationSolverParameters &solver,
74 const std::vector<double> &initial_potential,
75 const ModulePW::PW_Basis &basis,
76 double tpiba,
77 SccsResponse &result);
78
79// Use the same operator for the dielectric response and vacuum subtraction.
80// cavity.solvent_aware decides on every pool rank whether the cavity is
81// filled; probe_kernel is then its sa_probe_kernel, and is unused (may be
82// empty) without the filling.
84 const std::vector<double> &cavity_density,
85 const std::vector<double> &solute_charge,
86 const CavityParameters &cavity,
87 const std::vector<double> &probe_kernel,
88 const PolarizationSolverParameters &solver,
89 const std::vector<double> &initial_potential,
90 const ModulePW::PW_Basis &basis,
91 double tpiba,
92 CoulombOperator &coulomb,
93 SccsResponse &result);
94} // namespace ModuleSccs
95
96#endif
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:60
Definition sccs_coulomb.h:17
Definition pw_op.cpp:3
Definition sccs_fixed_src.h:11
void boundary_to_rho(const SccsResponse &response, const std::vector< double > &probe_kernel, const ModulePW::PW_Basis &basis, const std::vector< double > &boundary_potential, std::vector< double > &density_potential)
Definition sccs_response.cpp:310
void solve_response(const std::vector< double > &density, const std::vector< double > &charge, const CavityParameters &cavity, const PolarizationSolverParameters &solver, const std::vector< double > &initial_potential, const ModulePW::PW_Basis &basis, double tpiba, SccsResponse &result)
Definition sccs_response.cpp:335
Definition sccs_cavity.h:20
Definition sccs_sa.h:66
Definition sccs_response.h:22
double residual_rms
Definition sccs_response.h:24
std::vector< double > potential
Definition sccs_response.h:27
std::vector< ModuleBase::Vector3< double > > gradient
Definition sccs_response.h:28
bool warm_started
Definition sccs_response.h:26
int iterations
Definition sccs_response.h:23
double residual_max
Definition sccs_response.h:25
Definition sccs_parameters.h:43
Definition sccs_response.h:32
std::vector< double > cavity_potential
Definition sccs_response.h:47
std::vector< double > epsilon
Definition sccs_response.h:38
std::vector< ModuleBase::Vector3< double > > grad_log_epsilon
Definition sccs_response.h:39
std::vector< double > dsolute_drho
Definition sccs_response.h:36
FilledCavity solvent_aware
Definition sccs_response.h:37
std::vector< double > restart_potential
Definition sccs_response.h:48
double far_field_polarization_charge
Definition sccs_response.h:49
PolarizationResult polarization
Definition sccs_response.h:40
std::vector< double > solute
Definition sccs_response.h:35
std::vector< double > boundary_potential
Definition sccs_response.h:45