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