Changeset 8cbb97 for src/ellipsoid.cpp
- Timestamp:
- Apr 29, 2010, 1:55:21 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, Candidate_v1.7.0, 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:
- d79639
- Parents:
- 632bc3 (diff), 753f02 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/ellipsoid.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ellipsoid.cpp
r632bc3 r8cbb97 42 42 43 43 // 1. translate coordinate system so that ellipsoid center is in origin 44 helper.CopyVector(&x); 45 helper.SubtractVector(&EllipsoidCenter); 46 RefPoint.CopyVector(&helper); 44 RefPoint = helper = x - EllipsoidCenter; 47 45 //Log() << Verbose(4) << "Translated given point is at " << RefPoint << "." << endl; 48 46 … … 61 59 Matrix[8] = cos(theta); 62 60 helper.MatrixMultiplication(Matrix); 63 helper.Scale (InverseLength);61 helper.ScaleAll(InverseLength); 64 62 //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl; 65 63 … … 72 70 theta = -EllipsoidAngle[1]; 73 71 phi = -EllipsoidAngle[2]; 74 helper.Scale (EllipsoidLength);72 helper.ScaleAll(EllipsoidLength); 75 73 Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi); 76 74 Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi); … … 86 84 87 85 // 5. determine distance between backtransformed point and x 88 distance = RefPoint.DistanceSquared( &helper);86 distance = RefPoint.DistanceSquared(helper); 89 87 //Log() << Verbose(4) << "Squared distance between intersection and RefPoint is " << distance << "." << endl; 90 88 … … 116 114 // put parameters into suitable ellipsoid form 117 115 for (int i=0;i<3;i++) { 118 Center .x[i] = gsl_vector_get(x, i+0);116 Center[i] = gsl_vector_get(x, i+0); 119 117 EllipsoidLength[i] = gsl_vector_get(x, i+3); 120 118 EllipsoidAngle[i] = gsl_vector_get(x, i+6); … … 160 158 x = gsl_vector_alloc (9); 161 159 for (int i=0;i<3;i++) { 162 gsl_vector_set (x, i+0, EllipsoidCenter-> x[i]);160 gsl_vector_set (x, i+0, EllipsoidCenter->at(i)); 163 161 gsl_vector_set (x, i+3, EllipsoidLength[i]); 164 162 gsl_vector_set (x, i+6, EllipsoidAngle[i]); … … 195 193 if (status == GSL_SUCCESS) { 196 194 for (int i=0;i<3;i++) { 197 EllipsoidCenter-> x[i]= gsl_vector_get (s->x,i+0);195 EllipsoidCenter->at(i) = gsl_vector_get (s->x,i+0); 198 196 EllipsoidLength[i] = gsl_vector_get (s->x, i+3); 199 197 EllipsoidAngle[i] = gsl_vector_get (s->x, i+6); … … 304 302 Candidate = (*Runner); 305 303 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl); 306 x[PointsPicked++] .CopyVector(Candidate->node); // we have one more atom picked304 x[PointsPicked++] = *Candidate->node; // we have one more atom picked 307 305 current++; // next pre-picked atom 308 306 } … … 350 348 //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": "; 351 349 if (value > threshold) { 352 x[PointsPicked] .CopyVector(Runner->second->node->node);350 x[PointsPicked] = (*Runner->second->node->node); 353 351 PointsPicked++; 354 352 //Log() << Verbose(0) << "IN." << endl; … … 387 385 Center.Zero(); 388 386 for (PointMap::iterator Runner = T->PointsOnBoundary.begin(); Runner != T->PointsOnBoundary.end(); Runner++) 389 Center .AddVector(Runner->second->node->node);387 Center += (*Runner->second->node->node); 390 388 Center.Scale(1./T->PointsOnBoundaryCount); 391 389 DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl); … … 405 403 // calculate some sensible starting values for parameter fit 406 404 MaxDistance = 0.; 407 MinDistance = x[0].ScalarProduct( &x[0]);405 MinDistance = x[0].ScalarProduct(x[0]); 408 406 for (int i=0;i<N;i++) { 409 distance = x[i].ScalarProduct( &x[i]);407 distance = x[i].ScalarProduct(x[i]); 410 408 if (distance > MaxDistance) 411 409 MaxDistance = distance; … … 414 412 } 415 413 //Log() << Verbose(2) << "MinDistance " << MinDistance << ", MaxDistance " << MaxDistance << "." << endl; 416 EllipsoidCenter .CopyVector(&Center); // use Center of Gravity as initial center of ellipsoid414 EllipsoidCenter = Center; // use Center of Gravity as initial center of ellipsoid 417 415 for (int i=0;i<3;i++) 418 416 EllipsoidAngle[i] = 0.; … … 427 425 output << number << "\t"; 428 426 for (int i=0;i<3;i++) 429 output << setprecision(9) << EllipsoidCenter .x[i] << "\t";427 output << setprecision(9) << EllipsoidCenter[i] << "\t"; 430 428 for (int i=0;i<3;i++) 431 429 output << setprecision(9) << EllipsoidLength[i] << "\t";
Note:
See TracChangeset
for help on using the changeset viewer.
