def c_qv_python(T,omega):
"""
This function calculates the mode contribution to the heat capacity at a given T
and omega. A similar (faster) function should be available as C extension.
"""
#print ("Python c_qv")
if (T<1E-9 or omega<1E-9):
return 0.0
x = omega * KB1 / T
expx = math.exp(-x) # exponential term
x2 = math.pow(x,2)
if expx>1E-3: # compute normally
return x2*K_BOLTZMANN_RY*expx/math.pow(expx-1.0,2)
else: # Taylor series
return K_BOLTZMANN_RY*expx* (x/math.pow(x-0.5*math.pow(x,2)+
0.16666666666666667*math.pow(x,3)+0.04166666666666666667*math.pow(x,4),2))
################################################################################
#
# If available use a c version of the function c_qv, else use the (slower)
# Python version
#
评论列表
文章目录