Particles per unit proton energy in particles per GeV
500190
def _J(self):
        
        pd = self.particle_distribution(self._Ep * u.GeV)
        return pd.to("1/GeV").value
138519
def energy(self):
        """"""
        result = 0.0
        for index1 in range(self.numc):
            for index2 in range(index1):
                if self.scaling[index1, index2] > 0:
                    for se, ve in self.yield_pair_energies(index1, index2):
                        result += se*ve*self.scaling[index1, index2]
        return result
924819
def particles_ascii(self, prec=8):
        
        s = ""
        for p in self.particles:
            s += (("%%.%de "%prec) * 8)%(p.m, p.r, p.x, p.y, p.z, p.vx, p.vy, p.vz) + "\n"
        if len(s):
            s = s[:-1]
        return s
337
def _diffsigma(self, Ep, Egamma):
        
        Tp = Ep - self._m_p

        diffsigma = self._Amax(Tp) * self._F(Tp, Egamma)

        if self.nuclear_enhancement:
            diffsigma *= self._nuclear_factor(Tp)

        return diffsigma
580025
private int getHydrogenCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int hcounter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("H")) {
                hcounter += 1;
            }
        }
        return hcounter;
    }
796865
def _planck(self, lam, Teff):
        

        return 2*self.h*self.c*self.c/lam**5 * 1./(np.exp(self.h*self.c/lam/self.k/Teff)-1)
432250
public void calcScores(Atom[] ca1, Atom[] ca2){
		eqr0 = idx1.length;
		gaps0 = count_gaps(idx1,idx2);

		percId = 0;
		// calc the % id
		for (int i=0 ; i< idx1.length; i++){
			Atom a1 = ca1[idx1[i]];
			Atom a2 = ca2[idx2[i]];

			Group g1 = a1.getGroup();
			Group g2 = a2.getGroup();
			if ( g1.getPDBName().equals(g2.getPDBName())){
				percId++;
			}

		}
	}
624073
public static void ge_p2_0(ge_p2 h) {
        fe_0.fe_0(h.X);
        fe_1.fe_1(h.Y);
        fe_1.fe_1(h.Z);
    }
504855
def nuclear_attraction(alpha1,lmn1,A,alpha2,lmn2,B,C):
    
    l1,m1,n1 = lmn1
    l2,m2,n2 = lmn2
    gamma = alpha1+alpha2

    P = gaussian_product_center(alpha1,A,alpha2,B)
    rab2 = norm2(A-B)
    rcp2 = norm2(C-P)

    dPA = P-A
    dPB = P-B
    dPC = P-C

    Ax = A_array(l1,l2,dPA[0],dPB[0],dPC[0],gamma)
    Ay = A_array(m1,m2,dPA[1],dPB[1],dPC[1],gamma)
    Az = A_array(n1,n2,dPA[2],dPB[2],dPC[2],gamma)

    total = 0.
    for I in range(l1+l2+1):
        for J in range(m1+m2+1):
            for K in range(n1+n2+1):
                total += Ax[I]*Ay[J]*Az[K]*Fgamma(I+J+K,rcp2*gamma)
                
    val= -2*pi/gamma*exp(-alpha1*alpha2*rab2/gamma)*total
    return val
1200163
def _energy_uniform_per_node(X, cells):
    
    dim = 2
    mesh = MeshTri(X, cells)

    star_integrals = numpy.zeros(mesh.node_coords.shape[0])
    # Python loop over the cells... slow!
    for cell, cell_volume in zip(mesh.cells["nodes"], mesh.cell_volumes):
        for idx in cell:
            xi = mesh.node_coords[idx]
            tri = mesh.node_coords[cell]
            val = quadpy.triangle.integrate(
                lambda x: numpy.einsum("ij,ij->i", x.T - xi, x.T - xi),
                tri,
                # Take any scheme with order 2
                quadpy.triangle.Dunavant(2),
            )
            star_integrals[idx] += val

    return star_integrals / (dim + 1)
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
1357977
def _calc_specpp_loE(self, Egamma):
        
        from scipy.integrate import quad

        Egamma = Egamma.to("TeV").value
        Epimin = Egamma + self._m_pi ** 2 / (4 * Egamma)

        result = (
            2
            * quad(
                self._delta_integrand, Epimin, np.inf, epsrel=1e-3, epsabs=0
            )[0]
        )

        return result * u.Unit("1/(s TeV)")
