Changeset 8f4df1 for src/Legacy/oldmenu.cpp
- Timestamp:
- Aug 7, 2010, 12:07:04 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:
- 2d292d
- Parents:
- 8d6d31 (diff), d74077 (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
Legend:
- Unmodified
- Added
- Removed
-
src/Legacy/oldmenu.cpp
r8d6d31 r8f4df1 89 89 first = World::getInstance().createAtom(); 90 90 std::vector<element *> elements; 91 dialog->queryVector("Please enter coordinates: ",&first-> x,World::getInstance().getDomain(), false);91 dialog->queryVector("Please enter coordinates: ",&first->AtomicPosition,World::getInstance().getDomain(), false); 92 92 dialog->queryElement("Please choose element: ",&elements); 93 93 if(dialog->display()){ 94 94 if (elements.size() == 1) { 95 first-> type = elements.at(0);95 first->setType(elements.at(0)); 96 96 mol->AddAtom(first); // add to molecule 97 97 } else { … … 113 113 auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog()); 114 114 dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true); 115 dialog->queryVector("Enter relative coordinates.",&first-> x,World::getInstance().getDomain(), false);115 dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false); 116 116 if((aborted = !dialog->display())){ 117 117 continue; 118 118 } 119 first-> x+= x;120 } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first-> x)));119 first->AtomicPosition += x; 120 } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition))); 121 121 if(!aborted){ 122 first-> type= periode->AskElement(); // give type122 first->AtomicElement = periode->AskElement(); // give type 123 123 mol->AddAtom(first); // add to molecule 124 124 } … … 136 136 auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog()); 137 137 second = mol->AskAtom("Enter atom number: "); 138 dialog->queryVector("Enter relative coordinates.",&first-> x,World::getInstance().getDomain(), false);138 dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false); 139 139 dialog->display(); 140 140 for (int i=NDIM;i--;) { 141 first-> x[i] += second->x[i];141 first->AtomicPosition[i] += second->AtomicPosition[i]; 142 142 } 143 } while (!(valid = mol->CheckBounds((const Vector *)&first-> x)));144 first-> type= periode->AskElement(); // give type143 } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition))); 144 first->AtomicElement = periode->AskElement(); // give type 145 145 mol->AddAtom(first); // add to molecule 146 146 } … … 152 152 do { 153 153 if (!valid) { 154 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first-> x<< endl;154 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->AtomicPosition << endl; 155 155 } 156 156 Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; … … 185 185 */ 186 186 // calc axis vector 187 x= second-> x - third->x;187 x= second->AtomicPosition - third->AtomicPosition; 188 188 x.Normalize(); 189 189 Log() << Verbose(0) << "x: " << x << endl; 190 z = Plane(second-> x,third->x,fourth->x).getNormal();190 z = Plane(second->AtomicPosition,third->AtomicPosition,fourth->AtomicPosition).getNormal(); 191 191 Log() << Verbose(0) << "z: " << z << endl; 192 192 y = Plane(x,z,0).getNormal(); … … 194 194 195 195 // rotate vector around first angle 196 first-> x= x;197 first-> x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);198 Log() << Verbose(0) << "Rotated vector: " << first-> x<< endl,196 first->AtomicPosition = x; 197 first->AtomicPosition = Line(zeroVec,z).rotateVector(first->AtomicPosition,b - M_PI); 198 Log() << Verbose(0) << "Rotated vector: " << first->AtomicPosition << endl, 199 199 // remove the projection onto the rotation plane of the second angle 200 200 n = y; 201 n.Scale(first-> x.ScalarProduct(y));201 n.Scale(first->AtomicPosition.ScalarProduct(y)); 202 202 Log() << Verbose(0) << "N1: " << n << endl; 203 first-> x-= n;204 Log() << Verbose(0) << "Subtracted vector: " << first-> x<< endl;203 first->AtomicPosition -= n; 204 Log() << Verbose(0) << "Subtracted vector: " << first->AtomicPosition << endl; 205 205 n = z; 206 n.Scale(first-> x.ScalarProduct(z));206 n.Scale(first->AtomicPosition.ScalarProduct(z)); 207 207 Log() << Verbose(0) << "N2: " << n << endl; 208 first-> x-= n;209 Log() << Verbose(0) << "2nd subtracted vector: " << first-> x<< endl;208 first->AtomicPosition -= n; 209 Log() << Verbose(0) << "2nd subtracted vector: " << first->AtomicPosition << endl; 210 210 211 211 // rotate another vector around second angle … … 215 215 216 216 // add the two linear independent vectors 217 first-> x+= n;218 first-> x.Normalize();219 first-> x.Scale(a);220 first-> x += second->x;221 222 Log() << Verbose(0) << "resulting coordinates: " << first-> x<< endl;223 } while (!(valid = mol->CheckBounds((const Vector *)&first-> x)));224 first-> type= periode->AskElement(); // give type217 first->AtomicPosition += n; 218 first->AtomicPosition.Normalize(); 219 first->AtomicPosition.Scale(a); 220 first->AtomicPosition += second->AtomicPosition; 221 222 Log() << Verbose(0) << "resulting coordinates: " << first->AtomicPosition << endl; 223 } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition))); 224 first->AtomicElement = periode->AskElement(); // give type 225 225 mol->AddAtom(first); // add to molecule 226 226 break; … … 239 239 if (j != -1) { 240 240 second = mol->FindAtom(j); 241 atoms[i++] = &(second-> x);241 atoms[i++] = &(second->AtomicPosition); 242 242 } 243 243 } while ((j != -1) && (i<128)); 244 244 if (i >= 2) { 245 LSQdistance(first-> x,(const Vector **)atoms, i);246 247 Log() << Verbose(0) << first-> x;248 first-> type= periode->AskElement(); // give type245 LSQdistance(first->AtomicPosition,(const Vector **)atoms, i); 246 247 Log() << Verbose(0) << first->AtomicPosition; 248 first->AtomicElement = periode->AskElement(); // give type 249 249 mol->AddAtom(first); // add to molecule 250 250 } else { … … 338 338 third = mol->AskAtom("Enter third atom: "); 339 339 340 n = Plane(first-> x,second->x,third->x).getNormal();340 n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal(); 341 341 break; 342 342 case 'b': // normal vector of mirror plane … … 354 354 second = mol->AskAtom("Enter second atom: "); 355 355 356 n = first-> x - second->x;356 n = first->AtomicPosition - second->AtomicPosition; 357 357 n.Normalize(); 358 358 break; … … 405 405 third = mol->AskAtom("Enter third atom: "); 406 406 407 n = Plane(first-> x,second->x,third->x).getNormal();407 n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal(); 408 408 break; 409 409 case 'b': // normal vector of mirror plane … … 421 421 second = mol->AskAtom("Enter second atom: "); 422 422 423 n = first-> x - second->x;423 n = first->AtomicPosition - second->AtomicPosition; 424 424 n.Normalize(); 425 425 break; … … 464 464 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) { 465 465 runner = iter++; 466 if ((*runner)-> x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...466 if ((*runner)->AtomicPosition.DistanceSquared((*runner)->AtomicPosition) > tmp1*tmp1) // distance to first above radius ... 467 467 mol->RemoveAtom((*runner)); 468 468 } … … 479 479 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) { 480 480 runner = iter++; 481 if (((*runner)-> x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...481 if (((*runner)->AtomicPosition[axis] < tmp1) || ((*runner)->AtomicPosition[axis] > tmp2)) {// out of boundary ... 482 482 //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl; 483 483 mol->RemoveAtom((*runner)); … … 526 526 527 527 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 528 Z = (*iter)-> type->Z;528 Z = (*iter)->getType()->Z; 529 529 tmp1 = 0.; 530 530 if (first != (*iter)) { 531 x = first-> x - (*iter)->x;531 x = first->AtomicPosition - (*iter)->AtomicPosition; 532 532 tmp1 = x.Norm(); 533 533 } … … 536 536 } 537 537 for (int i=MAX_ELEMENTS;i--;) 538 if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first-> type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;538 if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->getType()->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl; 539 539 break; 540 540 … … 544 544 for (int i=NDIM;i--;) 545 545 min[i] = 0.; 546 x = first-> x - second->x;546 x = first->AtomicPosition - second->AtomicPosition; 547 547 tmp1 = x.Norm(); 548 548 Log() << Verbose(1) << "Distance vector is " << x << "." << "/n" … … 556 556 third = mol->AskAtom("Enter last atom: "); 557 557 tmp1 = tmp2 = tmp3 = 0.; 558 x = first-> x - second->x;559 y = third-> x - second->x;558 x = first->AtomicPosition - second->AtomicPosition; 559 y = third->AtomicPosition - second->AtomicPosition; 560 560 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 561 561 Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; … … 695 695 minBond = 0.; 696 696 for (int i=NDIM;i--;) 697 minBond += (first-> x[i]-second->x[i])*(first->x[i] - second->x[i]);697 minBond += (first->AtomicPosition[i]-second->AtomicPosition[i])*(first->AtomicPosition[i] - second->AtomicPosition[i]); 698 698 minBond = sqrt(minBond); 699 Log() << Verbose(0) << "Current Bond length between " << first-> type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;699 Log() << Verbose(0) << "Current Bond length between " << first->getType()->name << " Atom " << first->nr << " and " << second->getType()->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl; 700 700 Log() << Verbose(0) << "Enter new bond length [a.u.]: "; 701 701 cin >> bond; 702 702 for (int i=NDIM;i--;) { 703 second-> x[i] -= (second->x[i]-first->x[i])/minBond*(minBond-bond);703 second->AtomicPosition[i] -= (second->AtomicPosition[i]-first->AtomicPosition[i])/minBond*(minBond-bond); 704 704 } 705 705 //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: "; … … 757 757 cin >> Z; 758 758 first->setType(Z); 759 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first-> type->name << "." << endl;759 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->getType()->name << "." << endl; 760 760 } 761 761 break; … … 785 785 j = 0; 786 786 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 787 Elements[j] = (*iter)-> type;788 vectors[j] = &(*iter)-> x;787 Elements[j] = (*iter)->AtomicElement; 788 vectors[j] = &(*iter)->AtomicPosition; 789 789 j++; 790 790 } … … 798 798 for (int k=count;k--;) { // go through every atom of the original cell 799 799 first = World::getInstance().createAtom(); // create a new body 800 first-> x= (*vectors[k]) + x; // use coordinate of original atom801 first-> type= Elements[k]; // insert original element800 first->AtomicPosition = (*vectors[k]) + x; // use coordinate of original atom 801 first->AtomicElement = Elements[k]; // insert original element 802 802 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 803 803 }
Note:
See TracChangeset
for help on using the changeset viewer.