48#include "lattice/shapedLattice.hpp"
52#include "brains/Register.hpp"
58 shapedLattice::shapedLattice(RealType latticeConstant,
string latticeType) :
59 latticeConstant_(latticeConstant), latticeType_(latticeType) {
61 simpleLattice_ = LatticeFactory::getInstance().createLattice(latticeType);
62 if (simpleLattice_ == NULL) {
63 std::cerr <<
"shapedLattice:: Error creating lattice" << std::endl;
68 std::vector<RealType> lc;
69 lc.push_back(latticeConstant_);
70 simpleLattice_->setLatticeConstant(lc);
71 sitesComputed_ =
false;
75 dimension_ = dimension;
77 beginNx_ = -(int)ceil(0.5 * dimension_[0] / latticeConstant_);
78 beginNy_ = -(int)ceil(0.5 * dimension_[1] / latticeConstant_);
79 beginNz_ = -(int)ceil(0.5 * dimension_[2] / latticeConstant_);
80 endNx_ = (int)ceil(0.5 * dimension_[0] / latticeConstant_);
81 endNy_ = (int)ceil(0.5 * dimension_[1] / latticeConstant_);
82 endNz_ = (int)ceil(0.5 * dimension_[2] / latticeConstant_);
83 sitesComputed_ =
false;
86 void shapedLattice::setOrigin(Vector3d origin) {
88 simpleLattice_->setOrigin(origin_);
89 sitesComputed_ =
false;
92 void shapedLattice::findSites() {
94 orientations_.clear();
96 std::vector<Vector3d> latticePos;
97 std::vector<Vector3d> pointsOrt = simpleLattice_->getLatticePointsOrt();
98 int numMolPerCell = simpleLattice_->getNumSitesPerCell();
100 for (
int i = beginNx_; i <= endNx_; i++) {
101 for (
int j = beginNy_; j <= endNy_; j++) {
102 for (
int k = beginNz_; k <= endNz_; k++) {
104 simpleLattice_->getLatticePointsPos(latticePos, i, j, k);
105 for (
int l = 0; l < numMolPerCell; l++) {
106 if (isInterior(latticePos[l])) {
107 Vector3d myPoint = latticePos[l];
108 Vector3d myOrt = pointsOrt[l];
109 sites_.push_back(myPoint);
110 orientations_.push_back(myOrt);
116 sitesComputed_ =
true;
119 std::vector<Vector3d> shapedLattice::getSites() {
120 if (!sitesComputed_) { findSites(); }
124 std::vector<Vector3d> shapedLattice::getOrientations() {
125 if (!sitesComputed_) { findSites(); }
126 return orientations_;
void setGridDimension(Vector3d dimension)
setGridDimension:
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
void registerLattice()
Register all lattice.