CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Properties.cc
Go to the documentation of this file.
2 
3 namespace CASM {
4 
5  // Reference Properties + DeltaProperties -> Calculated/Clex Properties
7 
8  // add energy
9  if(contains("energy") && delta.contains("energy"))
10  (*this)["energy"] = (*this)["energy"].get<double>() + delta["energy"].get<double>();
11 
12  // add relaxed_energy
13  if(contains("relaxed_energy") && delta.contains("relaxed_energy"))
14  (*this)["relaxed_energy"] = (*this)["relaxed_energy"].get<double>() + delta["relaxed_energy"].get<double>();
15 
16  // add forces
17  /*
18  if(contains("forces") && delta.contains("forces")) {
19  Array< Vector3<double> > f, f_delta;
20  from_json(f, (*this)["forces"]);
21  from_json(f_delta, delta["forces"]);
22  for(int i = 0; i < f.size(); i++)
23  f[i] += f_delta[i];
24  (*this)["forces"] = f;
25  }
26  */
27 
28  // add deformation -- a guess at what this could be ...
29  /*
30  if(contains("structure") && delta.contains("deformation")) {
31  BasicStructure<Coordinate> struc;
32  Deformation deformation;
33  from_json(struc, (*this)["structure"]);
34  from_json(deformation, delta["deformation"]);
35  (*this)["structure"] = struc * deformation.get_strain() + deformation.get_displacement();
36  }
37  */
38 
39  return *this;
40  }
41 
42  // Reference Properties + DeltaProperties -> Calculated/Clex Properties
44  Properties calc(*this);
45  return calc += delta;
46  }
47 
48  // Calculated Properties - Reference Properties -> DeltaProperties
50  return DeltaProperties(*this, ref);
51  }
52 
53  // Calculated Properties - Reference Properties -> DeltaProperties
55 
56  //std::cout << "begin DeltaProperties::DeltaProperties()" << std::endl;
57  //std::cout << "calc:\n" << calc << std::endl;
58  //std::cout << "ref:\n" << ref << std::endl;
59 
60  // energy
61  if(calc.contains("energy") && ref.contains("energy"))
62  (*this)["energy"] = calc["energy"].get<double>() - ref["energy"].get<double>();
63 
64  // relaxed_energy
65  if(calc.contains("relaxed_energy") && ref.contains("relaxed_energy"))
66  (*this)["relaxed_energy"] = calc["relaxed_energy"].get<double>() - ref["relaxed_energy"].get<double>();
67 
68 
69  // forces
70  /*
71  if(calc.contains("forces") && ref.contains("forces")) {
72  Array< Vector3<double> > f, f_ref;
73  from_json(f, calc["forces"]);
74  from_json(f_ref, ref["forces"]);
75  for(int i = 0; i < f.size(); i++)
76  f[i] -= f_ref[i];
77  (*this)["forces"] = f;
78  }
79  */
80 
81  // deformation -- a guess at what this could be ...
82  /*
83  if(calc.contains("structure") && ref.contains("structure")) {
84  (*this)["deformation"] = Deformation(from_json< BasicStructure<Coordinate> >(calc["structure"]),
85  from_json< BasicStructure<Coordinate> >(ref["structure"]));
86  }
87  */
88  }
89 
90 }
91 
Main CASM namespace.
Definition: complete.cpp:8
T get(Args...args) const
Get data from json, using one of several alternatives.
Definition: jsonParser.hh:729
pair_type ref
Definition: settings.cc:110
bool contains(const std::string &name) const
Return true if JSON object contains 'name'.
Definition: jsonParser.cc:500
DeltaProperties operator-(const Properties &ref) const
Definition: Properties.cc:49
Properties & operator+=(const DeltaProperties &delta)
Definition: Properties.cc:6
Properties operator+(const DeltaProperties &delta) const
Definition: Properties.cc:43