Skip to content

Commit 46b346d

Browse files
committed
[Backport from ReSpect] Fix initialization of explicit solvent from host
Interface parameters where not properly initialized when setting an explicit solvent from an host program. This commit fixes this problem by providing (bogus) initialization values for these, unused and unreachable (from host program input), parameters (cherry picked from commit 999f7e50bc9eb0cc978480d662be3b4a471eb78c)
1 parent 303dd25 commit 46b346d

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/interface/Input.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void Input::reader(const std::string & filename) {
9292
int nAtoms = int(spheresInput.size() / 4);
9393
for (int i = 0; i < nAtoms; ++i) {
9494
Eigen::Vector3d center;
95-
center << spheresInput[j], spheresInput[j + 1], spheresInput[j + 2];
95+
center = (Eigen::Vector3d() << spheresInput[j], spheresInput[j + 1], spheresInput[j + 2]).finished();
9696
Sphere sph(center, spheresInput[j + 3]);
9797
spheres_.push_back(sph);
9898
j += 4;
@@ -216,6 +216,16 @@ void Input::reader(const PCMInput & host_input) {
216216
derivativeOutsideType_ = detail::derivativeTraits("DERIVATIVE");
217217
epsilonStaticOutside_ = host_input.outside_epsilon;
218218
epsilonDynamicOutside_ = host_input.outside_epsilon;
219+
// Initialize interface parameters with bogus values
220+
epsilonStatic1_ = 0.0;
221+
epsilonDynamic1_ = 0.0;
222+
epsilonStatic2_ = 0.0;
223+
epsilonDynamic2_ = 0.0;
224+
center_ = 0.0;
225+
width_ = 0.0;
226+
origin_ = std::vector<double>(3, 0.0);
227+
profileType_ = 0;
228+
maxL_ = 0;
219229
} else { // This part must be reviewed!! Some data members are not initialized...
220230
// Just initialize the solvent object in this class
221231
hasSolvent_ = true;
@@ -232,6 +242,7 @@ void Input::reader(const PCMInput & host_input) {
232242
epsilonStaticOutside_ = solvent_.epsStatic;
233243
epsilonDynamicOutside_ = solvent_.epsDynamic;
234244
}
245+
235246
integratorType_ = "COLLOCATION";
236247
integratorScaling_ = 1.07;
237248

@@ -256,7 +267,7 @@ void Input::initMolecule() {
256267
Eigen::VectorXd charges = Eigen::VectorXd::Zero(nuclei);
257268
int j = 0;
258269
for (int i = 0; i < nuclei; ++i) {
259-
centers.col(i) << geometry_[j], geometry_[j + 1], geometry_[j + 2];
270+
centers.col(i) = (Eigen::Vector3d() << geometry_[j], geometry_[j + 1], geometry_[j + 2]).finished();
260271
charges(i) = geometry_[j + 3];
261272
j += 4;
262273
}
@@ -338,7 +349,7 @@ GreenData Input::outsideStaticGreenParams() const {
338349
retval.epsilon2 = epsilonStatic2_;
339350
retval.center = center_;
340351
retval.width = width_;
341-
retval.origin << origin_[0], origin_[1], origin_[2];
352+
retval.origin = (Eigen::Vector3d() << origin_[0], origin_[1], origin_[2]).finished();
342353
retval.maxL = maxL_;
343354
}
344355
return retval;
@@ -352,7 +363,7 @@ GreenData Input::outsideDynamicGreenParams() const {
352363
retval.epsilon2 = epsilonDynamic2_;
353364
retval.center = center_;
354365
retval.width = width_;
355-
retval.origin << origin_[0], origin_[1], origin_[2];
366+
retval.origin = (Eigen::Vector3d() << origin_[0], origin_[1], origin_[2]).finished();
356367
retval.maxL = maxL_;
357368
}
358369
return retval;

0 commit comments

Comments
 (0)