Changeset 61951b
- Timestamp:
- Aug 10, 2010, 2:56: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:
- 95e6b1, bbbad5
- Parents:
- 1883f9
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/config.cpp ¶
r1883f9 r61951b 1589 1589 mol = World::getInstance().createMolecule(); 1590 1590 mol->SetNameFromFilename(ConfigFileName); 1591 molecules->SimpleMultiMerge(mol, src, N);1592 1591 //mol->CalculateOrbitals(*this); 1593 1592 delete[](src); -
TabularUnified src/molecule.hpp ¶
r1883f9 r61951b 379 379 void eraseMolecule(); 380 380 381 382 // merging of molecules383 bool SimpleMerge(molecule *mol, molecule *srcmol);384 bool SimpleAdd(molecule *mol, molecule *srcmol);385 bool SimpleMultiMerge(molecule *mol, int *src, int N);386 bool SimpleMultiAdd(molecule *mol, int *src, int N);387 bool ScatterMerge(molecule *mol, int *src, int N);388 bool EmbedMerge(molecule *mol, molecule *srcmol);389 390 381 private: 391 382 World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor -
TabularUnified src/moleculelist.cpp ¶
r1883f9 r61951b 212 212 }; 213 213 214 /** Simple merge of two molecules into one.215 * \param *mol destination molecule216 * \param *srcmol source molecule217 * \return true - merge successful, false - merge failed (probably due to non-existant indices218 */219 bool MoleculeListClass::SimpleMerge(molecule *mol, molecule *srcmol)220 {221 if (srcmol == NULL)222 return false;223 224 // put all molecules of src into mol225 for (molecule::iterator iter = srcmol->begin(); !srcmol->empty(); iter=srcmol->begin()) {226 atom * const Walker = *iter;227 srcmol->UnlinkAtom(Walker);228 mol->AddAtom(Walker);229 }230 231 // remove src232 ListOfMolecules.remove(srcmol);233 World::getInstance().destroyMolecule(srcmol);234 return true;235 };236 237 /** Simple add of one molecules into another.238 * \param *mol destination molecule239 * \param *srcmol source molecule240 * \return true - merge successful, false - merge failed (probably due to non-existant indices241 */242 bool MoleculeListClass::SimpleAdd(molecule *mol, molecule *srcmol)243 {244 if (srcmol == NULL)245 return false;246 247 // put all molecules of src into mol248 atom *Walker = NULL;249 for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {250 Walker = mol->AddCopyAtom((*iter));251 Walker->father = Walker;252 }253 254 return true;255 };256 257 /** Simple merge of a given set of molecules into one.258 * \param *mol destination molecule259 * \param *src index of set of source molecule260 * \param N number of source molecules261 * \return true - merge successful, false - some merges failed (probably due to non-existant indices)262 */263 bool MoleculeListClass::SimpleMultiMerge(molecule *mol, int *src, int N)264 {265 bool status = true;266 // check presence of all source molecules267 for (int i=0;i<N;i++) {268 molecule *srcmol = ReturnIndex(src[i]);269 status = status && SimpleMerge(mol, srcmol);270 }271 insert(mol);272 return status;273 };274 275 /** Simple add of a given set of molecules into one.276 * \param *mol destination molecule277 * \param *src index of set of source molecule278 * \param N number of source molecules279 * \return true - merge successful, false - some merges failed (probably due to non-existant indices)280 */281 bool MoleculeListClass::SimpleMultiAdd(molecule *mol, int *src, int N)282 {283 bool status = true;284 // check presence of all source molecules285 for (int i=0;i<N;i++) {286 molecule *srcmol = ReturnIndex(src[i]);287 status = status && SimpleAdd(mol, srcmol);288 }289 return status;290 };291 292 /** Scatter merge of a given set of molecules into one.293 * Scatter merge distributes the molecules in such a manner that they don't overlap.294 * \param *mol destination molecule295 * \param *src index of set of source molecule296 * \param N number of source molecules297 * \return true - merge successful, false - merge failed (probably due to non-existant indices298 * \TODO find scatter center for each src molecule299 */300 bool MoleculeListClass::ScatterMerge(molecule *mol, int *src, int N)301 {302 // check presence of all source molecules303 for (int i=0;i<N;i++) {304 // get pointer to src molecule305 molecule *srcmol = ReturnIndex(src[i]);306 if (srcmol == NULL)307 return false;308 }309 // adapt each Center310 for (int i=0;i<N;i++) {311 // get pointer to src molecule312 molecule *srcmol = ReturnIndex(src[i]);313 }314 // perform a simple multi merge315 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 *mol336 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 bonds346 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 atom351 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 nothing360 }361 }362 DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged.");363 364 // go through all bonds and add as well365 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 };374 214 375 215 /** Simple output of the pointers in ListOfMolecules.
Note:
See TracChangeset
for help on using the changeset viewer.