ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
sccs_sa_test.h
Go to the documentation of this file.
1#ifndef SCCS_SA_TEST_H
2#define SCCS_SA_TEST_H
3
4#include "../sccs_cavity.h"
5#include "../sccs_sa.h"
6#include "sccs_test.h"
7
8#include <vector>
9
10// Grid helpers and the cubic-cell fixture of the solvent-aware tests
11// (definitions in sccs_sa_test.cpp).
12namespace SccsTest
13{
15 1.0,
16 0.0,
17 0.0,
18 0.0,
19 1.0,
20 0.0,
21 0.0,
22 0.0,
23 1.0);
25
26void setup_basis(
27 ModulePW::PW_Basis &basis,
28 double scale,
29 const ModuleBase::Matrix3 &lattice,
30 double ecut);
31
32// Fold a displacement into the cube [-length/2, length/2).
33void fold_into_cube(double length, ModuleBase::Vector3<double> &r);
34
35// Minimum-image displacement of grid point ir from the origin in a cube.
36ModuleBase::Vector3<double> cubic_displacement(const ModulePW::PW_Basis &basis, double length, int ir);
37
38std::vector<ModuleBase::Vector3<double>> spectral_gradient(
39 const std::vector<double> &values, const ModulePW::PW_Basis &basis, double tpiba);
40
41std::vector<double> spectral_laplacian(
42 const std::vector<double> &values, const ModulePW::PW_Basis &basis, double tpiba);
43
44double pool_dot(const std::vector<double> &left, const std::vector<double> &right);
45
46double pool_max(const ModulePW::PW_Basis &basis, double value);
47
48// values + step * direction, for central differences.
49std::vector<double> shifted(const std::vector<double> &values, const std::vector<double> &direction, double step);
50
52
58
59// A cubic cell and the probe kernel of the solvent-aware parameters.
60class SolventAwareTest : public testing::Test
61{
62 protected:
63 SolventAwareTest() : basis("cpu", "double") {}
64
65 void set_up_cube(double edge, double ecut, const ModuleSccs::SolventAwareParameters &probe);
66
68
69 // Smooth sphere erfc((|r - center| - radius)/spread)/2.
70 std::vector<double> sphere(const ModuleBase::Vector3<double> &center, double radius, double spread) const;
71
72 ModuleSccs::SolventAwareBoundary fill(const std::vector<double> &local) const
73 {
75 }
76
77 // Two Gaussians of density along x, centred at +-offset; their midpoint is a density saddle.
78 std::vector<double> gaussian_pair(double offset) const;
79
81 const std::vector<double> &density, const ModuleSccs::CavityParameters &cavity, double regularization) const;
82
83 // Central difference of the discrete surface along direction against the
84 // projected analytic derivative; returns the relative error.
86 const std::vector<double> &density,
87 const std::vector<double> &direction,
88 const ModuleSccs::CavityParameters &cavity,
89 double regularization,
90 double step) const;
91
92 double length = 0.0;
93 double tpiba = 0.0;
96 std::vector<double> kernel;
97};
98} // namespace SccsTest
99
100#endif
3x3 matrix and related mathamatical operations
Definition matrix3.h:15
3 elements vector
Definition vector3.h:21
A class which can convert a function of "r" to the corresponding linear superposition of plane waves ...
Definition pw_basis.h:60
void set_up_cube(double edge, double ecut, const ModuleSccs::SolventAwareParameters &probe)
Definition sccs_sa_test.cpp:101
double surface_derivative_error(const std::vector< double > &density, const std::vector< double > &direction, const ModuleSccs::CavityParameters &cavity, double regularization, double step) const
Definition sccs_sa_test.cpp:180
DensitySurface surface_of_density(const std::vector< double > &density, const ModuleSccs::CavityParameters &cavity, double regularization) const
Definition sccs_sa_test.cpp:141
std::vector< double > kernel
Definition sccs_sa_test.h:96
ModuleSccs::SolventAwareBoundary fill(const std::vector< double > &local) const
Definition sccs_sa_test.h:72
double tpiba
Definition sccs_sa_test.h:93
SolventAwareTest()
Definition sccs_sa_test.h:63
ModulePW::PW_Basis basis
Definition sccs_sa_test.h:94
std::vector< double > sphere(const ModuleBase::Vector3< double > &center, double radius, double spread) const
Definition sccs_sa_test.cpp:110
ModuleBase::Vector3< double > displacement(int ir) const
Definition sccs_sa_test.h:67
ModuleSccs::SolventAwareParameters parameters
Definition sccs_sa_test.h:95
std::vector< double > gaussian_pair(double offset) const
Definition sccs_sa_test.cpp:124
double length
Definition sccs_sa_test.h:92
SolventAwareBoundary sa_boundary(const std::vector< double > &local, const std::vector< double > &kernel, const SolventAwareParameters &parameters, const ModulePW::PW_Basis &basis)
Definition sccs_sa.cpp:172
Definition sccs_cell_test.h:11
std::vector< double > spectral_laplacian(const std::vector< double > &values, const ModulePW::PW_Basis &basis, double tpiba)
Definition sccs_sa_test.cpp:58
std::vector< double > shifted(const std::vector< double > &values, const std::vector< double > &direction, double step)
Definition sccs_sa_test.cpp:84
ModuleBase::Vector3< double > cubic_displacement(const ModulePW::PW_Basis &basis, double length, int ir)
Definition sccs_sa_test.cpp:35
double pool_max(const ModulePW::PW_Basis &basis, double value)
Definition sccs_sa_test.cpp:78
void setup_basis(ModulePW::PW_Basis &basis, double scale, const ModuleBase::Matrix3 &lattice, double ecut)
Definition sccs_sa_test.cpp:11
void fold_into_cube(double length, ModuleBase::Vector3< double > &r)
Definition sccs_sa_test.cpp:26
double pool_dot(const std::vector< double > &left, const std::vector< double > &right)
Definition sccs_sa_test.cpp:67
ModuleSccs::SolventAwareParameters probe_parameters(double solvent_radius)
Definition sccs_sa_test.cpp:94
const ModuleBase::Matrix3 cubic_lattice(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
const ModuleBase::Vector3< double > origin(0.0, 0.0, 0.0)
std::vector< ModuleBase::Vector3< double > > spectral_gradient(const std::vector< double > &values, const ModulePW::PW_Basis &basis, double tpiba)
Definition sccs_sa_test.cpp:48
Definition sccs_cavity.h:20
Definition sccs_sa.h:44
Definition sccs_cavity.h:10
Definition sccs_sa_test.h:54
ModuleSccs::SolventAwareNonelectrostatic chain
Definition sccs_sa_test.h:56
double surface
Definition sccs_sa_test.h:55