Changeset 273382 for src/Legacy/oldmenu.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 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:
- 1bd79e
- Parents:
- 72e7fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Legacy/oldmenu.cpp
r72e7fa r273382 103 103 dialog->queryVector("Enter reference coordinates.",&x,mol->cell_size,true); 104 104 dialog->queryVector("Enter relative coordinates.",&first->x,mol->cell_size,false); 105 first->x .AddVector(&x);105 first->x += x; 106 106 dialog->display(); 107 107 delete dialog; … … 168 168 */ 169 169 // calc axis vector 170 x.CopyVector(&second->x); 171 x.SubtractVector(&third->x); 170 x= second->x - third->x; 172 171 x.Normalize(); 173 172 Log() << Verbose(0) << "x: " << x << endl; … … 178 177 179 178 // rotate vector around first angle 180 first->x .CopyVector(&x);179 first->x = x; 181 180 first->x = RotateVector(first->x,z,b - M_PI); 182 181 Log() << Verbose(0) << "Rotated vector: " << first->x << endl, 183 182 // remove the projection onto the rotation plane of the second angle 184 n .CopyVector(&y);185 n.Scale(first->x.ScalarProduct( &y));183 n = y; 184 n.Scale(first->x.ScalarProduct(y)); 186 185 Log() << Verbose(0) << "N1: " << n << endl; 187 first->x .SubtractVector(&n);186 first->x -= n; 188 187 Log() << Verbose(0) << "Subtracted vector: " << first->x << endl; 189 n .CopyVector(&z);190 n.Scale(first->x.ScalarProduct( &z));188 n = z; 189 n.Scale(first->x.ScalarProduct(z)); 191 190 Log() << Verbose(0) << "N2: " << n << endl; 192 first->x .SubtractVector(&n);191 first->x -= n; 193 192 Log() << Verbose(0) << "2nd subtracted vector: " << first->x << endl; 194 193 195 194 // rotate another vector around second angle 196 n .CopyVector(&y);195 n = y; 197 196 n = RotateVector(n,x,c - M_PI); 198 197 Log() << Verbose(0) << "2nd Rotated vector: " << n << endl; 199 198 200 199 // add the two linear independent vectors 201 first->x .AddVector(&n);200 first->x += n; 202 201 first->x.Normalize(); 203 202 first->x.Scale(a); 204 first->x .AddVector(&second->x);203 first->x += second->x; 205 204 206 205 Log() << Verbose(0) << "resulting coordinates: " << first->x << endl; … … 277 276 } 278 277 mol->CenterEdge(&x); // make every coordinate positive 279 mol->Center.AddVector(&y); // translate by boundary 280 helper.CopyVector(&y); 281 helper.Scale(2.); 282 helper.AddVector(&x); 278 mol->Center += y; // translate by boundary 279 helper = (2*y)+x; 283 280 mol->SetBoxDimension(&helper); // update Box of atoms by boundary 284 281 break; … … 340 337 second = mol->AskAtom("Enter second atom: "); 341 338 342 n.CopyVector((const Vector *)&first->x); 343 n.SubtractVector((const Vector *)&second->x); 339 n = first->x - second->x; 344 340 n.Normalize(); 345 341 break; … … 408 404 second = mol->AskAtom("Enter second atom: "); 409 405 410 n.CopyVector((const Vector *)&first->x); 411 n.SubtractVector((const Vector *)&second->x); 406 n = first->x - second->x; 412 407 n.Normalize(); 413 408 break; … … 453 448 first = second; 454 449 second = first->next; 455 if (first->x.DistanceSquared( (const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...450 if (first->x.DistanceSquared(second->x) > tmp1*tmp1) // distance to first above radius ... 456 451 mol->RemoveAtom(first); 457 452 } … … 520 515 tmp1 = 0.; 521 516 if (first != second) { 522 x.CopyVector((const Vector *)&first->x); 523 x.SubtractVector((const Vector *)&second->x); 517 x = first->x - second->x; 524 518 tmp1 = x.Norm(); 525 519 } … … 536 530 for (int i=NDIM;i--;) 537 531 min[i] = 0.; 538 x.CopyVector((const Vector *)&first->x); 539 x.SubtractVector((const Vector *)&second->x); 532 x = first->x - second->x; 540 533 tmp1 = x.Norm(); 541 534 Log() << Verbose(1) << "Distance vector is " << x << "." << "/n" … … 549 542 third = mol->AskAtom("Enter last atom: "); 550 543 tmp1 = tmp2 = tmp3 = 0.; 551 x.CopyVector((const Vector *)&first->x); 552 x.SubtractVector((const Vector *)&second->x); 553 y.CopyVector((const Vector *)&third->x); 554 y.SubtractVector((const Vector *)&second->x); 544 x = first->x - second->x; 545 y = third->x - second->x; 555 546 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 556 Log() << Verbose(0) << (acos(x.ScalarProduct( (const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;547 Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 557 548 break; 558 549 case 'd': … … 777 768 y[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 778 769 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 779 x .AddVector(&y); // per factor one cell width further770 x += y; // per factor one cell width further 780 771 for (int k=count;k--;) { // go through every atom of the original cell 781 772 first = World::getInstance().createAtom(); // create a new body 782 first->x.CopyVector(vectors[k]); // use coordinate of original atom 783 first->x.AddVector(&x); // translate the coordinates 773 first->x = (*vectors[k]) + x; // use coordinate of original atom 784 774 first->type = Elements[k]; // insert original element 785 775 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) … … 793 783 // correct cell size 794 784 if (axis < 0) { // if sign was negative, we have to translate everything 795 x.Zero(); 796 x.AddVector(&y); 785 x = y; 797 786 x.Scale(-(faktor-1)); 798 787 mol->Translate(&x); … … 894 883 dialog->display(); 895 884 delete dialog; 896 mol->Center .AddVector((const Vector *)&x);885 mol->Center += x; 897 886 } 898 887 break;
Note:
See TracChangeset
for help on using the changeset viewer.