77
ThermostatShapeFunction(Thermostat * thermostat,
77
ThermostatShapeFunction(AtomicRegulator * thermostat,
78
78
const std::string & regulatorPrefix = "");
80
80
virtual ~ThermostatShapeFunction() {};
117
114
class ThermostatRescale : public ThermostatShapeFunction {
118
friend class KinetoThermostatRescale; // since this is sometimes used as a set of member functions for friend
121
ThermostatRescale(Thermostat * thermostat);
120
ThermostatRescale(AtomicRegulator * thermostat);
123
122
virtual ~ThermostatRescale() {};
128
127
/** applies thermostat to atoms in the post-corrector phase */
129
128
virtual void apply_post_corrector(double dt);
130
/** compute boundary flux, requires thermostat input since it is part of the coupling scheme */
131
virtual void compute_boundary_flux(FIELDS & fields)
132
{boundaryFlux_[TEMPERATURE] = 0.;};
131
134
/** get data for output */
132
135
virtual void output(OUTPUT_LIST & outputData);
139
/** set weighting factor for in matrix Nhat^T * weights * Nhat */
140
virtual void set_weights();
142
/** sets up and solves thermostat equations */
143
virtual void compute_thermostat(double dt);
136
145
/** apply solution to atomic quantities */
137
146
void apply_to_atoms(PerAtomQuantity<double> * atomVelocities);
139
/** correct the RHS for complex temperature definitions */
140
virtual void correct_rhs(DENS_MAT & rhs) {}; // base class does no correction, assuming kinetic definition
148
/** construct the RHS vector */
149
virtual void set_rhs(DENS_MAT & rhs);
142
151
/** FE temperature field */
143
152
DENS_MAN & nodalTemperature_;
180
/** correct the RHS for inclusion of the PE */
181
virtual void correct_rhs(DENS_MAT & rhs);
189
/** set weighting factor for in matrix Nhat^T * weights * Nhat */
190
virtual void set_weights();
192
/** construct the RHS vector */
193
virtual void set_rhs(DENS_MAT & rhs);
183
195
/** nodal fluctuating potential energy */
184
196
DENS_MAN * nodalAtomicFluctuatingPotentialEnergy_;
212
* @class ThermostatFsSolver
213
* @brief Class for solving the linear system for lambda
214
* (thermostats have general for of N^T w N lambda = rhs)
217
class ThermostatFsSolver : public RegulatorShapeFunction {
222
ThermostatFsSolver(AtomicRegulator * thermostat,
223
int lambdaMaxIterations,
224
const std::string & regulatorPrefix = "");
226
virtual ~ThermostatFsSolver() {};
228
/** pre-run initialization of method data */
229
virtual void initialize();
231
/* sets up and solves the linear system for lambda */
232
virtual void compute_lambda(const DENS_MAT & rhs,
233
bool iterateSolution = true);
236
virtual void scale_lambda(double factor) {*lambda_ *= factor;};
238
/** change the time step factor */
239
virtual void set_timestep_factor(double dtFactor) {dtFactor_ = dtFactor;};
244
/** solves the non-linear equation for lambda iteratively */
245
void iterate_lambda(const MATRIX & rhs);
247
/** set weighting factor for in matrix Nhat^T * weights * Nhat */
248
virtual void set_weights();
251
/** mapping from all to regulated nodes */
254
/** maximum number of iterations used in iterative solve for lambda */
255
int lambdaMaxIterations_;
257
/** pointer to the values of lambda interpolated to atoms */
258
DENS_MAN * rhsLambdaSquared_;
260
/** fraction of timestep over which constraint is exactly enforced */
264
DENS_MAT _lambdaOld_; // lambda from previous iteration
265
DENS_MAT _rhsOverlap_; // normal RHS vector mapped to overlap nodes
266
DENS_VEC _rhsTotal_; // normal + 2nd order RHS for the iteration loop
267
DENS_VEC _weightVector_, _maskedWeightVector_;
271
// DO NOT define this
272
ThermostatFsSolver();
200
277
* @class ThermostatGlcFs
201
* @brief Class for thermostat algorithms based on Gaussian least constraints (GLC) for fractional step (FS) algorithsm
278
* @brief Class for thermostat algorithms which perform the time-integration component of the fractional step method
204
class ThermostatGlcFs : public ThermostatShapeFunction {
281
class ThermostatGlcFs : public RegulatorMethod {
208
ThermostatGlcFs(Thermostat * thermostat,
285
ThermostatGlcFs(AtomicRegulator * thermostat,
286
int lambdaMaxIterations,
209
287
const std::string & regulatorPrefix = "");
211
289
virtual ~ThermostatGlcFs() {};
225
303
/** applies thermostat to atoms in the post-corrector phase */
226
304
virtual void apply_post_corrector(double dt);
306
/** compute boundary flux, requires regulator input since it is part of the coupling scheme */
307
virtual void compute_boundary_flux(FIELDS & fields);
228
309
/** get data for output */
229
310
virtual void output(OUTPUT_LIST & outputData);
231
312
/* flag for performing the full lambda prediction calculation */
232
313
bool full_prediction();
315
/** set up atom to material identification */
316
virtual void reset_atom_materials(const Array<int> & elementToMaterialMap,
317
const MatrixDependencyManager<DenseMatrix, int> * atomElement);
237
/** determine mapping from all nodes to those to which the thermostat applies */
238
void compute_rhs_map();
240
322
/** sets up appropriate rhs for thermostat equations */
241
323
virtual void set_thermostat_rhs(DENS_MAT & rhs,
257
339
virtual void compute_lambda(double dt,
258
340
bool iterateSolution = true);
260
/** solves the non-linear equation for lambda iteratively */
261
void iterate_lambda(const MATRIX & rhs);
343
/** solver for lambda linear system */
344
ThermostatFsSolver * lambdaSolver_;
347
/** MD mass matrix */
348
DIAG_MAN & mdMassMatrix_;
350
/** pointer to atom velocities */
351
FundamentalAtomQuantity * atomVelocities_;
264
353
/** reference to AtC FE temperature */
265
354
DENS_MAN & temperature_;
273
362
/** filtered lambda power */
274
363
DENS_MAN * lambdaPowerFiltered_;
365
/** lambda at atomic locations */
366
PerAtomQuantity<double> * atomLambdas_;
276
368
/** atomic force induced by lambda */
277
369
AtomicThermostatForce * atomThermostatForces_;
279
371
/** pointer to atom masses */
280
372
FundamentalAtomQuantity * atomMasses_;
282
/** pointer to the values of lambda interpolated to atoms */
283
DENS_MAN * rhsLambdaSquared_;
285
374
/** hack to determine if first timestep has been passed */
286
375
bool isFirstTimestep_;
288
/** maximum number of iterations used in iterative solve for lambda */
289
int lambdaMaxIterations_;
291
377
/** nodal atomic energy */
292
378
DENS_MAN * nodalAtomicEnergy_;
309
395
/** right-hand side data for thermostat equation */
312
/** mapping from all to regulated nodes */
315
/** fraction of timestep over which constraint is exactly enforced */
319
399
DENS_MAT _lambdaPowerOutput_; // power applied by lambda in output format
320
400
DENS_MAT _velocityDelta_; // change in velocity when lambda force is applied
321
401
DENS_VEC _lambdaOverlap_; // lambda in MD overlapping FE nodes
322
DENS_MAT _lambdaOld_; // lambda from previous iteration
323
DENS_MAT _rhsOverlap_; // normal RHS vector mapped to overlap nodes
324
DENS_VEC _rhsTotal_; // normal + 2nd order RHS for the iteration loop
334
* @class ThermostatFlux
411
* @class ThermostatSolverFlux
335
412
* @brief Class enforces GLC on atomic forces based on FE power when using fractional step time integration
338
class ThermostatFlux : public ThermostatGlcFs {
415
class ThermostatSolverFlux : public ThermostatFsSolver {
342
ThermostatFlux(Thermostat * thermostat,
343
const std::string & regulatorPrefix = "");
419
ThermostatSolverFlux(AtomicRegulator * thermostat,
420
int lambdaMaxIterations,
421
const std::string & regulatorPrefix = "");
345
virtual ~ThermostatFlux() {};
423
virtual ~ThermostatSolverFlux() {};
347
425
/** instantiate all needed data */
348
426
virtual void construct_transfers();
431
/** sets up the transfer which is the set of nodes being regulated */
432
virtual void construct_regulated_nodes();
436
// DO NOT define this
437
ThermostatSolverFlux();
442
* @class ThermostatIntegratorFlux
443
* @brief Class integrates GLC on atomic forces based on FE power when using fractional step time integration
446
class ThermostatIntegratorFlux : public ThermostatGlcFs {
450
ThermostatIntegratorFlux(AtomicRegulator * thermostat,
451
int lambdaMaxIterations,
452
const std::string & regulatorPrefix = "");
454
virtual ~ThermostatIntegratorFlux() {};
350
456
/** pre-run initialization of method data */
351
457
virtual void initialize();
373
476
// DO NOT define this
477
ThermostatIntegratorFlux();
379
* @class ThermostatFixed
482
* @class ThermostatSolverFixed
380
483
* @brief Class enforces GLC on atomic forces based on FE power when using fractional step time integration
383
class ThermostatFixed : public ThermostatGlcFs {
387
ThermostatFixed(Thermostat * thermostat,
388
const std::string & regulatorPrefix = "");
390
virtual ~ThermostatFixed() {};
486
class ThermostatSolverFixed : public ThermostatFsSolver {
490
ThermostatSolverFixed(AtomicRegulator * thermostat,
491
int lambdaMaxIterations,
492
const std::string & regulatorPrefix = "");
494
virtual ~ThermostatSolverFixed() {};
496
/** instantiate all needed data */
497
virtual void construct_transfers();
502
/** sets up the transfer which is the set of nodes being regulated */
503
virtual void construct_regulated_nodes();
507
// DO NOT define this
508
ThermostatSolverFixed();
513
* @class ThermostatIntegratorFixed
514
* @brief Class integrates GLC on atomic forces based on FE power when using fractional step time integration
517
class ThermostatIntegratorFixed : public ThermostatGlcFs {
521
ThermostatIntegratorFixed(AtomicRegulator * thermostat,
522
int lambdaMaxIterations,
523
const std::string & regulatorPrefix = "");
525
virtual ~ThermostatIntegratorFixed() {};
392
527
/** instantiate all needed data */
393
528
virtual void construct_transfers();
472
604
// DO NOT define this
605
ThermostatIntegratorFixed();
478
* @class ThermostatFluxFiltered
479
* @brief Class enforces GLC on atomic forces based on FE power when using fractional step time integration
610
* @class ThermostatIntegratorFluxFiltered
611
* @brief Class integrates GLC on atomic forces based on FE power when using fractional step time integration
480
612
* in conjunction with time filtering
483
class ThermostatFluxFiltered : public ThermostatFlux {
615
class ThermostatIntegratorFluxFiltered : public ThermostatIntegratorFlux {
487
ThermostatFluxFiltered(Thermostat * thermostat,
488
const std::string & regulatorPrefix = "");
619
ThermostatIntegratorFluxFiltered(AtomicRegulator * thermostat,
620
int lambdaMaxIterations,
621
const std::string & regulatorPrefix = "");
490
virtual ~ThermostatFluxFiltered() {};
623
virtual ~ThermostatIntegratorFluxFiltered() {};
492
625
/** pre-run initialization of method data */
493
626
virtual void initialize();
520
653
// DO NOT define this
521
ThermostatFluxFiltered();
654
ThermostatIntegratorFluxFiltered();
526
* @class ThermostatFixedFiltered
659
* @class ThermostatIntegratorFixedFiltered
527
660
* @brief Class for thermostatting using the temperature matching constraint and is compatible with
528
661
the fractional step time-integration with time filtering
531
class ThermostatFixedFiltered : public ThermostatFixed {
664
class ThermostatIntegratorFixedFiltered : public ThermostatIntegratorFixed {
535
ThermostatFixedFiltered(Thermostat * thermostat,
536
const std::string & regulatorPrefix = "");
668
ThermostatIntegratorFixedFiltered(AtomicRegulator * thermostat,
669
int lambdaMaxIterations,
670
const std::string & regulatorPrefix = "");
538
virtual ~ThermostatFixedFiltered() {};
672
virtual ~ThermostatIntegratorFixedFiltered() {};
540
674
/** get data for output */
541
675
virtual void output(OUTPUT_LIST & outputData);
607
742
/** thermostat for imposing the fluxes */
608
ThermostatFlux * thermostatFlux_;
743
ThermostatIntegratorFlux * thermostatFlux_;
610
745
/** thermostat for imposing fixed nodes */
611
ThermostatFixed * thermostatFixed_;
746
ThermostatIntegratorFixed * thermostatFixed_;
613
748
/** pointer to whichever thermostat should compute the flux, based on coupling method */
614
749
ThermostatGlcFs * thermostatBcs_;