calculate static pressure at 300 K.

        :param v: unit-cell volume in A^3
        :return: static pressure at t_ref (=300 K) in GPa
763259
def cal_pst(self, v):
        
        p_h = self._hugoniot_p(v)
        p_th_h = self._hugoniot_pth(v)
        p_st = p_h - p_th_h
        return p_st
687642
def _compute_non_linear_slope(self, vs30, C):
        
        V1 = 180.0
        V2 = 300.0
        Vref = 760.0

        # equation (13d), values are zero for vs30 >= Vref = 760.0
        bnl = np.zeros(vs30.shape)

        # equation (13a)
        idx = vs30 <= V1
        bnl[idx] = C['b1']

        # equation (13b)
        idx = np.where((vs30 > V1) & (vs30 <= V2))
        bnl[idx] = (C['b1'] - C['b2']) * \
                   np.log(vs30[idx] / V2) / np.log(V1 / V2) + C['b2']

        # equation (13c)
        idx = np.where((vs30 > V2) & (vs30 < Vref))
        bnl[idx] = C['b2'] * np.log(vs30[idx] / Vref) / np.log(V2 / Vref)
        return bnl
1062243
def cal_pel(self, v, temp):
        
        if (self.eqn_el is None) or (self.params_el is None):
            return np.zeros_like(v)
        params = self._set_params(self.params_el)
        return func_el[self.eqn_el](v, temp, *params,
                                    self.n, self.z, t_ref=self.t_ref,
                                    three_r=self.three_r)
790892
def rel_humid_from_db_hr(db_temp, humid_ratio, b_press=101325):
    
    pw = (humid_ratio * 1000 * b_press) / (621.9907 + (humid_ratio * 1000))
    pws = saturated_vapor_pressure(db_temp + 273.15)
    rel_humid = (pw / pws) * 100
    return rel_humid
381010
def thermal_conductivity(self, temperature, volume):
        
        gamma = self.gruneisen_parameter(temperature, volume)
        theta_d = self.debye_temperature(volume)  # K
        theta_a = theta_d * self.natoms**(-1./3.)  # K
        prefactor = (0.849 * 3 * 4**(1./3.)) / (20. * np.pi**3)
        # kg/K^3/s^3
        prefactor = prefactor * (self.kb/self.hbar)**3 * self.avg_mass
        kappa = prefactor / (gamma**2 - 0.514 * gamma + 0.228)
        # kg/K/s^3 * Ang = (kg m/s^2)/(Ks)*1e-10
        # = N/(Ks)*1e-10 = Nm/(Kms)*1e-10 = W/K/m*1e-10
        kappa = kappa * theta_a**2 * volume**(1./3.) * 1e-10
        return kappa
449927
def rel_humid_from_db_dpt(db_temp, dew_pt):
    
    pws_ta = saturated_vapor_pressure(db_temp + 273.15)
    pws_td = saturated_vapor_pressure(dew_pt + 273.15)
    rh = 100 * (pws_td / pws_ta)
    return rh
951229
def _get_sa_at_1180(self, C, imt, sites, rup, dists):
        
        # reference vs30 = 1180 m/s
        vs30_1180 = np.ones_like(sites.vs30) * 1180.
        # reference shaking intensity = 0
        ref_iml = np.zeros_like(sites.vs30)
        # fake Z1.0 - Since negative it will be replaced by the default Z1.0
        # for the corresponding region
        fake_z1pt0 = np.ones_like(sites.vs30) * -1
        return (self._get_basic_term(C, rup, dists) +
                self._get_faulting_style_term(C, rup) +
                self._get_site_response_term(C, imt, vs30_1180, ref_iml) +
                self._get_hanging_wall_term(C, dists, rup) +
                self._get_top_of_rupture_depth_term(C, imt, rup) +
                self._get_soil_depth_term(C, fake_z1pt0, vs30_1180) +
                self._get_regional_term(C, imt, vs30_1180, dists.rrup)
                )
503816
def japan_basin_model(vs30):
    
    coeff = 412.39 ** 2.0
    model = (-5.23 / 2.0) * np.log(
        ((vs30 ** 2.0) + coeff) / ((1360.0 ** 2.0) + coeff)
        ) - np.log(1000.)
    return np.exp(model)
