56#include "brains/Register.hpp"
59#include "brains/Thermo.hpp"
60#include "brains/Velocitizer.hpp"
61#include "constraints/Shake.hpp"
63#include "flucq/FluctuatingChargeConstraints.hpp"
64#include "flucq/FluctuatingChargeDamped.hpp"
69#include "optimization/BoxObjectiveFunction.hpp"
72#include "optimization/OptimizationFactory.hpp"
84template<
typename Real>
85class Vector6 :
public Vector<Real, 6> {
87 using ElemType = Real;
88 using ElemPoinerType = Real*;
90 Vector6() :
Vector<Real, 6>() {}
93 inline Vector6(RealType v0, RealType v1, RealType v2, RealType v3,
94 RealType v4, RealType v5) {
103 inline Vector6(Real* array) :
Vector<Real, 6>(array) {}
108 if (
this == &v) {
return *
this; }
114using Vector6d = Vector6<RealType>;
116RealType slope(
const std::vector<RealType>& x,
const std::vector<RealType>& y) {
122 const size_t n = x.size();
123 const RealType s_x = std::accumulate(x.begin(), x.end(), 0.0);
124 const RealType s_y = std::accumulate(y.begin(), y.end(), 0.0);
125 const RealType s_xx = std::inner_product(x.begin(), x.end(), x.begin(), 0.0);
126 const RealType s_xy = std::inner_product(x.begin(), x.end(), y.begin(), 0.0);
127 const RealType a = (n * s_xy - s_x * s_y) / (n * s_xx - s_x * s_x);
131void quadraticFit(
const std::vector<RealType>& x,
132 const std::vector<RealType>& y, RealType& a, RealType& b,
134 RealType s00 = RealType(x.size());
135 RealType s10(0.0), s20(0.0), s30(0.0), s40(0.0);
136 RealType s01(0.0), s11(0.0), s21(0.0);
138 for (
size_t i = 0; i < x.size(); i++) {
146 s21 += pow(x[i], 2) * y[i];
150 RealType D = (s40 * (s20 * s00 - s10 * s10) - s30 * (s30 * s00 - s10 * s20) +
151 s20 * (s30 * s10 - s20 * s20));
153 a = (s21 * (s20 * s00 - s10 * s10) - s11 * (s30 * s00 - s10 * s20) +
154 s01 * (s30 * s10 - s20 * s20)) /
157 b = (s40 * (s11 * s00 - s01 * s10) - s30 * (s21 * s00 - s01 * s20) +
158 s20 * (s21 * s10 - s11 * s20)) /
161 c = (s40 * (s20 * s01 - s10 * s11) - s30 * (s30 * s01 - s10 * s21) +
162 s20 * (s30 * s11 - s20 * s21)) /
170 std::cout << left << title <<
" (" << units <<
"):" << std::endl;
171 std::cout << std::endl;
174 std::cout << right << setw(12) << M(0, 0) <<
" ";
175 std::cout << right << setw(12) << M(0, 1) <<
" ";
176 std::cout << right << setw(12) << M(0, 2) <<
" ";
177 std::cout << right << setw(12) << M(0, 3) <<
" ";
178 std::cout << right << setw(12) << M(0, 4) <<
" ";
179 std::cout << right << setw(12) << M(0, 5);
180 std::cout << std::endl;
183 std::cout << right << setw(12) << M(1, 0) <<
" ";
184 std::cout << right << setw(12) << M(1, 1) <<
" ";
185 std::cout << right << setw(12) << M(1, 2) <<
" ";
186 std::cout << right << setw(12) << M(1, 3) <<
" ";
187 std::cout << right << setw(12) << M(1, 4) <<
" ";
188 std::cout << right << setw(12) << M(1, 5);
189 std::cout << std::endl;
192 std::cout << right << setw(12) << M(2, 0) <<
" ";
193 std::cout << right << setw(12) << M(2, 1) <<
" ";
194 std::cout << right << setw(12) << M(2, 2) <<
" ";
195 std::cout << right << setw(12) << M(2, 3) <<
" ";
196 std::cout << right << setw(12) << M(2, 4) <<
" ";
197 std::cout << right << setw(12) << M(2, 5);
198 std::cout << std::endl;
201 std::cout << right << setw(12) << M(3, 0) <<
" ";
202 std::cout << right << setw(12) << M(3, 1) <<
" ";
203 std::cout << right << setw(12) << M(3, 2) <<
" ";
204 std::cout << right << setw(12) << M(3, 3) <<
" ";
205 std::cout << right << setw(12) << M(3, 4) <<
" ";
206 std::cout << right << setw(12) << M(3, 5);
207 std::cout << std::endl;
210 std::cout << right << setw(12) << M(4, 0) <<
" ";
211 std::cout << right << setw(12) << M(4, 1) <<
" ";
212 std::cout << right << setw(12) << M(4, 2) <<
" ";
213 std::cout << right << setw(12) << M(4, 3) <<
" ";
214 std::cout << right << setw(12) << M(4, 4) <<
" ";
215 std::cout << right << setw(12) << M(4, 5);
216 std::cout << std::endl;
219 std::cout << right << setw(12) << M(5, 0) <<
" ";
220 std::cout << right << setw(12) << M(5, 1) <<
" ";
221 std::cout << right << setw(12) << M(5, 2) <<
" ";
222 std::cout << right << setw(12) << M(5, 3) <<
" ";
223 std::cout << right << setw(12) << M(5, 4) <<
" ";
224 std::cout << right << setw(12) << M(5, 5);
225 std::cout << std::endl;
226 std::cout << std::endl;
229void writeBoxGeometries(
Mat3x3d org,
Mat3x3d opt, std::string title1,
230 std::string title2, std::string units) {
231 std::cout << left << title1 <<
" (" << units <<
"):" << std::endl;
232 std::cout << std::endl;
234 std::cout << right << setw(12) << org(0, 0) <<
" ";
235 std::cout << right << setw(12) << org(0, 1) <<
" ";
236 std::cout << right << setw(12) << org(0, 2) <<
" ";
237 std::cout << std::endl;
239 std::cout << right << setw(12) << org(1, 0) <<
" ";
240 std::cout << right << setw(12) << org(1, 1) <<
" ";
241 std::cout << right << setw(12) << org(1, 2) <<
" ";
242 std::cout << std::endl;
244 std::cout << right << setw(12) << org(2, 0) <<
" ";
245 std::cout << right << setw(12) << org(2, 1) <<
" ";
246 std::cout << right << setw(12) << org(2, 2) <<
" ";
247 std::cout << std::endl;
248 std::cout << std::endl;
249 std::cout << left << title2 <<
" (" << units <<
"):" << std::endl;
250 std::cout << std::endl;
252 std::cout << right << setw(12) << opt(0, 0) <<
" ";
253 std::cout << right << setw(12) << opt(0, 1) <<
" ";
254 std::cout << right << setw(12) << opt(0, 2) <<
" ";
255 std::cout << std::endl;
257 std::cout << right << setw(12) << opt(1, 0) <<
" ";
258 std::cout << right << setw(12) << opt(1, 1) <<
" ";
259 std::cout << right << setw(12) << opt(1, 2) <<
" ";
260 std::cout << std::endl;
262 std::cout << right << setw(12) << opt(2, 0) <<
" ";
263 std::cout << right << setw(12) << opt(2, 1) <<
" ";
264 std::cout << right << setw(12) << opt(2, 2) <<
" ";
265 std::cout << std::endl;
266 std::cout << std::endl;
271 RealType C11 = C(0, 0);
272 RealType C22 = C(1, 1);
273 RealType C33 = C(2, 2);
274 RealType C12 = C(0, 1);
275 RealType C23 = C(1, 2);
276 RealType C31 = C(2, 0);
277 RealType C44 = C(3, 3);
278 RealType C55 = C(4, 4);
279 RealType C66 = C(5, 5);
281 RealType S11 = S(0, 0);
282 RealType S22 = S(1, 1);
283 RealType S33 = S(2, 2);
284 RealType S12 = S(0, 1);
285 RealType S23 = S(1, 2);
286 RealType S31 = S(2, 0);
287 RealType S44 = S(3, 3);
288 RealType S55 = S(4, 4);
289 RealType S66 = S(5, 5);
313 RealType Kv = ((C11 + C22 + C33) + 2.0 * (C12 + C23 + C31)) / 9.0;
315 RealType Kr = 1.0 / ((S11 + S22 + S33) + 2.0 * (S12 + S23 + S31));
318 ((C11 + C22 + C33) - (C12 + C23 + C31) + 3.0 * (C44 + C55 + C66)) / 15.0;
320 RealType Gr = 15.0 / (4.0 * (S11 + S22 + S33) - 4.0 * (S12 + S23 + S31) +
321 3.0 * (S44 + S55 + S66));
323 RealType Kh = (Kv + Kr) / 2.0;
325 RealType Gh = (Gv + Gr) / 2.0;
327 RealType Au = 5.0 * (Gv / Gr) + (Kv / Kr) - 6.0;
329 RealType muv = (1.0 - 3.0 * Gv / (3.0 * Kv + Gv)) / 2.0;
330 RealType mur = (1.0 - 3.0 * Gr / (3.0 * Kr + Gr)) / 2.0;
331 RealType muh = (1.0 - 3.0 * Gh / (3.0 * Kh + Gh)) / 2.0;
333 RealType Ev = 1.0 / (1.0 / (3.0 * Gv) + 1.0 / (9.0 * Kv));
334 RealType Er = 1.0 / (1.0 / (3.0 * Gr) + 1.0 / (9.0 * Kr));
335 RealType Eh = 1.0 / (1.0 / (3.0 * Gh) + 1.0 / (9.0 * Kh));
337 std::cout <<
" " << setw(12) <<
"Voigt"
338 <<
" " << setw(12) <<
"Reuss"
339 <<
" " << setw(12) <<
"Hill\n";
340 std::cout <<
"Bulk modulus: " << setw(12) << Kv <<
" "
341 << setw(12) << Kr <<
" " << setw(12) << Kh <<
" (GPa)\n";
343 std::cout <<
"Shear modulus: " << setw(12) << Gv <<
" "
344 << setw(12) << Gr <<
" " << setw(12) << Gh <<
" (GPa)\n";
346 std::cout <<
"Young\'s modulus (isotropic): " << setw(12) << Ev <<
" "
347 << setw(12) << Er <<
" " << setw(12) << Eh <<
" (GPa)\n";
349 std::cout <<
"Poisson\'s Ratio: " << setw(12) << muv <<
" "
350 << setw(12) << mur <<
" " << setw(12) << muh <<
"\n";
352 std::cout <<
"Universal elastic Anisotropy: " << setw(12) << Au <<
"\n";
379int main(
int argc,
char* argv[]) {
381 std::string inputFileName;
382 std::string outputFileName;
387 if (cmdline_parser(argc, argv, &args_info) != 0) {
388 cmdline_parser_print_help();
397 inputFileName = args_info.
inputs[0];
399 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
400 "No input file name was specified on the command line");
401 painCave.severity = OPENMD_ERROR;
402 painCave.isFatal = 1;
419 if (!method.compare(
"energy")) {
445 std::vector<Vector6d> eStrains;
448 eStrains.push_back(Vector6d(1., 0., 0., 0., 0., 0.));
449 eStrains.push_back(Vector6d(0., 1., 0., 0., 0., 0.));
450 eStrains.push_back(Vector6d(0., 0., 1., 0., 0., 0.));
451 eStrains.push_back(Vector6d(0., 0., 0., 2., 0., 0.));
452 eStrains.push_back(Vector6d(0., 0., 0., 0., 2., 0.));
453 eStrains.push_back(Vector6d(0., 0., 0., 0., 0., 2.));
454 eStrains.push_back(Vector6d(1., 1., 0., 0., 0., 0.));
455 eStrains.push_back(Vector6d(1., 0., 1., 0., 0., 0.));
456 eStrains.push_back(Vector6d(1., 0., 0., 2., 0., 0.));
457 eStrains.push_back(Vector6d(1., 0., 0., 0., 2., 0.));
458 eStrains.push_back(Vector6d(1., 0., 0., 0., 0., 2.));
459 eStrains.push_back(Vector6d(0., 1., 1., 0., 0., 0.));
460 eStrains.push_back(Vector6d(0., 1., 0., 2., 0., 0.));
461 eStrains.push_back(Vector6d(0., 1., 0., 0., 2., 0.));
462 eStrains.push_back(Vector6d(0., 1., 0., 0., 0., 2.));
463 eStrains.push_back(Vector6d(0., 0., 1., 2., 0., 0.));
464 eStrains.push_back(Vector6d(0., 0., 1., 0., 2., 0.));
465 eStrains.push_back(Vector6d(0., 0., 1., 0., 0., 2.));
466 eStrains.push_back(Vector6d(0., 0., 0., 2., 2., 0.));
467 eStrains.push_back(Vector6d(0., 0., 0., 2., 0., 2.));
468 eStrains.push_back(Vector6d(0., 0., 0., 0., 2., 2.));
494 std::vector<Vector6d> sStrains;
495 sStrains.push_back(Vector6d(1., 2., 3., 4., 5., 6.));
496 sStrains.push_back(Vector6d(-2., 1., 4., -3., 6., -5.));
497 sStrains.push_back(Vector6d(3., -5., -1., 6., 2., -4.));
498 sStrains.push_back(Vector6d(-4., -6., 5., 1., -3., 2.));
499 sStrains.push_back(Vector6d(5., 4., 6., -2., -1., -3.));
500 sStrains.push_back(Vector6d(-6., 3., -2., 5., -4., 1.));
502 std::vector<Vector6d> strainBasis;
504 if (!method.compare(
"energy")) {
505 strainBasis = eStrains;
507 strainBasis = sStrains;
514 RealType mat[36][21] = {
515 {1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
516 {0, 1, 0, 0, 0, 0, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
517 {0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0},
518 {0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 4, 5, 6, 0, 0, 0},
519 {0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 4, 0, 5, 6, 0},
520 {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 4, 0, 5, 6},
521 {-2, 1, 4, -3, 6, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
522 {0, -2, 0, 0, 0, 0, 1, 4, -3, 6, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
523 {0, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 4, -3, 6, -5, 0, 0, 0, 0, 0, 0},
524 {0, 0, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, -3, 6, -5, 0, 0, 0},
525 {0, 0, 0, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, -3, 0, 6, -5, 0},
526 {0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, -3, 0, 6, -5},
527 {3, -5, -1, 6, 2, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
528 {0, 3, 0, 0, 0, 0, -5, -1, 6, 2, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
529 {0, 0, 3, 0, 0, 0, 0, -5, 0, 0, 0, -1, 6, 2, -4, 0, 0, 0, 0, 0, 0},
530 {0, 0, 0, 3, 0, 0, 0, 0, -5, 0, 0, 0, -1, 0, 0, 6, 2, -4, 0, 0, 0},
531 {0, 0, 0, 0, 3, 0, 0, 0, 0, -5, 0, 0, 0, -1, 0, 0, 6, 0, 2, -4, 0},
532 {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, -5, 0, 0, 0, -1, 0, 0, 6, 0, 2, -4},
533 {-4, -6, 5, 1, -3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
534 {0, -4, 0, 0, 0, 0, -6, 5, 1, -3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
535 {0, 0, -4, 0, 0, 0, 0, -6, 0, 0, 0, 5, 1, -3, 2, 0, 0, 0, 0, 0, 0},
536 {0, 0, 0, -4, 0, 0, 0, 0, -6, 0, 0, 0, 5, 0, 0, 1, -3, 2, 0, 0, 0},
537 {0, 0, 0, 0, -4, 0, 0, 0, 0, -6, 0, 0, 0, 5, 0, 0, 1, 0, -3, 2, 0},
538 {0, 0, 0, 0, 0, -4, 0, 0, 0, 0, -6, 0, 0, 0, 5, 0, 0, 1, 0, -3, 2},
539 {5, 4, 6, -2, -1, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
540 {0, 5, 0, 0, 0, 0, 4, 6, -2, -1, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
541 {0, 0, 5, 0, 0, 0, 0, 4, 0, 0, 0, 6, -2, -1, -3, 0, 0, 0, 0, 0, 0},
542 {0, 0, 0, 5, 0, 0, 0, 0, 4, 0, 0, 0, 6, 0, 0, -2, -1, -3, 0, 0, 0},
543 {0, 0, 0, 0, 5, 0, 0, 0, 0, 4, 0, 0, 0, 6, 0, 0, -2, 0, -1, -3, 0},
544 {0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 4, 0, 0, 0, 6, 0, 0, -2, 0, -1, -3},
545 {-6, 3, -2, 5, -4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
546 {0, -6, 0, 0, 0, 0, 3, -2, 5, -4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
547 {0, 0, -6, 0, 0, 0, 0, 3, 0, 0, 0, -2, 5, -4, 1, 0, 0, 0, 0, 0, 0},
548 {0, 0, 0, -6, 0, 0, 0, 0, 3, 0, 0, 0, -2, 0, 0, 5, -4, 1, 0, 0, 0},
549 {0, 0, 0, 0, -6, 0, 0, 0, 0, 3, 0, 0, 0, -2, 0, 0, 5, 0, -4, 1, 0},
550 {0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 3, 0, 0, 0, -2, 0, 0, 5, 0, -4, 1}};
560 Globals* simParams = info->getSimParams();
563 std::unique_ptr<Velocitizer> veloSet {std::make_unique<Velocitizer>(info)};
569 bool hasFlucQ =
false;
572 if (info->usesFluctuatingCharges()) {
575 flucQ->setForceManager(forceMan);
584 veloSet->removeComDrift();
587 std::cout <<
"Doing box optimization\n\n";
599 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
600 "Optimization Factory can not create %s OptimizationMethod\n",
601 miniPars->getMethod().c_str());
602 painCave.isFatal = 1;
610 Problem problem(boxObjf, noConstraint, dsf, initCoords);
612 int maxIter = miniPars->getMaxIterations();
613 int mssIter = miniPars->getMaxStationaryStateIterations();
614 RealType rEps = miniPars->getRootEpsilon();
615 RealType fEps = miniPars->getFunctionEpsilon();
616 RealType gnEps = miniPars->getGradientNormEpsilon();
617 RealType initialStepSize = miniPars->getInitialStepSize();
619 EndCriteria endCriteria(maxIter, mssIter, rEps, fEps, gnEps);
621 minim->
minimize(problem, endCriteria, initialStepSize);
626 writeBoxGeometries(oldHmat, newHmat,
"Original Box Geometry",
627 "Optimized Box Geometry",
"Angstroms");
633 forceMan->calcForces();
634 Mat3x3d ptRef = thermo.getPressureTensor();
635 RealType V0 = thermo.getVolume();
637 ptRef *= Constants::elasticConvert;
639 Vector6d stress(0.0);
640 Vector6d strain(0.0);
641 Vector6d lstress(0.0);
644 std::vector<std::vector<RealType>> stressStrain;
645 std::vector<RealType> strainValues;
646 std::vector<RealType> energyValues;
653 SimInfo::MoleculeIterator miter;
664 std::vector<RealType> A2;
670 for (std::vector<Vector6d>::iterator it = strainBasis.begin();
671 it != strainBasis.end(); ++it) {
673 int ii = std::distance(strainBasis.begin(), it);
675 strainValues.clear();
676 energyValues.clear();
677 stressStrain.clear();
678 stressStrain.resize(6);
680 for (
int n = 0; n < nMax; n++) {
682 de = -0.5 * dmax + dmax * RealType(n) / RealType(nMax - 1);
686 eta.setupVoigtTensor(L[0], L[1], L[2], L[3] / 2., L[4] / 2., L[5] / 2.);
689 if (eta.frobeniusNorm() > 0.7) {
690 std::cerr <<
"Deformation is too large!\n";
697 while (norm > 1.0e-10) {
698 x = eta - eps * eps / 2.0;
700 norm = test.frobeniusNorm();
711 delta = deformation * pos;
714 Mat3x3d Hmat = deformation * refHmat;
716 shake->constraintR();
717 forceMan->calcForces();
718 if (hasFlucQ) flucQ->applyConstraints();
719 shake->constraintF();
722 if (!method.compare(
"energy")) {
723 energy = thermo.getPotential();
724 energyValues.push_back(energy);
736 pressureTensor = thermo.getPressureTensor();
738 pressureTensor *= Constants::elasticConvert;
740 Mat3x3d tao = idm * (pressureTensor * idm);
743 lstress = tao.toVoigtTensor();
745 for (
int j = 0; j < 6; j++) {
746 stressStrain[j].push_back(lstress[j]);
750 strainValues.push_back(de);
755 if (!method.compare(
"energy")) {
756 quadraticFit(strainValues, energyValues, a, b, c);
757 A2.push_back(a * Constants::energyElasticConvert / V0);
759 for (
int j = 0; j < 6; j++) {
760 quadraticFit(strainValues, stressStrain[j], a, b, c);
761 sigma(6 * ii + j) = b;
767 if (!method.compare(
"energy")) {
768 C(0, 0) = 2. * A2[0];
769 C(0, 1) = 1. * (-A2[0] - A2[1] + A2[6]);
770 C(0, 2) = 1. * (-A2[0] - A2[2] + A2[7]);
771 C(0, 3) = .5 * (-A2[0] - A2[3] + A2[8]);
772 C(0, 4) = .5 * (-A2[0] + A2[9] - A2[4]);
773 C(0, 5) = .5 * (-A2[0] + A2[10] - A2[5]);
774 C(1, 1) = 2. * A2[1];
775 C(1, 2) = 1. * (A2[11] - A2[1] - A2[2]);
776 C(1, 3) = .5 * (A2[12] - A2[1] - A2[3]);
777 C(1, 4) = .5 * (A2[13] - A2[1] - A2[4]);
778 C(1, 5) = .5 * (A2[14] - A2[1] - A2[5]);
779 C(2, 2) = 2. * A2[2];
780 C(2, 3) = .5 * (A2[15] - A2[2] - A2[3]);
781 C(2, 4) = .5 * (A2[16] - A2[2] - A2[4]);
782 C(2, 5) = .5 * (A2[17] - A2[2] - A2[5]);
783 C(3, 3) = .5 * A2[3];
784 C(3, 4) = .25 * (A2[18] - A2[3] - A2[4]);
785 C(3, 5) = .25 * (A2[19] - A2[3] - A2[5]);
786 C(4, 4) = .5 * A2[4];
787 C(4, 5) = .25 * (A2[20] - A2[4] - A2[5]);
788 C(5, 5) = .5 * A2[5];
794 ci = qr.solve(sigma);
821 for (
int i = 0; i < 5; i++) {
822 for (
int j = i + 1; j < 6; j++) {
831 writeMatrix(C,
"Elastic Tensor",
"GPa");
832 writeMatrix(S,
"Compliance Tensor",
"GPa^-1");
834 writeMaterialProperties(C, S);
Abstract constraint class.
Abstract optimization method class.
Abstract optimization problem class.
Dynamically-sized vector class.
abstract class for propagating fluctuating charge variables
ForceManager is responsible for calculating both the short range (bonded) interactions and long range...
void moveCom(const Vector3d &delta)
Moves the center of this molecule.
Vector3d getCom()
Returns the current center of mass position of this molecule.
static OptimizationFactory & getInstance()
Returns an instance of Optimization factory.
QuantLib::OptimizationMethod * createOptimization(const std::string &id, SimInfo *info)
Looks up the type identifier in the internal map.
void negate()
Negates the value of this matrix in place.
The only responsibility of SimCreator is to parse the meta-data file and create a SimInfo instance ba...
SimInfo * createSim(const std::string &mdFileName, bool loadInitCoords=true)
Setup Simulation.
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Molecule * beginMolecule(MoleculeIterator &i)
Returns the first molecule in this SimInfo and intialize the iterator.
int getNFluctuatingCharges()
Returns the total number of fluctuating charges that are present.
Molecule * nextMolecule(MoleculeIterator &i)
Returns the next avaliable Molecule based on the iterator.
SnapshotManager * getSnapshotManager()
Returns the snapshot manager.
The Snapshot class is a repository storing dynamic data during a Simulation.
Mat3x3d getHmat()
Returns the H-Matrix.
void setHmat(const Mat3x3d &m)
Sets the H-Matrix.
Snapshot * getCurrentSnapshot()
Returns the pointer of current snapshot.
SquareMatrix3< Real > inverse() const
Sets the value of this matrix to the inverse of itself.
Real determinant() const
Returns the determinant of this matrix.
Vector< Real, Dim > & operator=(const Vector< Real, Dim > &v)
copy assignment operator
Criteria to end optimization process:
Abstract class for constrained optimization method.
virtual EndCriteria::Type minimize(Problem &P, const EndCriteria &endCriteria, RealType initialStepSize)=0
minimize the optimization problem P
Constrained optimization problem.
The header file for the command line option parser generated by GNU Gengetopt version 2....
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
void registerAll()
register force fields, integrators and optimizers
bool invertMatrix(MatrixType &A, MatrixType &AI)
Invert input square matrix A into matrix AI.
Where the command line options are stored.
unsigned inputs_num
unamed options number
char ** inputs
unamed options (options without names)
char * input_arg
input dump file.
unsigned int method_given
Whether method was given.
int npoints_arg
number of points for fitting stress-strain relationship (default='25').
unsigned int delta_given
Whether delta was given.
double delta_arg
size of relative volume changes for strains.
int box_flag
Optimize box geometry before performing calculation (default=off).
unsigned int input_given
Whether input was given.
char * method_arg
Calculation Method.