Changeset d74077 for src/atom.cpp
- Timestamp:
- Jul 31, 2010, 3:23:10 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:
- 8f4df1
- Parents:
- 5fbaeb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/atom.cpp ¶
r5fbaeb rd74077 27 27 atom::atom() : 28 28 father(this), sort(&nr), mol(0) 29 { 30 node = &x; // TesselPoint::x can only be referenced from here 31 }; 29 {}; 32 30 33 31 /** Constructor of class atom. … … 36 34 ParticleInfo(pointer),father(pointer), sort(&nr) 37 35 { 38 type = pointer->type; // copy element of atom39 x = pointer->x; // copy coordination40 v = pointer->v; // copy velocity36 setType(pointer->getType()); // copy element of atom 37 setPosition(pointer->getPosition()); // copy coordination 38 AtomicVelocity = pointer->AtomicVelocity; // copy velocity 41 39 FixedIon = pointer->FixedIon; 42 node = &x;43 40 mol = 0; 44 41 }; … … 48 45 res->father = this; 49 46 res->sort = &res->nr; 50 res-> type = type;51 res-> x = this->x;52 res-> v = this->v;47 res->setType(getType()); 48 res->setPosition(this->getPosition()); 49 res->AtomicVelocity = this->AtomicVelocity; 53 50 res->FixedIon = FixedIon; 54 res->node = &x;55 51 res->mol = 0; 56 52 World::getInstance().registerAtom(res); … … 116 112 bool atom::IsInShape(const Shape& shape) const 117 113 { 118 return shape.isInside( *node);114 return shape.isInside(getPosition()); 119 115 }; 120 116 … … 141 137 if (out != NULL) { 142 138 *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t" << fixed << setprecision(9) << showpoint; 143 *out << x[0] << "\t" << x[1] << "\t" << x[2];139 *out << at(0) << "\t" << at(1) << "\t" << at(2); 144 140 *out << "\t" << FixedIon; 145 if ( v.Norm() > MYEPSILON)146 *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";141 if (AtomicVelocity.Norm() > MYEPSILON) 142 *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t"; 147 143 if (comment != NULL) 148 144 *out << " # " << comment << endl; … … 163 159 bool atom::OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment) const 164 160 { 165 AtomNo[ type->Z]++; // increment number166 if (out != NULL) { 167 *out << "Ion_Type" << ElementNo[ type->Z] << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint;168 *out << x[0] << "\t" << x[1] << "\t" << x[2];161 AtomNo[getType()->Z]++; // increment number 162 if (out != NULL) { 163 *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t" << fixed << setprecision(9) << showpoint; 164 *out << at(0) << "\t" << at(1) << "\t" << at(2); 169 165 *out << "\t" << FixedIon; 170 if ( v.Norm() > MYEPSILON)171 *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";166 if (AtomicVelocity.Norm() > MYEPSILON) 167 *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t"; 172 168 if (comment != NULL) 173 169 *out << " # " << comment << endl; … … 186 182 { 187 183 if (out != NULL) { 188 *out << type->symbol << "\t" << x[0] << "\t" << x[1] << "\t" << x[2]<< "\t" << endl;184 *out << getType()->symbol << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl; 189 185 return true; 190 186 } else … … 201 197 bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const 202 198 { 203 AtomNo[ type->Z]++;204 if (out != NULL) { 205 *out << "Ion_Type" << ElementNo[ type->Z] << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint;199 AtomNo[getType()->Z]++; 200 if (out != NULL) { 201 *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t" << fixed << setprecision(9) << showpoint; 206 202 *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2]; 207 203 *out << "\t" << FixedIon; … … 224 220 { 225 221 if (out != NULL) { 226 *out << type->symbol << "\t";222 *out << getType()->symbol << "\t"; 227 223 *out << Trajectory.R.at(step)[0] << "\t"; 228 224 *out << Trajectory.R.at(step)[1] << "\t"; … … 240 236 void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const 241 237 { 242 *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl; 238 Vector recentered(getPosition()); 239 recentered -= *center; 240 *out << "\t\t" << getType()->symbol << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl; 243 241 if (AtomNo != NULL) 244 242 *AtomNo++; … … 263 261 double atom::DistanceSquaredToVector(const Vector &origin) const 264 262 { 265 return origin.DistanceSquared(x);263 return DistanceSquared(origin); 266 264 }; 267 265 … … 272 270 double atom::DistanceToVector(const Vector &origin) const 273 271 { 274 return origin.distance(x);272 return distance(origin); 275 273 }; 276 274 … … 287 285 }; 288 286 287 std::ostream & atom::operator << (std::ostream &ost) const 288 { 289 ParticleInfo::operator<<(ost); 290 ost << "," << getPosition(); 291 return ost; 292 } 293 294 std::ostream & operator << (std::ostream &ost, const atom &a) 295 { 296 a.ParticleInfo::operator<<(ost); 297 ost << "," << a.getPosition(); 298 return ost; 299 } 289 300 290 301 bool operator < (atom &a, atom &b)
Note:
See TracChangeset
for help on using the changeset viewer.