Changeset 560bbe
- Timestamp:
- Feb 17, 2012, 3:24:18 PM (13 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:
- cdaae6
- Parents:
- ac5c36
- git-author:
- Frederik Heber <heber@…> (01/06/12 16:49:11)
- git-committer:
- Frederik Heber <heber@…> (02/17/12 15:24:18)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Atom/AtomicInfo.cpp
rac5c36 r560bbe 35 35 FatherId(0), 36 36 MolId(0), 37 Id(0) 37 Id(0), 38 Nr(0) 38 39 {} 39 40 AtomicInfo::AtomicInfo(const atom &_atom) : … … 43 44 FatherId(_atom.father->getId()), 44 45 MolId(_atom.getMolecule()->getId()), 45 Id(_atom.getId()) 46 Id(_atom.getId()), 47 Nr(_atom.getNr()) 46 48 {} 47 49 … … 72 74 if (_mol != NULL) 73 75 _atom.setMolecule(_mol); // this is ok, mol is const within AtomicInfo, but not outside (atoms need to register) 76 _atom.changeNr(Nr); 74 77 75 78 return status; … … 90 93 Velocity = AI.Velocity; 91 94 Id = AI.Id; 95 Nr = AI.Nr; 92 96 return *this; 93 97 } -
src/Atom/AtomicInfo.hpp
rac5c36 r560bbe 41 41 moleculeId_t MolId; 42 42 atomId_t Id; 43 int Nr; 43 44 }; 44 45 -
src/Atom/atom.cpp
rac5c36 r560bbe 322 322 } 323 323 324 bool atom::changeNr(const int newNr) 325 { 326 if ((mol) && (mol->changeAtomNr(getNr(),newNr,this))) { 327 return true; 328 } else{ 329 return false; 330 } 331 } 332 324 333 int atom::getNr() const{ 325 334 return ParticleInfo::getNr(); -
src/Atom/atom.hpp
rac5c36 r560bbe 211 211 */ 212 212 void removeFromMolecule(); 213 214 /** Changes the molecule internal ParticleInfo::Nr of this atom. 215 * 216 * @param newNr new ParticleInfo::Nr to set 217 * @return true - change successful, false - changed not successful, id remains the old one 218 */ 219 bool changeNr(int newNr); 213 220 214 221 /** Getter for ParticleInfo::Nr of the atom. -
src/documentation/constructs/molecules.dox
rac5c36 r560bbe 29 29 * as well. 30 30 * 31 * \section molecules-atoms Atoms 32 * 33 * Atoms are added to the molecule via molecule::AddAtom() and removed via 34 * molecule::RemoveAtom(). Therein, the atom receives a unique ParticleInfo::Nr 35 * that is useful only within the molecule and is displayed in the atoms name, 36 * i.e. atom names only vary within the molecule. 37 * 38 * The molecule only stores the atoms global id and uses a boost::transform_iterator 39 * to map the ids to the true refs obtained from the World. 40 * 31 41 * \section molecules-formula Formula 32 42 * -
src/molecule.cpp
rac5c36 r560bbe 25 25 #include <gsl/gsl_inline.h> 26 26 #include <gsl/gsl_heapsort.h> 27 28 #include "molecule.hpp" 27 29 28 30 #include "Atom/atom.hpp" … … 32 34 #include "CodePatterns/Log.hpp" 33 35 #include "config.hpp" 36 #include "Descriptors/AtomIdDescriptor.hpp" 34 37 #include "Element/element.hpp" 35 38 #include "Element/periodentafel.hpp" … … 41 44 #include "LinearAlgebra/Vector.hpp" 42 45 #include "LinkedCell/linkedcell.hpp" 43 #include " molecule.hpp"46 #include "IdPool_impl.hpp" 44 47 #include "Tesselation/tesselation.hpp" 45 48 #include "World.hpp" … … 63 66 AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), 64 67 BondCount(this,boost::bind(&molecule::doCountBonds,this),"BondCount"), 68 atomIdPool(0, 20, 100), 65 69 last_atom(0) 66 70 { … … 103 107 cout << "Set name of molecule " << getId() << " to " << _name << endl; 104 108 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 109 } 110 111 bool molecule::changeAtomNr(int oldNr, int newNr, atom* target){ 112 OBSERVE; 113 if(atomIdPool.reserveId(newNr)){ 114 if (oldNr != -1) // -1 is reserved and indicates no number 115 atomIdPool.releaseId(oldNr); 116 ASSERT (target, 117 "molecule::changeAtomNr() - given target is NULL, cannot set Nr or name."); 118 target->setNr(newNr); 119 setAtomName(target); 120 return true; 121 } else{ 122 return false; 123 } 105 124 } 106 125 … … 197 216 ++iter; 198 217 atomIds.erase( key->getId() ); 218 atomIdPool.releaseId(key->getNr()); 219 key->setNr(-1); 199 220 formula-=key->getType(); 200 221 key->removeFromMolecule(); … … 213 234 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId()); 214 235 if (res.second) { // push atom if went well 236 key->setNr(atomIdPool.getNextId()); 237 setAtomName(key); 215 238 formula+=key->getType(); 216 239 return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second); … … 219 242 } 220 243 } 244 245 void molecule::setAtomName(atom *_atom) const 246 { 247 std::stringstream sstr; 248 sstr << _atom->getType()->getSymbol() << _atom->getNr()+1; 249 _atom->setName(sstr.str()); 250 } 251 221 252 222 253 bool molecule::containsAtom(atom* key){ … … 247 278 OBSERVE; 248 279 if (pointer != NULL) { 249 if (pointer->getType() != NULL) { 250 if (pointer->getType()->getAtomicNumber() != 1) 251 NoNonHydrogen++; 252 if(pointer->getName() == "Unknown"){ 253 stringstream sstr; 254 sstr << pointer->getType()->getSymbol() << pointer->getNr()+1; 255 pointer->setName(sstr.str()); 256 } 257 } 280 if (pointer->getType()->getAtomicNumber() != 1) 281 NoNonHydrogen++; 258 282 insert(pointer); 259 283 pointer->setMolecule(this); … … 1029 1053 { 1030 1054 int res = size(); 1031 int i = 0;1032 1055 NoNonHydrogen = 0; 1033 for (molecule::iterator iter = begin(); iter != end(); ++iter) {1034 (*iter)->setNr(i); // update number in molecule (for easier referencing in FragmentMolecule lateron)1056 // go through atoms and look for new ones 1057 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) 1035 1058 if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it 1036 1059 NoNonHydrogen++; 1037 stringstream sstr;1038 sstr << (*iter)->getType()->getSymbol() << (*iter)->getNr()+1;1039 (*iter)->setName(sstr.str());1040 LOG(3, "Naming atom nr. " << (*iter)->getNr() << " " << (*iter)->getName() << ".");1041 i++;1042 }1043 1060 return res; 1044 1061 }; … … 1106 1123 ActiveFlag = !ActiveFlag; 1107 1124 } 1125 1126 // construct idpool 1127 CONSTRUCT_IDPOOL(atomId_t, continuousId) -
src/molecule.hpp
rac5c36 r560bbe 33 33 #include "Formula.hpp" 34 34 #include "Helpers/defs.hpp" 35 #include "IdPool_policy.hpp" 36 #include "IdPool.hpp" 35 37 #include "types.hpp" 36 38 … … 97 99 moleculeId_t id; 98 100 atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms 101 IdPool<atomId_t, uniqueId> atomIdPool; //!< pool of internal ids such that way may guarantee uniqueness 102 99 103 protected: 100 104 … … 150 154 */ 151 155 const_iterator erase(atom * key); 156 157 private: 158 friend bool atom::changeNr(int newId); 159 /** 160 * used when changing an ParticleInfo::Nr. 161 * Note that this number is local with this molecule. 162 * Unless you are calling this method from inside an atom don't fiddle with the third parameter. 163 * 164 * @param oldNr old Nr 165 * @param newNr new Nr to set 166 * @param *target ref to atom 167 * @return indicates wether the change could be done or not. 168 */ 169 bool changeAtomNr(int oldNr, int newNr, atom* target=0); 170 171 /** Sets the name of the atom. 172 * 173 * The name is set via its element symbol and its internal ParticleInfo::Nr. 174 * 175 * @param _atom atom whose name to set 176 */ 177 void setAtomName(atom *_atom) const; 152 178 153 179 public: -
tests/regression/Tesselation/BigNonConvex/post/NonConvexEnvelope.dat
rac5c36 r560bbe 2 2 VARIABLES = "X" "Y" "Z" "U" 3 3 ZONE T="test", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 6.9077 1.1106 0.1214 -6.99715 4 5 0.3612 -3.628 1.323 6.00416 5 6 0.4884 -3.5983 -0.4521 11.8428 … … 45 46 -6.8554 1.8134 -0.9499 3.80444 46 47 7.1391 2.0447 0.0264 -7.88713 47 6.9077 1.1106 0.1214 -6.9971548 48 49 31 434450 31 34 44 51 33 34 44 52 2 2 31 3453 1 6 22 3454 7 16 34 55 7 9 16 56 2 7 9 57 2 7 34 58 2 3 34 59 3 28 34 60 2 8 33 3461 1 2 3 62 1 3 28 63 1 14 28 64 1 4 27 2865 2 7 28 3366 1 6 14 67 6 13 14 68 1 3 14 2769 1 3 24 2770 2 4 27 3671 2 7 33 3672 33 36 44 73 36 434474 2 4 25 3675 2 4 25 2676 2 5 26 3277 2 5 32 4378 2 5 36 4379 1 3 24 2680 1 3 26 2981 5 13 29 82 5 23 29 83 2 3 29 3584 29 35 38 85 2 6 29 3886 2 6 29 3887 1 5 26 2988 1 5 17 2989 1 5 17 2690 1 7 26 3291 1 7 22 3292 5 6 23 93 5 6 13 94 6 10 23 95 1 0 19 2396 19 23 40 97 2 3 35 4098 3 5 40 4199 1 0 19 21100 4 10 21 101 4 6 10 102 1 4 6 103 3 5 37 38104 3 5 37 41105 1 7 29 30106 29 30 38 107 3 0 38 39108 8 17 30 109 8 16 17 110 1 6 17 22111 8 18 30 112 8 12 18 113 1 2 18 30114 1 2 20 30115 2 0 30 42116 3 0 39 42117 8 11 12 118 8 9 11 119 8 9 16 120 1 1 12 20121 1 1 20 21122 4 11 21 123 2 4 11 124 1 2 4 125 2 9 11 126 19 20 21 127 19 20 40 128 2 0 40 42129 4 0 41 42130 2 2 31 32131 3 1 32 43132 39 41 42 133 3 7 39 41134 3 7 38 3949 1 32 44 50 1 32 35 51 1 34 35 52 23 32 35 53 17 23 35 54 8 17 35 55 8 10 17 56 3 8 10 57 3 8 35 58 3 4 35 59 4 29 35 60 29 34 35 61 2 3 4 62 2 4 29 63 2 15 29 64 15 28 29 65 28 29 34 66 2 7 15 67 7 14 15 68 14 15 28 69 14 25 28 70 25 28 37 71 28 34 37 72 1 34 37 73 1 37 44 74 25 26 37 75 25 26 27 76 26 27 33 77 26 33 44 78 26 37 44 79 14 25 27 80 14 27 30 81 6 14 30 82 6 24 30 83 24 30 36 84 30 36 39 85 27 30 39 86 27 30 39 87 16 27 30 88 16 18 30 89 16 18 27 90 18 27 33 91 18 23 33 92 6 7 24 93 6 7 14 94 7 11 24 95 11 20 24 96 20 24 41 97 24 36 41 98 36 41 42 99 11 20 22 100 5 11 22 101 5 7 11 102 2 5 7 103 36 38 39 104 36 38 42 105 18 30 31 106 30 31 39 107 31 39 40 108 9 18 31 109 9 17 18 110 17 18 23 111 9 19 31 112 9 13 19 113 13 19 31 114 13 21 31 115 21 31 43 116 31 40 43 117 9 12 13 118 9 10 12 119 9 10 17 120 12 13 21 121 12 21 22 122 5 12 22 123 3 5 12 124 2 3 5 125 3 10 12 126 20 21 22 127 20 21 41 128 21 41 43 129 41 42 43 130 23 32 33 131 32 33 44 132 40 42 43 133 38 40 42 134 38 39 40 -
tests/regression/Tesselation/BigNonConvex/post/NonConvexEnvelope.r3d
rac5c36 r560bbe 3 3 # All atoms as spheres 4 4 2 5 0.777562 -3.65286 1.28459 0.1 1. 1. 1. 6 2 7 0.904762 -3.62316 -0.490507 0.1 1. 1. 1. 8 2 9 1.91486 -2.53606 0.492393 0.1 1. 1. 1. 10 2 11 -0.587138 -0.162455 -0.830407 0.1 1. 1. 1. 12 2 13 -1.53704 -3.60006 0.497793 0.1 1. 1. 1. 14 2 15 -0.771938 -0.223855 1.47919 0.1 1. 1. 1. 16 2 17 -0.300138 -1.62946 2.47449 0.1 1. 1. 1. 18 2 19 2.17906 -1.47276 -0.873307 0.1 1. 1. 1. 20 2 21 -0.586638 -1.38326 -2.92321 0.1 1. 1. 1. 22 2 23 0.438062 -2.68776 -2.23921 0.1 1. 1. 1. 24 2 25 -2.47214 -1.59546 1.71589 0.1 1. 1. 1. 26 2 27 -1.64154 -3.70136 -1.80061 0.1 1. 1. 1. 28 2 29 -2.50954 -2.13946 -1.80561 0.1 1. 1. 1. 30 2 31 1.45166 0.153645 2.50359 0.1 1. 1. 1. 32 2 33 2.04886 -1.35716 1.79219 0.1 1. 1. 1. 34 2 35 1.14346 1.15214 0.320993 0.1 1. 1. 1. 36 2 37 1.75376 -0.319055 -2.99941 0.1 1. 1. 1. 38 2 39 1.01996 1.06104 -2.15101 0.1 1. 1. 1. 40 2 41 -1.71014 0.133845 0.126293 0.1 1. 1. 1. 42 2 43 -2.78704 -0.528955 -1.12651 0.1 1. 1. 1. 44 2 45 -4.76454 -1.89276 0.930293 0.1 1. 1. 1. 46 2 47 -4.18614 -2.49696 -0.640907 0.1 1. 1. 1. 48 2 49 -3.92214 -3.45776 0.834093 0.1 1. 1. 1. 50 2 51 3.60736 1.29684 -2.87381 0.1 1. 1. 1. 52 2 53 -4.75094 -0.0564554 0.311693 0.1 1. 1. 1. 54 2 55 -3.67414 0.606345 1.56439 0.1 1. 1. 1. 56 2 57 3.22946 1.45274 2.47189 0.1 1. 1. 1. 58 2 59 4.33006 2.26874 1.33549 0.1 1. 1. 1. 60 2 61 2.57536 2.54894 1.23139 0.1 1. 1. 1. 62 2 63 4.07696 -0.484155 2.10119 0.1 1. 1. 1. 64 2 65 3.61706 -1.46676 0.692693 0.1 1. 1. 1. 66 2 67 -2.88384 2.33404 -0.0290068 0.1 1. 1. 1. 68 2 69 -3.96064 1.67134 -1.28171 0.1 1. 1. 1. 70 2 71 5.67566 1.42984 -1.78291 0.1 1. 1. 1. 72 2 73 5.10266 2.74254 -0.715907 0.1 1. 1. 1. 74 2 75 6.16236 -0.927955 1.16559 0.1 1. 1. 1. 76 2 77 5.53756 -0.911555 -0.496607 0.1 1. 1. 1. 78 2 79 -4.84774 2.80654 1.40919 0.1 1. 1. 1. 80 2 81 5.68906 1.58194 1.24439 0.1 1. 1. 1. 82 2 83 -5.82304 4.61784 0.0247932 0.1 1. 1. 1. 84 2 85 -4.05744 4.53424 -0.184207 0.1 1. 1. 1. 86 2 87 -5.13424 3.87154 -1.43691 0.1 1. 1. 1. 88 2 89 -6.29174 0.967445 0.583993 0.1 1. 1. 1. 90 2 91 -7.12784 2.53484 0.473393 0.1 1. 1. 1. 92 2 93 -6.43904 1.78854 -0.988307 0.1 1. 1. 1. 94 2 95 7.55546 2.01984 -0.0120068 0.1 1. 1. 1. 96 2 5 97 0.939662 -3.01666 0.414493 0.1 1. 1. 1. 6 98 2 … … 58 150 2 59 151 7.32406 1.08574 0.0829932 0.1 1. 1. 1. 60 261 0.777562 -3.65286 1.28459 0.1 1. 1. 1.62 263 0.904762 -3.62316 -0.490507 0.1 1. 1. 1.64 265 1.91486 -2.53606 0.492393 0.1 1. 1. 1.66 267 -0.587138 -0.162455 -0.830407 0.1 1. 1. 1.68 269 -1.53704 -3.60006 0.497793 0.1 1. 1. 1.70 271 -0.771938 -0.223855 1.47919 0.1 1. 1. 1.72 273 -0.300138 -1.62946 2.47449 0.1 1. 1. 1.74 275 2.17906 -1.47276 -0.873307 0.1 1. 1. 1.76 277 -0.586638 -1.38326 -2.92321 0.1 1. 1. 1.78 279 0.438062 -2.68776 -2.23921 0.1 1. 1. 1.80 281 -2.47214 -1.59546 1.71589 0.1 1. 1. 1.82 283 -1.64154 -3.70136 -1.80061 0.1 1. 1. 1.84 285 -2.50954 -2.13946 -1.80561 0.1 1. 1. 1.86 287 1.45166 0.153645 2.50359 0.1 1. 1. 1.88 289 2.04886 -1.35716 1.79219 0.1 1. 1. 1.90 291 1.14346 1.15214 0.320993 0.1 1. 1. 1.92 293 1.75376 -0.319055 -2.99941 0.1 1. 1. 1.94 295 1.01996 1.06104 -2.15101 0.1 1. 1. 1.96 297 -1.71014 0.133845 0.126293 0.1 1. 1. 1.98 299 -2.78704 -0.528955 -1.12651 0.1 1. 1. 1.100 2101 -4.76454 -1.89276 0.930293 0.1 1. 1. 1.102 2103 -4.18614 -2.49696 -0.640907 0.1 1. 1. 1.104 2105 -3.92214 -3.45776 0.834093 0.1 1. 1. 1.106 2107 3.60736 1.29684 -2.87381 0.1 1. 1. 1.108 2109 -4.75094 -0.0564554 0.311693 0.1 1. 1. 1.110 2111 -3.67414 0.606345 1.56439 0.1 1. 1. 1.112 2113 3.22946 1.45274 2.47189 0.1 1. 1. 1.114 2115 4.33006 2.26874 1.33549 0.1 1. 1. 1.116 2117 2.57536 2.54894 1.23139 0.1 1. 1. 1.118 2119 4.07696 -0.484155 2.10119 0.1 1. 1. 1.120 2121 3.61706 -1.46676 0.692693 0.1 1. 1. 1.122 2123 -2.88384 2.33404 -0.0290068 0.1 1. 1. 1.124 2125 -3.96064 1.67134 -1.28171 0.1 1. 1. 1.126 2127 5.67566 1.42984 -1.78291 0.1 1. 1. 1.128 2129 5.10266 2.74254 -0.715907 0.1 1. 1. 1.130 2131 6.16236 -0.927955 1.16559 0.1 1. 1. 1.132 2133 5.53756 -0.911555 -0.496607 0.1 1. 1. 1.134 2135 -4.84774 2.80654 1.40919 0.1 1. 1. 1.136 2137 5.68906 1.58194 1.24439 0.1 1. 1. 1.138 2139 -5.82304 4.61784 0.0247932 0.1 1. 1. 1.140 2141 -4.05744 4.53424 -0.184207 0.1 1. 1. 1.142 2143 -5.13424 3.87154 -1.43691 0.1 1. 1. 1.144 2145 -6.29174 0.967445 0.583993 0.1 1. 1. 1.146 2147 -7.12784 2.53484 0.473393 0.1 1. 1. 1.148 2149 -6.43904 1.78854 -0.988307 0.1 1. 1. 1.150 2151 7.55546 2.01984 -0.0120068 0.1 1. 1. 1.152 152 # All tesselation triangles 153 153 8
Note:
See TracChangeset
for help on using the changeset viewer.