8#ifndef PAPER_CODE_BASISFUNCTIONS_H_
9#define PAPER_CODE_BASISFUNCTIONS_H_
35 typedef std::vector<std::tuple<int, std::vector<double>, std::vector<double> > >
cbfT;
43 for(
const auto& tmp:molbas){
45 for(
const auto& bf:abf){
46 const int type = std::get<0>(bf);
47 const std::vector<double> ex=std::get<1>(bf);
48 const std::vector<double>
c=std::get<2>(bf);
49 std::cout << ex.size() <<
" " <<
type <<
"\n";
50 for(
size_t k=0;
k<ex.size();++
k) std::cout << ex[
k] <<
" " <<
c[
k] <<
"\n";
61 print(
"Exponents from file bas:");
63 time_1.
stop().
print(
"Read Exponents From File");
69 for(
const auto& bf:abf){
70 const int type = std::get<0>(bf);
71 const std::vector<double> ex=std::get<1>(bf);
72 const std::vector<double>
c=std::get<2>(bf);
75 for(
size_t k=0;
k<ex.size();++
k){
81 if(contracted_function.empty()) contracted_function=
c[
k]*gshell;
82 else contracted_function +=
c[
k]*gshell;
85 virtuals=
append(virtuals,contracted_function);
94 time_2.
stop().
print(
"Creating Contracted Guess Basis");
104 if(
world.
rank()==0) std::cout <<
"Create guess functions by multiplying plane-waves to " <<
f.size() <<
" functions \n";
113 std::vector<std::pair<vector_real_function_3d,std::string> > init_list;
115 for(
const auto& exop:exop_list){
117 init_list.push_back(std::make_pair(cs,exop));
123 else for(
auto& it:init_list){
124 if(
world.
rank()==0) std::cout <<
"polynomial guess!\n";
137 if(
name==
"pvdz") start=2;
138 else if(
name==
"pvtz") start=3;
139 else if(
name==
"pvqz") start=4;
140 else if(
name==
"pv5z") start=5;
141 else if(
name==
"pv6z") start=6;
142 else if(
name==
"pv7z") start=7;
146 std::map<std::string, std::vector<int> > guess_map;
149 const std::size_t n=atom.atomic_number;
150 if(empty) guess_map[symbol]=std::vector<int>(
lmax,0);
164 std::vector<int> result(
lmax,0);
165 for(
size_t i=0;i<
lmax;i++){
167 if(tmp>0) result[i]=tmp;
175 std::vector<int> result(
lmax,0);
176 for(
size_t i=0;i<(
lmax>
v.size() ?
v.size() :
lmax);++i) result[i]=
v[i];
185 std::map<std::string, std::vector<std::vector<double> > >
read_basis_from_file(
const std::string&
filename,
const std::vector<madness::Atom> atoms)
const;
192 std::map<std::string, cbfT > molbas;
195 if (molbas.find(symbol) == molbas.end()) {
197 molbas[symbol] = tmpbas;
208 std::string str_pw_guess, symbol;
210 std::size_t stars = 0;
223 if (s ==
"s" || s ==
"p" || s ==
"d" || s ==
"f" || s ==
"g" || s ==
"h" || s ==
"i" || s ==
"k") {
224 std::vector<double> exponents;
225 std::vector<double> coeff;
226 for(
int i=0;i<n;++i){
230 exponents.push_back(ex);
234 result.push_back(std::make_tuple(
lqtoint(s),exponents,coeff));
243 size_t lqtoint(
const std::string& l)
const;
254 double xx = xyz[0] -
x;
255 double yy = xyz[1] -
y;
256 double zz = xyz[2] -
z;
257 const double e =
exponent * (xx * xx + yy * yy + zz * zz);
268 const double exponent) {
269 std::vector<CartesianGaussian> gg;
272 for (
int kx = l;
kx >= 0;
kx--) {
273 for (
int ky = l -
kx;
ky >= 0;
ky--) {
294 template <
typename T>
int sgn(
T val)
const {
295 return (
T(0) < val) - (val <
T(0));
305 return std::vector<coord_3d>(1,coord);
309 const double width = 1.0/sqrt(2.0*
exponent);
321 const double exponent)
const {
322 std::vector<SolidHarmonicGaussian> gg;
325 for(
int m=-l;
m<=l; ++
m) {
Definition PNOGuessFunctions.h:245
int j
Definition PNOGuessFunctions.h:251
int k
cartesian exponents
Definition PNOGuessFunctions.h:251
CartesianGaussian(const Atom &atom, const double e, const int i, const int j, const int k)
double y
Definition PNOGuessFunctions.h:249
double z
origin
Definition PNOGuessFunctions.h:249
int i
Definition PNOGuessFunctions.h:251
double x
Definition PNOGuessFunctions.h:249
double exponent
exponent
Definition PNOGuessFunctions.h:250
double operator()(const coord_3d &xyz) const
Definition PNOGuessFunctions.h:253
Definition PNOGuessFunctions.h:284
double operator()(const coord_3d &xyz) const
Definition PNOGuessFunctions.cpp:160
Level special_level()
Override this change level refinement for special points (default is 6)
Definition PNOGuessFunctions.h:308
double exponent
exponent
Definition PNOGuessFunctions.h:290
SolidHarmonicGaussian(const Atom &atom, const double e, int l, int m)
Definition PNOGuessFunctions.h:286
double z
origin
Definition PNOGuessFunctions.h:289
std::vector< coord_3d > special_points() const
Override this to return list of special points to be refined more deeply.
Definition PNOGuessFunctions.h:300
int m
(real) solid harmonic quanta
Definition PNOGuessFunctions.h:292
int sgn(T val) const
Definition PNOGuessFunctions.h:294
int l
Definition PNOGuessFunctions.h:292
double Z
Definition PNOGuessFunctions.h:291
double y
Definition PNOGuessFunctions.h:289
double x
Definition PNOGuessFunctions.h:289
Definition PNOGuessFunctions.h:33
void print_contracted_basis(std::map< std::string, cbfT > &molbas) const
Definition PNOGuessFunctions.h:42
std::vector< std::tuple< int, std::vector< double >, std::vector< double > > > cbfT
Definition PNOGuessFunctions.h:35
std::vector< int > fill_peterson(const size_t &s) const
Definition PNOGuessFunctions.h:163
vector_real_function_3d guess_virtuals_internal(const std::map< std::string, std::vector< int > > guess_map) const
Definition PNOGuessFunctions.cpp:46
vector_real_function_3d guess_with_psi4(const vector_real_function_3d &mos) const
Definition PNOGuessFunctions.h:98
size_t lqtoint(const std::string &l) const
little helper function for l-quantum numbers
Definition PNOGuessFunctions.cpp:133
std::vector< SolidHarmonicGaussian > make_solidharmonic_guess(const Atom &atom, int l, const double exponent) const
make a set of Cartesian Gaussian functions located on atom
Definition PNOGuessFunctions.h:320
std::map< std::string, cbfT > read_contracted_basis_from_file(const std::string &filename, const std::vector< madness::Atom > atoms) const
Definition PNOGuessFunctions.h:191
vector_real_function_3d guess_contracted_virtuals_from_file() const
Definition PNOGuessFunctions.h:57
vector_real_function_3d predefined_guess(const std::string name) const
Definition PNOGuessFunctions.h:133
const size_t lmax
Definition PNOGuessFunctions.h:39
std::map< std::string, std::vector< std::vector< double > > > read_basis_from_file(const std::string &filename, const std::vector< madness::Atom > atoms) const
read external CABS
Definition PNOGuessFunctions.cpp:121
World & world
Definition PNOGuessFunctions.h:37
const Molecule & molecule
Definition PNOGuessFunctions.h:38
std::vector< int > fill_up(std::vector< int > v) const
Definition PNOGuessFunctions.h:174
BasisFunctions(World &world, const Molecule &mol, const size_t &l)
Definition PNOGuessFunctions.h:36
cbfT read_contracted_basis_from_file(const std::string &filename, const std::string &atom) const
Definition PNOGuessFunctions.h:203
vector_real_function_3d guess_virtuals_from_file() const
Definition PNOGuessFunctions.cpp:16
vector_real_function_3d guess_with_exop(const vector_real_function_3d &f, const std::string &type="dipole+", const bool trigo=true) const
make guess virtuals by exciting with polynomials: v = poly*f
Definition PNOGuessFunctions.h:103
vector_real_function_3d guess_virtual_gaussian_shell(const Atom &atom, const int l, const double e) const
Definition PNOGuessFunctions.cpp:89
std::vector< CartesianGaussian > make_cartesian_guess(const Atom &atom, int l, const double exponent)
make a set of Cartesian Gaussian functions located on atom
Definition PNOGuessFunctions.h:267
FunctionDefaults holds default paramaters as static class members.
Definition funcdefaults.h:204
static int set_length_scale(const double lo, const size_t k=get_k())
adapt the special level to resolve the smallest length scale
Definition funcdefaults.h:437
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
Definition molecule.h:124
const std::vector< Atom > & get_atoms() const
Definition molecule.h:433
void fence(bool debug=false)
Synchronizes all processes in communicator AND globally ensures no pending AM or tasks.
Definition worldgop.cc:161
A parallel world class.
Definition world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:318
WorldGopInterface & gop
Global operations.
Definition world.h:205
auto T(World &world, response_space &f) -> response_space
Definition global_functions.cc:34
static const double v
Definition hatom_sf_dirac.cc:20
static double pow(const double *a, const double *b)
Definition lda.h:74
General header file for using MADNESS.
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
std::vector< std::string > make_predefined_exop_strings(const std::string what)
Makes an excitation operator string based on predefined keywords.
Definition GuessFactory.cc:252
vector_real_function_3d apply_polynomial_exop(vector_real_function_3d &vf, const std::string &exop_input, std::vector< coord_3d > centers, const bool &fence)
Definition GuessFactory.cc:56
std::vector< Function< T, NDIM > > apply_trigonometric_exop(std::vector< Function< T, NDIM > > &vf, const std::string &exop_input, std::vector< coord_3d > centers, const bool &fence)
Definition GuessFactory.h:182
std::vector< coord_3d > compute_centroids(const std::vector< Function< T, NDIM > > &vf)
Definition GuessFactory.cc:27
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
static const char * filename
Definition legendre.cc:96
std::istream & position_stream(std::istream &f, const std::string &tag, bool rewind=true)
Definition position_stream.cc:37
void truncate(World &world, response_space &v, double tol, bool fence)
Definition basic_operators.cc:30
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:79
int Level
Definition key.h:55
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:225
std::vector< Function< T, NDIM > > append(const std::vector< Function< T, NDIM > > &lhs, const std::vector< Function< T, NDIM > > &rhs)
combine two vectors
Definition vmra.h:649
std::string atomic_number_to_symbol(const unsigned int atomic_number)
return the lower-case element symbol corresponding to the atomic number
Definition atomutil.cc:188
void print_size(World &world, const std::vector< Function< T, NDIM > > &v, const std::string &msg="vectorfunction")
Definition vmra.h:1679
NDIM & f
Definition mra.h:2416
std::string type(const PairType &n)
Definition PNOParameters.h:18
void normalize(World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
Normalizes a vector of functions — v[i] = v[i].scale(1.0/v[i].norm2())
Definition vmra.h:1671
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2002
static const double c
Definition relops.cc:10
static const double m
Definition relops.cc:9
static const long k
Definition rk.cc:44
Timer structure.
Definition PNOStructures.h:75
MyTimer stop()
Definition PNOStructures.h:89
MyTimer start() const
Definition PNOStructures.h:83
MyTimer print(const std::string &msg) const
Definition PNOStructures.h:96
void e()
Definition test_sig.cc:75
static const double ky
Definition testcosine.cc:16
static const double kz
Definition testcosine.cc:16
static const double kx
Definition testcosine.cc:16