This repository was archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelingProject.cpp
More file actions
67 lines (57 loc) · 2.07 KB
/
Copy pathModelingProject.cpp
File metadata and controls
67 lines (57 loc) · 2.07 KB
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
61
62
63
64
65
66
67
// ModelingProject.cpp: implementation of the ModelingProject class.+
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "LatticeRelaxation.h"
#include "ModelingProject.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ModelingProject::ModelingProject()
{
migratingAtom = NULL;
}
ModelingProject::ModelingProject(Lattice* lattice)
{
lattices.push_back(lattice);
activeLattice = lattice;
migratingAtom = NULL;
}
ModelingProject::~ModelingProject()
{
}
void ModelingProject::populateAtomTypes() {
std::deque<Lattice*>::const_iterator latticeIterator;
for (latticeIterator = lattices.begin(); latticeIterator != lattices.end(); latticeIterator++) {
Lattice* lattice = *latticeIterator;
std::deque<Atom*>& atoms = lattice->atoms;
std::deque<Atom*>::const_iterator atomsIterator;
for (atomsIterator = atoms.begin(); atomsIterator != atoms.end(); atomsIterator++) {
Atom* atom = *atomsIterator;
atomTypes.insert(atom->atomType);
}
}
}
void ModelingProject::populatePotentials() {
populateAtomTypes();
std::set<AtomType*>::iterator atomTypesIteratorI;
std::set<AtomType*>::iterator atomTypesIteratorJ;
for (atomTypesIteratorI = atomTypes.begin(); atomTypesIteratorI != atomTypes.end(); atomTypesIteratorI++) {
AtomType* atomTypeI = *atomTypesIteratorI;
for (atomTypesIteratorJ = atomTypesIteratorI; atomTypesIteratorJ != atomTypes.end(); atomTypesIteratorJ++) {
AtomType* atomTypeJ = *atomTypesIteratorJ;
if (atomTypeI < atomTypeJ) {
std::pair<AtomType*,AtomType*> atomTypePair(atomTypeI,atomTypeJ);
potentials.insert(std::map<std::pair<AtomType*,AtomType*>,Potential*>::value_type(atomTypePair,0));
} else {
std::pair<AtomType*,AtomType*> atomTypePair(atomTypeJ,atomTypeI);
potentials.insert(std::map<std::pair<AtomType*,AtomType*>,Potential*>::value_type(atomTypePair,0));
}
}
}
}