Changeset 8f4df1 for src/atom.cpp
- Timestamp:
- Aug 7, 2010, 12:07:04 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, Candidate_v1.7.0, 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:
- 2d292d
- Parents:
- 8d6d31 (diff), d74077 (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. - File:
-
- 1 edited
-
src/atom.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/atom.cpp
r8d6d31 r8f4df1 28 28 atom::atom() : 29 29 father(this), sort(&nr), mol(0) 30 { 31 node = &x; // TesselPoint::x can only be referenced from here 32 }; 30 {}; 33 31 34 32 /** Constructor of class atom. … … 37 35 ParticleInfo(pointer),father(pointer), sort(&nr) 38 36 { 39 type = pointer->type; // copy element of atom40 x = pointer->x; // copy coordination41 v = pointer->v; // copy velocity37 setType(pointer->getType()); // copy element of atom 38 setPosition(pointer->getPosition()); // copy coordination 39 AtomicVelocity = pointer->AtomicVelocity; // copy velocity 42 40 FixedIon = pointer->FixedIon; 43 node = &x;44 41 mol = 0; 45 42 }; … … 49 46 res->father = this; 50 47 res->sort = &res->nr; 51 res-> type = type;52 res-> x = this->x;53 res-> v = this->v;48 res->setType(getType()); 49 res->setPosition(this->getPosition()); 50 res->AtomicVelocity = this->AtomicVelocity; 54 51 res->FixedIon = FixedIon; 55 res->node = &x;56 52 res->mol = 0; 57 53 World::getInstance().registerAtom(res); … … 121 117 bool atom::IsInShape(const Shape& shape) const 122 118 { 123 return shape.isInside( *node);119 return shape.isInside(getPosition()); 124 120 }; 125 121 … … 146 142 if (out != NULL) { 147 143 *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t" << fixed << setprecision(9) << showpoint; 148 *out << x[0] << "\t" << x[1] << "\t" << x[2];144 *out << at(0) << "\t" << at(1) << "\t" << at(2); 149 145 *out << "\t" << FixedIon; 150 if ( v.Norm() > MYEPSILON)151 *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";146 if (AtomicVelocity.Norm() > MYEPSILON) 147 *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t"; 152 148 if (comment != NULL) 153 149 *out << " # " << comment << endl; … … 168 164 bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const 169 165 { 170 AtomNo[type->Z]++; // increment number 171 if (out != NULL) { 172 cout << "Looking for atom with element " << *type << endl; 173 ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration"); 174 *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint; 175 *out << x[0] << "\t" << x[1] << "\t" << x[2]; 166 AtomNo[getType()->Z]++; // increment number 167 if (out != NULL) { 168 const element *elemental = getType(); 169 cout << "Looking for atom with element " << *elemental << endl; 170 ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration"); 171 *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t" << fixed << setprecision(9) << showpoint; 172 *out << at(0) << "\t" << at(1) << "\t" << at(2); 176 173 *out << "\t" << FixedIon; 177 if ( v.Norm() > MYEPSILON)178 *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";174 if (AtomicVelocity.Norm() > MYEPSILON) 175 *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t"; 179 176 if (comment != NULL) 180 177 *out << " # " << comment << endl; … … 193 190 { 194 191 if (out != NULL) { 195 *out << type->symbol << "\t" << x[0] << "\t" << x[1] << "\t" << x[2]<< "\t" << endl;192 *out << getType()->symbol << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl; 196 193 return true; 197 194 } else … … 208 205 bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const 209 206 { 210 AtomNo[ type->Z]++;211 if (out != NULL) { 212 *out << "Ion_Type" << ElementNo[ type->Z] << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint;207 AtomNo[getType()->Z]++; 208 if (out != NULL) { 209 *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t" << fixed << setprecision(9) << showpoint; 213 210 *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2]; 214 211 *out << "\t" << FixedIon; … … 231 228 { 232 229 if (out != NULL) { 233 *out << type->symbol << "\t";230 *out << getType()->symbol << "\t"; 234 231 *out << Trajectory.R.at(step)[0] << "\t"; 235 232 *out << Trajectory.R.at(step)[1] << "\t"; … … 247 244 void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const 248 245 { 249 *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl; 246 Vector recentered(getPosition()); 247 recentered -= *center; 248 *out << "\t\t" << getType()->symbol << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl; 250 249 if (AtomNo != NULL) 251 250 *AtomNo++; … … 270 269 double atom::DistanceSquaredToVector(const Vector &origin) const 271 270 { 272 return origin.DistanceSquared(x);271 return DistanceSquared(origin); 273 272 }; 274 273 … … 279 278 double atom::DistanceToVector(const Vector &origin) const 280 279 { 281 return origin.distance(x);280 return distance(origin); 282 281 }; 283 282 … … 294 293 }; 295 294 295 std::ostream & atom::operator << (std::ostream &ost) const 296 { 297 ParticleInfo::operator<<(ost); 298 ost << "," << getPosition(); 299 return ost; 300 } 301 302 std::ostream & operator << (std::ostream &ost, const atom &a) 303 { 304 a.ParticleInfo::operator<<(ost); 305 ost << "," << a.getPosition(); 306 return ost; 307 } 296 308 297 309 bool operator < (atom &a, atom &b)
Note:
See TracChangeset
for help on using the changeset viewer.
