Rev 6872 | Rev 12963 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6872 | Rev 7222 | ||
---|---|---|---|
Line 228... | Line 228... | ||
228 | std::ostream & operator << (std::ostream & o, const AtomeListe & l){ |
228 | std::ostream & operator << (std::ostream & o, const AtomeListe & l){ |
229 | int n; |
229 | int n; |
230 | const AtomeListe * al; |
230 | const AtomeListe * al; |
231 | if (l.sq()) o << "["; |
231 | if (l.sq()) o << "["; |
232 | if(l.Z()>0 || l.Z()<-1){ |
232 | if(l.Z()>0 || l.Z()<-1){ |
233 | o << l.symbole |
233 | o << "\\mathrm{" << l.symbole() << "}"; |
234 | } |
234 | } |
235 | else if (l.Z()==-1){ // cas de l'électron |
235 | else if (l.Z()==-1){ // cas de l'électron |
236 | o << "e"; |
236 | o << "\\mathrm{e}"; |
237 | } |
237 | } |
238 | else{ // cas des groupes parenthésés |
238 | else{ // cas des groupes parenthésés |
239 | o << "("; |
239 | o << "("; |
240 | if((al=l.groupe())) o << *al; |
240 | if((al=l.groupe())) o << *al; |
241 | o << ")"; |
241 | o << ")"; |
Line 291... | Line 291... | ||
291 | if (ch) { |
291 | if (ch) { |
292 | o << "^"; |
292 | o << "^"; |
293 | if(fabs(1.0*ch)!=1) o << fabs(1.0*ch); |
293 | if(fabs(1.0*ch)!=1) o << fabs(1.0*ch); |
294 | if(ch>0) o << "+"; else o << "-"; |
294 | if(ch>0) o << "+"; else o << "-"; |
295 | } |
295 | } |
296 | if (!iswater() |
296 | if (!iswater() && !iselectron()) o << "_" << moltypeStr[t]; |
297 | } |
297 | } |
298 | 298 | ||
299 | void Molec::coeff( fraction f){ |
299 | void Molec::coeff( fraction f){ |
300 | nb.i *= f.i; |
300 | nb.i *= f.i; |
301 | nb.d *= f.d; |
301 | nb.d *= f.d; |
Line 400... | Line 400... | ||
400 | return false; |
400 | return false; |
401 | } |
401 | } |
402 | 402 | ||
403 | bool Molec::iswater()const{ |
403 | bool Molec::iswater()const{ |
404 | if (t != aqueous) return 0; |
404 | if (t != aqueous) return 0; |
405 | if (signature()==std::string(" |
405 | if (signature()==std::string("\\mathrm{H}_{2}\\mathrm{O}") || |
406 | signature()==std::string(" |
406 | signature()==std::string("\\mathrm{O}\\mathrm{H}_{2}")) return 1; |
407 | else return 0; |
407 | else return 0; |
408 | } |
408 | } |
409 | 409 | ||
410 | bool Molec::iselectron()const{ |
410 | bool Molec::iselectron()const{ |
411 | return (signature()==std::string(" |
411 | return (signature()==std::string("\\mathrm{e}^{-}")); |
412 | } |
412 | } |
413 | 413 | ||
414 | fraction Molec::nbelectron()const{ |
414 | fraction Molec::nbelectron()const{ |
415 | if (iselectron()) return nb; |
415 | if (iselectron()) return nb; |
416 | else return fraction(0); |
416 | else return fraction(0); |
Line 439... | Line 439... | ||
439 | if (m.charge()){ |
439 | if (m.charge()){ |
440 | o << "^{"; |
440 | o << "^{"; |
441 | if(fabs(1.0*m.charge())!=1) o << fabs(1.0*m.charge()); |
441 | if(fabs(1.0*m.charge())!=1) o << fabs(1.0*m.charge()); |
442 | if(m.charge()>0) o << "+}"; else o << "-}"; |
442 | if(m.charge()>0) o << "+}"; else o << "-}"; |
443 | } |
443 | } |
444 | if (m.typage() != aqueous) o << "_{" << moltypeStr[m.typage()] << "}"; |
444 | if (m.typage() != aqueous && ! m.iselectron()) o << "_{" << moltypeStr[m.typage()] << "}"; |
445 | return o; |
445 | return o; |
446 | } |
446 | } |
447 | 447 | ||
448 | int Membre::findMol(const Molec * m){ |
448 | int Membre::findMol(const Molec * m){ |
449 | // returns the index of a molecule with the same atomlist if any |
449 | // returns the index of a molecule with the same atomlist if any |