Logo Search packages:      
Sourcecode: cclib version File versions  Download package

def cclib::parser::utils::convertor (   value,
  fromunits,
  tounits 
)
Convert from one set of units to another.

>>> print "%.1f" % convertor(8, "eV", "cm-1")
64524.8

Definition at line 9 of file utils.py.

                                        :
    """Convert from one set of units to another.

    >>> print "%.1f" % convertor(8, "eV", "cm-1")
    64524.8
    """
    
    _convertor = {"eV_to_cm-1": lambda x: x*8065.6,
                  "hartree_to_eV": lambda x: x*27.2113845,
                  "bohr_to_Angstrom": lambda x: x*0.529177,
                  "Angstrom_to_bohr": lambda x: x*1.889716,
                  "nm_to_cm-1": lambda x: 1e7/x,
                  "cm-1_to_nm": lambda x: 1e7/x,
                  "hartree_to_cm-1": lambda x: x*219474.6,
                  # Taken from GAMESS docs, "Further information",
                  # "Molecular Properties and Conversion Factors"
                  "Debye^2/amu-Angstrom^2_to_km/mol": lambda x: x*42.255}

    return _convertor["%s_to_%s" % (fromunits, tounits)] (value)



Generated by  Doxygen 1.6.0   Back to index