Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# constants.R

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
```float(x) -> floating point number

Convert a string or number to a floating point number, if possible.
```

```from .conversions import (pt_from_CT, pt_from_t, pt0_from_t, CT_from_t,
t_from_CT)
from .constants import Kelvin, db2Pascal, P0, SSO, cp0, R, sfac, M_S

```
```    """
SA = np.maximum(SA, 0)
k = M_S / R
part = k * (1000 - SA) / (Kelvin + t)
x2 = sfac * SA
```

```from .conversions import (pt_from_CT, pt_from_t, pt0_from_t, CT_from_t,
t_from_CT)
from .constants import Kelvin, db2Pascal, P0, SSO, cp0, R, sfac, M_S

```
```    """
SA = np.maximum(SA, 0)
k = M_S / R
part = k * (1000 - SA) / (Kelvin + t)
x2 = sfac * SA
```

```        where :math:`T` is temperature and :math:`R` is the gas law constant.
"""
return 1.5 * constants.R

def getEnthalpy(self, T):
```
```        where :math:`T` is temperature and :math:`R` is the gas law constant.
"""
return 1.5 * constants.R * T

def getEntropy(self, T):
```
```        partition function, and :math:`R` is the gas law constant.
"""
return (numpy.log(self.getPartitionFunction(T)) + 1.5 + 1.0) * constants.R

def getDensityOfStates(self, Elist):
```
```        """
if self.linear:
return constants.R
else:
return 1.5 * constants.R
```

```        # Use free energy of reaction to calculate Ka
dGrxn = self.getFreeEnergyOfReaction(T)
K = numpy.exp(-dGrxn / constants.R / T)
# Convert Ka to Kc or Kp if specified
P0 = 1e5
if type == 'Kc':
# Convert from Ka to Kc; C0 is the reference concentration
C0 = P0 / constants.R / T
```
```        # Determine TST rate constant at each temperature
Qreac = 1.0
for spec in self.reactants: Qreac *= spec.states.getPartitionFunction(T) / (constants.R * T / 1e5)
Qts = self.transitionState.states.getPartitionFunction(T) / (constants.R * T / 1e5)
k = self.transitionState.degeneracy * (constants.kB * T / constants.h * Qts / Qreac *	numpy.exp(-E0 / constants.R / T))
```

```
# Set the Cp(T) limits as T -> and T -> infinity
self.cp0 = 3.5 * constants.R if linear else 4.0 * constants.R
self.cpInf = self.cp0 + (nFreq + 0.5 * nRotors) * constants.R

```
```        """
# Cp/R = a1 + a2 T + a3 T^2 + a4 T^3 + a5 T^4
return (self.c0 + T*(self.c1 + T*(self.c2 + T*(self.c3 + self.c4*T)))) * constants.R

def getEnthalpy(self, T):
```
```        T4 = T2*T2
# H/RT = a1 + a2 T /2 + a3 T^2 /3 + a4 T^3 /4 + a5 T^4 /5 + a6/T
return (self.c0 + self.c1*T/2 + self.c2*T2/3 + self.c3*T2*T/4 + self.c4*T4/5 + self.c5/T) * constants.R * T

def getEntropy(self, T):
```

```        `T` in K.
"""
return self.A * (T / self.T0)** self.n * math.exp(-self.Ea / constants.R / T)

def changeT0(self, T0):
```
```        A[:,0] = numpy.ones_like(Tlist)
A[:,1] = numpy.log(Tlist / T0)
A[:,2] = -1.0 / constants.R / Tlist
b = numpy.log(klist)
x = numpy.linalg.lstsq(A,b)[0]
```
```        Ea = cython.declare(cython.double)
Ea = self.getActivationEnergy(dHrxn)
return self.A * (T ** self.n) * math.exp(-self.Ea / constants.R / T)

def toArrhenius(self, dHrxn):
```