Ignore:
Timestamp:
Aug 10, 2010, 7:25:28 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, Candidate_v1.7.0, Candidate_v1.7.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:
fa1830
Parents:
7aa3cf (diff), 61951b (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 'SmallFixes' into stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r7aa3cf r95e6b1  
    193193      }
    194194      // Center and size
    195       (*out) << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
     195      Vector *Center = (*ListRunner)->DetermineCenterOfAll();
     196      (*out) << "\t" << *Center << "\t" << sqrt(size) << endl;
     197      delete(Center);
    196198    }
    197199  }
     
    210212};
    211213
    212 /** Simple merge of two molecules into one.
    213  * \param *mol destination molecule
    214  * \param *srcmol source molecule
    215  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    216  */
    217 bool MoleculeListClass::SimpleMerge(molecule *mol, molecule *srcmol)
    218 {
    219   if (srcmol == NULL)
    220     return false;
    221 
    222   // put all molecules of src into mol
    223   for (molecule::iterator iter = srcmol->begin(); !srcmol->empty(); iter=srcmol->begin()) {
    224     atom * const Walker = *iter;
    225     srcmol->UnlinkAtom(Walker);
    226     mol->AddAtom(Walker);
    227   }
    228 
    229   // remove src
    230   ListOfMolecules.remove(srcmol);
    231   World::getInstance().destroyMolecule(srcmol);
    232   return true;
    233 };
    234 
    235 /** Simple add of one molecules into another.
    236  * \param *mol destination molecule
    237  * \param *srcmol source molecule
    238  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    239  */
    240 bool MoleculeListClass::SimpleAdd(molecule *mol, molecule *srcmol)
    241 {
    242   if (srcmol == NULL)
    243     return false;
    244 
    245   // put all molecules of src into mol
    246   atom *Walker = NULL;
    247   for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
    248     Walker = mol->AddCopyAtom((*iter));
    249     Walker->father = Walker;
    250   }
    251 
    252   return true;
    253 };
    254 
    255 /** Simple merge of a given set of molecules into one.
    256  * \param *mol destination molecule
    257  * \param *src index of set of source molecule
    258  * \param N number of source molecules
    259  * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
    260  */
    261 bool MoleculeListClass::SimpleMultiMerge(molecule *mol, int *src, int N)
    262 {
    263   bool status = true;
    264   // check presence of all source molecules
    265   for (int i=0;i<N;i++) {
    266     molecule *srcmol = ReturnIndex(src[i]);
    267     status = status && SimpleMerge(mol, srcmol);
    268   }
    269   insert(mol);
    270   return status;
    271 };
    272 
    273 /** Simple add of a given set of molecules into one.
    274  * \param *mol destination molecule
    275  * \param *src index of set of source molecule
    276  * \param N number of source molecules
    277  * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
    278  */
    279 bool MoleculeListClass::SimpleMultiAdd(molecule *mol, int *src, int N)
    280 {
    281   bool status = true;
    282   // check presence of all source molecules
    283   for (int i=0;i<N;i++) {
    284     molecule *srcmol = ReturnIndex(src[i]);
    285     status = status && SimpleAdd(mol, srcmol);
    286   }
    287   return status;
    288 };
    289 
    290 /** Scatter merge of a given set of molecules into one.
    291  * Scatter merge distributes the molecules in such a manner that they don't overlap.
    292  * \param *mol destination molecule
    293  * \param *src index of set of source molecule
    294  * \param N number of source molecules
    295  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    296  * \TODO find scatter center for each src molecule
    297  */
    298 bool MoleculeListClass::ScatterMerge(molecule *mol, int *src, int N)
    299 {
    300   // check presence of all source molecules
    301   for (int i=0;i<N;i++) {
    302     // get pointer to src molecule
    303     molecule *srcmol = ReturnIndex(src[i]);
    304     if (srcmol == NULL)
    305       return false;
    306   }
    307   // adapt each Center
    308   for (int i=0;i<N;i++) {
    309     // get pointer to src molecule
    310     molecule *srcmol = ReturnIndex(src[i]);
    311     //srcmol->Center.Zero();
    312     srcmol->Translate(&srcmol->Center);
    313   }
    314   // perform a simple multi merge
    315   SimpleMultiMerge(mol, src, N);
    316   return true;
    317 };
    318 
    319 /** Embedding merge of a given set of molecules into one.
    320  * Embedding merge inserts one molecule into the other.
    321  * \param *mol destination molecule (fixed one)
    322  * \param *srcmol source molecule (variable one, where atoms are taken from)
    323  * \return true - merge successful, false - merge failed (probably due to non-existant indices)
    324  * \TODO linked cell dimensions for boundary points has to be as big as inner diameter!
    325  */
    326 bool MoleculeListClass::EmbedMerge(molecule *mol, molecule *srcmol)
    327 {
    328   LinkedCell *LCList = NULL;
    329   Tesselation *TesselStruct = NULL;
    330   if ((srcmol == NULL) || (mol == NULL)) {
    331     DoeLog(1) && (eLog()<< Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl);
    332     return false;
    333   }
    334 
    335   // calculate envelope for *mol
    336   LCList = new LinkedCell(mol, 8.);
    337   FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);
    338   if (TesselStruct == NULL) {
    339     DoeLog(1) && (eLog()<< Verbose(1) << "Could not tesselate the fixed molecule." << endl);
    340     return false;
    341   }
    342   delete(LCList);
    343   LCList = new LinkedCell(TesselStruct, 8.);  // re-create with boundary points only!
    344 
    345   // prepare index list for bonds
    346   atom ** CopyAtoms = new atom*[srcmol->getAtomCount()];
    347   for(int i=0;i<srcmol->getAtomCount();i++)
    348     CopyAtoms[i] = NULL;
    349 
    350   // for each of the source atoms check whether we are in- or outside and add copy atom
    351   int nr=0;
    352   for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
    353     DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
    354     if (!TesselStruct->IsInnerPoint((*iter)->getPosition(), LCList)) {
    355       CopyAtoms[(*iter)->nr] = (*iter)->clone();
    356       mol->AddAtom(CopyAtoms[(*iter)->nr]);
    357       nr++;
    358     } else {
    359       // do nothing
    360     }
    361   }
    362   DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged.");
    363 
    364   // go through all bonds and add as well
    365   for(molecule::iterator AtomRunner = srcmol->begin(); AtomRunner != srcmol->end(); ++AtomRunner)
    366     for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
    367       if ((*BondRunner)->leftatom == *AtomRunner) {
    368         DoLog(3) && (Log() << Verbose(3) << "Adding Bond between " << *CopyAtoms[(*BondRunner)->leftatom->nr] << " and " << *CopyAtoms[(*BondRunner)->rightatom->nr]<< "." << endl);
    369         mol->AddBond(CopyAtoms[(*BondRunner)->leftatom->nr], CopyAtoms[(*BondRunner)->rightatom->nr], (*BondRunner)->BondDegree);
    370       }
    371   delete(LCList);
    372   return true;
    373 };
    374214
    375215/** Simple output of the pointers in ListOfMolecules.
Note: See TracChangeset for help on using the changeset viewer.