ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
radial_collection.h
Go to the documentation of this file.
1#ifndef RADIAL_COLLECTION_H_
2#define RADIAL_COLLECTION_H_
3
4#include <numeric>
5#include <string>
6#include <memory>
7
9
18{
19 public:
20 RadialCollection() = default;
23
25
27 void build(const int nfile, const std::string* const file, const char ftype = '\0');
28
30 void build(const int ntype, Numerical_Nonlocal* const nls);
31
33 void build(const RadialCollection* nls, double radius = 0.0);
34
36 void build(const int ntype,
37 const double* const charges,
38 const bool with_slater_screening,
39 const int* const nmax,
40 const std::string* symbols = nullptr,
41 const double conv_thr = 1e-10,
42 const std::string* strategies = nullptr,
43 const int& rank = 0);
44
46 void build(const int ntype,
47 const std::string* const file,
48 const double* const screening_coeff,
49 const double conv_thr = 1e-10,
50 const int& rank = 0);
51
53 void build(const int lmax,
54 const int nbes,
55 const double rcut,
56 const double sigma,
57 const double dr
58 );
59
64 const std::string& symbol(const int itype) const { return radset_[itype]->symbol(); }
65 int ntype() const { return ntype_; }
66 int lmax(const int itype) const { return radset_[itype]->lmax(); }
67 int lmax() const { return lmax_; }
68 double rcut_max(const int itype) const { return radset_[itype]->rcut_max(); }
69 double rcut_max() const { return rcut_max_; }
70 int nzeta(const int itype, const int l) const { return radset_[itype]->nzeta(l); }
71 int nzeta_max(const int itype) const { return radset_[itype]->nzeta_max(); }
72 int nzeta_max() const { return nzeta_max_; }
73 int nchi() const { return nchi_; }
74 int nchi(const int itype) const { return radset_[itype]->nchi(); }
75
76 const NumericalRadial& operator()(const int itype, const int l, const int izeta) const
77 {
78 assert(itype >= 0 && itype < ntype_);
79 return radset_[itype]->chi(l, izeta);
80 }
81
82 const RadialSet& operator()(const int itype) const
83 {
84 assert(itype >= 0 && itype < ntype_);
85 return *radset_[itype];
86 }
88
95 const NumericalRadial** cbegin() const
96 {
97 assert(ntype_ > 0);
98 return iter_;
99 }
100
101 const NumericalRadial** cend() const
102 {
103 assert(ntype_ > 0);
104 return iter_ + nchi_;
105 }
106
108 const NumericalRadial** cbegin(const int l) const
109 {
110 assert(ntype_ > 0 && l >= 0 && l <= lmax_);
111 return iter_ + std::accumulate(nl_, nl_ + l, 0);
112 }
113
115 const NumericalRadial** cend(const int l) const
116 {
117 assert(ntype_ > 0 && l >= 0 && l <= lmax_);
118 return iter_ + std::accumulate(nl_, nl_ + l + 1, 0);
119 }
121
127 void set_transformer(ModuleBase::SphericalBesselTransformer sbt, const int update = 0);
128
130 void set_grid(const bool for_r_space, const int ngrid, const double* grid, const char mode = 'i');
131
133 void set_uniform_grid(const bool for_r_space,
134 const int ngrid,
135 const double cutoff,
136 const char mode = 'i',
137 const bool enable_fft = false);
139
146 void to_file(const std::string& appendix,
147 const std::string& format = "abacus_orb"
148 ) const;
149
150 private:
151 int ntype_ = 0;
152 int lmax_ = -1;
153 int nchi_ = 0;
154 int nzeta_max_ = 0;
155 double rcut_max_ = 0.0;
156
157 RadialSet** radset_ = nullptr;
158
165 const NumericalRadial** iter_ = nullptr;
166
168 int* nl_ = nullptr;
169
171 void cleanup();
172
174 void iter_build();
175
177 void set_rcut_max();
178
187 char check_file_type(const std::string& file) const;
188};
189
190#endif
A class that provides spherical Bessel transforms.
Definition spherical_bessel_transformer.h:69
A class that represents a numerical radial function.
Definition numerical_radial.h:65
Definition ORB_nonlocal.h:22
A class that holds all numerical radial functions of the same kind.
Definition radial_collection.h:18
int lmax_
maximum angular momentum of all NumericalRadial objects in the collection
Definition radial_collection.h:152
int nchi() const
Definition radial_collection.h:73
void to_file(const std::string &appendix, const std::string &format="abacus_orb") const
export all RadialSet objects to a file in a given format.
Definition radial_collection.cpp:370
const NumericalRadial & operator()(const int itype, const int l, const int izeta) const
Definition radial_collection.h:76
void set_grid(const bool for_r_space, const int ngrid, const double *grid, const char mode='i')
Sets a common grid for all RadialSet objects.
Definition radial_collection.cpp:315
RadialCollection & operator=(const RadialCollection &rhs)
deep copy
Definition radial_collection.cpp:39
double rcut_max_
maximum cutoff radius among all NumericalRadial objects
Definition radial_collection.h:155
RadialCollection()=default
RadialSet ** radset_
Definition radial_collection.h:157
void iter_build()
Builds iter_ from radset_.
Definition radial_collection.cpp:106
void set_rcut_max()
Finds the maximum cutoff radius among all RadialSet objects and sets rcut_max_ accordingly.
Definition radial_collection.cpp:76
~RadialCollection()
Definition radial_collection.cpp:65
const NumericalRadial ** iter_
"Iterator" for NumericalRadial objects.
Definition radial_collection.h:165
void build(const int nfile, const std::string *const file, const char ftype='\0')
Builds the collection from (orbital) files.
Definition radial_collection.cpp:175
int nzeta_max_
maximum number of distinct radial functions given a type & angular momentum
Definition radial_collection.h:154
int * nl_
Number of NumericalRadial objects for each angular momentum.
Definition radial_collection.h:168
const std::string & symbol(const int itype) const
Definition radial_collection.h:64
int nchi_
total number of NumericalRadial objects in the collection
Definition radial_collection.h:153
const NumericalRadial ** cbegin(const int l) const
*(this->cbegin(l)) returns the address of the first NumericalRadial object with angular momentum l
Definition radial_collection.h:108
void cleanup()
Deallocates all RadialSet objects and resets all members to default.
Definition radial_collection.cpp:85
int ntype() const
Definition radial_collection.h:65
int nchi(const int itype) const
Definition radial_collection.h:74
const NumericalRadial ** cbegin() const
*(this->cbegin(l)) returns the address of the first NumericalRadial object with angular momentum l
Definition radial_collection.h:95
int nzeta_max() const
Definition radial_collection.h:72
int nzeta(const int itype, const int l) const
Definition radial_collection.h:70
int ntype_
number of RadialSet in the collection
Definition radial_collection.h:151
int nzeta_max(const int itype) const
Definition radial_collection.h:71
double rcut_max() const
Definition radial_collection.h:69
void set_transformer(ModuleBase::SphericalBesselTransformer sbt, const int update=0)
Definition radial_collection.cpp:307
char check_file_type(const std::string &file) const
Returns the file type of a given file.
Definition radial_collection.cpp:337
const NumericalRadial ** cend() const
*(this->cbegin(l)) returns the address of the first NumericalRadial object with angular momentum l
Definition radial_collection.h:101
const NumericalRadial ** cend(const int l) const
*(this->cend(l)) returns the address of one-past-last NumericalRadial object with angular momentum l
Definition radial_collection.h:115
double rcut_max(const int itype) const
Definition radial_collection.h:68
int lmax() const
Definition radial_collection.h:67
int lmax(const int itype) const
Definition radial_collection.h:66
const RadialSet & operator()(const int itype) const
Definition radial_collection.h:82
void set_uniform_grid(const bool for_r_space, const int ngrid, const double cutoff, const char mode='i', const bool enable_fft=false)
Sets a common uniform grid for all RadialSet objects.
Definition radial_collection.cpp:324
An abstract class representing the set of all numerical radial functions (of the same kind) from a si...
Definition radial_set.h:26
int lmax() const
Definition radial_set.h:155
const NumericalRadial & chi(const int l, const int izeta)
Definition radial_set.cpp:141
int nzeta_max() const
Definition radial_set.h:159
double rcut_max() const
Definition radial_set.h:156
int nzeta(const int l) const
Definition radial_set.h:158
const std::string & symbol() const
Definition radial_set.h:153
int nchi() const
Definition radial_set.h:160
file(GLOB ATen_CORE_SRCS "*.cpp") set(ATen_CPU_SRCS $
Definition CMakeLists.txt:1