MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
common.hpp
1/*
2 * common.hpp
3 *
4 * Created on: Aug 14, 2013
5 * Author: drewlewis
6 */
7
8#ifndef mpqc_interfaces_tiledarray_tests_common_hpp
9#define mpqc_interfaces_tiledarray_tests_common_hpp
10
11#include <chemistry/molecule/molecule.h>
12#include <chemistry/qc/basis/basis.h>
13#include <chemistry/qc/basis/split.h>
14#include <chemistry/qc/basis/integral.h>
15#include <mpqc/integrals/integrals.hpp>
16#include <mpqc/integrals/integralenginepool.hpp>
17#include <tiledarray.h>
18#include <mpqc/interfaces/tiledarray/array_ints.hpp>
19#include <string>
20#include <iostream>
21
22namespace mpqc {
23namespace tests {
24 // Typedefs and template alaises
25 template<typename T> using R = sc::Ref<T>;
26 using Molecule = sc::Molecule;
27 using Basis = sc::GaussianBasisSet;
28 using string = std::string;
29 using AKeyVal = sc::AssignedKeyVal;
30 using KeyVal = sc::KeyVal;
31 using Integral = sc::Integral;
32 template<typename T> using IntPool = IntegralEnginePool<T>;
33
34namespace detail {
35 // Takes a std::string and will return a ref molecule either water or h2.
36 // You may provide your own if you would like.
37 R<Molecule>
38 get_molecule(const string &mol_name){
39 R<Molecule> mol = new Molecule;
40
41 if(mol_name == "H2"){
42 mol->add_atom(1, 0,1,-1);
43 mol->add_atom(1, 0,1,1);
44 }
45
46 else if(mol_name == "H2O"){
47 mol->add_atom(8, 0, 0, 0);
48 mol->add_atom(1, 0, 1, -1);
49 mol->add_atom(1, 0, 1, 1);
50 }
51
52 else if (mol_name == "TRange1Test"){
53 mol->add_atom( 6, 0, 0, 0);
54 mol->add_atom( 9, -1, -1, 0);
55 mol->add_atom( 1, 0.6, -0.1, 0.9);
56 mol->add_atom(17, -0.75, 1.5, 0);
57 mol->add_atom(35, 1.1, -0.18, -1.5);
58 }
59
60
61 return mol;
62 }
63
64
65 // Returns a basis set for a molecule given a string with the basis set name
66 // and the ref<molecule> in that the basis is desired for.
67 R<Basis>
68 get_basis(const string &basis_name, const R<Molecule> &mol){
69
70 R<AKeyVal> akv = new AKeyVal;
71 akv->assign("name", basis_name);
72 akv->assign("molecule", mol.pointer());
73
74 R<Basis> basis = new Basis(R<KeyVal>(akv));
75 if(basis->max_ncontraction() > 1){
76 R<Basis> split_basis = new sc::SplitBasisSet(basis);
77 basis = split_basis;
78 }
79
80 return basis;
81
82 }
83
84}
85
86 // Get molecule. Figure out which molecule we are getting and then call
87 // helper function.
88 R<Molecule>
89 get_molecule(const string &mol_name = ""){
90 R<Molecule> mol;
91
92 if(!mol_name.empty()){
93 if(mol_name == "H2"){
94 mol = detail::get_molecule(mol_name);
95 }
96 else if(mol_name == "H2O"){
97 mol = detail::get_molecule(mol_name);
98 }
99 else if (mol_name == "TRange1Test"){
100 mol = detail::get_molecule(mol_name);
101 }
102 else{
103 std::cout << "Molecule name not reconized defaulting to H2"
104 << std::endl;
105 mol = detail::get_molecule("H2");
106 }
107 }
108 else {
109 std::cout << "Molecule name is empty defaulting to H2" << std::endl;
110 mol = detail::get_molecule("H2");
111 }
112
113 return mol;
114 }
115
116 // Get basis set. If empty basis set get STO-3G
117 R<Basis>
118 get_basis(const string &basis_name, const R<Molecule> &mol){
119
120 R<Basis> basis;
121
122 if(!basis_name.empty()){
123 basis = detail::get_basis(basis_name, mol);
124 }
125 else{
126 std::cout << "Basis name empty defaulting to STO-3G" << std::endl;
127 basis = detail::get_basis("STO-3G", mol);
128 }
129
130 return basis;
131
132 }
133
134 // Make an integral factory for use in calculations. This is where
135 // We get our engines from.
136 R<Integral>
137 get_integral_factory(int argc, char** argv){
138 R<Integral> integral_fac = Integral::initial_integral(argc, argv);
139 if(integral_fac)
140 Integral::set_default_integral(integral_fac);
141 integral_fac = Integral::get_default_integral()->clone();
142 return integral_fac;
143 }
144
145} // namespace mpqc
146} // namespace tests
147
148
149
150
151#endif /* mpqc_interfaces_tiledarray_tests_common_hpp */
This class allows keyval associations to be set up by the program, rather than determined by an exter...
Definition keyval.h:340
The GaussianBasisSet class is used describe a basis set composed of atomic gaussian orbitals.
Definition gaussbas.h:145
The Integral abstract class acts as a factory to provide objects that compute one and two electron in...
Definition integral.h:111
static Integral * get_default_integral()
Returns the default Integral factory.
static Integral * initial_integral(int &argc, char **argv)
Create an integral factory.
static void set_default_integral(const Ref< Integral > &)
Specifies a new default Integral factory.
virtual Integral * clone()=0
Clones the given Integral factory. The new factory may need to have set_basis and set_storage to be c...
The KeyVal class is designed to simplify the process of allowing a user to specify keyword/value asso...
Definition keyval.h:69
The Molecule class contains information about molecules.
Definition molecule.h:153
A template class that maintains references counts.
Definition ref.h:361
The SplitBasisSet class is used to split a basis set's contractions into multiple shells.
Definition split.h:38
Contains new MPQC code since version 3.
Definition integralenginepool.hpp:37

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.