Changeset 0a4f7f for src/molecule.cpp
- Timestamp:
- Apr 7, 2010, 3:45:38 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:
- 72e7fa
- Parents:
- f9352d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
rf9352d r0a4f7f 25 25 #include "tesselation.hpp" 26 26 #include "vector.hpp" 27 #include "Plane.hpp" 28 #include "Exceptions/LinearDependenceException.hpp" 27 29 28 30 /************************************* Functions for class molecule *********************************/ … … 231 233 Orthovector1.Zero(); 232 234 for (int i=NDIM;i--;) { 233 l = TopReplacement->x .x[i] - TopOrigin->x.x[i];235 l = TopReplacement->x[i] - TopOrigin->x[i]; 234 236 if (fabs(l) > BondDistance) { // is component greater than bond distance 235 Orthovector1 .x[i] = (l < 0) ? -1. : +1.;237 Orthovector1[i] = (l < 0) ? -1. : +1.; 236 238 } // (signs are correct, was tested!) 237 239 } … … 305 307 306 308 // determine the plane of these two with the *origin 307 AllWentWell = AllWentWell && Orthovector1.MakeNormalVector(&TopOrigin->x, &FirstOtherAtom->x, &SecondOtherAtom->x); 309 try { 310 Orthovector1 =Plane(TopOrigin->x, FirstOtherAtom->x, SecondOtherAtom->x).getNormal(); 311 } 312 catch(LinearDependenceException &excp){ 313 Log() << Verbose(0) << excp; 314 // TODO: figure out what to do with the Orthovector in this case 315 AllWentWell = false; 316 } 308 317 } else { 309 318 Orthovector1.GetOneNormalVector(&InBondvector); … … 313 322 //Log() << Verbose(0) << endl; 314 323 // orthogonal vector and bond vector between origin and replacement form the new plane 315 Orthovector1.MakeNormal Vector(&InBondvector);324 Orthovector1.MakeNormalTo(InBondvector); 316 325 Orthovector1.Normalize(); 317 326 //Log() << Verbose(3) << "ReScaleCheck: " << Orthovector1.Norm() << " and " << InBondvector.Norm() << "." << endl; … … 345 354 SecondOtherAtom->x.Zero(); 346 355 for(int i=NDIM;i--;) { // rotate by half the bond angle in both directions (InBondvector is bondangle = 0 direction) 347 FirstOtherAtom->x .x[i] = InBondvector.x[i] * cos(bondangle) + Orthovector1.x[i] * (sin(bondangle));348 SecondOtherAtom->x .x[i] = InBondvector.x[i] * cos(bondangle) + Orthovector1.x[i] * (-sin(bondangle));356 FirstOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle)); 357 SecondOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle)); 349 358 } 350 359 FirstOtherAtom->x.Scale(&BondRescale); // rescale by correct BondDistance … … 352 361 //Log() << Verbose(3) << "ReScaleCheck: " << FirstOtherAtom->x.Norm() << " and " << SecondOtherAtom->x.Norm() << "." << endl; 353 362 for(int i=NDIM;i--;) { // and make relative to origin atom 354 FirstOtherAtom->x .x[i] += TopOrigin->x.x[i];355 SecondOtherAtom->x .x[i] += TopOrigin->x.x[i];363 FirstOtherAtom->x[i] += TopOrigin->x[i]; 364 SecondOtherAtom->x[i] += TopOrigin->x[i]; 356 365 } 357 366 // ... and add to molecule … … 394 403 // Orthovector1.Output(out); 395 404 // Log() << Verbose(0) << endl; 396 AllWentWell = AllWentWell && Orthovector2.MakeNormalVector(&InBondvector, &Orthovector1); 405 try{ 406 Orthovector2 = Plane(InBondvector, Orthovector1,0).getNormal(); 407 } 408 catch(LinearDependenceException &excp) { 409 Log() << Verbose(0) << excp; 410 AllWentWell = false; 411 } 397 412 // Log() << Verbose(3) << "Orthovector2: "; 398 413 // Orthovector2.Output(out); … … 514 529 } 515 530 for(j=NDIM;j--;) { 516 Walker->x .x[j] = x[j];517 Walker->Trajectory.R.at(MDSteps-1) .x[j] = x[j];518 Walker->Trajectory.U.at(MDSteps-1) .x[j] = 0;519 Walker->Trajectory.F.at(MDSteps-1) .x[j] = 0;531 Walker->x[j] = x[j]; 532 Walker->Trajectory.R.at(MDSteps-1)[j] = x[j]; 533 Walker->Trajectory.U.at(MDSteps-1)[j] = 0; 534 Walker->Trajectory.F.at(MDSteps-1)[j] = 0; 520 535 } 521 536 AddAtom(Walker); // add to molecule … … 661 676 void molecule::SetBoxDimension(Vector *dim) 662 677 { 663 cell_size[0] = dim-> x[0];678 cell_size[0] = dim->at(0); 664 679 cell_size[1] = 0.; 665 cell_size[2] = dim-> x[1];680 cell_size[2] = dim->at(1); 666 681 cell_size[3] = 0.; 667 682 cell_size[4] = 0.; 668 cell_size[5] = dim-> x[2];683 cell_size[5] = dim->at(2); 669 684 }; 670 685 … … 755 770 for (int i=0;i<NDIM;i++) { 756 771 j += i+1; 757 result = result && ((x-> x[i] >= 0) && (x->x[i]< cell_size[j]));772 result = result && ((x->at(i) >= 0) && (x->at(i) < cell_size[j])); 758 773 } 759 774 //return result; … … 1005 1020 DeterminePeriodicCenter(CenterOfGravity); 1006 1021 OtherMolecule->DeterminePeriodicCenter(OtherCenterOfGravity); 1007 Log() << Verbose(5) << "Center of Gravity: "; 1008 CenterOfGravity.Output(); 1009 Log() << Verbose(0) << endl << Verbose(5) << "Other Center of Gravity: "; 1010 OtherCenterOfGravity.Output(); 1011 Log() << Verbose(0) << endl; 1022 Log() << Verbose(5) << "Center of Gravity: " << CenterOfGravity << endl; 1023 Log() << Verbose(5) << "Other Center of Gravity: " << OtherCenterOfGravity << endl; 1012 1024 if (CenterOfGravity.DistanceSquared(&OtherCenterOfGravity) > threshold*threshold) { 1013 1025 Log() << Verbose(4) << "Centers of gravity don't match." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.