Changeset 920c70 for src/molecule.cpp
- Timestamp:
- May 31, 2010, 1:09:58 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:
- 42af9e
- Parents:
- 87b597
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r87b597 r920c70 242 242 Orthovector1.MatrixMultiplication(matrix); 243 243 InBondvector -= Orthovector1; // subtract just the additional translation 244 Free(&matrix);244 delete[](matrix); 245 245 bondlength = InBondvector.Norm(); 246 246 // Log() << Verbose(4) << "Corrected InBondvector is now: "; … … 251 251 InBondvector.Normalize(); 252 252 // get typical bond length and store as scale factor for later 253 ASSERT(TopOrigin->type != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given."); 253 254 BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1]; 254 255 if (BondRescale == -1) { … … 472 473 break; 473 474 } 474 Free(&matrix);475 delete[](matrix); 475 476 476 477 // Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl; … … 1034 1035 if (result) { 1035 1036 DoLog(5) && (Log() << Verbose(5) << "Calculating distances" << endl); 1036 Distances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: Distances");1037 OtherDistances = Calloc<double>(AtomCount, "molecule::IsEqualToWithinThreshold: OtherDistances");1037 Distances = new double[AtomCount]; 1038 OtherDistances = new double[AtomCount]; 1038 1039 SetIndexedArrayForEachAtomTo ( Distances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity); 1039 1040 SetIndexedArrayForEachAtomTo ( OtherDistances, &atom::nr, &atom::DistanceSquaredToVector, (const Vector &)CenterOfGravity); 1041 for(int i=0;i<AtomCount;i++) { 1042 Distances[i] = 0.; 1043 OtherDistances[i] = 0.; 1044 } 1040 1045 1041 1046 /// ... sort each list (using heapsort (o(N log N)) from GSL) 1042 1047 DoLog(5) && (Log() << Verbose(5) << "Sorting distances" << endl); 1043 PermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermMap"); 1044 OtherPermMap = Calloc<size_t>(AtomCount, "molecule::IsEqualToWithinThreshold: *OtherPermMap"); 1048 PermMap = new size_t[AtomCount]; 1049 OtherPermMap = new size_t[AtomCount]; 1050 for(int i=0;i<AtomCount;i++) { 1051 PermMap[i] = 0; 1052 OtherPermMap[i] = 0; 1053 } 1045 1054 gsl_heapsort_index (PermMap, Distances, AtomCount, sizeof(double), CompareDoubles); 1046 1055 gsl_heapsort_index (OtherPermMap, OtherDistances, AtomCount, sizeof(double), CompareDoubles); 1047 PermutationMap = Calloc<int>(AtomCount, "molecule::IsEqualToWithinThreshold: *PermutationMap"); 1056 PermutationMap = new int[AtomCount]; 1057 for(int i=0;i<AtomCount;i++) 1058 PermutationMap[i] = 0; 1048 1059 DoLog(5) && (Log() << Verbose(5) << "Combining Permutation Maps" << endl); 1049 1060 for(int i=AtomCount;i--;) … … 1060 1071 1061 1072 // free memory 1062 Free(&PermMap);1063 Free(&OtherPermMap);1064 Free(&Distances);1065 Free(&OtherDistances);1073 delete[](PermMap); 1074 delete[](OtherPermMap); 1075 delete[](Distances); 1076 delete[](OtherDistances); 1066 1077 if (flag) { // if not equal 1067 Free(&PermutationMap);1078 delete[](PermutationMap); 1068 1079 result = false; 1069 1080 } … … 1091 1102 atom *Walker = NULL, *OtherWalker = NULL; 1092 1103 DoLog(3) && (Log() << Verbose(3) << "Begin of GetFatherAtomicMap." << endl); 1093 int *AtomicMap = Malloc<int>(AtomCount, "molecule::GetAtomicMap: *AtomicMap");1104 int *AtomicMap = new int[AtomCount]; 1094 1105 for (int i=AtomCount;i--;) 1095 1106 AtomicMap[i] = -1;
Note:
See TracChangeset
for help on using the changeset viewer.