- Timestamp:
- Jul 21, 2010, 7:49:33 AM (14 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:
- 6d858c
- Parents:
- c538d1 (diff), be97a8 (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. - Location:
- src
- Files:
-
- 6 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/ChangeElementAction.cpp
rc538d1 r3d078d 38 38 std::vector<element *> elements; 39 39 40 dialog->query Atom(NAME, &first, MapOfActions::getInstance().getDescription(NAME));41 dialog->query Element("element", &elements, MapOfActions::getInstance().getDescription("element"));40 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 41 dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id")); 42 42 43 43 if(dialog->display()) { -
src/Actions/MapOfActions.cpp
rc538d1 r3d078d 272 272 TypeMap["center-in-box"] = Box; 273 273 TypeMap["change-box"] = Box; 274 TypeMap["change-element"] = Atom;274 TypeMap["change-element"] = Element; 275 275 TypeMap["change-molname"] = String; 276 276 TypeMap["convex-envelope"] = Molecule; … … 323 323 TypeMap["MaxDistance"] = Double; 324 324 TypeMap["molecule-by-id"] = Molecule; 325 TypeMap["molecule-by-name"] = Molecule;325 TypeMap["molecule-by-name"] = String; 326 326 TypeMap["nonconvex-file"] = String; 327 327 TypeMap["order"] = Integer; -
src/Actions/ParserAction/LoadXyzAction.cpp
rc538d1 r3d078d 78 78 if (UniqueList.size() != ListAfter.size()) { // only create if new atoms have been parsed 79 79 MoleculeListClass *molecules = World::getInstance().getMolecules(); 80 molecule *mol= NULL; 81 if (molecules->ListOfMolecules.empty()) { 82 mol = World::getInstance().createMolecule(); 83 molecules->insert(mol); 84 } else { 85 mol = *(molecules->ListOfMolecules.begin()); 86 } 80 molecule *mol = World::getInstance().createMolecule(); 81 molecules->insert(mol); 87 82 for (vector<atom *>::iterator runner = ListAfter.begin(); runner != ListAfter.end(); ++runner) { 88 83 Inserter = UniqueList.insert(*runner); -
src/Actions/WorldAction/ChangeBoxAction.cpp
rc538d1 r3d078d 41 41 if(dialog->display()) { 42 42 DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << cell_size.getM() << endl); 43 World::getInstance().setDomain(cell_size.getM()); 43 44 delete dialog; 44 45 return Action::success; -
src/Actions/WorldAction/InputAction.cpp
rc538d1 r3d078d 38 38 MoleculeListClass *molecules = World::getInstance().getMolecules(); 39 39 molecule *mol = NULL; 40 st ring filename;40 std::string filename; 41 41 std::ifstream test; 42 42 … … 45 45 if(dialog->display()) { 46 46 DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl); 47 std::string FilenamePrefix = filename.substr(0,filename.find('.')); 48 FormatParserStorage::getInstance().SetOutputPrefixForAll(FilenamePrefix); 49 DoLog(1) && (Log() << Verbose(1) << "Setting config file name prefix to " << FilenamePrefix << "." << endl); 50 test.open(filename.c_str()); 51 if (test == NULL) { 52 DoLog(1) && (Log() << Verbose(1) << "Specified config file " << filename << " not found." << endl); 47 if (filename.find('.') != string::npos) { 48 std::string FilenamePrefix = filename.substr(0,filename.find_last_of('.')); 49 std::string FilenameSuffix = filename.substr(filename.find_last_of('.')+1, filename.length()); 50 DoLog(1) && (Log() << Verbose(1) << "Setting config file name prefix to " << FilenamePrefix << "." << endl); 51 test.open(filename.c_str()); 52 if (test == NULL) { 53 DoLog(1) && (Log() << Verbose(1) << "Specified config file " << filename << " not found." << endl); 54 } else { 55 DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... "); 56 FormatParserStorage::getInstance().get((std::istream &)test, FilenameSuffix); 57 test.close(); 58 } 59 FormatParserStorage::getInstance().SetOutputPrefixForAll(FilenamePrefix); 60 // set mol to first active molecule 61 if (molecules->ListOfMolecules.size() != 0) { 62 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 63 if ((*ListRunner)->ActiveFlag) { 64 mol = *ListRunner; 65 break; 66 } 67 } 68 if (mol == NULL) { 69 mol = World::getInstance().createMolecule(); 70 mol->ActiveFlag = true; 71 molecules->insert(mol); 72 } 73 mol->SetNameFromFilename(filename.substr(0,filename.find('.')).c_str()); 53 74 } else { 54 DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... "); 55 FormatParserStorage::getInstance().getPcp().load(&test); 56 test.close(); 75 DoeLog(1) && (eLog() << Verbose(1) << "Input file does not have a suffix, cannot recognize format." << endl); 57 76 } 58 // set mol to first active molecule59 if (molecules->ListOfMolecules.size() != 0) {60 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)61 if ((*ListRunner)->ActiveFlag) {62 mol = *ListRunner;63 break;64 }65 }66 if (mol == NULL) {67 mol = World::getInstance().createMolecule();68 mol->ActiveFlag = true;69 molecules->insert(mol);70 }71 mol->SetNameFromFilename(filename.c_str());72 77 delete dialog; 73 78 return Action::success; -
src/Box.cpp
rc538d1 r3d078d 46 46 47 47 void Box::setM(Matrix _M){ 48 ASSERT(_M.at(1,0)==_M.at(0,1),"Matrix used as cell_size was not symmetric"); 49 ASSERT(_M.at(2,0)==_M.at(0,2),"Matrix used as cell_size was not symmetric"); 50 ASSERT(_M.at(1,2)==_M.at(2,1),"Matrix used as cell_size was not symmetric"); 48 ASSERT(_M.determinant()!=0,"Matrix in Box construction was not invertible"); 51 49 *M =_M; 52 50 *Minv = M->invert(); -
src/Descriptors/AtomDescriptor.cpp
rc538d1 r3d078d 82 82 vector<atom*> res; 83 83 World::AtomSet atoms = getAtoms(); 84 atoms_iter_t iter; 85 for(iter=atoms.begin_internal();iter!=atoms.end_internal();++iter) { 86 if(predicate(*iter)){ 87 res.push_back((*iter).second); 88 } 84 for_each(atoms.begin_internal(), 85 atoms.end_internal(), 86 boost::bind(&AtomDescriptor_impl::checkAndAdd, 87 this,&res,_1)); 88 return res; 89 } 90 91 void AtomDescriptor_impl::checkAndAdd(std::vector<atom*> *v,std::pair<atomId_t,atom*> p){ 92 if(predicate(p)){ 93 v->push_back(p.second); 89 94 } 90 return res;91 95 } 92 96 -
src/Descriptors/AtomDescriptor_impl.hpp
rc538d1 r3d078d 50 50 */ 51 51 World::AtomSet& getAtoms(); 52 53 void checkAndAdd(std::vector<atom*>*,std::pair<atomId_t,atom*>); 52 54 }; 53 55 -
src/Descriptors/AtomIdDescriptor.cpp
rc538d1 r3d078d 33 33 34 34 atom *AtomIdDescriptor_impl::find(){ 35 World::AtomSet atoms = getAtoms();35 World::AtomSet &atoms = getAtoms(); 36 36 World::AtomSet::iterator res = atoms.find(id); 37 37 return (res!=atoms.end())?((*res).second):0; -
src/Descriptors/MoleculeDescriptor.cpp
rc538d1 r3d078d 74 74 75 75 molecule* MoleculeDescriptor_impl::find() { 76 World::MoleculeSet molecules = getMolecules();76 World::MoleculeSet &molecules = getMolecules(); 77 77 molecules_iter_t res = find_if(molecules.begin_internal(),molecules.end_internal(),boost::bind(&MoleculeDescriptor_impl::predicate,this,_1)); 78 78 return (res!=molecules.end_internal())?((*res).second):0; … … 81 81 vector<molecule*> MoleculeDescriptor_impl::findAll() { 82 82 vector<molecule*> res; 83 World::MoleculeSet molecules = getMolecules(); 84 molecules_iter_t iter; 85 for(iter=molecules.begin_internal();iter!=molecules.end_internal();++iter) { 86 if(predicate(*iter)){ 87 res.push_back((*iter).second); 88 } 83 World::MoleculeSet &molecules = getMolecules(); 84 for_each(molecules.begin_internal(), 85 molecules.end_internal(), 86 boost::bind(&MoleculeDescriptor_impl::checkAndAdd, 87 this,&res,_1)); 88 return res; 89 } 90 91 void MoleculeDescriptor_impl::checkAndAdd(std::vector<molecule*> *v,std::pair<moleculeId_t,molecule*> p){ 92 if(predicate(p)){ 93 v->push_back(p.second); 89 94 } 90 return res;91 95 } 92 96 -
src/Descriptors/MoleculeDescriptor_impl.hpp
rc538d1 r3d078d 50 50 */ 51 51 World::MoleculeSet& getMolecules(); 52 53 void checkAndAdd(std::vector<molecule*>*,std::pair<moleculeId_t,molecule*>); 52 54 }; 53 55 -
src/Descriptors/MoleculeIdDescriptor.cpp
rc538d1 r3d078d 34 34 35 35 molecule *MoleculeIdDescriptor_impl::find(){ 36 World::MoleculeSet molecules = getMolecules();36 World::MoleculeSet &molecules = getMolecules(); 37 37 World::MoleculeSet::iterator res = molecules.find(id); 38 38 return (res!=molecules.end())?((*res).second):0; -
src/Makefile.am
rc538d1 r3d078d 150 150 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \ 151 151 Descriptors/AtomIdDescriptor.cpp \ 152 Descriptors/AtomSelectionDescriptor.cpp \ 152 153 Descriptors/AtomTypeDescriptor.cpp \ 153 154 Descriptors/MoleculeDescriptor.cpp \ 154 155 Descriptors/MoleculeIdDescriptor.cpp \ 155 156 Descriptors/MoleculeNameDescriptor.cpp \ 156 Descriptors/MoleculePtrDescriptor.cpp 157 Descriptors/MoleculePtrDescriptor.cpp \ 158 Descriptors/MoleculeSelectionDescriptor.cpp 157 159 158 160 159 161 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \ 160 162 Descriptors/AtomIdDescriptor.hpp \ 163 Descriptors/AtomSelectionDescriptor.hpp \ 161 164 Descriptors/AtomTypeDescriptor.hpp \ 162 165 Descriptors/MoleculeDescriptor.hpp \ 163 166 Descriptors/MoleculeIdDescriptor.hpp \ 164 167 Descriptors/MoleculeNameDescriptor.hpp \ 165 Descriptors/MoleculePtrDescriptor.hpp 168 Descriptors/MoleculePtrDescriptor.hpp \ 169 Descriptors/MoleculeSelectionDescriptor.cpp 166 170 167 171 QTUISOURCE = ${QTUIMOC_TARGETS} \ -
src/Parser/FormatParserStorage.cpp
rc538d1 r3d078d 42 42 ParserSuffix.resize(ParserTypes_end, ""); 43 43 44 ParserSuffix[mpqc] = " conf.in";44 ParserSuffix[mpqc] = "in"; 45 45 ParserSuffix[pcp] = "conf"; 46 ParserSuffix[tremolo] = " conf.data";47 ParserSuffix[xyz] = " conf.xyz";46 ParserSuffix[tremolo] = "data"; 47 ParserSuffix[xyz] = "xyz"; 48 48 } 49 49 … … 133 133 } 134 134 135 /** Parses an istream depending on its suffix 136 * \param &input input stream 137 * \param suffix 138 * \return true - parsing ok, false - suffix unknown 139 */ 140 bool FormatParserStorage::get(std::istream &input, std::string suffix) 141 { 142 if (suffix == ParserSuffix[mpqc]) { 143 getMpqc().load(&input); 144 } else if (suffix == ParserSuffix[pcp]) { 145 getPcp().load(&input); 146 } else if (suffix == ParserSuffix[tremolo]) { 147 getTremolo().load(&input); 148 } else if (suffix == ParserSuffix[xyz]) { 149 getXyz().load(&input); 150 } else { 151 DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix to for FormatParserStorage::get()." << endl); 152 return false; 153 } 154 return true; 155 } 156 135 157 /** Returns reference to the output MpqcParser, adds if not present. 136 158 * \return reference to the output MpqcParser -
src/Parser/FormatParserStorage.hpp
rc538d1 r3d078d 41 41 void addXyz(); 42 42 43 bool get(std::istream &input, std::string suffix); 43 44 MpqcParser &getMpqc(); 44 45 PcpParser &getPcp(); -
src/Parser/XyzParser.cpp
rc538d1 r3d078d 59 59 if (comment == "") { 60 60 time_t now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' 61 comment = " \tCreated by molecuilder on ";61 comment = "Created by molecuilder on "; 62 62 // ctime ends in \n\0, we have to cut away the newline 63 63 std::string time(ctime(&now)); … … 68 68 comment += time; 69 69 } 70 *file << World::getInstance().numAtoms() << endl << comment << endl;70 *file << World::getInstance().numAtoms() << endl << "\t" << comment << endl; 71 71 72 72 vector<atom*> atoms = World::getInstance().getAllAtoms(); -
src/World.cpp
rc538d1 r3d078d 9 9 10 10 #include "World.hpp" 11 #include "Patterns/ObservedContainer_impl.hpp" 11 12 #include <functional> 12 13 13 14 #include "atom.hpp" … … 28 29 29 30 #include "Patterns/Singleton_impl.hpp" 31 #include "Patterns/ObservedContainer_impl.hpp" 30 32 31 33 using namespace std; … … 83 85 84 86 void World::setDomain(const Matrix &mat){ 87 OBSERVE; 85 88 *cell_size = mat; 86 89 } … … 88 91 void World::setDomain(double * matrix) 89 92 { 93 OBSERVE; 90 94 Matrix M = ReturnFullMatrixforSymmetric(matrix); 91 95 cell_size->setM(M); … … 98 102 void World::setDefaultName(std::string name) 99 103 { 104 OBSERVE; 100 105 defaultName = name; 101 106 }; … … 485 490 } 486 491 492 /************************** Selection of Atoms and molecules ******************/ 493 494 // Atoms 495 496 void World::clearAtomSelection(){ 497 selectedAtoms.clear(); 498 } 499 500 void World::selectAtom(atom *atom){ 501 ASSERT(atom,"Invalid pointer in selection of atom"); 502 selectedAtoms[atom->getId()]=atom; 503 } 504 505 void World::selectAtom(atomId_t id){ 506 ASSERT(atoms.count(id),"Atom Id selected that was not in the world"); 507 selectedAtoms[id]=atoms[id]; 508 } 509 510 void World::selectAllAtoms(AtomDescriptor descr){ 511 internal_AtomIterator begin = getAtomIter_internal(descr); 512 internal_AtomIterator end = atomEnd_internal(); 513 void (World::*func)(atom*) = &World::selectAtom; // needed for type resolution of overloaded function 514 for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above 515 } 516 517 void World::selectAtomsOfMolecule(molecule *_mol){ 518 ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule"); 519 // need to make it const to get the fast iterators 520 const molecule *mol = _mol; 521 void (World::*func)(atom*) = &World::selectAtom; // needed for type resolution of overloaded function 522 for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is select... see above 523 } 524 525 void World::selectAtomsOfMolecule(moleculeId_t id){ 526 ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule"); 527 selectAtomsOfMolecule(molecules[id]); 528 } 529 530 void World::unselectAtom(atom *atom){ 531 ASSERT(atom,"Invalid pointer in unselection of atom"); 532 unselectAtom(atom->getId()); 533 } 534 535 void World::unselectAtom(atomId_t id){ 536 ASSERT(atoms.count(id),"Atom Id unselected that was not in the world"); 537 selectedAtoms.erase(id); 538 } 539 540 void World::unselectAllAtoms(AtomDescriptor descr){ 541 internal_AtomIterator begin = getAtomIter_internal(descr); 542 internal_AtomIterator end = atomEnd_internal(); 543 void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function 544 for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above 545 } 546 547 void World::unselectAtomsOfMolecule(molecule *_mol){ 548 ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule"); 549 // need to make it const to get the fast iterators 550 const molecule *mol = _mol; 551 void (World::*func)(atom*) = &World::unselectAtom; // needed for type resolution of overloaded function 552 for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is unsselect... see above 553 } 554 555 void World::unselectAtomsOfMolecule(moleculeId_t id){ 556 ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule"); 557 unselectAtomsOfMolecule(molecules[id]); 558 } 559 560 // Molecules 561 562 void World::clearMoleculeSelection(){ 563 selectedMolecules.clear(); 564 } 565 566 void World::selectMolecule(molecule *mol){ 567 ASSERT(mol,"Invalid pointer to molecule in selection"); 568 selectedMolecules[mol->getId()]=mol; 569 } 570 571 void World::selectMolecule(moleculeId_t id){ 572 ASSERT(molecules.count(id),"Molecule Id selected that was not in the world"); 573 selectedMolecules[id]=molecules[id]; 574 } 575 576 void World::selectAllMoleculess(MoleculeDescriptor descr){ 577 internal_MoleculeIterator begin = getMoleculeIter_internal(descr); 578 internal_MoleculeIterator end = moleculeEnd_internal(); 579 void (World::*func)(molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function 580 for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above 581 } 582 583 void World::selectMoleculeOfAtom(atom *atom){ 584 ASSERT(atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 585 molecule *mol=atom->getMolecule(); 586 // the atom might not be part of a molecule 587 if(mol){ 588 selectMolecule(mol); 589 } 590 } 591 592 void World::selectMoleculeOfAtom(atomId_t id){ 593 ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\ 594 selectMoleculeOfAtom(atoms[id]); 595 } 596 597 void World::unselectMolecule(molecule *mol){ 598 ASSERT(mol,"invalid pointer in unselection of molecule"); 599 unselectMolecule(mol->getId()); 600 } 601 602 void World::unselectMolecule(moleculeId_t id){ 603 ASSERT(molecules.count(id),"No such molecule with ID in unselection"); 604 selectedMolecules.erase(id); 605 } 606 607 void World::unselectAllMoleculess(MoleculeDescriptor descr){ 608 internal_MoleculeIterator begin = getMoleculeIter_internal(descr); 609 internal_MoleculeIterator end = moleculeEnd_internal(); 610 void (World::*func)(molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function 611 for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above 612 } 613 614 void World::unselectMoleculeOfAtom(atom *atom){ 615 ASSERT(atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 616 molecule *mol=atom->getMolecule(); 617 // the atom might not be part of a molecule 618 if(mol){ 619 unselectMolecule(mol); 620 } 621 } 622 623 void World::unselectMoleculeOfAtom(atomId_t id){ 624 ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\ 625 unselectMoleculeOfAtom(atoms[id]); 626 } 627 628 /******************* Iterators over Selection *****************************/ 629 World::AtomSelectionIterator World::beginAtomSelection(){ 630 return selectedAtoms.begin(); 631 } 632 633 World::AtomSelectionIterator World::endAtomSelection(){ 634 return selectedAtoms.end(); 635 } 636 637 638 World::MoleculeSelectionIterator World::beginMoleculeSelection(){ 639 return selectedMolecules.begin(); 640 } 641 642 World::MoleculeSelectionIterator World::endMoleculeSelection(){ 643 return selectedMolecules.end(); 644 } 645 487 646 /******************************* Singleton Stuff **************************/ 488 647 … … 494 653 ExitFlag(0), 495 654 atoms(this), 655 selectedAtoms(this), 496 656 currAtomId(0), 497 657 lastAtomPoolSize(0), 498 658 numAtomDefragSkips(0), 499 659 molecules(this), 660 selectedMolecules(this), 500 661 currMoleculeId(0), 501 662 molecules_deprecated(new MoleculeListClass(this)) -
src/World.hpp
rc538d1 r3d078d 62 62 friend class MoleculeDescriptor_impl; 63 63 friend class MoleculeDescriptor; 64 // coupling with descriptors over selection 65 friend class AtomSelectionDescriptor_impl; 66 friend class MoleculeSelectionDescriptor_impl; 64 67 65 68 // Actions, calculations etc associated with the World … … 222 225 * All these iterators are observed to track changes. 223 226 * There is a corresponding protected section with unobserved iterators, 224 * which ca be used internally when the extra speed is needed227 * which can be used internally when the extra speed is needed 225 228 */ 226 229 … … 239 242 typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor> MoleculeIterator; 240 243 244 /** 245 * returns an iterator over all Molecules matching a given descriptor. 246 * This iterator is observed, so don't keep it around unnecessary to 247 * avoid unintended blocking. 248 */ 241 249 MoleculeIterator getMoleculeIter(MoleculeDescriptor descr); 242 250 MoleculeIterator getMoleculeIter(); 243 251 244 252 MoleculeIterator moleculeEnd(); 253 254 /******** Selections of molecules and Atoms *************/ 255 void clearAtomSelection(); 256 void selectAtom(atom*); 257 void selectAtom(atomId_t); 258 void selectAllAtoms(AtomDescriptor); 259 void selectAtomsOfMolecule(molecule*); 260 void selectAtomsOfMolecule(moleculeId_t); 261 void unselectAtom(atom*); 262 void unselectAtom(atomId_t); 263 void unselectAllAtoms(AtomDescriptor); 264 void unselectAtomsOfMolecule(molecule*); 265 void unselectAtomsOfMolecule(moleculeId_t); 266 267 void clearMoleculeSelection(); 268 void selectMolecule(molecule*); 269 void selectMolecule(moleculeId_t); 270 void selectAllMoleculess(MoleculeDescriptor); 271 void selectMoleculeOfAtom(atom*); 272 void selectMoleculeOfAtom(atomId_t); 273 void unselectMolecule(molecule*); 274 void unselectMolecule(moleculeId_t); 275 void unselectAllMoleculess(MoleculeDescriptor); 276 void unselectMoleculeOfAtom(atom*); 277 void unselectMoleculeOfAtom(atomId_t); 278 279 /******************** Iterators to selections *****************/ 280 typedef AtomSet::iterator AtomSelectionIterator; 281 AtomSelectionIterator beginAtomSelection(); 282 AtomSelectionIterator endAtomSelection(); 283 284 typedef MoleculeSet::iterator MoleculeSelectionIterator; 285 MoleculeSelectionIterator beginMoleculeSelection(); 286 MoleculeSelectionIterator endMoleculeSelection(); 245 287 246 288 protected: … … 308 350 class ThermoStatContainer *Thermostats; 309 351 int ExitFlag; 310 public: 352 private: 353 311 354 AtomSet atoms; 312 private: 355 AtomSet selectedAtoms; 313 356 typedef std::set<std::pair<atomId_t, atomId_t> > atomIdPool_t; 314 315 357 /** 316 358 * stores the pool for all available AtomIds below currAtomId … … 324 366 325 367 MoleculeSet molecules; 368 MoleculeSet selectedMolecules; 326 369 typedef std::set<std::pair<moleculeId_t, moleculeId_t> > moleculeIdPool_t; 370 /** 371 * stores the pool for all available AtomIds below currAtomId 372 * 373 * The pool contains ranges of free ids in the form [bottom,top). 374 */ 327 375 moleculeIdPool_t moleculeIdPool; 328 376 moleculeId_t currMoleculeId; -
src/atom.cpp
rc538d1 r3d078d 330 330 } 331 331 332 molecule* atom::getMolecule(){ 333 return mol; 334 } 335 332 336 void atom::removeFromMolecule(){ 333 337 if(mol){ -
src/atom.hpp
rc538d1 r3d078d 90 90 91 91 void setMolecule(molecule*); 92 molecule* getMolecule(); 92 93 void removeFromMolecule(); 93 94 -
src/unittests/ParserUnitTest.cpp
rc538d1 r3d078d 131 131 \tmolecule = $:molecule\n\ 132 132 )\n"; 133 static string waterXyz = "3\n H2O: water molecule\nO\t0\t0\t0\nH\t0.758602\t0\t0.504284\nH\t0.758602\t0\t-0.504284\n";133 static string waterXyz = "3\n\tH2O: water molecule\nO\t0\t0\t0\nH\t0.758602\t0\t0.504284\nH\t0.758602\t0\t-0.504284\n"; 134 134 static string Tremolo_Atomdata1 = "# ATOMDATA\tId\tname\tType\tx=3\n"; 135 135 static string Tremolo_Atomdata2 = "#\n#ATOMDATA Id name Type x=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
Note:
See TracChangeset
for help on using the changeset viewer.