votca 2024-dev
Loading...
Searching...
No Matches
csg_reupdate.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2021 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Standard includes
19#include <cmath>
20#include <cstdio>
21#include <cstdlib>
22#include <fstream>
23#include <iostream>
24#include <memory>
25#include <sstream>
26
27// VOTCA includes
29#include <votca/tools/linalg.h>
30
31// Local VOTCA includes
33
34// Local private VOTCA includes
35#include "csg_reupdate.h"
36
37using namespace std;
38
39int main(int argc, char **argv) {
40 CsgREupdate app;
41 return app.Exec(argc, argv);
42}
43
44// program options are added here
46
48
49 AddProgramOptions("RE Specific options")(
50 "options", boost::program_options::value<string>(),
51 " options file for coarse graining")(
52 "gentable",
53 boost::program_options::value<bool>(&gentable_)->default_value(false),
54 " only generate potential tables from given parameters, "
55 " NO RE update!")("interaction", boost::program_options::value<string>(),
56 " [OPTIONAL] generate potential tables only for the "
57 "specified interactions, \n"
58 " only valid when 'gentable' is true")(
59 "param-in-ext",
60 boost::program_options::value<string>(&param_in_ext_)
61 ->default_value("param.cur"),
62 " Extension of the input parameter tables")(
63 "param-out-ext",
64 boost::program_options::value<string>(&param_out_ext_)
65 ->default_value("param.new"),
66 " Extension of the output parameter tables")(
67 "pot-out-ext",
68 boost::program_options::value<string>(&pot_out_ext_)
69 ->default_value("pot.new"),
70 " Extension of the output potential tables")(
71 "hessian-check",
72 boost::program_options::value<bool>(&hessian_check_)->default_value(true),
73 " Disable the hessian check (mostly for testing)");
74 AddProgramOptions()("top", boost::program_options::value<string>(),
75 " atomistic topology file (only needed for RE update)");
76}
77
79
81 CheckRequired("options", "need to specify options file");
82 if (!gentable_) {
83 CheckRequired("trj", "no trajectory file specified");
84 CheckRequired("top", "no topology file specified");
85 }
86 LoadOptions(OptionsMap()["options"].as<string>());
87 return true;
88}
89
90// load user provided .xml option file
91void CsgREupdate::LoadOptions(const string &file) {
92
94 nonbonded_ = options_.Select("cg.non-bonded");
95}
96
98
99 // initializing non-bonded interactions
100 nlamda_ = 0;
101 for (Property *prop : nonbonded_) {
102
103 string name = prop->get("name").value();
104 votca::Index id = potentials_.size();
105
106 PotentialInfo *i =
107 new PotentialInfo(id, false, nlamda_, param_in_ext_, prop, gentable_);
108
109 Table *aardf = new Table();
110 aardf->Load(name + ".dist.tgt");
111 aardfs_.push_back(aardf);
112
113 // generate the bead lists
114 BeadList beads1, beads2;
115 beads1.Generate(*top, prop->get("type1").value());
116 beads2.Generate(*top, prop->get("type2").value());
117
118 if (beads1.size() == 0) {
119 throw std::runtime_error("Topology does not have beads of type \"" +
120 prop->get("type1").value() +
121 "\"\n"
122 "This was specified in type1 of interaction \"" +
123 name + "\"");
124 }
125 if (beads2.size() == 0) {
126 throw std::runtime_error("Topology does not have beads of type \"" +
127 prop->get("type2").value() +
128 "\"\n"
129 "This was specified in type2 of interaction \"" +
130 name + "\"");
131 }
132
133 // calculate normalization factor for rdf
134 double *rdfnorm = new double();
135
136 if (prop->get("type1").value() == prop->get("type2").value()) {
137 *rdfnorm =
138 (double)(beads1.size() * beads2.size()) / 2. / top->BoxVolume();
139 } else {
140 *rdfnorm = (double)(beads1.size() * beads2.size()) / top->BoxVolume();
141 }
142
143 aardfnorms_.push_back(rdfnorm);
144
145 // let user know the properties of CG potential he/she selected
146 cout << "We have " << i->potentialName << " CG potential" << endl;
147 cout << "\t \t Between beads " << i->type1 << "-" << i->type2 << endl;
148 cout << "\t \t With Function form " << i->potentialFunction << endl;
149 cout << "\t \t And " << i->ucg->getOptParamSize()
150 << " parameters to "
151 "optimize"
152 << endl;
153 cout << "Potential range:" << endl;
154 cout << "\t \t rmin = " << i->rmin << " [nm]" << endl;
155 cout << "\t \t rcutoff = " << i->rcut << " [nm]" << endl;
156
157 // update parameter counter
158 nlamda_ += i->ucg->getOptParamSize();
159
160 potentials_.push_back(i);
161 }
162
163 cout << "Total number of parameters to optimize: " << nlamda_ << endl;
164
165 lamda_.resize(nlamda_);
166
167 // need to store initial guess of parameters in lamda_
168 for (auto &potential_ : potentials_) {
169
170 votca::Index pos_start = potential_->vec_pos;
171 votca::Index pos_max = pos_start + potential_->ucg->getOptParamSize();
172
173 for (votca::Index row = pos_start; row < pos_max; row++) {
174
175 votca::Index lamda_i = row - pos_start;
176 lamda_(row) = potential_->ucg->getOptParam(lamda_i);
177
178 } // end row loop
179
180 } // end potiter loop
181
182 DS_ = Eigen::VectorXd::Zero(nlamda_);
183 HS_ = Eigen::MatrixXd::Zero(nlamda_, nlamda_);
184 dUFrame_ = Eigen::VectorXd::Zero(nlamda_);
185 nframes_ = 0.0; // no frames processed yet!
186
187 // set Temperature
188 beta_ = (1.0 / options_.get("cg.inverse.kBT").as<double>());
189
190 // relaxation parameter for update
191 relax_ = options_.get("cg.inverse.scale").as<double>();
192
193 UavgAA_ = 0.0;
194 UavgCG_ = 0.0;
195}
196
198
199 if (!gentable_) {
201 } else {
202
203 // only write potential tables for given parameters
204 nlamda_ = 0;
205 for (Property *prop : nonbonded_) {
206
207 string name = prop->get("name").value();
208
209 if (OptionsMap().count("interaction")) {
210
211 Tokenizer tok(OptionsMap()["interaction"].as<string>(), ";");
212 vector<string> vtok = tok.ToVector();
213 vector<string>::iterator vtok_iter =
214 find(vtok.begin(), vtok.end(), name);
215 if (vtok_iter == vtok.end()) {
216 continue;
217 }
218 }
219
220 PotentialInfo *i = new PotentialInfo(potentials_.size(), false, nlamda_,
221 param_in_ext_, prop, gentable_);
222
223 // update parameter counter
224 nlamda_ += i->ucg->getOptParamSize();
225
226 potentials_.push_back(i);
227 }
228
230 }
231}
232
234
235 if (nframes_ == 0) {
236 throw std::runtime_error("No frames to process! Please check your input.");
237 }
238
239 // formulate HS_ dlamda = - DS_
240
242
243 cout << "Updating parameters" << endl;
245
246 cout << "AA Ensemble Avg Energy :: " << UavgAA_ << endl;
247 cout << "CG Ensemble Avg Energy :: " << UavgCG_ << endl;
248
250
251 cout << "Finished RE update!\n";
252}
253
255 cout << "Writing CG parameters and potential(s)\n";
256 string file_name;
257
258 for (auto &potential_ : potentials_) {
259 file_name = potential_->potentialName;
260 file_name = file_name + "." + pot_out_ext_;
261 cout << "Writing file: " << file_name << endl;
262 potential_->ucg->SavePotTab(file_name,
263 potential_->options_->get("step").as<double>(),
264 potential_->options_->get("min").as<double>(),
265 potential_->options_->get("max").as<double>());
266 // for gentable with no RE update no need to write-out parameters
267 if (!gentable_) {
268 file_name = potential_->potentialName;
269 file_name = file_name + "." + param_out_ext_;
270 cout << "Writing file: " << file_name << endl;
271 potential_->ucg->SaveParam(file_name);
272 }
273 }
274}
275
276// formulate HS_ x = - DS_
278
279 /* compute CG ensemble avges of dU,d2U by dividing its
280 * sum over all frames by total no. of frames
281 */
282
283 DS_ /= ((double)nframes_);
284 HS_ /= ((double)nframes_);
285 UavgCG_ /= ((double)nframes_);
286
287 /* adding 4th term in eq. 52 of ref J. Chem. Phys. 134, 094112, 2011
288 * to HS_
289 */
290
291 HS_ -= DS_ * DS_.transpose();
292
293 /* adding 1st term (i.e. aa ensemble avg) of eq. 51 to DS_
294 * and of eq. 52 to DH_
295 */
296 for (auto potinfo : potentials_) {
297
298 if (potinfo->bonded) {
299 AAavgBonded(potinfo);
300 } else {
301 AAavgNonbonded(potinfo);
302 }
303 }
304}
305
306// update lamda = lamda + relax*dlamda
308
309 // first solve HS_ dx = - DS_
310 Eigen::LLT<Eigen::MatrixXd> cholesky(HS_); // compute the Cholesky
311 // decomposition of HS_
312 Eigen::VectorXd dlamda = cholesky.solve(-DS_);
313 if (cholesky.info() == Eigen::ComputationInfo::NumericalIssue) {
314
315 /* then can not use Newton-Raphson
316 * steepest descent with line-search may be helpful
317 * not implemented yet!
318 */
319 if (hessian_check_) {
320 throw runtime_error(
321 "Hessian NOT a positive definite!\n"
322 "This can be a result of poor initial guess or "
323 "ill-suited CG potential settings or poor CG sampling.\n");
324 } else {
325
326 cout << "****************** WARNING *****************" << endl;
327 cout << "Hessian H NOT a positive definite!" << endl;
328 cout << "This can be a result of poor initial guess or ill-suited CG "
329 "potential settings or poor CG sampling."
330 << endl;
331 cout << "********************************************" << endl;
332 cout << endl;
333 cout << "However, you want to proceed despite non-positive definite H."
334 << endl;
335 cout << "Non-positive H does not gurantee relative entropy iterations to "
336 "converge to minimum."
337 << endl;
338 cout << "You can turn on Hessian check by setting command line option "
339 "--hessian-check=true."
340 << endl;
341
342 cout << "In this case, alternative update option is steepest descent."
343 << endl;
344 dlamda = -DS_;
345 }
346 }
347
348 lamda_ = lamda_ + relax_ * dlamda;
349
350 // now update parameters of individual cg potentials
351 for (auto &potential_ : potentials_) {
352
353 votca::Index pos_start = potential_->vec_pos;
354 votca::Index pos_max = pos_start + potential_->ucg->getOptParamSize();
355
356 for (votca::Index row = pos_start; row < pos_max; row++) {
357
358 votca::Index lamda_i = row - pos_start;
359 potential_->ucg->setOptParam(lamda_i, lamda_(row));
360
361 } // end row loop
362
363 } // end potiter loop
364}
365
366// do non bonded potential AA ensemble avg energy computations
368
369 votca::Index pos_start = potinfo->vec_pos;
370 votca::Index pos_max = pos_start + potinfo->ucg->getOptParamSize();
371 double dU_i, d2U_ij;
372 double U;
373 votca::Index indx = potinfo->potentialIndex;
374
375 // compute avg AA energy
376 U = 0.0;
377
378 // assuming rdf bins are of same size
379 double step = aardfs_[indx]->x(2) - aardfs_[indx]->x(1);
380
381 for (votca::Index bin = 0; bin < aardfs_[indx]->size(); bin++) {
382
383 double r_hist = aardfs_[indx]->x(bin);
384 double r1 = r_hist - 0.5 * step;
385 double r2 = r1 + step;
386 double n_hist =
387 aardfs_[indx]->y(bin) * (*aardfnorms_[indx]) *
388 (4. / 3. * votca::tools::conv::Pi * (r2 * r2 * r2 - r1 * r1 * r1));
389
390 if (n_hist > 0.0) {
391 U += n_hist * potinfo->ucg->CalculateF(r_hist);
392 }
393 }
394
395 UavgAA_ += U;
396
397 // computing dU/dlamda and d2U/dlamda_i dlamda_j
398 for (votca::Index row = pos_start; row < pos_max; row++) {
399
400 // ith parameter of this potential
401 votca::Index lamda_i = row - pos_start;
402
403 // compute dU/dlamda and add to DS_
404 dU_i = 0.0;
405
406 for (votca::Index bin = 0; bin < aardfs_[indx]->size(); bin++) {
407
408 double r_hist = aardfs_[indx]->x(bin);
409 double r1 = r_hist - 0.5 * step;
410 double r2 = r1 + step;
411 double n_hist =
412 aardfs_[indx]->y(bin) * (*aardfnorms_[indx]) *
413 (4. / 3. * votca::tools::conv::Pi * (r2 * r2 * r2 - r1 * r1 * r1));
414
415 if (n_hist > 0.0) {
416 dU_i += n_hist * potinfo->ucg->CalculateDF(lamda_i, r_hist);
417 }
418
419 } // end loop over hist
420
421 DS_(row) += (beta_ * dU_i);
422
423 for (votca::Index col = row; col < pos_max; col++) {
424
425 votca::Index lamda_j = col - pos_start;
426
427 // compute d2U/dlamda_i dlamda_j and add to HS_
428 d2U_ij = 0.0;
429
430 for (votca::Index bin = 0; bin < aardfs_[indx]->size(); bin++) {
431
432 double r_hist = aardfs_[indx]->x(bin);
433 double r1 = r_hist - 0.5 * step;
434 double r2 = r1 + step;
435 double n_hist =
436 aardfs_[indx]->y(bin) * (*aardfnorms_[indx]) *
437 (4. / 3. * votca::tools::conv::Pi * (r2 * r2 * r2 - r1 * r1 * r1));
438
439 if (n_hist > 0.0) {
440 d2U_ij +=
441 n_hist * potinfo->ucg->CalculateD2F(lamda_i, lamda_j, r_hist);
442 }
443
444 } // end loop pair_iter
445
446 HS_(row, col) += (beta_ * d2U_ij);
447 if (row != col) {
448 HS_(col, row) += (beta_ * d2U_ij);
449 }
450 } // end loop col
451
452 } // end loop row
453}
454
455// do bonded potential AA ensemble avg energy computations
457
458std::unique_ptr<CsgApplication::Worker> CsgREupdate::ForkWorker() {
459
460 auto worker = std::make_unique<CsgREupdateWorker>();
461
462 // initialize worker
463 worker->options_ = options_;
464 worker->nonbonded_ = nonbonded_;
465 worker->nlamda_ = 0;
466
467 for (Property *prop : nonbonded_) {
468
469 PotentialInfo *i = new PotentialInfo(worker->potentials_.size(), false,
470 worker->nlamda_, param_in_ext_, prop);
471 // update parameter counter
472 worker->nlamda_ += i->ucg->getOptParamSize();
473
474 worker->potentials_.push_back(i);
475 }
476
477 worker->lamda_.resize(worker->nlamda_);
478
479 // need to store initial guess of parameters in lamda_
480 for (PotentialInfo *pot : worker->potentials_) {
481
482 votca::Index pos_start = pot->vec_pos;
483 votca::Index pos_max = pos_start + pot->ucg->getOptParamSize();
484
485 for (votca::Index row = pos_start; row < pos_max; row++) {
486
487 votca::Index lamda_i = row - pos_start;
488 worker->lamda_(row) = pot->ucg->getOptParam(lamda_i);
489
490 } // end row loop
491
492 } // end potiter loop
493
494 worker->DS_ = Eigen::VectorXd::Zero(worker->nlamda_);
495 worker->HS_ = Eigen::MatrixXd::Zero(worker->nlamda_, worker->nlamda_);
496 worker->dUFrame_ = Eigen::VectorXd::Zero(worker->nlamda_);
497 worker->nframes_ = 0.0; // no frames processed yet!
498 // set Temperature
499 worker->beta_ = (1.0 / worker->options_.get("cg.inverse.kBT").as<double>());
500 worker->UavgCG_ = 0.0;
501
502 return worker;
503}
504
506
507 CsgREupdateWorker *myCsgREupdateWorker;
508 myCsgREupdateWorker = dynamic_cast<CsgREupdateWorker *>(worker);
509 UavgCG_ += myCsgREupdateWorker->UavgCG_;
510 nframes_ += myCsgREupdateWorker->nframes_;
511 DS_ += myCsgREupdateWorker->DS_;
512 HS_ += myCsgREupdateWorker->HS_;
513}
514
516
517 /* as per Relative Entropy Ref. J. Chem. Phys. 134, 094112, 2011
518 * for each CG we need to compute dU/dlamda and d2U/dlamda_i dlamda_j
519 * here, we add running sum of the second term of eq. 51 and store it
520 * in DS_, ensemble averaging and first term addition is done in EndEvaluate
521 * for eq. 52, here the running sum of second and third terms is computed
522 * and added to HS_, addition of 1st and 4th term and ensemble average
523 * is performed in EndEvalute
524 * 3rd term of eq. 52 can not be computed in EvalBonded/EvalNonbonded
525 * since only one CG potential is accessible in there.
526 * hence store current frame dU/dlamda in dUFrame_!
527 */
528
529 dUFrame_.setZero();
530
531 for (PotentialInfo *potinfo : potentials_) {
532
533 if (potinfo->bonded) {
534 EvalBonded(conf, potinfo);
535 } else {
536 EvalNonbonded(conf, potinfo);
537 }
538 }
539 // update DS_ and HS_
540 DS_ -= beta_ * dUFrame_;
541 HS_ += beta_ * beta_ * dUFrame_ * dUFrame_.transpose();
542
543 nframes_++;
544}
545
546// do nonbonded potential related update stuff for the current frame in
547// evalconfig
549
550 BeadList beads1, beads2;
551 beads1.Generate(*conf, potinfo->type1);
552 beads2.Generate(*conf, potinfo->type2);
553
554 if (beads1.size() == 0) {
555 throw std::runtime_error("Topology does not have beads of type \"" +
556 potinfo->type1 +
557 "\"\n"
558 "This was specified in type1 of interaction \"" +
559 potinfo->potentialName + "\"");
560 }
561 if (beads2.size() == 0) {
562 throw std::runtime_error("Topology does not have beads of type \"" +
563 potinfo->type2 +
564 "\"\n"
565 "This was specified in type2 of interaction \"" +
566 potinfo->potentialName + "\"");
567 }
568
569 std::unique_ptr<NBList> nb;
570 bool gridsearch = false;
571
572 if (options_.exists("cg.nbsearch")) {
573
574 if (options_.get("cg.nbsearch").as<string>() == "grid") {
575 gridsearch = true;
576 } else if (options_.get("cg.nbsearch").as<string>() == "simple") {
577 gridsearch = false;
578 } else {
579 throw std::runtime_error("cg.nbsearch invalid, can be grid or simple");
580 }
581 }
582
583 if (gridsearch) {
584 nb = std::make_unique<NBListGrid>();
585 } else {
586 nb = std::make_unique<NBList>();
587 }
588
589 nb->setCutoff(potinfo->ucg->getCutOff());
590
591 if (potinfo->type1 == potinfo->type2) { // same beads
592 nb->Generate(beads1, true);
593 } else { // different beads
594 nb->Generate(beads1, beads2, true);
595 }
596
597 votca::Index pos_start = potinfo->vec_pos;
598 votca::Index pos_max = pos_start + potinfo->ucg->getOptParamSize();
599
600 // compute total energy
601 double U = 0.0;
602 for (auto &pair_iter : *nb) {
603 U += potinfo->ucg->CalculateF(pair_iter->dist());
604 }
605
606 UavgCG_ += U;
607
608 // computing dU/dlamda and d2U/dlamda_i dlamda_j
609 for (votca::Index row = pos_start; row < pos_max; row++) {
610
611 votca::Index lamda_i = row - pos_start;
612
613 double dU_i = 0.0;
614 for (auto &pair_iter : *nb) {
615 dU_i += potinfo->ucg->CalculateDF(lamda_i, pair_iter->dist());
616 }
617
618 dUFrame_(row) = dU_i;
619
620 for (votca::Index col = row; col < pos_max; col++) {
621
622 votca::Index lamda_j = col - pos_start;
623 double d2U_ij = 0.0;
624
625 for (auto &pair_iter : *nb) {
626 d2U_ij +=
627 potinfo->ucg->CalculateD2F(lamda_i, lamda_j, pair_iter->dist());
628 }
629
630 HS_(row, col) -= beta_ * d2U_ij;
631 if (row != col) {
632 HS_(col, row) -= beta_ * d2U_ij;
633 }
634 } // end loop col
635
636 } // end loop row
637}
638
639// do bonded potential related update stuff for the current frame in evalconfig
641
643 votca::Index vec_pos_, string &param_in_ext_,
644 Property *options, bool gentable) {
645
646 potentialIndex = index;
647 bonded = bonded_;
648 vec_pos = vec_pos_;
649 options_ = options;
650
651 potentialName = options_->get("name").value();
652 type1 = options_->get("type1").value();
653 type2 = options_->get("type2").value();
654 potentialFunction = options_->get("re.function").value();
655
656 rmin = options_->get("min").as<double>();
657 rcut = options_->get("max").as<double>();
658
659 // assign the user selected function form for this potential
660 if (potentialFunction == "lj126") {
662 } else if (potentialFunction == "ljg") {
664 } else if (potentialFunction == "cbspl") {
665 // get number of B-splines coefficients which are to be optimized
666 votca::Index nlam = options_->get("re.cbspl.nknots").as<votca::Index>();
667
668 if (!gentable) {
669 // determine minimum for B-spline from CG-MD rdf
670
671 Table dist;
672 string filename = potentialName + ".dist.new";
673 try {
674 dist.Load(filename);
675 // for( Index i = 0; i < dist.size(); i++)
676 // In the highly repulsive core (<0.1 nm) at some locations
677 // an unphysical non-zero RDF value may occur,
678 // so it would be better to estimate Rmin loop
679 // through RDF values from Rcut to zero instead of zero to Rcut.
680 double new_min = 0.0;
681 for (votca::Index i = dist.size() - 2; i > 0; i--) {
682 if (dist.y(i) < 1.0e-4) {
683 new_min = dist.x(i + 1);
684 break;
685 }
686 }
687 // setting extrapolation region based on CG rdf
688 rmin = new_min;
689
690 } catch (std::runtime_error &) {
691 throw std::runtime_error(
692 "Missing file for CG rdf for the interaction " + potentialName +
693 "." + " Make sure CG RDF for the pair " + potentialName +
694 " is computed after CG-MD simulation.");
695 }
696 }
698 } else {
699 throw std::runtime_error(
700 "Function form \"" + potentialFunction + "\" selected for \"" +
701 potentialName + "\" is not available yet.\n" +
702 "Please specify either \"lj126, ljg, or cbspl\" " + "in options file.");
703 }
704 // initialize cg potential with old parameters
705 string oldparam_file_name = potentialName + "." + param_in_ext_;
706 ucg->setParam(oldparam_file_name);
707}
PotentialContainer potentials_
void EvalConfiguration(Topology *conf, Topology *conf_atom) override
overload with the actual computation
votca::Index nframes_
Eigen::VectorXd dUFrame_
Eigen::VectorXd DS_
void EvalBonded(Topology *conf, PotentialInfo *potinfo)
Eigen::MatrixXd HS_
void EvalNonbonded(Topology *conf, PotentialInfo *potinfo)
void Run() override
Main body of application.
Property options_
std::string pot_out_ext_
std::vector< Property * > nonbonded_
PotentialContainer potentials_
void MergeWorker(Worker *worker) override
std::vector< double * > aardfnorms_
void AAavgNonbonded(PotentialInfo *potinfo)
std::unique_ptr< CsgApplication::Worker > ForkWorker(void) override
void LoadOptions(const std::string &file)
void AAavgBonded(PotentialInfo *potinfo)
void REFormulateLinEq()
votca::Index nlamda_
bool hessian_check_
votca::Index nframes_
std::vector< Table * > aardfs_
Eigen::VectorXd lamda_
void EndEvaluate() override
called after the last frame
bool EvaluateOptions() override
Process command line options.
void Initialize() override
Initialize application data.
void BeginEvaluate(Topology *top, Topology *top_atom=nullptr) override
called before the first frame
void WriteOutFiles()
std::string param_in_ext_
void REUpdateLamda()
Eigen::MatrixXd HS_
Eigen::VectorXd DS_
std::string param_out_ext_
Eigen::VectorXd dUFrame_
Index Generate(Topology &top, const std::string &select)
Select all beads of type "select".
Definition beadlist.cc:30
Index size() const
Definition beadlist.h:52
Worker, derived from Thread, does the work.
bool EvaluateOptions() override
Process command line options.
void Initialize() override
Initialize application data.
void Run(void) override
Main body of application.
virtual double CalculateD2F(Index i, Index j, double r) const =0
virtual Index getOptParamSize() const
virtual double CalculateDF(Index i, double r) const =0
virtual double CalculateF(double r) const =0
virtual void setParam(std::string filename)
topology of the whole system
Definition topology.h:81
double BoxVolume() const
Definition topology.cc:248
int Exec(int argc, char **argv)
executes the program
boost::program_options::variables_map & OptionsMap()
get available program options & descriptions
boost::program_options::options_description_easy_init AddProgramOptions(const std::string &group="")
add option for command line
void CheckRequired(const std::string &option_name, const std::string &error_msg="")
Check weather required option is set.
class to manage program options with xml serialization functionality
Definition property.h:55
Property & get(const std::string &key)
get existing property
Definition property.cc:79
std::string & value()
reference to value of property
Definition property.h:153
bool exists(const std::string &key) const
check whether property exists
Definition property.cc:122
T as() const
return value as type
Definition property.h:283
std::vector< Property * > Select(const std::string &filter)
select property based on a filter
Definition property.cc:185
void LoadFromXML(std::string filename)
Definition property.cc:238
class to store tables like rdfs, tabulated potentials, etc
Definition table.h:36
double & x(Index i)
Definition table.h:44
Index size() const
Definition table.h:42
void Load(std::string filename)
Definition table.cc:47
double & y(Index i)
Definition table.h:45
break string into words
Definition tokenizer.h:72
std::vector< T > ToVector()
store all words in a vector of type T, does type conversion.
Definition tokenizer.h:109
int main(int argc, char **argv)
STL namespace.
const double Pi
Definition constants.h:36
Eigen::Index Index
Definition types.h:26
votca::Index vec_pos
votca::Index potentialIndex
std::string potentialName
std::string type2
std::string potentialFunction
Property * options_
PotentialInfo(votca::Index index, bool bonded_, votca::Index vec_pos_, std::string &param_in_ext_, Property *options, bool gentable=false)
PotentialFunction * ucg
std::string type1