test_conversion.py 883 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #! /usr/bin/env python
  2. import subprocess, re, os, time, random
  3. import math
  4. import numpy as np
  5. def convert_k_to_cminv(k):
  6. """
  7. Import force constant in Hartree/Ang^2
  8. convert it to cm-1
  9. """
  10. mu = 918.553523379183232925595706294
  11. #ang_to_bohr = 1/(0.529)
  12. nu = 1/(2*np.pi)*math.sqrt(k/mu)*(1/(137*10**-8))
  13. return (nu)
  14. k_list = [0.018960310761731762, 0.018634725, 0.009231205575136386, 0.007623297, 0.013665928861826174, 0.019693516]
  15. for k in k_list:
  16. nu = convert_k_to_cminv(k)
  17. print (nu)
  18. def convert_k_to_cminv_rotor(k):
  19. """
  20. Convert force constant in Hartree/Radian^2 to cm-1
  21. this is for h2
  22. """
  23. I = 1948.37443393238771437461228584
  24. nu = 1/(2*np.pi)*math.sqrt(k/I)*(1/(137*5.29*10**-9))
  25. return nu
  26. k_rotor_list = [0.032352748, 0.007038849]
  27. for k in k_rotor_list:
  28. nu = convert_k_to_cminv_rotor(k)
  29. print (nu)