Changeset a67d19 for src/molecule.cpp
- Timestamp:
- Apr 22, 2010, 2:00:03 PM (15 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:
- 299554
- Parents:
- 6613ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r6613ec ra67d19 429 429 input = new istringstream(line); 430 430 *input >> NumberOfAtoms; 431 Log() << Verbose(0) << "Parsing " << NumberOfAtoms << " atoms in file." << endl;431 DoLog(0) && (Log() << Verbose(0) << "Parsing " << NumberOfAtoms << " atoms in file." << endl); 432 432 getline(xyzfile,line,'\n'); // Read comment 433 Log() << Verbose(1) << "Comment: " << line << endl;433 DoLog(1) && (Log() << Verbose(1) << "Comment: " << line << endl); 434 434 435 435 if (MDSteps == 0) // no atoms yet present … … 665 665 return walker; 666 666 } else { 667 Log() << Verbose(0) << "Atom not found in list." << endl;667 DoLog(0) && (Log() << Verbose(0) << "Atom not found in list." << endl); 668 668 return NULL; 669 669 } … … 681 681 //mol->Output((ofstream *)&cout); 682 682 //Log() << Verbose(0) << "===============================================" << endl; 683 Log() << Verbose(0) << text;683 DoLog(0) && (Log() << Verbose(0) << text); 684 684 cin >> No; 685 685 ion = this->FindAtom(No); … … 770 770 void molecule::OutputListOfBonds() const 771 771 { 772 Log() << Verbose(2) << endl << "From Contents of ListOfBonds, all non-hydrogen atoms:" << endl;772 DoLog(2) && (Log() << Verbose(2) << endl << "From Contents of ListOfBonds, all non-hydrogen atoms:" << endl); 773 773 ActOnAllAtoms (&atom::OutputBondOfAtom ); 774 Log() << Verbose(0) << endl;774 DoLog(0) && (Log() << Verbose(0) << endl); 775 775 }; 776 776 … … 829 829 } 830 830 if ((AtomCount == 0) || (i != AtomCount)) { 831 Log() << Verbose(3) << "Mismatch in AtomCount " << AtomCount << " and recounted number " << i << ", renaming all." << endl;831 DoLog(3) && (Log() << Verbose(3) << "Mismatch in AtomCount " << AtomCount << " and recounted number " << i << ", renaming all." << endl); 832 832 AtomCount = i; 833 833 … … 845 845 Walker->Name = Malloc<char>(6, "molecule::CountAtoms: *walker->Name"); 846 846 sprintf(Walker->Name, "%2s%02d", Walker->type->symbol, Walker->nr+1); 847 Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->Name << "." << endl;847 DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << Walker->nr << " " << Walker->Name << "." << endl); 848 848 i++; 849 849 } 850 850 } else 851 Log() << Verbose(3) << "AtomCount is still " << AtomCount << ", thus counting nothing." << endl;851 DoLog(3) && (Log() << Verbose(3) << "AtomCount is still " << AtomCount << ", thus counting nothing." << endl); 852 852 } 853 853 }; … … 909 909 bool result = true; // status of comparison 910 910 911 Log() << Verbose(3) << "Begin of IsEqualToWithinThreshold." << endl;911 DoLog(3) && (Log() << Verbose(3) << "Begin of IsEqualToWithinThreshold." << endl); 912 912 /// first count both their atoms and elements and update lists thereby ... 913 913 //Log() << Verbose(0) << "Counting atoms, updating list" << endl; … … 921 921 if (result) { 922 922 if (AtomCount != OtherMolecule->AtomCount) { 923 Log() << Verbose(4) << "AtomCounts don't match: " << AtomCount << " == " << OtherMolecule->AtomCount << endl;923 DoLog(4) && (Log() << Verbose(4) << "AtomCounts don't match: " << AtomCount << " == " << OtherMolecule->AtomCount << endl); 924 924 result = false; 925 925 } else Log() << Verbose(4) << "AtomCounts match: " << AtomCount << " == " << OtherMolecule->AtomCount << endl; … … 928 928 if (result) { 929 929 if (ElementCount != OtherMolecule->ElementCount) { 930 Log() << Verbose(4) << "ElementCount don't match: " << ElementCount << " == " << OtherMolecule->ElementCount << endl;930 DoLog(4) && (Log() << Verbose(4) << "ElementCount don't match: " << ElementCount << " == " << OtherMolecule->ElementCount << endl); 931 931 result = false; 932 932 } else Log() << Verbose(4) << "ElementCount match: " << ElementCount << " == " << OtherMolecule->ElementCount << endl; … … 940 940 } 941 941 if (flag < MAX_ELEMENTS) { 942 Log() << Verbose(4) << "ElementsInMolecule don't match." << endl;942 DoLog(4) && (Log() << Verbose(4) << "ElementsInMolecule don't match." << endl); 943 943 result = false; 944 944 } else Log() << Verbose(4) << "ElementsInMolecule match." << endl; … … 946 946 /// then determine and compare center of gravity for each molecule ... 947 947 if (result) { 948 Log() << Verbose(5) << "Calculating Centers of Gravity" << endl;948 DoLog(5) && (Log() << Verbose(5) << "Calculating Centers of Gravity" << endl); 949 949 DeterminePeriodicCenter(CenterOfGravity); 950 950 OtherMolecule->DeterminePeriodicCenter(OtherCenterOfGravity); 951 Log() << Verbose(5) << "Center of Gravity: ";951 DoLog(5) && (Log() << Verbose(5) << "Center of Gravity: "); 952 952 CenterOfGravity.Output(); 953 Log() << Verbose(0) << endl << Verbose(5) << "Other Center of Gravity: ";953 DoLog(0) && (Log() << Verbose(0) << endl << Verbose(5) << "Other Center of Gravity: "); 954 954 OtherCenterOfGravity.Output(); 955 Log() << Verbose(0) << endl;955 DoLog(0) && (Log() << Verbose(0) << endl); 956 956 if (CenterOfGravity.DistanceSquared(&OtherCenterOfGravity) > threshold*threshold) { 957 Log() << Verbose(4) << "Centers of gravity don't match." << endl;957 DoLog(4) && (Log() << Verbose(4) << "Centers of gravity don't match." << endl); 958 958 result = false; 959 959 } … … 962 962 /// ... then make a list with the euclidian distance to this center for each atom of both molecules 963 963 if (result) { 964 Log() << Verbose(5) << "Calculating distances" << endl;964 DoLog(5) && (Log() << Verbose(5) << "Calculating distances" << endl); 965 965 Distances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: Distances"); 966 966 OtherDistances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: OtherDistances"); … … 969 969 970 970 /// ... sort each list (using heapsort (o(N log N)) from GSL) 971 Log() << Verbose(5) << "Sorting distances" << endl;971 DoLog(5) && (Log() << Verbose(5) << "Sorting distances" << endl); 972 972 PermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermMap"); 973 973 OtherPermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *OtherPermMap"); … … 975 975 gsl_heapsort_index (OtherPermMap, OtherDistances, AtomCount, sizeof(double), CompareDoubles); 976 976 PermutationMap = Calloc<int>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermutationMap"); 977 Log() << Verbose(5) << "Combining Permutation Maps" << endl;977 DoLog(5) && (Log() << Verbose(5) << "Combining Permutation Maps" << endl); 978 978 for(int i=AtomCount;i--;) 979 979 PermutationMap[PermMap[i]] = (int) OtherPermMap[i]; 980 980 981 981 /// ... and compare them step by step, whether the difference is individually(!) below \a threshold for all 982 Log() << Verbose(4) << "Comparing distances" << endl;982 DoLog(4) && (Log() << Verbose(4) << "Comparing distances" << endl); 983 983 flag = 0; 984 984 for (int i=0;i<AtomCount;i++) { 985 Log() << Verbose(5) << "Distances squared: |" << Distances[PermMap[i]] << " - " << OtherDistances[OtherPermMap[i]] << "| = " << fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) << " ?<? " << threshold << endl;985 DoLog(5) && (Log() << Verbose(5) << "Distances squared: |" << Distances[PermMap[i]] << " - " << OtherDistances[OtherPermMap[i]] << "| = " << fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) << " ?<? " << threshold << endl); 986 986 if (fabs(Distances[PermMap[i]] - OtherDistances[OtherPermMap[i]]) > threshold*threshold) 987 987 flag = 1; … … 999 999 } 1000 1000 /// return pointer to map if all distances were below \a threshold 1001 Log() << Verbose(3) << "End of IsEqualToWithinThreshold." << endl;1001 DoLog(3) && (Log() << Verbose(3) << "End of IsEqualToWithinThreshold." << endl); 1002 1002 if (result) { 1003 Log() << Verbose(3) << "Result: Equal." << endl;1003 DoLog(3) && (Log() << Verbose(3) << "Result: Equal." << endl); 1004 1004 return PermutationMap; 1005 1005 } else { 1006 Log() << Verbose(3) << "Result: Not equal." << endl;1006 DoLog(3) && (Log() << Verbose(3) << "Result: Not equal." << endl); 1007 1007 return NULL; 1008 1008 } … … 1019 1019 { 1020 1020 atom *Walker = NULL, *OtherWalker = NULL; 1021 Log() << Verbose(3) << "Begin of GetFatherAtomicMap." << endl;1021 DoLog(3) && (Log() << Verbose(3) << "Begin of GetFatherAtomicMap." << endl); 1022 1022 int *AtomicMap = Malloc<int>(AtomCount, "molecule::GetAtomicMap: *AtomicMap"); 1023 1023 for (int i=AtomCount;i--;) … … 1026 1026 for (int i=AtomCount;i--;) // no need as -1 means already that there is trivial correspondence 1027 1027 AtomicMap[i] = i; 1028 Log() << Verbose(4) << "Map is trivial." << endl;1028 DoLog(4) && (Log() << Verbose(4) << "Map is trivial." << endl); 1029 1029 } else { 1030 Log() << Verbose(4) << "Map is ";1030 DoLog(4) && (Log() << Verbose(4) << "Map is "); 1031 1031 Walker = start; 1032 1032 while (Walker->next != end) { … … 1045 1045 } 1046 1046 } 1047 Log() << Verbose(0) << AtomicMap[Walker->nr] << "\t";1048 } 1049 Log() << Verbose(0) << endl;1050 } 1051 Log() << Verbose(3) << "End of GetFatherAtomicMap." << endl;1047 DoLog(0) && (Log() << Verbose(0) << AtomicMap[Walker->nr] << "\t"); 1048 } 1049 DoLog(0) && (Log() << Verbose(0) << endl); 1050 } 1051 DoLog(3) && (Log() << Verbose(3) << "End of GetFatherAtomicMap." << endl); 1052 1052 return AtomicMap; 1053 1053 };
Note:
See TracChangeset
for help on using the changeset viewer.