Changeset 927aba for molecuilder/src
- Timestamp:
- May 21, 2008, 11:14:06 AM (17 years ago)
- Children:
- 3ce105
- Parents:
- 06feff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified molecuilder/src/molecules.cpp ¶
r06feff r927aba 461 461 istringstream *item = new istringstream(line); 462 462 //istringstream input(line); 463 cout << Verbose(1) << "Reading: " << line << endl;463 //cout << Verbose(1) << "Reading: " << line << endl; 464 464 *item >> shorthand; 465 465 *item >> x[0]; … … 596 596 cell_size[4] = 0.; 597 597 cell_size[5] = dim->x[2]; 598 }; 599 600 /** Centers the molecule in the box whose lengths are defined by vector \a *BoxLengths. 601 * \param *out output stream for debugging 602 * \param *BoxLengths box lengths 603 */ 604 bool molecule::CenterInBox(ofstream *out, vector *BoxLengths) 605 { 606 bool status = true; 607 atom *ptr = NULL; 608 vector *min = new vector; 609 vector *max = new vector; 610 611 // gather min and max for each axis 612 ptr = start->next; // start at first in list 613 if (ptr != end) { //list not empty? 614 for (int i=0;i<NDIM;i++) { 615 max->x[i] = ptr->x.x[i]; 616 min->x[i] = ptr->x.x[i]; 617 } 618 while (ptr->next != end) { // continue with second if present 619 ptr = ptr->next; 620 //ptr->Output(1,1,out); 621 for (int i=0;i<NDIM;i++) { 622 max->x[i] = (max->x[i] < ptr->x.x[i]) ? ptr->x.x[i] : max->x[i]; 623 min->x[i] = (min->x[i] > ptr->x.x[i]) ? ptr->x.x[i] : min->x[i]; 624 } 625 } 626 } 627 // sanity check 628 for(int i=0;i<NDIM;i++) { 629 if (max->x[i] - min->x[i] > BoxLengths->x[i]) 630 status = false; 631 } 632 // warn if check failed 633 if (!status) 634 *out << "WARNING: molecule is bigger than defined box!" << endl; 635 else { // else center in box 636 ptr = start; 637 while (ptr->next != end) { 638 ptr = ptr->next; 639 for (int i=0;i<NDIM;i++) 640 ptr->x.x[i] += -(max->x[i] + min->x[i])/2. + BoxLengths->x[i]/2.; // first term centers molecule at (0,0,0), second shifts to center of new box 641 } 642 } 643 644 // free and exit 645 delete(min); 646 delete(max); 647 return status; 598 648 }; 599 649 … … 884 934 * \param *text question before entering 885 935 */ 886 atom * molecule::AskAtom( char *text)936 atom * molecule::AskAtom(string text) 887 937 { 888 938 int No; … … 1204 1254 * \return string of the flag 1205 1255 */ 1206 char *molecule::GetColor(enum Shading color)1256 string molecule::GetColor(enum Shading color) 1207 1257 { 1208 1258 switch(color) { … … 3240 3290 3241 3291 // Hier muessen von 1 bis NumberOfBondsPerAtom[Walker->nr] alle Kombinationen 3242 // von Endstuecken (aus den Bonds) hinzugef ÃŒgt werden und fÃŒr verbleibende ANOVAOrder3243 // rekursiv GraphCrawler in der n Àchsten Ebene aufgerufen werden3292 // von Endstuecken (aus den Bonds) hinzugefᅵᅵgt werden und fᅵᅵr verbleibende ANOVAOrder 3293 // rekursiv GraphCrawler in der nᅵᅵchsten Ebene aufgerufen werden 3244 3294 3245 3295 *out << Verbose(1+verbosity) << "Begin of SPFragmentGenerator." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.