source: ThirdParty/mpqc_open/src/lib/chemistry/cca/MPQC_IntegralEvaluatorFactory_Impl.cc

Candidate_v1.6.1
Last change on this file was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 12.5 KB
Line 
1//
2// File: MPQC_IntegralEvaluatorFactory_Impl.cc
3// Symbol: MPQC.IntegralEvaluatorFactory-v0.2
4// Symbol Type: class
5// Babel Version: 0.10.2
6// Description: Server-side implementation for MPQC.IntegralEvaluatorFactory
7//
8// WARNING: Automatically generated; only changes within splicers preserved
9//
10// babel-version = 0.10.2
11//
12#include "MPQC_IntegralEvaluatorFactory_Impl.hh"
13
14// DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory._includes)
15using namespace std;
16using namespace sc;
17using namespace Chemistry::QC;
18string get_Integral_keyval(string);
19#include <iostream>
20#include <chemistry/qc/intv3/intv3.h>
21#ifdef HAVE_CINTS
22 #include <chemistry/qc/cints/cints.h>
23#endif
24#include "MPQC_IntegralEvaluator2.hh"
25#include "MPQC_IntegralEvaluator3.hh"
26#include "MPQC_IntegralEvaluator4.hh"
27sc::Ref<sc::GaussianBasisSet> basis_cca_to_sc(GaussianBasis::Molecular&);
28// DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory._includes)
29
30// user-defined constructor.
31void MPQC::IntegralEvaluatorFactory_impl::_ctor() {
32 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory._ctor)
33 // add construction details here
34 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory._ctor)
35}
36
37// user-defined destructor.
38void MPQC::IntegralEvaluatorFactory_impl::_dtor() {
39 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory._dtor)
40 // add destruction details here
41 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory._dtor)
42}
43
44// static class initializer.
45void MPQC::IntegralEvaluatorFactory_impl::_load() {
46 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory._load)
47 // guaranteed to be called at most once before any other method in this class
48 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory._load)
49}
50
51// user-defined static methods: (none)
52
53// user-defined non-static methods:
54/**
55 * Starts up a component presence in the calling framework.
56 * @param Svc the component instance's handle on the framework world.
57 * Contracts concerning Svc and setServices:
58 *
59 * The component interaction with the CCA framework
60 * and Ports begins on the call to setServices by the framework.
61 *
62 * This function is called exactly once for each instance created
63 * by the framework.
64 *
65 * The argument Svc will never be nil/null.
66 *
67 * Those uses ports which are automatically connected by the framework
68 * (so-called service-ports) may be obtained via getPort during
69 * setServices.
70 */
71void
72MPQC::IntegralEvaluatorFactory_impl::setServices (
73 /* in */ ::gov::cca::Services services )
74throw (
75 ::gov::cca::CCAException
76){
77 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.setServices)
78
79 services_ = services;
80 if (services_._is_nil()) return;
81
82 try {
83 services_.addProvidesPort(self, "IntegralEvaluatorFactory",
84 "Chemistry.QC.GaussianBasis.IntegralEvaluatorFactory", 0);
85 }
86 catch (gov::cca::CCAException e) {
87 std::cout << "Error using services: "
88 << e.getNote() << std::endl;
89 }
90
91 //setup parameters
92 try {
93
94 if (services_._not_nil()) {
95 gov::cca::TypeMap tm = services_.createTypeMap();
96 services_.registerUsesPort("classicParam",
97 "gov.cca.ParameterPortFactoryService",tm);
98 gov::cca::Port p = services_.getPort("classicParam");
99 ccaffeine::ports::PortTranslator portX = p;
100 if(portX._not_nil()) {
101 classic::gov::cca::Port *cp
102 =static_cast<classic::gov::cca::Port*>(portX.getClassicPort());
103 if(!cp) {
104 std::cout << "Couldn't get classic port" << std::endl;
105 return;
106 }
107 ConfigurableParameterFactory *cpf
108 = dynamic_cast<ConfigurableParameterFactory *>(cp);
109 ConfigurableParameterPort *pp = setup_parameters(cpf);
110 classic::gov::cca::Port *clscp
111 = dynamic_cast<classic::gov::cca::Port*>(pp);
112 if (!clscp) {
113 std::cout << "Couldn't cast to classic::gov::cca::Port"
114 << std::endl;
115 }
116 void *vp = static_cast<void*>(clscp);
117 ccaffeine::ports::PortTranslator provideX
118 = ccaffeine::ports::PortTranslator::createFromClassic(vp);
119
120 services_.addProvidesPort(provideX,
121 "configure", "ParameterPort", tm);
122
123 services_.releasePort("classicParam");
124 services_.unregisterUsesPort("classicParam");
125 }
126 }
127 }
128 catch(std::exception& e) {
129 std::cout << "Exception caught: " << e.what() << std::endl;
130 }
131
132 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.setServices)
133}
134
135/**
136 * Set the molecular basis
137 * @param molbasis The molecular basis
138 */
139void
140MPQC::IntegralEvaluatorFactory_impl::set_molecular (
141 /* in */ ::Chemistry::QC::GaussianBasis::Molecular molbasis )
142throw ()
143{
144 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.set_molecular)
145 // insert implementation here
146 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.set_molecular)
147}
148
149/**
150 * Get the molecular basis
151 * @return The molecular basis
152 */
153::Chemistry::QC::GaussianBasis::Molecular
154MPQC::IntegralEvaluatorFactory_impl::get_molecular ()
155throw ()
156
157{
158 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_molecular)
159 // insert implementation here
160 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_molecular)
161}
162
163/**
164 * Set the molecule
165 * @param The molecule
166 */
167void
168MPQC::IntegralEvaluatorFactory_impl::set_molecule (
169 /* in */ ::Chemistry::Molecule mol )
170throw ()
171{
172 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.set_molecule)
173 molecule_ = mol;
174 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.set_molecule)
175}
176
177/**
178 * Get the molecule
179 * @return The molecule
180 */
181::Chemistry::Molecule
182MPQC::IntegralEvaluatorFactory_impl::get_molecule ()
183throw ()
184
185{
186 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_molecule)
187 return molecule_;
188 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_molecule)
189}
190
191/**
192 * Set the integral package
193 * @param The integral package
194 */
195void
196MPQC::IntegralEvaluatorFactory_impl::set_integral_package (
197 /* in */ const ::std::string& label )
198throw ()
199{
200 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.set_integral_package)
201 package_ = label;
202 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.set_integral_package)
203}
204
205/**
206 * Get a 2-center integral evaluator
207 * @param label String specifying integral type
208 * @param max_deriv Maximum derivative that will be computed
209 * @param bs1 Molecular basis set on center 1
210 * @param bs2 Molecular basis set on center 2
211 * @return 2-center integral evaluator
212 */
213::Chemistry::QC::GaussianBasis::IntegralEvaluator2
214MPQC::IntegralEvaluatorFactory_impl::get_integral_evaluator2 (
215 /* in */ const ::std::string& label,
216 /* in */ int64_t max_deriv,
217 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs1,
218 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs2 )
219throw ()
220{
221 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_integral_evaluator2)
222 MPQC::IntegralEvaluator2 eval = MPQC::IntegralEvaluator2::_create();
223 if( package_.size() == 0 )
224 package_ = package_param_->getValueString();
225 eval.set_integral_package( package_ );
226 eval.initialize( bs1, bs2, label, max_deriv );
227 return eval;
228 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_integral_evaluator2)
229}
230
231/**
232 * Get a nuclear repulsion specialized 2-center integral
233 * evaluator. Returns derivative integrals taken with
234 * respect to DerivCenters.
235 * @param max_deriv Maximum derivative that will be computed
236 * @param bs1 Molecular basis set on center 1
237 * @param bs2 Molecular basis set on center 2
238 * @return nuclear repulsion integral evaluator
239 */
240::Chemistry::QC::GaussianBasis::IntegralEvaluator2
241MPQC::IntegralEvaluatorFactory_impl::get_nuclear_evaluator (
242 /* in */ int64_t max_deriv,
243 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs1,
244 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs2,
245 /* in */ ::Chemistry::QC::GaussianBasis::DerivCenters dc )
246throw ()
247{
248 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_nuclear_evaluator)
249 // Insert-Code-Here {MPQC.IntegralEvaluatorFactory.get_nuclear_evaluator} (get_nuclear_evaluator method)
250 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_nuclear_evaluator)
251}
252
253/**
254 * Get a hcore specialized 2-center integral
255 * evaluator. Returns derivative integrals taken with
256 * respect to DerivCenters.
257 * @param max_deriv Maximum derivative that will be computed
258 * @param bs1 Molecular basis set on center 1
259 * @param bs2 Molecular basis set on center 2
260 * @return hcore repulsion integral evaluator
261 */
262::Chemistry::QC::GaussianBasis::IntegralEvaluator2
263MPQC::IntegralEvaluatorFactory_impl::get_hcore_evaluator (
264 /* in */ int64_t max_deriv,
265 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs1,
266 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs2,
267 /* in */ ::Chemistry::QC::GaussianBasis::DerivCenters dc )
268throw ()
269{
270 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_hcore_evaluator)
271 // Insert-Code-Here {MPQC.IntegralEvaluatorFactory.get_hcore_evaluator} (get_hcore_evaluator method)
272 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_hcore_evaluator)
273}
274
275/**
276 * Get a 3-center integral evaluator
277 * @param label String specifying integral type
278 * @param max_deriv Maximum derivative that will be computed
279 * @param bs1 Molecular basis set on center 1
280 * @param bs2 Molecular basis set on center 2
281 * @param bs3 Molecular basis set on center 3
282 * @return 3-center integral evaluator
283 */
284::Chemistry::QC::GaussianBasis::IntegralEvaluator3
285MPQC::IntegralEvaluatorFactory_impl::get_integral_evaluator3 (
286 /* in */ const ::std::string& label,
287 /* in */ int64_t max_deriv,
288 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs1,
289 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs2,
290 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs3 )
291throw ()
292{
293 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_integral_evaluator3)
294 MPQC::IntegralEvaluator3 eval = MPQC::IntegralEvaluator3::_create();
295 if( package_.size() == 0 )
296 package_ = package_param_->getValueString();
297 eval.set_integral_package( package_ );
298 eval.initialize( bs1, bs2, bs3, label, max_deriv );
299 return eval;
300 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_integral_evaluator3)
301}
302
303/**
304 * Get a 4-center integral evaluator
305 * @param label String defining integral type
306 * @param max_deriv Maximum derivative that will be computed
307 * @param bs1 Molecular basis set on center 1
308 * @param bs2 Molecular basis set on center 2
309 * @param bs3 Molecular basis set on center 3
310 * @param bs4 Molecular basis set on center 4
311 * @return 4-center integral evaluator
312 */
313::Chemistry::QC::GaussianBasis::IntegralEvaluator4
314MPQC::IntegralEvaluatorFactory_impl::get_integral_evaluator4 (
315 /* in */ const ::std::string& label,
316 /* in */ int64_t max_deriv,
317 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs1,
318 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs2,
319 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs3,
320 /* in */ ::Chemistry::QC::GaussianBasis::Molecular bs4 )
321throw ()
322{
323 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_integral_evaluator4)
324 MPQC::IntegralEvaluator4 eval = MPQC::IntegralEvaluator4::_create();
325 if( package_.size() == 0 )
326 package_ = package_param_->getValueString();
327 eval.set_integral_package( package_ );
328 eval.initialize( bs1, bs2, bs3, bs4, label, max_deriv );
329 return eval;
330 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_integral_evaluator4)
331}
332
333/**
334 * Get the contraction transform
335 * @return The contraction transform
336 */
337::Chemistry::QC::GaussianBasis::ContractionTransform
338MPQC::IntegralEvaluatorFactory_impl::get_contraction_transform ()
339throw ()
340
341{
342 // DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory.get_contraction_transform)
343 // insert implementation here
344 // DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory.get_contraction_transform)
345}
346
347
348// DO-NOT-DELETE splicer.begin(MPQC.IntegralEvaluatorFactory._misc)
349
350ConfigurableParameterPort *
351MPQC::IntegralEvaluatorFactory_impl::setup_parameters(
352 ConfigurableParameterFactory *cpf)
353{
354 ConfigurableParameterPort * pp = cpf->createConfigurableParameterPort();
355
356 pp->setBatchTitle("PortTranslatorStarter Configuration");
357 pp->setGroupName("Model Factory Input");
358
359 package_param_ = new StringParameter("package", "Integral package",
360 "package", "intv3");
361 pp->addRequest(package_param_);
362
363 return pp;
364}
365
366// DO-NOT-DELETE splicer.end(MPQC.IntegralEvaluatorFactory._misc)
367
Note: See TracBrowser for help on using the repository browser.