970167
def cadhumidex(temp, humidity):
    ""
    if temp is None or humidity is None:
        return None
    # Formulas are adapted to not use e^(...) with no appreciable
    # change in accuracy (0.0227%)
    saturation_pressure = (6.112 * (10.0**(7.5 * temp / (237.7 + temp))) *
                           float(humidity) / 100.0)
    return temp + (0.555 * (saturation_pressure - 10.0))
1167736
def calcEL(self,**kwargs):
                                   
        E,L= calcELAxi(self._R,self._vR,self._vT,self._pot)
        if self._gamma != 0.:
            #Adjust E
            E-= self._vT**2./2.
            L= m.fabs(L)+self._gamma*self.Jz(**kwargs)
            E+= L**2./2./self._R**2.
        return (E,L)
267369
def cal_g_bm3(p, g, k):
    
    v = cal_v_bm3(p, k)
    v0 = k[0]
    k0 = k[1]
    kp = k[2]
    g0 = g[0]
    gp = g[1]
    f = 0.5 * ((v / v0)**(-2. / 3.) - 1.)
    return (1. + 2. * f)**(5. / 2.) * (g0 + (3. * k0 * gp - 5. * g0) * f +
                                       (6. * k0 * gp - 24. * k0 - 14. * g0 +
                                        9. / 2. * k0 * kp) * f**2.)
979638
def pressure(self):
        
        ut = self.get_raw_temp()
        up = self.get_raw_pressure()
        x1 = ((ut - self.cal['AC6']) * self.cal['AC5']) >> 15
        x2 = (self.cal['MC'] << 11) // (x1 + self.cal['MD'])
        b5 = x1 + x2
        b6 = b5 - 4000
        x1 = (self.cal['B2'] * (b6 * b6) >> 12) >> 11
        x2 = (self.cal['AC2'] * b6) >> 11
        x3 = x1 + x2
        b3 = (((self.cal['AC1'] * 4 + x3) << self.mode) + 2) // 4
        x1 = (self.cal['AC3'] * b6) >> 13
        x2 = (self.cal['B1'] * ((b6 * b6) >> 12)) >> 16
        x3 = ((x1 + x2) + 2) >> 2
        b4 = (self.cal['AC4'] * (x3 + 32768)) >> 15
        b7 = (up - b3) * (50000 >> self.mode)
        if b7 < 0x80000000:
            p = (b7 * 2) // b4
        else:
            p = (b7 // b4) * 2
        x1 = (p >> 8) * (p >> 8)
        x1 = (x1 * 3038) >> 16
        x2 = (-7357 * p) >> 16
        p += (x1 + x2 + 3791) >> 4
        return p
49575
def volume(self) -> float:
        
        m = self._matrix
        return float(abs(dot(np.cross(m[0], m[1]), m[2])))
119386
def vol_prefactor(n, p=2.):
    

    p *= 1.  # convert to float in case user inputs an integer
    f = (2 * special.gamma(1./p + 1.))**n / special.gamma(n/p + 1)

    return f
308254
def volume_adjusted_moving_average(close_data, volume, period):
    
    catch_errors.check_for_input_len_diff(close_data, volume)
    catch_errors.check_for_period_error(close_data, period)

    avg_vol = np.mean(volume)
    vol_incr = avg_vol * 0.67
    vol_ratio = [val / vol_incr for val in volume]
    close_vol = np.array(close_data) * vol_ratio
    vama = [sum(close_vol[idx+1-period:idx+1]) / period for idx in range(period-1, len(close_data))]
    vama = fill_for_noncomputable_vals(close_data, vama)
    return vama
462212
def cal_pth(self, v, temp):
        
        params_t = self._set_params(self.params_therm)
        return constq_pth(v, temp, *params_t, self.n, self.z,
                          t_ref=self.t_ref, three_r=self.three_r)
393075
def __getBarFC(pressure):
    """"""
    if pressure is None:
        return 0
    press = __to_float1(pressure)
    if press < 974:
        return 1
    if press < 990:
        return 2
    if press < 1002:
        return 3
    if press < 1010:
        return 4
    if press < 1022:
        return 5
    if press < 1035:
        return 6
    return 7