Changeset 51c910


Ignore:
Timestamp:
Jul 23, 2009, 2:04:47 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:
36ec71
Parents:
d067d45 (diff), 375b458 (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.
Message:

Merge branch 'AtomRemoval'

Conflicts:

molecuilder/src/builder.cpp
molecuilder/src/molecules.cpp

merges:

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    rd067d45 r51c910  
    463463      cin >> tmp1;
    464464      first = mol->start;
    465       while(first->next != mol->end) {
    466         first = first->next;
     465      second = first->next;
     466      while(second != mol->end) {
     467        first = second;
     468        second = first->next;
    467469        if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
    468470          mol->RemoveAtom(first);
     
    472474      cout << Verbose(0) << "Which axis is it: ";
    473475      cin >> axis;
    474       cout << Verbose(0) << "Left inward boundary: ";
     476      cout << Verbose(0) << "Lower boundary: ";
    475477      cin >> tmp1;
    476       cout << Verbose(0) << "Right inward boundary: ";
     478      cout << Verbose(0) << "Upper boundary: ";
    477479      cin >> tmp2;
    478480      first = mol->start;
    479       while(first->next != mol->end) {
    480         first = first->next;
    481         if ((first->x.x[axis] > tmp2) || (first->x.x[axis] < tmp1)) // out of boundary ...
     481      second = first->next;
     482      while(second != mol->end) {
     483        first = second;
     484        second = first->next;
     485        if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
     486          //cout << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    482487          mol->RemoveAtom(first);
     488        }
    483489      }
    484490      break;
     
    13491355            cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
    13501356            cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    1351             cout << "\t-N\tGet non-convex-envelope." << endl;
     1357            cout << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
    13521358            cout << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    13531359            cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
     
    13551361            cout << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl;
    13561362            cout << "\t-r\t\tConvert file from an old pcp syntax." << endl;
     1363            cout << "\t-R\t\tRemove all atoms out of sphere around a given one." << endl;
    13571364            cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    13581365            cout << "\t-T <file> Store temperatures from the config file in <file>." << endl;
     
    16211628                  cout << Verbose(2) << "File found and parsed." << endl;
    16221629                argptr+=1;
     1630              }
     1631              break;
     1632            case 'R':
     1633              ExitFlag = 1;
     1634              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
     1635                ExitFlag = 255;
     1636                cerr << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     1637              } else {
     1638                SaveFlag = true;
     1639                cout << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;
     1640                double tmp1 = atof(argv[argptr+1]);
     1641                atom *third = mol->FindAtom(atoi(argv[argptr]));
     1642                atom *first = mol->start;
     1643                if ((third != NULL) && (first != mol->end)) {
     1644                  atom *second = first->next;
     1645                  while(second != mol->end) {
     1646                    first = second;
     1647                    second = first->next;
     1648                    if (first->x.DistanceSquared((const Vector *)&third->x) > tmp1*tmp1) // distance to first above radius ...
     1649                      mol->RemoveAtom(first);
     1650                  }
     1651                } else {
     1652                  cerr << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     1653                }
     1654                argptr+=2;
    16231655              }
    16241656              break;
  • src/molecules.cpp

    rd067d45 r51c910  
    18601860bool molecule::RemoveAtom(atom *pointer)
    18611861{
    1862   if (ElementsInMolecule[pointer->type->Z] != 0)  // this would indicate an error
     1862  if (ElementsInMolecule[pointer->type->Z] != 0)  { // this would indicate an error
    18631863    ElementsInMolecule[pointer->type->Z]--;  // decrease number of atom of this element
    1864   else
     1864    AtomCount--;
     1865  } else
    18651866    cerr << "ERROR: Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
    18661867  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
     
    28452846    ColorList[i] = white;
    28462847  }
    2847  
     2848
    28482849  *out << Verbose(1) << "Back edge list - ";
    28492850  BackEdgeStack->Output(out);
     
    38523853        OtherAtom = ListOfBondsPerAtom[Walker->nr][i]->GetOtherAtom(Walker);
    38533854        if (OtherAtom == ListOfLocalAtoms[Binder->rightatom->nr]) { // found the bond
    3854             LocalStack->Push(ListOfBondsPerAtom[Walker->nr][i]);
    3855                 *out << Verbose(3) << "Found local edge " << *(ListOfBondsPerAtom[Walker->nr][i]) << "." << endl;
     3855          LocalStack->Push(ListOfBondsPerAtom[Walker->nr][i]);
     3856          *out << Verbose(3) << "Found local edge " << *(ListOfBondsPerAtom[Walker->nr][i]) << "." << endl;
    38563857          break;
    38573858        }
     
    38613862    ReferenceStack->Push(Binder);
    38623863  } while (FirstBond != Binder);
    3863  
     3864
    38643865  return status;
    38653866};
     
    40064007  Walker = start;
    40074008  while (Walker->next != end) {
    4008     Walker = Walker->next; 
     4009    Walker = Walker->next;
    40094010    *out << Verbose(4) << "Atom " << Walker->Name << "/" << Walker->nr << " with " << NumberOfBondsPerAtom[Walker->nr] << " bonds: ";
    40104011    TotalDegree = 0;
     
    43654366#ifdef ADDHYDROGEN
    43664367   && (Walker->type->Z == 1)
    4367 #endif
    4368                         ) { // search for first non-hydrogen atom
    4369     *out << Verbose(4) << "Current Root candidate is " << Walker->Name << "." << endl;
    4370     Walker = Walker->next;
    4371   }
    4372   if (Walker != end)
    4373     RootStack->Push(Walker);
    4374   else
    4375     *out << Verbose(0) << "ERROR: Could not find an appropriate Root atom!" << endl;
    4376   *out << Verbose(3) << "Root " << Walker->Name << " is on AtomStack, beginning loop through all vertices ..." << endl;
    4377 
    4378   ///// OUTER LOOP ////////////
    4379   while (!RootStack->IsEmpty()) {
    4380     // get new root vertex from atom stack
    4381     Root = RootStack->PopFirst();
    4382     ShortestPathList[Root->nr] = 0;
    4383     if (Labels[Root->nr] == -1)
    4384       Labels[Root->nr] = RunningIndex++; // prevent it from getting again on AtomStack
    4385     PredecessorList[Root->nr] = Root;
    4386     TouchedStack->Push(Root);
    4387     *out << Verbose(0) << "Root for this loop is: " << Root->Name << ".\n";
    4388 
    4389     // clear snake stack
    4390     SnakeStack->ClearStack();
    4391     //SnakeStack->TestImplementation(out, start->next);
    4392 
    4393     ///// INNER LOOP ////////////
    4394     // Problems:
    4395     // - what about cyclic bonds?
    4396     Walker = Root;
    4397     do {
    4398       *out << Verbose(1) << "Current Walker is: " << Walker->Name;
    4399       // initial setting of the new Walker: label, color, shortest path and put on stacks
    4400       if (Labels[Walker->nr] == -1)  {  // give atom a unique, monotonely increasing number
    4401         Labels[Walker->nr] = RunningIndex++;
    4402         RootStack->Push(Walker);
    4403       }
    4404       *out << ", has label " << Labels[Walker->nr];
    4405       if ((ColorVertexList[Walker->nr] == white) || ((Binder != NULL) && (ColorEdgeList[Binder->nr] == white))) {  // color it if newly discovered and push on stacks (and if within reach!)
    4406         if ((Binder != NULL) && (ColorEdgeList[Binder->nr] == white)) {
    4407           // Binder ought to be set still from last neighbour search
    4408           *out << ", coloring bond " << *Binder << " black";
    4409           ColorEdgeList[Binder->nr] = black; // mark this bond as used
    4410         }
    4411         if (ShortestPathList[Walker->nr] == -1) {
    4412           ShortestPathList[Walker->nr] = ShortestPathList[PredecessorList[Walker->nr]->nr]+1;
    4413           TouchedStack->Push(Walker); // mark every atom for lists cleanup later, whose shortest path has been changed
    4414         }
    4415         if ((ShortestPathList[Walker->nr] < Order) && (ColorVertexList[Walker->nr] != darkgray)) {  // if not already on snake stack
    4416           SnakeStack->Push(Walker);
    4417           ColorVertexList[Walker->nr] = darkgray; // mark as dark gray of on snake stack
    44184368        }
    44194369      }
     
    44524402            } else { // otherwise check its colour and element
    44534403              if (
    4454 #ifdef ADDHYDROGEN
    44554404              (OtherAtom->type->Z != 1) &&
    44564405#endif
Note: See TracChangeset for help on using the changeset viewer.