Skip to content

Commit 770243f

Browse files
committed
Add data structures for FQ
1 parent cc5efaa commit 770243f

5 files changed

Lines changed: 46 additions & 18 deletions

File tree

src/interface/Input.cpp

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ void Input::reader(const std::string & filename) {
166166
std::vector<double> mono = chgdist.getDblVec("MONOPOLES");
167167
int j = 0;
168168
int n = int(mono.size() / 4);
169-
multipoles_.monopoles = Eigen::VectorXd::Zero(n);
170-
multipoles_.monopolesSites = Eigen::Matrix3Xd::Zero(3, n);
169+
fragments_.monopoles = Eigen::VectorXd::Zero(n);
170+
fragments_.monopolesSites = Eigen::Matrix3Xd::Zero(3, n);
171171
for (int i = 0; i < n; ++i) {
172-
multipoles_.monopolesSites.col(i) =
172+
fragments_.monopolesSites.col(i) =
173173
(Eigen::Vector3d() << mono[j], mono[j + 1], mono[j + 2]).finished();
174-
multipoles_.monopoles(i) = mono[j + 3];
174+
fragments_.monopoles(i) = mono[j + 3];
175175
j += 4;
176176
}
177177
}
@@ -180,16 +180,34 @@ void Input::reader(const std::string & filename) {
180180
std::vector<double> dipo = chgdist.getDblVec("DIPOLES");
181181
int j = 0;
182182
int n = int(dipo.size() / 6);
183-
multipoles_.dipoles = Eigen::Matrix3Xd::Zero(3, n);
184-
multipoles_.dipolesSites = Eigen::Matrix3Xd::Zero(3, n);
183+
fragments_.dipoles = Eigen::Matrix3Xd::Zero(3, n);
184+
fragments_.dipolesSites = Eigen::Matrix3Xd::Zero(3, n);
185185
for (int i = 0; i < n; ++i) {
186-
multipoles_.dipolesSites.col(i) =
186+
fragments_.dipolesSites.col(i) =
187187
(Eigen::Vector3d() << dipo[j], dipo[j + 1], dipo[j + 2]).finished();
188-
multipoles_.dipoles.col(i) =
188+
fragments_.dipoles.col(i) =
189189
(Eigen::Vector3d() << dipo[j + 3], dipo[j + 4], dipo[j + 5]).finished();
190190
j += 6;
191191
}
192192
}
193+
// Set fluctuating charges
194+
isFQ_ = false;
195+
if (chgdist.getKey<std::vector<double> >("FQ").isDefined()) {
196+
isFQ_ = true;
197+
std::vector<double> fq = chgdist.getDblVec("FQ");
198+
int j = 0;
199+
int n = int(fq.size() / 5);
200+
fragments_.FQSites = Eigen::Matrix3Xd::Zero(3, n);
201+
fragments_.FQChi = Eigen::VectorXd::Zero(n);
202+
fragments_.FQEta = Eigen::VectorXd::Zero(n);
203+
for (int i = 0; i < n; ++i) {
204+
fragments_.FQSites.col(i) =
205+
(Eigen::Vector3d() << fq[j], fq[j + 1], fq[j + 2]).finished();
206+
fragments_.FQChi(i) = fq[j + 3];
207+
fragments_.FQEta(i) = fq[j + 4];
208+
j += 5;
209+
}
210+
}
193211
}
194212

195213
providedBy_ = std::string("API-side");
@@ -264,6 +282,7 @@ void Input::reader(const PCMInput & host_input) {
264282
correction_ = host_input.correction;
265283
hermitivitize_ = true;
266284
isDynamic_ = false;
285+
isFQ_ = false;
267286

268287
providedBy_ = std::string("host-side");
269288
}

src/interface/Input.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class PCMSolver_EXPORT Input {
116116
bool hermitivitize() const { return hermitivitize_; }
117117
bool isDynamic() const { return isDynamic_; }
118118
double integratorScaling() const { return integratorScaling_; }
119+
bool isFQ() const { return isFQ_; }
119120
/// @}
120121

121122
/// Keeps track of who did the parsing: the API or the host program
@@ -130,7 +131,7 @@ class PCMSolver_EXPORT Input {
130131
BIOperatorData integratorParams() const;
131132
/// @}
132133

133-
ChargeDistribution multipoles() const { return multipoles_; }
134+
ChargeDistribution fragments() const { return fragments_; }
134135
bool MEPfromMolecule() { return MEPfromMolecule_; }
135136

136137
/// Operators
@@ -241,10 +242,12 @@ class PCMSolver_EXPORT Input {
241242
std::vector<double> origin_;
242243
/// Molecular geometry
243244
std::vector<double> geometry_;
245+
/// Whether this is a FQ calculation
246+
bool isFQ_;
244247
/// Whether to calculate the MEP from the molecular geometry
245248
bool MEPfromMolecule_;
246-
/// Classical charge distribution of point multipoles
247-
ChargeDistribution multipoles_;
249+
/// Classical charge distribution
250+
ChargeDistribution fragments_;
248251
/// Who performed the syntactic input parsing
249252
std::string providedBy_;
250253
};

src/utils/ChargeDistribution.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ struct ChargeDistribution {
5252
Eigen::Matrix3Xd dipoles;
5353
/*! Dipoles sites */
5454
Eigen::Matrix3Xd dipolesSites;
55+
/*! FQ electronegativities */
56+
Eigen::VectorXd FQChi;
57+
/*! FQ hardnesses */
58+
Eigen::VectorXd FQEta;
59+
/*! FQ sites */
60+
Eigen::Matrix3Xd FQSites;
5561
};
5662

5763
/*! \typedef GFValue

tests/input/fq.inp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ MEDIUM
1212
SOLVENT = WATER
1313
}
1414

15-
FQ
15+
CHARGEDISTRIBUTION
1616
{
1717
# X, Y, Z, CHI, ETA
18-
FRAGMENTS = [0.0, 0.0, 0.0, 1.0, 2.0,
19-
0.0, 0.0, 0.0, 1.0, 2.0]
18+
FQ = [0.0, 0.0, 0.0, 1.0, 2.0,
19+
0.0, 0.0, 0.0, 1.0, 2.0]
2020
}
2121

tools/pcmparser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ def setup_keywords():
361361
# FQ section
362362
# Set a classical fluctuating charge force field
363363
# No additional spheres will be generated.
364-
fq = getkw.Section('FQ', callback = verify_fq)
364+
fq = Section('FQ', callback = verify_fq)
365365
# FQ force field
366366
# Valid values: array of doubles in format [x, y, z, chi, eta]
367-
fq.add_kw('FRAGMENTS', 'DBL_ARRAY')
368-
# TODO: smearing parameters
369-
top.add_sect(fq)
367+
charge_distribution.add_kw('FQ', 'DBL_ARRAY')
368+
# TODO: smearing parameters for FQ
369+
top.add_sect(charge_distribution)
370370

371371
return top
372372

0 commit comments

Comments
 (0)