Reciprocal space model charge value
        for input squared reciprocal vector.
        Args:
            g2: Square of reciprocal vector

        Returns:
            Charge density at the reciprocal vector magnitude
358017
def rho_rec(self, g2):
        
        return (self.expnorm / np.sqrt(1 + self.gamma2 * g2) + (
            1 - self.expnorm) * np.exp(-0.25 * self.beta2 * g2))
928336
def scale_v2(vec, amount):
    """"""

    return Vec2(vec.x * amount, vec.y * amount)
385518
def _compute_term2(self, C, mag, rjb):
        
        RM = np.sqrt(rjb ** 2 + (C['c7'] ** 2) *
                     np.exp(-1.25 + 0.227 * mag) ** 2)

        return (-C['c4'] * np.log(RM) -
                (C['c5'] - C['c4']) *
                np.maximum(np.log(RM / 100), 0) - C['c6'] * RM)
950774
def get_scaled_v2(self, amount):
        """"""

        return Vec2(self.x * amount, self.y * amount)
947326
def _G(self, x, p):
        

        prefactor = (p + p ** 3) ** -1 * p

        if isinstance(x, np.ndarray):

            inds0 = np.where(x * p == 1)
            inds1 = np.where(x * p < 1)
            inds2 = np.where(x * p > 1)

            func = np.ones_like(x)

            func[inds0] = np.log(0.25 * x[inds0] ** 2 * p ** 2) + np.pi * p * (self._u(x[inds0]) - 1) + \
                          2 * p ** 2 * (self._u(x[inds0]) * np.arctanh(self._u(x[inds0]) ** -1) +
                                        np.log(0.5 * x[inds0]))

            func[inds1] = np.log(0.25 * x[inds1] ** 2 * p ** 2) + np.pi * p * (self._u(x[inds1]) - 1) + \
                          2 * p ** 2 * (self._u(x[inds1]) * np.arctanh(self._u(x[inds1]) ** -1) +
                                        np.log(0.5 * x[inds1])) + 2 * self._g(x[inds1], p) * np.arctanh(
                self._g(x[inds1], p))

            func[inds2] = np.log(0.25 * x[inds2] ** 2 * p ** 2) + np.pi * p * (self._u(x[inds2]) - 1) + \
                          2 * p ** 2 * (self._u(x[inds2]) * np.arctanh(self._u(x[inds2]) ** -1) +
                                        np.log(0.5 * x[inds2])) - 2 * self._f(x[inds2], p) * np.arctan(
                self._f(x[inds2], p))


        else:

            if x * p == 1:

                func = np.log(0.25 * x ** 2 * p ** 2) + np.pi * p * (self._u(x) - 1) + \
                       2 * p ** 2 * (self._u(x) * np.arctanh(self._u(x) ** -1) +
                                     np.log(0.5 * x))

            elif x * p < 1:

                func = np.log(0.25 * x ** 2 * p ** 2) + np.pi * p * (self._u(x) - 1) + \
                       2 * p ** 2 * (self._u(x) * np.arctanh(self._u(x) ** -1) +
                                     np.log(0.5 * x)) + 2 * self._g(x, p) * np.arctanh(self._g(x, p))

            else:

                func = np.log(0.25 * x ** 2 * p ** 2) + np.pi * p * (self._u(x) - 1) + \
                       2 * p ** 2 * (self._u(x) * np.arctanh(self._u(x) ** -1) +
                                     np.log(0.5 * x)) - 2 * self._f(x, p) * np.arctan(self._f(x, p))

        return func * prefactor
1222606
def xyz2rgb(x__, y__, z__):
    
    x2_ = x__ / 100.0
    y2_ = y__ / 100.0
    z2_ = z__ / 100.0

    r__ = x2_ *  3.2406 + y2_ * -1.5372 + z2_ * -0.4986
    g__ = x2_ * -0.9689 + y2_ *  1.8758 + z2_ *  0.0415
    b__ = x2_ *  0.0557 + y2_ * -0.2040 + z2_ *  1.0570

    def finv(arr):
        """Inverse
        """
        return np.where(arr > 0.0031308,
                        1.055 * (arr ** (1.0 / 2.4)) - 0.055,
                        12.92 * arr)

    return finv(r__) * 255, finv(g__) * 255, finv(b__) * 255
