Changeset 83f176
- Timestamp:
- Aug 19, 2010, 3:23:37 PM (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:
- 2a7457
- Parents:
- 1ee380f
- git-author:
- Frederik Heber <heber@…> (08/17/10 17:21:25)
- git-committer:
- Frederik Heber <heber@…> (08/19/10 15:23:37)
- Location:
- src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
r1ee380f r83f176 76 76 Vector x = (*iter)->getPosition(); 77 77 x -= *CenterOfGravity; 78 const double mass = (*iter)->getType()-> mass;78 const double mass = (*iter)->getType()->getMass(); 79 79 InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]); 80 80 InertiaTensor.at(0,1) += mass*(-x[0]*x[1]); -
src/Actions/MapOfActions.cpp
r1ee380f r83f176 808 808 if (typeid(const element ) == *TypeMap[name]) { 809 809 std::ostringstream stream; 810 stream << _T-> Z;810 stream << _T->getAtomicNumber(); 811 811 CurrentValue[name] = stream.str(); 812 812 } else … … 869 869 std::ostringstream stream; 870 870 for (std::vector<const element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) { 871 stream << (*iter)-> Z<< " ";871 stream << (*iter)->getAtomicNumber() << " "; 872 872 } 873 873 CurrentValue[name] = stream.str(); -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
r1ee380f r83f176 97 97 Vector x = (*iter)->getPosition(); 98 98 x -= *CenterOfGravity; 99 const double mass = (*iter)->getType()-> mass;99 const double mass = (*iter)->getType()->getMass(); 100 100 InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]); 101 101 InertiaTensor.at(0,1) += mass*(-x[0]*x[1]); … … 148 148 Vector x = (*iter)->getPosition(); 149 149 x -= *CenterOfGravity; 150 const double mass = (*iter)->getType()-> mass;150 const double mass = (*iter)->getType()->getMass(); 151 151 InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]); 152 152 InertiaTensor.at(0,1) += mass*(-x[0]*x[1]); -
src/Parser/PcpParser.cpp
r1ee380f r83f176 505 505 PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0; 506 506 for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) { 507 PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()-> NoValenceOrbitals;507 PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals(); 508 508 } 509 509 cout << PlaneWaveSpecifics.MaxPsiDouble << endl; … … 540 540 // insert all found elements into the map 541 541 for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 542 Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()-> Z, 1));542 Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1)); 543 543 if (!Inserter.second) // increase if present 544 544 Inserter.first->second += 1; … … 555 555 const element * const elemental = World::getInstance().getPeriode()->FindElement(iter->first); 556 556 ZtoIndexMap.insert( pair<int,int> (iter->first, counter) ); 557 *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental-> Z << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->mass<< "\t" << elemental->getName() << "\t" << elemental->getSymbol() <<endl;557 *file << "Ion_Type" << counter++ << "\t" << iter->second << "\t" << elemental->getAtomicNumber() << "\t1.0\t3\t3\t" << fixed << setprecision(11) << showpoint << elemental->getMass() << "\t" << elemental->getName() << "\t" << elemental->getSymbol() <<endl; 558 558 } 559 559 } … … 571 571 int nr = 0; 572 572 for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 573 Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()-> Z, 1) );573 Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) ); 574 574 if (!Inserter.second) 575 575 Inserter.first->second += 1; 576 const int Z = (*AtomRunner)->getType()-> Z;576 const int Z = (*AtomRunner)->getType()->getAtomicNumber(); 577 577 *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t" << fixed << setprecision(9) << showpoint; 578 578 *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2); -
src/analysis_bonds.cpp
r1ee380f r83f176 150 150 molecule::iterator Runner = (*MolRunner)->begin(); 151 151 for(;Runner!=(*MolRunner)->end();++Runner){ 152 if (((*Walker)->getType()-> Z == 8) && ((*Runner)->getType()->Z== 8)) {152 if (((*Walker)->getType()->getAtomicNumber() == 8) && ((*Runner)->getType()->getAtomicNumber() == 8)) { 153 153 // check distance 154 154 const double distance = (*Runner)->DistanceSquared(*(*Walker)); … … 164 164 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 165 165 // if hydrogen, check angle to be greater(!) than 30 degrees 166 if (OtherAtom->getType()-> Z== 1) {166 if (OtherAtom->getType()->getAtomicNumber() == 1) { 167 167 const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition()); 168 168 OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON); … … 189 189 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) { 190 190 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 191 if (OtherAtom->getType()-> Z== 1) {191 if (OtherAtom->getType()->getAtomicNumber() == 1) { 192 192 // check angle 193 193 if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) { -
src/atom.cpp
r1ee380f r83f176 180 180 bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const 181 181 { 182 AtomNo[getType()-> Z]++; // increment number182 AtomNo[getType()->getAtomicNumber()]++; // increment number 183 183 if (out != NULL) { 184 184 const element *elemental = getType(); 185 185 cout << "Looking for atom with element " << *elemental << endl; 186 186 ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration"); 187 *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental-> Z] << "\t" << fixed << setprecision(9) << showpoint;187 *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->getAtomicNumber()] << "\t" << fixed << setprecision(9) << showpoint; 188 188 *out << at(0) << "\t" << at(1) << "\t" << at(2); 189 189 *out << "\t" << FixedIon; … … 221 221 bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const 222 222 { 223 AtomNo[getType()-> Z]++;224 if (out != NULL) { 225 *out << "Ion_Type" << ElementNo[getType()-> Z] << "_" << AtomNo[getType()->Z] << "\t" << fixed << setprecision(9) << showpoint;223 AtomNo[getType()->getAtomicNumber()]++; 224 if (out != NULL) { 225 *out << "Ion_Type" << ElementNo[getType()->getAtomicNumber()] << "_" << AtomNo[getType()->getAtomicNumber()] << "\t" << fixed << setprecision(9) << showpoint; 226 226 *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2]; 227 227 *out << "\t" << FixedIon; -
src/atom_bondedparticle.cpp
r1ee380f r83f176 164 164 NoBonds = CountBonds(); 165 165 //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl; 166 if ((int)(getType()-> NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch166 if ((int)(getType()->getNoValenceOrbitals()) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch 167 167 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) { 168 168 OtherWalker = (*Runner)->GetOtherAtom(this); 169 169 OtherNoBonds = OtherWalker->CountBonds(); 170 170 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl; 171 if ((int)(OtherWalker->getType()-> NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate171 if ((int)(OtherWalker->getType()->getNoValenceOrbitals()) > OtherNoBonds) { // check if possible candidate 172 172 if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first 173 173 CandidateBond = (*Runner); -
src/atom_trajectoryparticle.cpp
r1ee380f r83f176 50 50 { 51 51 for (int i=NDIM;i--;) 52 *temperature += getType()-> mass* Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];52 *temperature += getType()->getMass() * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i]; 53 53 }; 54 54 … … 77 77 for(int d=0;d<NDIM;d++) { 78 78 Trajectory.U.at(Step)[d] -= CoGVelocity->at(d); 79 *ActualTemp += 0.5 * getType()-> mass* Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];79 *ActualTemp += 0.5 * getType()->getMass() * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d]; 80 80 } 81 81 }; … … 125 125 Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d]; 126 126 Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2 127 Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()-> mass); // F = m * a and s =127 Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->getMass()); // F = m * a and s = 128 128 } 129 129 // Update U 130 130 for (int d=0; d<NDIM; d++) { 131 131 Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d]; 132 Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()-> mass); // v = F/m * t132 Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->getMass()); // v = F/m * t 133 133 } 134 134 // Update R (and F) … … 149 149 void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const 150 150 { 151 *TotalMass += getType()-> mass; // sum up total mass151 *TotalMass += getType()->getMass(); // sum up total mass 152 152 for(int d=0;d<NDIM;d++) { 153 TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()-> mass;153 TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->getMass(); 154 154 } 155 155 }; … … 166 166 for (int d=0; d<NDIM; d++) { 167 167 U[d] *= ScaleTempFactor; 168 *ekin += 0.5*getType()-> mass* U[d]*U[d];168 *ekin += 0.5*getType()->getMass() * U[d]*U[d]; 169 169 } 170 170 }; … … 182 182 for (int d=0; d<NDIM; d++) { 183 183 *G += U[d] * F[d]; 184 *E += U[d]*U[d]*getType()-> mass;184 *E += U[d]*U[d]*getType()->getMass(); 185 185 } 186 186 }; … … 197 197 if (FixedIon == 0) // even FixedIon moves, only not by other's forces 198 198 for (int d=0; d<NDIM; d++) { 199 U[d] += configuration->Deltat/getType()-> mass * ( (G_over_E) * (U[d]*getType()->mass) );200 *ekin += getType()-> mass* U[d]*U[d];199 U[d] += configuration->Deltat/getType()->getMass() * ( (G_over_E) * (U[d]*getType()->getMass()) ); 200 *ekin += getType()->getMass() * U[d]*U[d]; 201 201 } 202 202 }; … … 210 210 void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration) 211 211 { 212 double sigma = sqrt(configuration->Thermostats->TargetTemp/getType()-> mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)212 double sigma = sqrt(configuration->Thermostats->TargetTemp/getType()->getMass()); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime) 213 213 Vector &U = Trajectory.U.at(Step); 214 214 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces … … 223 223 } 224 224 for (int d=0; d<NDIM; d++) 225 *ekin += 0.5*getType()-> mass* U[d]*U[d];225 *ekin += 0.5*getType()->getMass() * U[d]*U[d]; 226 226 } 227 227 }; … … 239 239 for (int d=0; d<NDIM; d++) { 240 240 U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1)); 241 *ekin += 0.5*getType()-> mass* U[d]*U[d];241 *ekin += 0.5*getType()->getMass() * U[d]*U[d]; 242 242 } 243 243 } … … 253 253 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 254 254 for (int d=0; d<NDIM; d++) { 255 *delta_alpha += U[d]*U[d]*getType()-> mass;255 *delta_alpha += U[d]*U[d]*getType()->getMass(); 256 256 } 257 257 } … … 268 268 if (FixedIon == 0) { // even FixedIon moves, only not by other's forces 269 269 for (int d=0; d<NDIM; d++) { 270 U[d] += configuration->Deltat/getType()-> mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass));271 *ekin += (0.5*getType()-> mass) * U[d]*U[d];270 U[d] += configuration->Deltat/getType()->getMass() * (configuration->Thermostats->alpha * (U[d] * getType()->getMass())); 271 *ekin += (0.5*getType()->getMass()) * U[d]*U[d]; 272 272 } 273 273 } -
src/bond.cpp
r1ee380f r83f176 63 63 { 64 64 if ((left != NULL) && (right != NULL)) { 65 if ((left->getType() != NULL) && (left->getType()-> Z== 1))65 if ((left->getType() != NULL) && (left->getType()->getAtomicNumber() == 1)) 66 66 HydrogenBond++; 67 if ((right->getType() != NULL) && (right->getType()-> Z== 1))67 if ((right->getType() != NULL) && (right->getType()->getAtomicNumber() == 1)) 68 68 HydrogenBond++; 69 69 } -
src/bondgraph.cpp
r1ee380f r83f176 144 144 145 145 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 146 if ((*iter)->getType()-> CovalentRadius> max_distance)147 max_distance = (*iter)->getType()-> CovalentRadius;146 if ((*iter)->getType()->getCovalentRadius() > max_distance) 147 max_distance = (*iter)->getType()->getCovalentRadius(); 148 148 } 149 149 max_distance *= 2.; … … 161 161 void BondGraph::CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem) 162 162 { 163 MinDistance = OtherWalker->getType()-> CovalentRadius + Walker->getType()->CovalentRadius;163 MinDistance = OtherWalker->getType()->getCovalentRadius() + Walker->getType()->getCovalentRadius(); 164 164 MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem; 165 165 MaxDistance = MinDistance + BondThreshold; … … 182 182 CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); 183 183 } else { 184 MinDistance = GetBondLength(Walker->getType()-> Z-1, OtherWalker->getType()->Z-1);184 MinDistance = GetBondLength(Walker->getType()->getAtomicNumber()-1, OtherWalker->getType()->getAtomicNumber()-1); 185 185 MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem; 186 186 MaxDistance = MinDistance + BondThreshold; -
src/boundary.cpp
r1ee380f r83f176 717 717 // sum up the atomic masses 718 718 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 719 totalmass += (*iter)->getType()-> mass;719 totalmass += (*iter)->getType()->getMass(); 720 720 } 721 721 DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl); -
src/config.cpp
r1ee380f r83f176 484 484 ParseForParameter(verbose,FileBuffer, name, 0, 2, 1, int_type, &Z, 1, critical); 485 485 elementhash[i] = periode->FindElement(Z); 486 DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]-> Z<< " with " << No[i] << " ions." << endl);486 DoLog(1) && (Log() << Verbose(1) << i << ". Z = " << elementhash[i]->getAtomicNumber() << " with " << No[i] << " ions." << endl); 487 487 NoAtoms += No[i]; 488 488 } … … 1352 1352 AtomNo = 0; 1353 1353 for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) { 1354 sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()-> Z]);1355 elementNo[(*iter)->getType()-> Z] = (elementNo[(*iter)->getType()->Z]+1) % 100; // confine to two digits1354 sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]); 1355 elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100; // confine to two digits 1356 1356 fprintf(f, 1357 1357 "ATOM %6u %-4s %4s%c%4u %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s\n", … … 1364 1364 (*iter)->at(1), /* position Y in Angstroem */ 1365 1365 (*iter)->at(2), /* position Z in Angstroem */ 1366 (double)(*iter)->getType()-> Valence, /* occupancy */1367 (double)(*iter)->getType()-> NoValenceOrbitals, /* temperature factor */1366 (double)(*iter)->getType()->getValence(), /* occupancy */ 1367 (double)(*iter)->getType()->getNoValenceOrbitals(), /* temperature factor */ 1368 1368 "0", /* segment identifier */ 1369 1369 (*iter)->getType()->getSymbol().c_str(), /* element symbol */ … … 1405 1405 AtomNo = 0; 1406 1406 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 1407 sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()-> Z]);1408 elementNo[(*iter)->getType()-> Z] = (elementNo[(*iter)->getType()->Z]+1) % 100; // confine to two digits1407 sprintf(name, "%2s%2d",(*iter)->getType()->getSymbol().c_str(), elementNo[(*iter)->getType()->getAtomicNumber()]); 1408 elementNo[(*iter)->getType()->getAtomicNumber()] = (elementNo[(*iter)->getType()->getAtomicNumber()]+1) % 100; // confine to two digits 1409 1409 fprintf(f, 1410 1410 "ATOM %6u %-4s %4s%c%4u %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s\n", … … 1417 1417 (*iter)->at(1), /* position Y in Angstroem */ 1418 1418 (*iter)->at(2), /* position Z in Angstroem */ 1419 (double)(*iter)->getType()-> Valence, /* occupancy */1420 (double)(*iter)->getType()-> NoValenceOrbitals, /* temperature factor */1419 (double)(*iter)->getType()->getValence(), /* occupancy */ 1420 (double)(*iter)->getType()->getNoValenceOrbitals(), /* temperature factor */ 1421 1421 "0", /* segment identifier */ 1422 1422 (*iter)->getType()->getSymbol().c_str(), /* element symbol */ … … 1464 1464 *output << 0 << "\t"; 1465 1465 *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t"; 1466 *output << static_cast<double>((*iter)->getType()-> Valence) << "\t";1466 *output << static_cast<double>((*iter)->getType()->getValence()) << "\t"; 1467 1467 *output << (*iter)->getType()->getSymbol() << "\t"; 1468 1468 for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++) … … 1536 1536 *output << MolCounter+1 << "\t"; 1537 1537 *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t"; 1538 *output << (double)(*iter)->getType()-> Valence<< "\t";1538 *output << (double)(*iter)->getType()->getValence() << "\t"; 1539 1539 *output << (*iter)->getType()->getSymbol() << "\t"; 1540 1540 for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++) -
src/element.cpp
r1ee380f r83f176 22 22 #include <fstream> 23 23 24 #include "Helpers/Assert.hpp" 24 25 #include "element.hpp" 25 26 … … 107 108 } 108 109 110 double element::getMass() const 111 { 112 return mass; 113 } 114 115 double element::getCovalentRadius() const 116 { 117 return CovalentRadius; 118 } 119 120 double element::getVanDerWaalsRadius() const 121 { 122 return VanDerWaalsRadius; 123 } 124 125 int element::getAtomicNumber() const 126 { 127 return Z; 128 } 129 130 double element::getValence() const 131 { 132 return Valence; 133 } 134 135 int element::getNoValenceOrbitals() const 136 { 137 return NoValenceOrbitals; 138 } 139 140 double element::getHBondDistance(const int i) const 141 { 142 ASSERT((i>=0) && (i<3), "Access to element::HBondDistance out of bounds."); 143 return HBondDistance[i]; 144 } 145 146 double element::getHBondAngle(const int i) const 147 { 148 ASSERT((i>=0) && (i<3), "Access to element::HBondAngle out of bounds."); 149 return HBondAngle[i]; 150 } 151 109 152 string &element::getSymbol(){ 110 153 return symbol; … … 113 156 const string &element::getSymbol() const{ 114 157 return symbol; 158 } 159 160 void element::setSymbol(const std::string &temp) 161 { 162 symbol = temp; 115 163 } 116 164 … … 123 171 } 124 172 173 void element::setName(const std::string &temp) 174 { 175 name = temp; 176 } 177 125 178 std::ostream &operator<<(std::ostream &ost,const element &elem){ 126 179 ost << elem.getName() << "(" << elem.getNumber() << ")"; -
src/element.hpp
r1ee380f r83f176 22 22 #include "types.hpp" 23 23 24 class periodentafel; 25 24 26 /********************************************** declarations *******************************/ 25 27 … … 28 30 */ 29 31 class element { 32 friend class periodentafel; 30 33 public: 34 element(); 35 element(const element&); 36 ~element(); 37 38 element &operator=(const element&); 39 40 // accessor functions 41 atomicNumber_t getNumber() const; 42 double getMass() const; 43 double getCovalentRadius() const; 44 double getVanDerWaalsRadius() const; 45 int getAtomicNumber() const; 46 double getValence() const; 47 int getNoValenceOrbitals() const; 48 double getHBondDistance(const int i) const; 49 double getHBondAngle(const int i) const; 50 51 std::string &getSymbol(); 52 const std::string &getSymbol() const; 53 void setSymbol(const std::string &temp); 54 55 std::string &getName(); 56 const std::string &getName() const; 57 void setName(const std::string &temp); 58 59 //> print element entries to screen 60 bool Output(std::ostream * const out) const; 61 bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const; 62 63 private: 31 64 double mass; //!< mass in g/mol 32 65 double CovalentRadius; //!< covalent radius … … 41 74 double HBondAngle[NDIM]; //!< typical angle for one, two, three bonded hydrogen (in degrees) 42 75 43 element(); 44 element(const element&); 45 ~element(); 46 47 element &operator=(const element&); 48 49 // accessor functions 50 atomicNumber_t getNumber() const; 51 std::string &getSymbol(); 52 const std::string &getSymbol() const; 53 std::string &getName(); 54 const std::string &getName() const; 55 56 //> print element entries to screen 57 bool Output(std::ostream * const out) const; 58 bool Checkout(std::ostream * const out, const int No, const int NoOfAtoms) const; 59 60 private: 61 std::string name; //!< atom name, i.e. "Hydrogren" 76 std::string name; //!< atom name, i.e. "Hydrogen" 62 77 std::string symbol; //!< short form of the atom, i.e. "H" 63 78 }; -
src/molecule.cpp
r1ee380f r83f176 234 234 pointer->sort = &pointer->nr; 235 235 if (pointer->getType() != NULL) { 236 if (pointer->getType()-> Z!= 1)236 if (pointer->getType()->getAtomicNumber() != 1) 237 237 NoNonHydrogen++; 238 238 if(pointer->getName() == "Unknown"){ … … 262 262 walker->nr = last_atom++; // increase number within molecule 263 263 insert(walker); 264 if ((pointer->getType() != NULL) && (pointer->getType()-> Z!= 1))264 if ((pointer->getType() != NULL) && (pointer->getType()->getAtomicNumber() != 1)) 265 265 NoNonHydrogen++; 266 266 retval=walker; … … 348 348 // get typical bond length and store as scale factor for later 349 349 ASSERT(TopOrigin->getType() != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given."); 350 BondRescale = TopOrigin->getType()-> HBondDistance[TopBond->BondDegree-1];350 BondRescale = TopOrigin->getType()->getHBondDistance(TopBond->BondDegree-1); 351 351 if (BondRescale == -1) { 352 352 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl); … … 365 365 FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity 366 366 FirstOtherAtom->FixedIon = TopReplacement->FixedIon; 367 if (TopReplacement->getType()-> Z== 1) { // neither rescale nor replace if it's already hydrogen367 if (TopReplacement->getType()->getAtomicNumber() == 1) { // neither rescale nor replace if it's already hydrogen 368 368 FirstOtherAtom->father = TopReplacement; 369 369 BondRescale = bondlength; … … 434 434 FirstOtherAtom->father = NULL; // we are just an added hydrogen with no father 435 435 SecondOtherAtom->father = NULL; // we are just an added hydrogen with no father 436 bondangle = TopOrigin->getType()-> HBondAngle[1];436 bondangle = TopOrigin->getType()->getHBondAngle(1); 437 437 if (bondangle == -1) { 438 438 DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl); … … 510 510 511 511 // create correct coordination for the three atoms 512 alpha = (TopOrigin->getType()-> HBondAngle[2])/180.*M_PI/2.; // retrieve triple bond angle from database512 alpha = (TopOrigin->getType()->getHBondAngle(2))/180.*M_PI/2.; // retrieve triple bond angle from database 513 513 l = BondRescale; // desired bond length 514 514 b = 2.*l*sin(alpha); // base length of isosceles triangle … … 718 718 atom1->RegisterBond(Binder); 719 719 atom2->RegisterBond(Binder); 720 if ((atom1->getType() != NULL) && (atom1->getType()-> Z != 1) && (atom2->getType() != NULL) && (atom2->getType()->Z!= 1))720 if ((atom1->getType() != NULL) && (atom1->getType()->getAtomicNumber() != 1) && (atom2->getType() != NULL) && (atom2->getType()->getAtomicNumber() != 1)) 721 721 NoNonBonds++; 722 722 … … 912 912 ElementNo[i] = 0; 913 913 } 914 SetIndexedArrayForEachAtomTo ( ElementNo, &element::Z, &AbsoluteValue, 1); 914 for(molecule::iterator iter = begin(); iter != end(); ++iter) { 915 ElementNo[(*iter)->getType()->getAtomicNumber()] = 1; 916 } 915 917 int current=1; 916 918 for (int i=0;i<MAX_ELEMENTS;++i) { … … 986 988 for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 987 989 (*iter)->nr = i; // update number in molecule (for easier referencing in FragmentMolecule lateron) 988 if ((*iter)->getType()-> Z!= 1) // count non-hydrogen atoms whilst at it990 if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it 989 991 NoNonHydrogen++; 990 992 stringstream sstr; -
src/molecule_fragmentation.cpp
r1ee380f r83f176 463 463 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 464 464 #ifdef ADDHYDROGEN 465 if ((*iter)->getType()-> Z!= 1) // skip hydrogen465 if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen 466 466 #endif 467 467 { … … 483 483 for(molecule::const_iterator iter = begin(); iter != end(); ++iter) { 484 484 #ifdef ADDHYDROGEN 485 if ((*iter)->getType()-> Z!= 1) // skip hydrogen485 if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen 486 486 #endif 487 487 { … … 892 892 for (KeySet::iterator runner = Leaf->begin(); runner != Leaf->end(); runner++) { 893 893 Runner = FindAtom((*runner)); 894 if (Runner->getType()-> Z!= 1) { // skip all those added hydrogens when re-filling snake stack894 if (Runner->getType()->getAtomicNumber() != 1) { // skip all those added hydrogens when re-filling snake stack 895 895 if (ShortestPathList[(*runner)] > SP) { // remove the oldest one with longest shortest path 896 896 SP = ShortestPathList[(*runner)]; … … 981 981 ++iter; 982 982 #ifdef ADDHYDROGEN 983 while ((iter != Leaf->end()) && ((*iter)->getType()-> Z== 1)){ // skip added hydrogen983 while ((iter != Leaf->end()) && ((*iter)->getType()->getAtomicNumber() == 1)){ // skip added hydrogen 984 984 iter++; 985 985 } … … 1359 1359 if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end()) 1360 1360 #ifdef ADDHYDROGEN 1361 && (OtherWalker->getType()-> Z!= 1)1361 && (OtherWalker->getType()->getAtomicNumber() != 1) 1362 1362 #endif 1363 1363 ) { // skip hydrogens and restrict to fragment -
src/molecule_geometry.cpp
r1ee380f r83f176 186 186 if (iter != end()) { //list not empty? 187 187 for (; iter != end(); ++iter) { // continue with second if present 188 Num += (*iter)->getType()-> mass;189 tmp = (*iter)->getType()-> mass* (*iter)->getPosition();188 Num += (*iter)->getType()->getMass(); 189 tmp = (*iter)->getType()->getMass() * (*iter)->getPosition(); 190 190 (*a) += tmp; 191 191 } … … 299 299 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 300 300 #ifdef ADDHYDROGEN 301 if ((*iter)->getType()-> Z!= 1) {301 if ((*iter)->getType()->getAtomicNumber() != 1) { 302 302 #endif 303 303 Testvector = inversematrix * (*iter)->getPosition(); … … 324 324 // now also change all hydrogens 325 325 for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) { 326 if ((*Runner)->GetOtherAtom((*iter))->getType()-> Z== 1) {326 if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) { 327 327 Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition(); 328 328 Testvector += Translationvector; -
src/molecule_graph.cpp
r1ee380f r83f176 745 745 OtherAtom = (*Runner)->GetOtherAtom(Walker); 746 746 #ifdef ADDHYDROGEN 747 if (OtherAtom->getType()-> Z!= 1) {747 if (OtherAtom->getType()->getAtomicNumber() != 1) { 748 748 #endif 749 749 DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl); -
src/moleculelist.cpp
r1ee380f r83f176 347 347 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 348 348 //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl; 349 if (((*iter)->getType()-> Z== 1) && (((*iter)->father == NULL)350 || ((*iter)->father->getType()-> Z!= 1))) { // if it's a hydrogen349 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL) 350 || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen 351 351 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) { 352 352 //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl; 353 353 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 354 354 Binder = *((*runner)->ListOfBonds.begin()); 355 if (((*runner)->getType()-> Z== 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)355 if (((*runner)->getType()->getAtomicNumber() == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!) 356 356 // 4. evaluate the morse potential for each matrix component and add up 357 357 distance = (*runner)->distance(*(*iter)); … … 836 836 if (AtomMask[Father->nr]) // apply mask 837 837 #ifdef ADDHYDROGEN 838 if ((*iter)->getType()-> Z!= 1) // skip hydrogen838 if ((*iter)->getType()->getAtomicNumber() != 1) // skip hydrogen 839 839 #endif 840 840 RootStack[FragmentCounter].push_front((*iter)->nr); -
src/periodentafel.cpp
r1ee380f r83f176 310 310 while (!input.eof()) { 311 311 element *neues = new element; 312 input >> neues-> getName();;313 //(*input) >> ws; 314 input >> neues-> getSymbol();312 input >> neues->name; 313 //(*input) >> ws; 314 input >> neues->symbol; 315 315 //(*input) >> ws; 316 316 input >> neues->period;
Note:
See TracChangeset
for help on using the changeset viewer.