-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage.cc
60 lines (47 loc) · 1.12 KB
/
storage.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include "storage.h"
#include "structure.h"
#include "iop.h"
using namespace std;
template<>
bool Storage<compareEnergy>::addCluster (structure &S)
{
double energy = S.getEnergy();
typename storageMap<compareEnergy>::iterator iter = _mapping.find(energy);
if (iter == _mapping.end())
{
_mapping[energy] = S;
return true;
}
return false;
}
template<>
bool Storage<compareInterPartDist>::addCluster (structure &S)
{
S.propertyInterPartDist();
vector<double> dist = S.getInterPartDist();
typename storageMap<compareInterPartDist>::iterator iter = _mapping.find(dist);
if (iter == _mapping.end())
{
_mapping[dist] = S;
return true;
}
return false;
}
template<typename T>
void Storage<T>::printKeys(ostream& out)
{
for (auto& i : _mapping) out << i.first << endl;
}
template<typename T>
void Storage<T>::printStructures()
{
int n(0);
for (auto& i : _mapping)
{
xyzout (i.second, to_string(n) + ".xyz");
n++;
}
}
template class Storage<compareEnergy>;
template class Storage<compareInterPartDist>;