Changeset 1024cb for src/builder.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/builder.cpp
r42af9e r1024cb 865 865 866 866 mol->CountAtoms(); // recount atoms 867 if (mol-> AtomCount!= 0) { // if there is more than none868 count = mol-> AtomCount; // is changed becausing of adding, thus has to be stored away beforehand867 if (mol->getAtomCount() != 0) { // if there is more than none 868 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 869 869 Elements = new element *[count]; 870 870 vectors = new Vector *[count]; … … 1296 1296 // generate some KeySets 1297 1297 DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl); 1298 KeySet TestSets[mol-> AtomCount+1];1298 KeySet TestSets[mol->getAtomCount()+1]; 1299 1299 i=1; 1300 1300 while (Walker->next != mol->end) { … … 1307 1307 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl); 1308 1308 KeySetTestPair test; 1309 test = TestSets[mol-> AtomCount-1].insert(Walker->nr);1309 test = TestSets[mol->getAtomCount()-1].insert(Walker->nr); 1310 1310 if (test.second) { 1311 1311 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); … … 1313 1313 DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl); 1314 1314 } 1315 TestSets[mol-> AtomCount].insert(mol->end->previous->nr);1316 TestSets[mol-> AtomCount].insert(mol->end->previous->previous->previous->nr);1315 TestSets[mol->getAtomCount()].insert(mol->end->previous->nr); 1316 TestSets[mol->getAtomCount()].insert(mol->end->previous->previous->previous->nr); 1317 1317 1318 1318 // constructing Graph structure … … 1322 1322 // insert KeySets into Subgraphs 1323 1323 DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl); 1324 for (int j=0;j<mol-> AtomCount;j++) {1324 for (int j=0;j<mol->getAtomCount();j++) { 1325 1325 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.))); 1326 1326 } 1327 1327 DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl); 1328 1328 GraphTestPair test2; 1329 test2 = Subgraphs.insert(GraphPair (TestSets[mol-> AtomCount],pair<int, double>(counter++, 1.)));1329 test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.))); 1330 1330 if (test2.second) { 1331 1331 DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl); … … 1714 1714 if (first->type != NULL) { 1715 1715 mol->AddAtom(first); // add to molecule 1716 if ((configPresent == empty) && (mol-> AtomCount!= 0))1716 if ((configPresent == empty) && (mol->getAtomCount() != 0)) 1717 1717 configPresent = present; 1718 1718 } else … … 1732 1732 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl); 1733 1733 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 1734 int *MinimumRingSize = new int[mol-> AtomCount];1734 int *MinimumRingSize = new int[mol->getAtomCount()]; 1735 1735 atom ***ListOfLocalAtoms = NULL; 1736 1736 class StackClass<bond *> *BackEdgeStack = NULL; … … 1880 1880 int counter = 0; 1881 1881 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1882 if ((Boundary == NULL) || (Boundary-> AtomCount < (*BigFinder)->AtomCount)) {1882 if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) { 1883 1883 Boundary = *BigFinder; 1884 1884 } … … 1939 1939 performCriticalExit(); 1940 1940 } else { 1941 mol->getAtomCount(); 1941 1942 SaveFlag = true; 1942 1943 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl); … … 2042 2043 int counter = 0; 2043 2044 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 2044 (*BigFinder)->CountAtoms(); 2045 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 2045 if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) { 2046 2046 Boundary = *BigFinder; 2047 2047 } 2048 2048 counter++; 2049 2049 } 2050 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary-> AtomCount<< " atoms." << endl);2050 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->getAtomCount() << " atoms." << endl); 2051 2051 start = clock(); 2052 2052 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); … … 2115 2115 case 'R': 2116 2116 if (ExitFlag == 0) ExitFlag = 1; 2117 if ((argptr+ 1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {2117 if ((argptr+3 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 2118 2118 ExitFlag = 255; 2119 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R < id> <distance>" << endl);2119 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <x> <y> <z> <distance>" << endl); 2120 2120 performCriticalExit(); 2121 2121 } else { 2122 2122 SaveFlag = true; 2123 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl);2124 double tmp1 = atof(argv[argptr+1]);2125 atom *third = mol->FindAtom(atoi(argv[argptr]));2126 atom * first = mol->start;2127 if ((third != NULL) && (first != mol->end)) {2128 atom *second = first->next;2129 while(second != mol->end) {2130 first = second;2131 second = first->next;2132 if (first->x.DistanceSquared(third->x) > tmp1*tmp1) {// distance to first above radius ...2133 mol->RemoveAtom(first);2134 }2123 const double radius = atof(argv[argptr+3]); 2124 Vector point(atof(argv[argptr]),atof(argv[argptr+1]),atof(argv[argptr+2])); 2125 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point << " with radius " << radius << "." << endl); 2126 atom *Walker = NULL; 2127 molecule::iterator advancer = mol->begin(); 2128 for(molecule::iterator iter = advancer; advancer != mol->end();) { 2129 iter = advancer++; 2130 if ((*iter)->x.DistanceSquared(point) > radius*radius){ // distance to first above radius ... 2131 Walker = (*iter); 2132 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << *Walker << "." << endl); 2133 mol->RemoveAtom(*(iter)); 2134 World::getInstance().destroyAtom(Walker); 2135 2135 } 2136 } else {2137 DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);2138 2136 } 2139 argptr+= 2;2137 argptr+=4; 2140 2138 } 2141 2139 break; … … 2262 2260 performCriticalExit(); 2263 2261 } else { 2262 mol->getAtomCount(); 2264 2263 SaveFlag = true; 2265 2264 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl); … … 2381 2380 faktor = 1; 2382 2381 } 2383 mol->CountAtoms(); // recount atoms 2384 if (mol->AtomCount != 0) { // if there is more than none 2385 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 2382 if (mol->getAtomCount() != 0) { // if there is more than none 2383 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 2386 2384 Elements = new const element *[count]; 2387 2385 vectors = new Vector *[count]; 2388 2386 j = 0; 2389 first = mol->start; 2390 while (first->next != mol->end) { // make a list of all atoms with coordinates and element 2391 first = first->next; 2392 Elements[j] = first->type; 2393 vectors[j] = &first->x; 2387 for(molecule::iterator iter = mol->begin();iter!=mol->end();++iter){ 2388 Elements[j] = (*iter)->type; 2389 vectors[j] = &(*iter)->x; 2394 2390 j++; 2395 2391 } … … 2458 2454 { 2459 2455 config *configuration = World::getInstance().getConfig(); 2456 // while we are non interactive, we want to abort from asserts 2457 //ASSERT_DO(Assert::Abort); 2458 molecule *mol = NULL; 2460 2459 Vector x, y, z, n; 2461 2460 ifstream test; … … 2481 2480 // need to init the history before any action is created 2482 2481 ActionHistory::init(); 2482 2483 // In the interactive mode, we can leave the user the choice in case of error 2484 ASSERT_DO(Assert::Ask); 2483 2485 2484 2486 // from this moment on, we need to be sure to deeinitialize in the correct order
Note:
See TracChangeset
for help on using the changeset viewer.