Changeset b21e1f for molecuilder/src/molecules.cpp
- Timestamp:
- Sep 6, 2008, 4:21:31 PM (17 years ago)
- Children:
- 03c204
- Parents:
- d473c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecules.cpp
rd473c3 rb21e1f 644 644 if (!status) 645 645 *out << "WARNING: molecule is bigger than defined box!" << endl; 646 else { // else center in box 647 ptr = start; 648 while (ptr->next != end) { 649 ptr = ptr->next; 650 for (int i=NDIM;i--;) 651 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 652 } 646 else { // else center in box 647 max->AddVector(min); 648 max->Scale(-1.); 649 max->AddVector(BoxLengths); 650 max->Scale(0.5); 651 Translate(max); 653 652 } 654 653 … … 687 686 // min->Output(out); 688 687 // *out << endl; 689 690 for (int i=NDIM;i--;) { 691 min->x[i] *= -1.; 692 max->x[i] += min->x[i]; 693 } 688 min->Scale(-1.); 689 max->AddVector(min); 694 690 Translate(min); 695 691 } … … 772 768 a->Scale(-1./Num); // divide through total mass (and sign for direction) 773 769 } 774 *out << Verbose(1) << "Resulting center of gravity: ";775 a->Output(out);776 *out << endl;770 // *out << Verbose(1) << "Resulting center of gravity: "; 771 // a->Output(out); 772 // *out << endl; 777 773 return a; 778 774 }; … … 802 798 while (ptr->next != end) { 803 799 ptr = ptr->next; 800 for (int j=0;j<MDSteps;j++) 801 Trajectories[ptr].R.at(j).Scale(factor); 804 802 ptr->x.Scale(factor); 805 803 } … … 815 813 while (ptr->next != end) { 816 814 ptr = ptr->next; 815 for (int j=0;j<MDSteps;j++) 816 Trajectories[ptr].R.at(j).Translate(trans); 817 817 ptr->x.Translate(trans); 818 818 } … … 828 828 while (ptr->next != end) { 829 829 ptr = ptr->next; 830 for (int j=0;j<MDSteps;j++) 831 Trajectories[ptr].R.at(j).Mirror(n); 830 832 ptr->x.Mirror(n); 831 833 } … … 961 963 while (ptr->next != end) { 962 964 ptr = ptr->next; 965 for (int j=0;j<MDSteps;j++) 966 Trajectories[ptr].R.at(j).MatrixMultiplication(evec->data); 963 967 ptr->x.MatrixMultiplication(evec->data); 964 968 } … … 1142 1146 ptr->x.x[0] = cos(alpha) * tmp + sin(alpha) * ptr->x.x[2]; 1143 1147 ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2]; 1148 for (int j=0;j<MDSteps;j++) { 1149 tmp = Trajectories[ptr].R.at(j).x[0]; 1150 Trajectories[ptr].R.at(j).x[0] = cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2]; 1151 Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2]; 1152 } 1144 1153 } 1145 1154 // rotate n vector … … 1160 1169 ptr->x.x[1] = cos(alpha) * tmp + sin(alpha) * ptr->x.x[2]; 1161 1170 ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2]; 1171 for (int j=0;j<MDSteps;j++) { 1172 tmp = Trajectories[ptr].R.at(j).x[1]; 1173 Trajectories[ptr].R.at(j).x[1] = cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2]; 1174 Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2]; 1175 } 1162 1176 } 1163 1177 // rotate n vector (for consistency check) … … 1184 1198 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 1185 1199 ElementCount--; 1200 Trajectories.erase(pointer); 1186 1201 return remove(pointer, start, end); 1187 1202 };
Note:
See TracChangeset
for help on using the changeset viewer.