PSCF v1.3
MixAndMatchEnv.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "MixAndMatchEnv.h"
9
10namespace Pscf {
11namespace Prdc {
12
13 /*
14 * Constructor.
15 */
17 { setClassName("MixAndMatchEnv"); }
18
19 /*
20 * Destructor.
21 */
24
25 /*
26 * Modify stress to account for Environment, for one lattice parameter.
27 */
28 double MixAndMatchEnv::modifyStress(int paramId, double stress) const
29 {
31
32 // Add stress contributions from each FieldGenerator
33 if (fieldGenPtr1_) {
34 stress += fieldGenPtr1_->stress(paramId);
35 }
36 if (fieldGenPtr2_) {
37 stress += fieldGenPtr2_->stress(paramId);
38 }
39
40 // Allow each FieldGenerator to modify the resulting stress
41 if (fieldGenPtr1_) {
42 stress = fieldGenPtr1_->modifyStress(paramId, stress);
43 }
44 if (fieldGenPtr2_) {
45 stress = fieldGenPtr2_->modifyStress(paramId, stress);
46 }
47
48 return stress;
49 }
50
51} // namespace Prdc
52} // namespace Pscf
bool needsUpdate() const
Does this Environment need to be updated?
double modifyStress(int paramId, double stress) const
Modify stress to account for Environment, for one lattice parameter.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Definition param_pc.dox:1