1242371
def cvss_base_v2_value(cls, cvss_base_vector):
        
        if not cvss_base_vector:
            return None

        _av, _ac, _au, _c, _i, _a = cls._parse_cvss_base_vector(
            cvss_base_vector)

        _impact = 10.41 * (1 - (1 - cvss_v2_metrics['C'].get(_c)) *
                           (1 - cvss_v2_metrics['I'].get(_i)) *
                           (1 - cvss_v2_metrics['A'].get(_a)))

        _exploitability = (20 * cvss_v2_metrics['AV'].get(_av) *
                           cvss_v2_metrics['AC'].get(_ac) *
                           cvss_v2_metrics['Au'].get(_au))

        f_impact = 0 if _impact == 0 else 1.176

        cvss_base = ((0.6 * _impact) + (0.4 * _exploitability) - 1.5) * f_impact

        return round(cvss_base, 1)
166305
def chi_p(mass1, mass2, spin1x, spin1y, spin2x, spin2y):
    
    xi1 = secondary_xi(mass1, mass2, spin1x, spin1y, spin2x, spin2y)
    xi2 = primary_xi(mass1, mass2, spin1x, spin1y, spin2x, spin2y)
    return chi_p_from_xi1_xi2(xi1, xi2)
533865
def reaction_charge(reaction, compound_charge):
    

    charge_sum = 0.0
    for compound, value in reaction.compounds:
        charge = compound_charge.get(compound.name, float('nan'))
        charge_sum += charge * float(value)
    return charge_sum
1310427
def pgv(self, centimeters=False):
        """"""
        if self._pgv is None:
            # Compute transfer function -- only over non-zero frequencies
            mask = ~np.isclose(self.angular_freqs, 0)
            tf = np.zeros_like(mask, dtype=np.complex)
            tf[mask] = 1 / (self.angular_freqs[mask] * 1j)
            if centimeters:
                self._pgv = GRAVITY * 100 * self.calc_peak(tf)
            else:
                self._pgv = GRAVITY * self.calc_peak(tf)
        return self._pgv
1302442
def xi2_from_mass1_mass2_spin2x_spin2y(mass1, mass2, spin2x, spin2y):
    
    q = q_from_mass1_mass2(mass1, mass2)
    a1 = 2 + 3 * q / 2
    a2 = 2 + 3 / (2 * q)
    return a1 / (q**2 * a2) * chi_perp_from_spinx_spiny(spin2x, spin2y)
401020
def get_gammadot(F, mc, q, e):
    

    # chirp mass
    mc *= SOLAR2S

    #total mass
    m = (((1+q)**2)/q)**(3/5) * mc

    dgdt = 6*np.pi*F * (2*np.pi*F*m)**(2/3) / (1-e**2) * \
        (1 + 0.25*(2*np.pi*F*m)**(2/3)/(1-e**2)*(26-15*e**2))

    return dgdt
705686
def get_rmsd(self, mol1, mol2):
        
        label1, label2 = self._mapper.uniform_labels(mol1, mol2)
        if label1 is None or label2 is None:
            return float("Inf")
        return self._calc_rms(mol1, mol2, label1, label2)
117601
def mass_2d(self,R,Rs,rho0,r_trunc):

        

        x = R / Rs
        tau = r_trunc / Rs
        gx = self._g(x,tau)
        m_2d = 4 * rho0 * Rs * R ** 2 * gx / x ** 2 * np.pi
        return m_2d
1074036
def obfn_g0(self, Y0):
        
        """

        return np.sum(np.abs(self.W * self.obfn_g0var()))
588263
def density_2d(self, x, y, rho0, Rs, center_x=0, center_y=0):
        
        x_ = x - center_x
        y_ = y - center_y
        r = np.sqrt(x_**2 + y_**2)
        X = r/Rs
        sigma0 = self.rho2sigma(rho0, Rs)
        if isinstance(X, int) or isinstance(X, float):
            if X == 1:
                X = 1.000001
        else:
            X[X == 1] = 1.000001
        sigma = sigma0 / (X**2-1)**2 * (-3 + (2+X**2)*self._F(X))
        return sigma
611127
def sis_theta_E2sigma_v(self, theta_E):
        
        v_sigma_c2 = theta_E * const.arcsec / (4*np.pi) * self.D_s / self.D_ds
        return np.sqrt(v_sigma_c2)*const.c / 1000