Changes in src/molecule_geometry.cpp [f66195:99593f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_geometry.cpp
rf66195 r99593f 24 24 { 25 25 bool status = true; 26 Vector x;27 26 const Vector *Center = DetermineCenterOfAll(out); 28 27 double *M = ReturnFullMatrixforSymmetric(cell_size); 29 double *Minv = x.InverseMatrix(M);28 double *Minv = InverseMatrix(M); 30 29 31 30 // go through all atoms … … 46 45 { 47 46 bool status = true; 48 Vector x;49 47 double *M = ReturnFullMatrixforSymmetric(cell_size); 50 double *Minv = x.InverseMatrix(M);48 double *Minv = InverseMatrix(M); 51 49 52 50 // go through all atoms … … 122 120 * \return pointer to center of all vector 123 121 */ 124 Vector * molecule::DetermineCenterOfAll(ofstream *out) 122 Vector * molecule::DetermineCenterOfAll(ofstream *out) const 125 123 { 126 124 atom *ptr = start->next; // start at first in list … … 198 196 * \param *factor pointer to scaling factor 199 197 */ 200 void molecule::Scale( double **factor)198 void molecule::Scale(const double ** const factor) 201 199 { 202 200 atom *ptr = start; … … 231 229 void molecule::TranslatePeriodically(const Vector *trans) 232 230 { 233 Vector x;234 231 double *M = ReturnFullMatrixforSymmetric(cell_size); 235 double *Minv = x.InverseMatrix(M);232 double *Minv = InverseMatrix(M); 236 233 237 234 // go through all atoms … … 258 255 { 259 256 atom *Walker = start; 260 bond *Binder = NULL;261 257 double *matrix = ReturnFullMatrixforSymmetric(cell_size); 262 258 double tmp; … … 275 271 Testvector.InverseMatrixMultiplication(matrix); 276 272 Translationvector.Zero(); 277 for (int i=0;i<NumberOfBondsPerAtom[Walker->nr]; i++) { 278 Binder = ListOfBondsPerAtom[Walker->nr][i]; 279 if (Walker->nr < Binder->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing 273 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 274 if (Walker->nr < (*Runner)->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing 280 275 for (int j=0;j<NDIM;j++) { 281 tmp = Walker->x.x[j] - Binder->GetOtherAtom(Walker)->x.x[j];276 tmp = Walker->x.x[j] - (*Runner)->GetOtherAtom(Walker)->x.x[j]; 282 277 if ((fabs(tmp)) > BondDistance) { 283 278 flag = false; 284 cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << * Binder<< " has to be shifted due to " << tmp << "." << endl;279 cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl; 285 280 if (tmp > 0) 286 281 Translationvector.x[j] -= 1.; … … 298 293 #ifdef ADDHYDROGEN 299 294 // now also change all hydrogens 300 for (int i=0;i<NumberOfBondsPerAtom[Walker->nr]; i++) { 301 Binder = ListOfBondsPerAtom[Walker->nr][i]; 302 if (Binder->GetOtherAtom(Walker)->type->Z == 1) { 303 Testvector.CopyVector(&Binder->GetOtherAtom(Walker)->x); 295 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 296 if ((*Runner)->GetOtherAtom(Walker)->type->Z == 1) { 297 Testvector.CopyVector(&(*Runner)->GetOtherAtom(Walker)->x); 304 298 Testvector.InverseMatrixMultiplication(matrix); 305 299 Testvector.AddVector(&Translationvector);
Note:
See TracChangeset
for help on using the changeset viewer.