Changes in src/molecule.cpp [76ff55:e4afb4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r76ff55 re4afb4 640 640 * \return copy of molecule 641 641 */ 642 molecule *molecule::CopyMolecule() 642 molecule *molecule::CopyMolecule() const 643 643 { 644 644 molecule *copy = World::getInstance().createMolecule(); … … 648 648 649 649 // copy all bonds 650 for(molecule:: iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)651 for(BondList:: iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)650 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 651 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 652 652 if ((*BondRunner)->leftatom == *AtomRunner) { 653 653 bond *Binder = (*BondRunner); … … 874 874 * \param *out output stream 875 875 */ 876 bool molecule::Output(ostream * const output) 876 bool molecule::Output(ostream * const output) const 877 877 { 878 878 if (output == NULL) { … … 882 882 memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo)); 883 883 enumeration<const element*> elementLookup = formula.enumerateElements(); 884 for(map<const element*,unsigned int>::iterator iter=elementLookup.there.begin();885 iter!=elementLookup.there.end();++iter){886 cout << "Enumerated element " << *iter->first << " with number " << iter->second << endl;887 }888 884 *output << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 889 885 for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0)); … … 895 891 * \param *out output stream 896 892 */ 897 bool molecule::OutputTrajectories(ofstream * const output) 898 { 899 int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS]; 900 893 bool molecule::OutputTrajectories(ofstream * const output) const 894 { 901 895 if (output == NULL) { 902 896 return false; … … 908 902 *output << "# ====== MD step " << step << " =========" << endl; 909 903 } 910 for (int i=0;i<MAX_ELEMENTS;++i) { 911 AtomNo[i] = 0; 912 ElementNo[i] = 0; 913 } 914 for(molecule::iterator iter = begin(); iter != end(); ++iter) { 915 ElementNo[(*iter)->getType()->getAtomicNumber()] = 1; 916 } 917 int current=1; 918 for (int i=0;i<MAX_ELEMENTS;++i) { 919 if (ElementNo[i] == 1) 920 ElementNo[i] = current++; 921 } 922 ActOnAllAtoms( &atom::OutputTrajectory, output, (const int *)ElementNo, AtomNo, (const int)step ); 904 int AtomNo[MAX_ELEMENTS]; 905 memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo)); 906 enumeration<const element*> elementLookup = formula.enumerateElements(); 907 for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectory,_1,output,elementLookup, AtomNo, (const int)step)); 923 908 } 924 909 return true; … … 1055 1040 *output << "# Step Temperature [K] Temperature [a.u.]" << endl; 1056 1041 for (int step=startstep;step < endstep; step++) { // loop over all time steps 1057 temperature = 0.; 1058 ActOnAllAtoms( &TrajectoryParticle::AddKineticToTemperature, &temperature, step); 1042 temperature = atoms.totalTemperatureAtStep(step); 1059 1043 *output << step << "\t" << temperature*AtomicEnergyToKelvin << "\t" << temperature << endl; 1060 1044 } 1061 1045 return true; 1062 };1063 1064 void molecule::SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::*index) const1065 {1066 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {1067 array[((*iter)->*index)] = (*iter);1068 }1069 1046 }; 1070 1047
Note:
See TracChangeset
for help on using the changeset viewer.