Psi4
LibXCfunctional.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2019 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef LibXC_FUNCTIONAL_H
30 #define LibXC_FUNCTIONAL_H
31 
33 #include "psi4/libmints/typedefs.h"
34 
35 #include <map>
36 
37 struct xc_func_type;
38 
42 namespace psi {
43 
44 class LibXCFunctional : public Functional {
45  // Wrapper to the LibXC library
46 
47  private:
48  std::string xc_func_name_;
49  std::unique_ptr<xc_func_type> xc_functional_;
50  int func_id_;
52  bool exc_;
53  bool vxc_;
54  bool fxc_;
55 
56  // **ONLY** Used to pass information up the chain.
57  // Exchange
58  double global_exch_;
59  double lr_exch_;
60 
61  // Needs vv10
63  double vv10_b_;
64  double vv10_c_;
65 
66  // User defined tweakers
67  std::vector<double> user_tweakers_;
68 
69  public:
70  LibXCFunctional(std::string xc_name, bool unpolarized);
71  ~LibXCFunctional() override;
72 
73  void compute_functional(const std::map<std::string, SharedVector>& in,
74  const std::map<std::string, SharedVector>& out, int npoints, int deriv) override;
75 
76  // Clones a *worker* for the functional. This is not a complete functional
77  std::shared_ptr<Functional> build_worker() override;
78 
79  // Setters and getters
80  void set_omega(double omega);
81  void set_tweak(std::vector<double> values);
82  std::vector<std::tuple<std::string, int, double>> get_mix_data();
83 
84  // Make queries to libxc
85  std::map<std::string, double> query_libxc(const std::string& functional);
86 
87  // Only used to pass information up the chain
88  double global_exchange() { return global_exch_; }
89  double lr_exchange() { return lr_exch_; }
90  double needs_vv10() { return needs_vv10_; }
91  double vv10_b() { return vv10_b_; }
92  double vv10_c() { return vv10_c_; }
93 };
94 }
95 
96 #endif
bool fxc_
Definition: LibXCfunctional.h:54
std::string xc_func_name_
Definition: LibXCfunctional.h:48
std::vector< std::tuple< std::string, int, double > > get_mix_data()
Definition: LibXCfunctional.cc:350
Definition: LibXCfunctional.h:44
std::vector< double > user_tweakers_
Definition: LibXCfunctional.h:67
double vv10_c_
Definition: LibXCfunctional.h:64
int func_id_
Definition: LibXCfunctional.h:50
std::unique_ptr< xc_func_type > xc_functional_
Definition: LibXCfunctional.h:49
Definition: functional.h:49
double vv10_b_
Definition: LibXCfunctional.h:63
double needs_vv10()
Definition: LibXCfunctional.h:90
double vv10_c()
Definition: LibXCfunctional.h:92
void set_tweak(std::vector< double > values)
Definition: LibXCfunctional.cc:249
double lr_exch_
Definition: LibXCfunctional.h:59
bool user_omega_
Definition: LibXCfunctional.h:51
void set_omega(double omega)
Definition: LibXCfunctional.cc:198
~LibXCFunctional() override
Definition: LibXCfunctional.cc:172
LibXCFunctional(std::string xc_name, bool unpolarized)
Definition: LibXCfunctional.cc:49
bool vxc_
Definition: LibXCfunctional.h:53
bool exc_
Definition: LibXCfunctional.h:52
double global_exchange()
Definition: LibXCfunctional.h:88
void compute_functional(const std::map< std::string, SharedVector > &in, const std::map< std::string, SharedVector > &out, int npoints, int deriv) override
Definition: LibXCfunctional.cc:370
bool needs_vv10_
Definition: LibXCfunctional.h:62
double omega() const
Definition: functional.h:135
std::map< std::string, double > query_libxc(const std::string &functional)
Definition: LibXCfunctional.cc:222
double vv10_b()
Definition: LibXCfunctional.h:91
std::shared_ptr< Functional > build_worker() override
Definition: LibXCfunctional.cc:173
double lr_exchange()
Definition: LibXCfunctional.h:89
double global_exch_
Definition: LibXCfunctional.h:58