Jesse_V

FAHViewer averageBondLength

Sep 8th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. double Atom::averageBondLength(const Atom &atom) const {
  2. // See: http://www.wiredchemist.com/chemistry/data/bond_energies_lengths.html
  3. const double table[][5] = {
  4. // H C N O S
  5. {0.74, 1.09, 1.01, 0.96, 1.34}, // H
  6. {1.09, 1.54, 1.47, 1.43, 1.82}, // C
  7. {1.01, 1.47, 1.45, 1.40, 1.43}, // N
  8. {0.96, 1.43, 1.40, 1.48, 1.43}, // O
  9. {1.34, 1.82, 1.43, 1.43, 1.49}, // S
  10. };
  11.  
  12. int i = numberToIndex(number);
  13. int j = numberToIndex(atom.number);
  14.  
  15. if (i == -1 || j == -1) return 2; // a wild guess
  16.  
  17. return table[i][j];
  18. }
Advertisement
Add Comment
Please, Sign In to add comment