Changeset 1024cb for src/builder.cpp


Ignore:
Timestamp:
May 31, 2010, 5:32:27 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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)
Message:

Merge commit 'jupiter/MoleculeStartEndSwitch' into CommandLineActionMapping

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/unittests/AnalysisCorrelationToPointUnitTest.cpp
molecuilder/src/unittests/listofbondsunittest.cpp

Integration of MoleculeStartEndSwitch had the following consequences:

  • no more AtomCount -> getAtomCount()
  • no more start/end -> begin(), end() and iterator
  • no more decent ordering in atomic ids (hence, Simple_configuration/8 and Domain/5, Domain/6 now check by comparing sorted xyz, not confs)

There is still a huge problem with bonds. One test runs into an endless loop.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r42af9e r1024cb  
    865865
    866866        mol->CountAtoms(); // recount atoms
    867         if (mol->AtomCount != 0) {  // if there is more than none
    868           count = mol->AtomCount;  // is changed becausing of adding, thus has to be stored away beforehand
     867        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
    869869          Elements = new element *[count];
    870870          vectors = new Vector *[count];
     
    12961296  // generate some KeySets
    12971297  DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
    1298   KeySet TestSets[mol->AtomCount+1];
     1298  KeySet TestSets[mol->getAtomCount()+1];
    12991299  i=1;
    13001300  while (Walker->next != mol->end) {
     
    13071307  DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl);
    13081308  KeySetTestPair test;
    1309   test = TestSets[mol->AtomCount-1].insert(Walker->nr);
     1309  test = TestSets[mol->getAtomCount()-1].insert(Walker->nr);
    13101310  if (test.second) {
    13111311    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
     
    13131313    DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl);
    13141314  }
    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);
    13171317
    13181318  // constructing Graph structure
     
    13221322  // insert KeySets into Subgraphs
    13231323  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++) {
    13251325    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    13261326  }
    13271327  DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl);
    13281328  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.)));
    13301330  if (test2.second) {
    13311331    DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
     
    17141714                if (first->type != NULL) {
    17151715                  mol->AddAtom(first);  // add to molecule
    1716                   if ((configPresent == empty) && (mol->AtomCount != 0))
     1716                  if ((configPresent == empty) && (mol->getAtomCount() != 0))
    17171717                    configPresent = present;
    17181718                } else
     
    17321732                DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl);
    17331733                MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
    1734                 int *MinimumRingSize = new int[mol->AtomCount];
     1734                int *MinimumRingSize = new int[mol->getAtomCount()];
    17351735                atom ***ListOfLocalAtoms = NULL;
    17361736                class StackClass<bond *> *BackEdgeStack = NULL;
     
    18801880                          int counter  = 0;
    18811881                          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())) {
    18831883                              Boundary = *BigFinder;
    18841884                            }
     
    19391939                performCriticalExit();
    19401940              } else {
     1941                mol->getAtomCount();
    19411942                SaveFlag = true;
    19421943                DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl);
     
    20422043                int counter  = 0;
    20432044                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())) {
    20462046                    Boundary = *BigFinder;
    20472047                  }
    20482048                  counter++;
    20492049                }
    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);
    20512051                start = clock();
    20522052                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     
    21152115            case 'R':
    21162116              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])))  {
    21182118                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);
    21202120                performCriticalExit();
    21212121              } else {
    21222122                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);
    21352135                  }
    2136                 } else {
    2137                   DoeLog(1) && (eLog()<< Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl);
    21382136                }
    2139                 argptr+=2;
     2137                argptr+=4;
    21402138              }
    21412139              break;
     
    22622260                performCriticalExit();
    22632261              } else {
     2262                mol->getAtomCount();
    22642263                SaveFlag = true;
    22652264                DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl);
     
    23812380                    faktor = 1;
    23822381                  }
    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
    23862384                    Elements = new const element *[count];
    23872385                    vectors = new Vector *[count];
    23882386                    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;
    23942390                      j++;
    23952391                    }
     
    24582454{
    24592455    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;
    24602459    Vector x, y, z, n;
    24612460    ifstream test;
     
    24812480    // need to init the history before any action is created
    24822481    ActionHistory::init();
     2482
     2483    // In the interactive mode, we can leave the user the choice in case of error
     2484    ASSERT_DO(Assert::Ask);
    24832485
    24842486    // 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.