Changeset a7b761b for src/Legacy/oldmenu.cpp
- Timestamp:
- May 27, 2010, 10:46:54 AM (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:
- 1024cb
- Parents:
- 8f215d (diff), 05a97c (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
r8f215d ra7b761b 423 423 void oldmenu::RemoveAtoms(molecule *mol) 424 424 { 425 atom * first, *second;425 atom *second; 426 426 int axis; 427 427 double tmp1, tmp2; … … 446 446 break; 447 447 case 'b': 448 second = mol->AskAtom("Enter number of atom as reference point: ");449 Log() << Verbose(0) << "Enter radius: ";450 cin >> tmp1;451 first = mol->start;452 second = first->next;453 while(second != mol->end) {454 first = second;455 second = first->next;456 if (first->x.DistanceSquared(second->x) > tmp1*tmp1) // distance to first above radius ...457 mol->RemoveAtom(first);448 { 449 second = mol->AskAtom("Enter number of atom as reference point: "); 450 Log() << Verbose(0) << "Enter radius: "; 451 cin >> tmp1; 452 molecule::iterator runner; 453 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) { 454 runner = iter++; 455 if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ... 456 mol->RemoveAtom((*runner)); 457 } 458 458 } 459 459 break; … … 465 465 Log() << Verbose(0) << "Upper boundary: "; 466 466 cin >> tmp2; 467 first = mol->start; 468 second = first->next; 469 while(second != mol->end) { 470 first = second; 471 second = first->next; 472 if ((first->x[axis] < tmp1) || (first->x[axis] > tmp2)) {// out of boundary ... 473 //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl; 474 mol->RemoveAtom(first); 467 molecule::iterator runner; 468 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) { 469 runner = iter++; 470 if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ... 471 //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl; 472 mol->RemoveAtom((*runner)); 475 473 } 476 474 } … … 515 513 min[i] = 0.; 516 514 517 second = mol->start; 518 while ((second->next != mol->end)) { 519 second = second->next; // advance 520 Z = second->type->Z; 515 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 516 Z = (*iter)->type->Z; 521 517 tmp1 = 0.; 522 if (first != second) {523 x = first->x - second->x;518 if (first != (*iter)) { 519 x = first->x - (*iter)->x; 524 520 tmp1 = x.Norm(); 525 521 } 526 522 if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1; 527 //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;523 //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << ((*iter)->nr << ": " << tmp1 << " a.u." << endl; 528 524 } 529 525 for (int i=MAX_ELEMENTS;i--;) … … 754 750 Log() << Verbose(0) << "State the factor: "; 755 751 cin >> faktor; 756 757 mol->CountAtoms(); // recount atoms 758 if (mol->AtomCount != 0) { // if there is more than none 759 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 752 if (mol->getAtomCount() != 0) { // if there is more than none 753 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 760 754 Elements = new const element *[count]; 761 755 vectors = new Vector *[count]; 762 756 j = 0; 763 first = mol->start; 764 while (first->next != mol->end) { // make a list of all atoms with coordinates and element 765 first = first->next; 766 Elements[j] = first->type; 767 vectors[j] = &first->x; 757 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 758 Elements[j] = (*iter)->type; 759 vectors[j] = &(*iter)->x; 768 760 j++; 769 761 } … … 1024 1016 return; 1025 1017 } 1026 atom *Walker = mol->start;1027 1018 1028 1019 // generate some KeySets 1029 1020 Log() << Verbose(0) << "Generating KeySets." << endl; 1030 KeySet TestSets[mol-> AtomCount+1];1021 KeySet TestSets[mol->getAtomCount()+1]; 1031 1022 i=1; 1032 while (Walker->next != mol->end) { 1033 Walker = Walker->next; 1023 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 1034 1024 for (int j=0;j<i;j++) { 1035 TestSets[j].insert( Walker->nr);1025 TestSets[j].insert((*iter)->nr); 1036 1026 } 1037 1027 i++; … … 1039 1029 Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl; 1040 1030 KeySetTestPair test; 1041 test = TestSets[mol->AtomCount-1].insert(Walker->nr); 1042 if (test.second) { 1043 Log() << Verbose(1) << "Insertion worked?!" << endl; 1031 molecule::const_iterator iter = mol->begin(); 1032 if (iter != mol->end()) { 1033 test = TestSets[mol->getAtomCount()-1].insert((*iter)->nr); 1034 if (test.second) { 1035 Log() << Verbose(1) << "Insertion worked?!" << endl; 1036 } else { 1037 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl; 1038 } 1044 1039 } else { 1045 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl; 1046 } 1047 TestSets[mol->AtomCount].insert(mol->end->previous->nr); 1048 TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr); 1040 eLog() << Verbose(1) << "No atoms to test double insertion." << endl; 1041 } 1049 1042 1050 1043 // constructing Graph structure … … 1054 1047 // insert KeySets into Subgraphs 1055 1048 Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl; 1056 for (int j=0;j<mol-> AtomCount;j++) {1049 for (int j=0;j<mol->getAtomCount();j++) { 1057 1050 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.))); 1058 1051 } 1059 1052 Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl; 1060 1053 GraphTestPair test2; 1061 test2 = Subgraphs.insert(GraphPair (TestSets[mol-> AtomCount],pair<int, double>(counter++, 1.)));1054 test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.))); 1062 1055 if (test2.second) { 1063 1056 Log() << Verbose(1) << "Insertion worked?!" << endl;
Note:
See TracChangeset
for help on using the changeset viewer.