implementation of getEnergy()
[cluster_expansion.git] / Structure.cpp
blob53e66d16306d4961ea1eb2879caa7d4320878164
1 #include <stdexcept>
3 #include <blitz/array.h>
4 using namespace blitz;
6 #include "SymmetryOperations.h"
7 #include "Lattice.h"
8 #include "Interactions.h"
9 #include "Structure.h"
11 using namespace std;
14 double
15 Structure::getEnergy()
17 // FIXME: check adsorbate species and get correct on-site energy contribution
19 // get interaction multiplicities for current configuration
20 lattice.assessInteractions(interactions);
22 double energy = 0.0;
24 for (LatticeLayer::iterator i = lattice.adsorbates.begin(); i != lattice.adsorbates.end(); i++) {
25 if (lattice.adsorbates(i.position()) == empty)
26 continue;
27 // implement species checking CO or O or whatever
28 // energy += adsorbate_on_site_energy(species!)
30 for (Interactions::iterator interaction = interactions.begin();
31 interaction != interactions.end(); interaction++) {
32 energy += (interaction->energy * interaction->multiplicity);
36 return energy;