Changes in src/molecule.cpp [e4afb4:76ff55]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
re4afb4 r76ff55 640 640 * \return copy of molecule 641 641 */ 642 molecule *molecule::CopyMolecule() const642 molecule *molecule::CopyMolecule() 643 643 { 644 644 molecule *copy = World::getInstance().createMolecule(); … … 648 648 649 649 // copy all bonds 650 for(molecule:: const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)651 for(BondList:: const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)650 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 651 for(BondList::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) const876 bool molecule::Output(ostream * const output) 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 } 884 888 *output << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 885 889 for_each(atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0)); … … 891 895 * \param *out output stream 892 896 */ 893 bool molecule::OutputTrajectories(ofstream * const output) const 894 { 897 bool molecule::OutputTrajectories(ofstream * const output) 898 { 899 int ElementNo[MAX_ELEMENTS], AtomNo[MAX_ELEMENTS]; 900 895 901 if (output == NULL) { 896 902 return false; … … 902 908 *output << "# ====== MD step " << step << " =========" << endl; 903 909 } 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)); 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 ); 908 923 } 909 924 return true; … … 1040 1055 *output << "# Step Temperature [K] Temperature [a.u.]" << endl; 1041 1056 for (int step=startstep;step < endstep; step++) { // loop over all time steps 1042 temperature = atoms.totalTemperatureAtStep(step); 1057 temperature = 0.; 1058 ActOnAllAtoms( &TrajectoryParticle::AddKineticToTemperature, &temperature, step); 1043 1059 *output << step << "\t" << temperature*AtomicEnergyToKelvin << "\t" << temperature << endl; 1044 1060 } 1045 1061 return true; 1062 }; 1063 1064 void molecule::SetIndexedArrayForEachAtomTo ( atom **array, int ParticleInfo::*index) const 1065 { 1066 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 1067 array[((*iter)->*index)] = (*iter); 1068 } 1046 1069 }; 1047 1070
Note:
See TracChangeset
for help on using the changeset viewer.