-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first version of basinhopping is running; results are incorrect
- Loading branch information
Showing
5 changed files
with
105 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <iostream> | ||
#include "storage.h" | ||
#include "structure.h" | ||
|
||
using namespace std; | ||
|
||
bool Storage::addCluster (structure &S) | ||
{ | ||
double energy = S.getEnergy(); | ||
|
||
energyStructureMap::iterator iter = _mapping.find(energy); | ||
|
||
if (iter == _mapping.end()) | ||
{ | ||
_mapping[energy] = S; | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef STORAGE | ||
#define STORAGE | ||
|
||
#include <map> | ||
#include "structure.h" | ||
|
||
struct compareDouble | ||
{ | ||
compareDouble(double eps = 1e-2) : _eps(eps) {} | ||
double _eps; | ||
bool operator() (const double a, const double b) const | ||
{ | ||
if (b - a > _eps) return true; | ||
return false; | ||
} | ||
}; | ||
|
||
class Storage | ||
{ | ||
private: | ||
typedef std::map<double, structure, compareDouble> energyStructureMap; | ||
energyStructureMap _mapping; | ||
|
||
public: | ||
Storage() : _mapping() {} | ||
bool addCluster (structure &S); | ||
int getSize() {return _mapping.size();} | ||
|
||
energyStructureMap::iterator begin() {return _mapping.begin();} | ||
energyStructureMap::iterator end() {return _mapping.end();} | ||
}; | ||
#endif |