860739
def peak_energy(self):
        

        # Eq. 6 in Massaro et al. 2004
        # (http://adsabs.harvard.edu/abs/2004A%26A...413..489M)

        return self.piv.value * pow(10, ((2 + self.alpha.value) * np.log(10)) / (2 * self.beta.value))
882588
def total_energy(self):
        
        return sum(sum(self._recip)) + sum(sum(self._real)) + sum(self._point) + self._charged_cell_energy
108140
def calc_mass(nu_max, delta_nu, teff):
    
    NU_MAX = 3140.0 # microHz
    DELTA_NU = 135.03 # microHz
    TEFF = 5777.0
    return (nu_max/NU_MAX)**3 * (delta_nu/DELTA_NU)**(-4) * (teff/TEFF)**1.5
1231179
def _energy_evaluation(self, operator):
        
        if self._quantum_state is not None:
            input_circuit = self._quantum_state
        else:
            input_circuit = [self.opt_circuit]
        if operator._paulis:
            mean_energy, std_energy = operator.evaluate_with_result(self._operator_mode, input_circuit,
                                                                    self._quantum_instance.backend, self.ret)
        else:
            mean_energy = 0.0
            std_energy = 0.0
        operator.disable_summarize_circuits()
        logger.debug('Energy evaluation {} returned {}'.format(self._eval_count, np.real(mean_energy)))
        return np.real(mean_energy), np.real(std_energy)
274456
def gp_sims(version):
  
  inDir, outDir = getWorkDirs()
  inDir = os.path.join(inDir, version, 'cocktail_contribs')
  xmax = {
      'pion': 0.125, 'eta': 0.52, 'etap': 0.92, 'omega': 1.22,
      'phi': 1.22, 'jpsi': 3.52
  }
  for particles in [
      'pion', 'eta', 'etap', ['omega', 'rho'], 'phi', 'jpsi'
  ]:
      if isinstance(particles, str):
          particles = [particles]
      contribs = OrderedDict()
      for particle in particles:
          for energy in energies:
              fstem = particle+str(energy)
              fname = os.path.join(inDir, fstem+'.dat')
              contribs[fstem] = np.loadtxt(open(fname, 'rb'))
              contribs[fstem][:,2:] = 0
      print contribs.keys()
      titles = [
          ' '.join([getEnergy4Key(str(energy)), 'GeV'])
          for energy in energies
      ] + [ '' for k in range(len(contribs)-len(energies)) ]
      make_plot(
          data = contribs.values(),
          properties = [
              'with lines lc %s lw 4 lt %d' % (
                  default_colors[i%len(energies)], i/len(energies)+1
              ) for i in xrange(len(contribs))
          ],
          titles = titles,
          xlabel = xlabel, # if particles[0] == 'phi' else '',
          ylabel = ylabel, # if particles[0] == 'pion' or particles[0] == 'omega' else '',
          name = os.path.join(outDir, '_'.join(['sims']+particles)),
          ylog = True, lmargin = 0.15, bmargin = 0.17, tmargin = 0.96, rmargin = 0.98,
          gpcalls = [ 'nokey' ] if particles[0] != 'pion' else [],
          xr = [1. if particles[0] == 'jpsi' else 0,xmax[particles[0]]],
          size = '10in,6.5in',
          labels = {
              particleLabel4Key(particles[0]): [0.15,0.9,False],
              particleLabel4Key(particles[1]) if len(particles) > 1 else '': [0.15,0.1,False],
          }
      )