Changeset deac6c for src/molecules.cpp
- Timestamp:
- Sep 6, 2008, 4:21:31 PM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- bd3e55
- Parents:
- a6b7fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecules.cpp
ra6b7fb rdeac6c 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.