@@ -176,7 +176,6 @@ Meddle::Meddle(int nr_nuclei,
176
176
cavity_(__nullptr),
177
177
K_0_(__nullptr),
178
178
K_d_(__nullptr),
179
- infoStream_(" \n ~~~~~~~~~~ PCMSolver ~~~~~~~~~~\n " ),
180
179
hasDynamic_(false ) {
181
180
TIMER_ON (" Meddle::initInput" );
182
181
initInput (nr_nuclei, charges, coordinates, symmetry_info);
@@ -199,20 +198,20 @@ pcm::Meddle::~Meddle() {
199
198
}
200
199
201
200
PCMSolverIndex pcmsolver_get_cavity_size (pcmsolver_context_t * context) {
202
- return (AS_TYPE (pcm::Meddle, context)->getCavitySize ());
201
+ return (AS_CTYPE (pcm::Meddle, context)->getCavitySize ());
203
202
}
204
203
PCMSolverIndex pcm::Meddle::getCavitySize () const { return cavity_->size (); }
205
204
206
205
PCMSolverIndex pcmsolver_get_irreducible_cavity_size (pcmsolver_context_t * context) {
207
- return (AS_TYPE (pcm::Meddle, context)->getIrreducibleCavitySize ());
206
+ return (AS_CTYPE (pcm::Meddle, context)->getIrreducibleCavitySize ());
208
207
}
209
208
PCMSolverIndex pcm::Meddle::getIrreducibleCavitySize () const {
210
209
return cavity_->irreducible_size ();
211
210
}
212
211
213
212
void pcmsolver_get_centers (pcmsolver_context_t * context, double centers[]) {
214
213
TIMER_ON (" pcmsolver_get_centers" );
215
- AS_TYPE (pcm::Meddle, context)->getCenters (centers);
214
+ AS_CTYPE (pcm::Meddle, context)->getCenters (centers);
216
215
TIMER_OFF (" pcmsolver_get_centers" );
217
216
}
218
217
void pcm::Meddle::getCenters (double centers[]) const {
@@ -223,14 +222,14 @@ void pcm::Meddle::getCenters(double centers[]) const {
223
222
}
224
223
225
224
void pcmsolver_get_center (pcmsolver_context_t * context, int its, double center[]) {
226
- AS_TYPE (pcm::Meddle, context)->getCenter (its, center);
225
+ AS_CTYPE (pcm::Meddle, context)->getCenter (its, center);
227
226
}
228
227
void pcm::Meddle::getCenter (int its, double center[]) const {
229
228
Eigen::Map<Eigen::Vector3d>(center, 3 , 1 ) = cavity_->elementCenter (its - 1 );
230
229
}
231
230
232
231
void pcmsolver_get_areas (pcmsolver_context_t * context, double areas[]) {
233
- AS_TYPE (pcm::Meddle, context)->getAreas (areas);
232
+ AS_CTYPE (pcm::Meddle, context)->getAreas (areas);
234
233
}
235
234
void pcm::Meddle::getAreas (double areas[]) const {
236
235
Eigen::Map<Eigen::VectorXd>(areas, cavity_->size (), 1 ) = cavity_->elementArea ();
@@ -240,25 +239,34 @@ double pcmsolver_compute_polarization_energy(pcmsolver_context_t * context,
240
239
const char * mep_name,
241
240
const char * asc_name) {
242
241
return (
243
- AS_TYPE (pcm::Meddle, context)
242
+ AS_CTYPE (pcm::Meddle, context)
244
243
->computePolarizationEnergy (std::string (mep_name), std::string (asc_name)));
245
244
}
246
245
double pcm::Meddle::computePolarizationEnergy (const std::string & mep_name,
247
246
const std::string & asc_name) const {
248
- // Dot product of MEP and ASC surface function
249
- double energy = functions_[mep_name].dot (functions_[asc_name]);
247
+ #ifdef HAS_CXX11
248
+ double energy = functions_.at (mep_name).dot (functions_.at (asc_name));
249
+ #else /* HAS_CXX11 */
250
+ double energy =
251
+ (functions_.find (mep_name)->second ).dot (functions_.find (asc_name)->second );
252
+ #endif /* HAS_CXX11 */
250
253
return (energy / 2.0 );
251
254
}
252
255
253
256
double pcmsolver_get_asc_dipole (pcmsolver_context_t * context,
254
257
const char * asc_name,
255
258
double dipole[]) {
256
259
return (
257
- AS_TYPE (pcm::Meddle, context)->getASCDipole (std::string (asc_name), dipole));
260
+ AS_CTYPE (pcm::Meddle, context)->getASCDipole (std::string (asc_name), dipole));
258
261
}
259
262
double pcm::Meddle::getASCDipole (const std::string & asc_name,
260
263
double dipole[]) const {
261
- Eigen::Vector3d asc_dipole = cavity_->elementCenter () * functions_[asc_name];
264
+ #ifdef HAS_CXX11
265
+ Eigen::Vector3d asc_dipole = cavity_->elementCenter () * functions_.at (asc_name);
266
+ #else /* HAS_CXX11 */
267
+ Eigen::Vector3d asc_dipole =
268
+ cavity_->elementCenter () * functions_.find (asc_name)->second ;
269
+ #endif /* HAS_CXX11 */
262
270
// Bind to host-allocated array
263
271
Eigen::Map<Eigen::Vector3d>(dipole, 3 , 1 ) = asc_dipole;
264
272
return asc_dipole.norm ();
@@ -275,7 +283,7 @@ void pcmsolver_compute_asc(pcmsolver_context_t * context,
275
283
}
276
284
void pcm::Meddle::computeASC (const std::string & mep_name,
277
285
const std::string & asc_name,
278
- int irrep) const {
286
+ int irrep) {
279
287
// Get the proper iterators
280
288
SurfaceFunctionMapConstIter iter_pot = functions_.find (mep_name);
281
289
Eigen::VectorXd asc = K_0_->computeCharge (iter_pot->second , irrep);
@@ -300,7 +308,7 @@ void pcmsolver_compute_response_asc(pcmsolver_context_t * context,
300
308
}
301
309
void pcm::Meddle::computeResponseASC (const std::string & mep_name,
302
310
const std::string & asc_name,
303
- int irrep) const {
311
+ int irrep) {
304
312
// Get the proper iterators
305
313
SurfaceFunctionMapConstIter iter_pot = functions_.find (mep_name);
306
314
Eigen::VectorXd asc (cavity_->size ());
@@ -323,7 +331,8 @@ void pcmsolver_get_surface_function(pcmsolver_context_t * context,
323
331
double values[],
324
332
const char * name) {
325
333
TIMER_ON (" pcmsolver_get_surface_function" );
326
- AS_TYPE (pcm::Meddle, context)->getSurfaceFunction (size, values, std::string (name));
334
+ AS_CTYPE (pcm::Meddle, context)
335
+ ->getSurfaceFunction (size, values, std::string (name));
327
336
TIMER_OFF (" pcmsolver_get_surface_function" );
328
337
}
329
338
void pcm::Meddle::getSurfaceFunction (PCMSolverIndex size,
@@ -349,7 +358,7 @@ void pcmsolver_set_surface_function(pcmsolver_context_t * context,
349
358
}
350
359
void pcm::Meddle::setSurfaceFunction (PCMSolverIndex size,
351
360
double values[],
352
- const std::string & name) const {
361
+ const std::string & name) {
353
362
if (cavity_->size () != size)
354
363
PCMSOLVER_ERROR (" The " + name + " SurfaceFunction is bigger than the cavity!" );
355
364
@@ -363,21 +372,25 @@ void pcm::Meddle::setSurfaceFunction(PCMSolverIndex size,
363
372
364
373
void pcmsolver_print_surface_function (pcmsolver_context_t * context,
365
374
const char * name) {
366
- AS_TYPE (pcm::Meddle, context)->printSurfaceFunction (std::string (name));
375
+ AS_CTYPE (pcm::Meddle, context)->printSurfaceFunction (std::string (name));
367
376
}
368
377
void pcm::Meddle::printSurfaceFunction (const std::string & name) const {
369
378
if (functions_.count (name) == 1 ) { // Key in map already
370
379
std::ostringstream print_sf;
371
380
Eigen::IOFormat fmt (Eigen::FullPrecision);
372
- print_sf << functions_[name].format (fmt) << std::endl;
381
+ #ifdef HAS_CXX11
382
+ print_sf << functions_.at (name).format (fmt) << std::endl;
383
+ #else /* HAS_CXX11 */
384
+ print_sf << (functions_.find (name)->second ).format (fmt) << std::endl;
385
+ #endif /* HAS_CXX11 */
373
386
hostWriter_ (print_sf);
374
387
} else {
375
388
PCMSOLVER_ERROR (" You are trying to print a nonexistent SurfaceFunction!" );
376
389
}
377
390
}
378
391
379
392
void pcmsolver_save_surface_functions (pcmsolver_context_t * context) {
380
- AS_TYPE (pcm::Meddle, context)->saveSurfaceFunctions ();
393
+ AS_CTYPE (pcm::Meddle, context)->saveSurfaceFunctions ();
381
394
}
382
395
void pcm::Meddle::saveSurfaceFunctions () const {
383
396
hostWriter_ (" \n Dumping surface functions to .npy files" );
@@ -392,7 +405,7 @@ void pcm::Meddle::saveSurfaceFunctions() const {
392
405
393
406
void pcmsolver_save_surface_function (pcmsolver_context_t * context,
394
407
const char * name) {
395
- AS_TYPE (pcm::Meddle, context)->saveSurfaceFunction (std::string (name));
408
+ AS_CTYPE (pcm::Meddle, context)->saveSurfaceFunction (std::string (name));
396
409
}
397
410
void pcm::Meddle::saveSurfaceFunction (const std::string & name) const {
398
411
SurfaceFunctionMapConstIter it = functions_.find (name);
@@ -403,7 +416,7 @@ void pcmsolver_load_surface_function(pcmsolver_context_t * context,
403
416
const char * name) {
404
417
AS_TYPE (pcm::Meddle, context)->loadSurfaceFunction (std::string (name));
405
418
}
406
- void pcm::Meddle::loadSurfaceFunction (const std::string & name) const {
419
+ void pcm::Meddle::loadSurfaceFunction (const std::string & name) {
407
420
hostWriter_ (" \n Loading surface function " + name + " from .npy file" );
408
421
Eigen::VectorXd values = cnpy::custom::npy_load<double >(name + " .npy" );
409
422
if (values.size () != cavity_->size ())
@@ -418,12 +431,12 @@ void pcm::Meddle::loadSurfaceFunction(const std::string & name) const {
418
431
}
419
432
420
433
void pcmsolver_write_timings (pcmsolver_context_t * context) {
421
- AS_TYPE (pcm::Meddle, context)->writeTimings ();
434
+ AS_CTYPE (pcm::Meddle, context)->writeTimings ();
422
435
}
423
436
void pcm::Meddle::writeTimings () const { TIMER_DONE (" pcmsolver.timer.dat" ); }
424
437
425
438
void pcmsolver_print (pcmsolver_context_t * context) {
426
- AS_TYPE (pcm::Meddle, context)->printInfo ();
439
+ AS_CTYPE (pcm::Meddle, context)->printInfo ();
427
440
}
428
441
void pcm::Meddle::printInfo () const {
429
442
hostWriter_ (citation_message ());
@@ -511,7 +524,7 @@ void Meddle::initDynamicSolver() {
511
524
delete gf_i;
512
525
}
513
526
514
- void Meddle::mediumInfo (IGreensFunction * gf_i, IGreensFunction * gf_o) const {
527
+ void Meddle::mediumInfo (IGreensFunction * gf_i, IGreensFunction * gf_o) {
515
528
using utils::Solvent;
516
529
infoStream_ << " ============ Medium " << std::endl;
517
530
if (input_.fromSolvent ()) {
0 commit comments