Generates the opposite number of energy above grand potential
        convex hull for both reactants.

        Returns:
            [(reactant1, no_mixing_energy1),(reactant2,no_mixing_energy2)].
481188
def get_no_mixing_energy(self):
        
        assert self.grand == 1, \
            'Please provide grand potential phase diagram ' \
            'for computing no_mixing_energy!'

        energy1 = self.pd.get_hull_energy(self.comp1) - \
            self._get_grand_potential(self.c1)
        energy2 = self.pd.get_hull_energy(self.comp2) - \
            self._get_grand_potential(self.c2)
        unit = 'eV/f.u.'
        if self.norm:
            unit = 'eV/atom'
        return [(self.c1_original.reduced_formula +
                 ' ({0})'.format(unit), energy1),
                (self.c2_original.reduced_formula +
                 ' ({0})'.format(unit), energy2)]
184276
def probabilities(self, angles: List[float]) -> np.ndarray:
        
        if isinstance(angles, list):
            angles = np.array(angles)

        assert angles.shape[0] == 2 * self.steps, "angles must be 2 * steps"

        param_prog = self.get_parameterized_program()
        prog = param_prog(angles)
        wf = WavefunctionSimulator().wavefunction(prog)
        wf = wf.amplitudes.reshape((-1, 1))
        probs = np.zeros_like(wf)
        for xx in range(2 ** len(self.qubits)):
            probs[xx] = np.conj(wf[xx]) * wf[xx]
        return probs
1210662
def convex_hull(self):
        
        bnodes, nb, na, nt = _tripack.bnodes(self.lst, self.lptr, self.lend, self.npoints)
        return self._deshuffle_simplices(bnodes[:nb] - 1)
490009
def precompute_sharp_round(nxk, nyk, xc, yc):
    

    # Create arrays for the two- and four-fold symmetry computations:
    s4m = np.ones((nyk,nxk),dtype=np.int16)
    s4m[yc, xc] = 0

    s2m = np.ones((nyk,nxk),dtype=np.int16)
    s2m[yc, xc] = 0
    s2m[yc:nyk, 0:xc]     = -1;
    s2m[0:yc+1, xc+1:nxk] = -1;

    return s2m, s4m
966250
def nearest_neighbour_delta_E( self ):
        
        delta_nn = self.final_site.nn_occupation() - self.initial_site.nn_occupation() - 1 # -1 because the hopping ion is not counted in the final site occupation number
        return ( delta_nn * self.nearest_neighbour_energy )
1324465
def energy(self):
        """"""
        e = 0
        for i in range(len(self.state)):
            e += self.distance_matrix[self.state[i-1]][self.state[i]]
        return e
1365777
def energy(self, hamiltonian=None):
        
        """

        if self.hamiltonian is None and hamiltonian is None:
            raise ValueError("To compute the total energy, a hamiltonian"
                             " object must be provided!")

        from ..potential import PotentialBase
        if isinstance(hamiltonian, PotentialBase):
            from ..potential import Hamiltonian

            warnings.warn("This function now expects a `Hamiltonian` instance "
                          "instead of a `PotentialBase` subclass instance. If "
                          "you are using a static reference frame, you just "
                          "need to pass your potential object in to the "
                          "Hamiltonian constructor to use, e.g., Hamiltonian"
                          "(potential).", DeprecationWarning)

            hamiltonian = Hamiltonian(hamiltonian)

        if hamiltonian is None:
            hamiltonian = self.hamiltonian

        return hamiltonian(self)
861277
def symmetric_difference(self, other):
        
        return self.copy(super(NGram, self).symmetric_difference(other))
596626
public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) {
        // Make sure that we spend no time on empty nodes or self-interactions
        if (cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex))
            return;
        MemoryWorkspace workspace =
                workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace()
                        : Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(
                        workspaceConfigurationExternal,
                        workspaceExternal);
        try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {


            // Compute distance between point and center-of-mass
            buf.assign(data.slice(pointIndex)).subi(centerOfMass);

            double D = Nd4j.getBlasWrapper().dot(buf, buf);
            // Check whether we can use this node as a "summary"
            double maxWidth = boundary.width().max(Integer.MAX_VALUE).getDouble(0);
            // Check whether we can use this node as a "summary"
            if (isLeaf() || maxWidth / Math.sqrt(D) < theta) {

                // Compute and add t-SNE force between point and current node
                double Q = 1.0 / (1.0 + D);
                double mult = cumSize * Q;
                sumQ.addAndGet(mult);
                mult *= Q;
                negativeForce.addi(buf.muli(mult));

            } else {

                // Recursively apply Barnes-Hut to children
                for (int i = 0; i < numChildren; i++) {
                    children[i].computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ);
                }

            }
        }
    }
381956
def _reciprocal(coords1, charges1, coords2, charges2, kmax, kappa, box):
    
    n = coords1.shape[0]
    m = coords2.shape[0]
    result = np.zeros(n, dtype=np.float64)
    need_self = np.zeros(n, dtype=np.uint8)

    # Reciprocal unit vectors
    g1, g2, g3 = reciprocal_vectors(box)
    
    V = box_volume(box)
    
    prefac = 1.0 / (np.pi * V)
    for i in range(n):
        q_i = charges1[i]
        r_i = coords1[i]
        
        for j in range(m):
            q_j = charges2[j]
            r_j = coords2[j]
            
            r_ij = _dist(r_i, r_j)
            if r_ij < 1e-10:
                need_self[i] = 1
        
            for k_i in range(-kmax, kmax + 1):
                for k_j in range(-kmax, kmax + 1):
                    for k_k in range(-kmax, kmax + 1):
                        if k_i == 0 and k_j == 0 and k_k == 0:
                            continue
                        # Reciprocal vector
                        k = k_i * g1 + k_j * g2 + k_k * g3
                        
                        k_sq = sqsum(k)
                        
                        result[i] += (prefac * q_i * q_j *
                                      4.0 * np.pi ** 2 / k_sq *
                                      math.exp(-k_sq / (4.0 * kappa ** 2)) *
                                      math.cos(np.dot(k, r_i - r_j)))
        
    # Self-energy correction
    # I had to do some FUCKED UP stuff because NUMBA SUCKS BALLS and 
    # breaks compatibility with simple expressions such as that one
    # apparently doing result -= something is too hard in numba
    self_energy = 2 * (need_self * kappa * charges1 ** 2) / (np.pi**0.5)
    return result - self_energy
786172
def hessian(self):
        """"""
        result = np.zeros((self.numc, 3, self.numc, 3), float)
        for index1 in range(self.numc):
            for index2 in range(self.numc):
                result[index1, :, index2, :] = self.hessian_component(index1, index2)
        return result
531681
def symmetric_difference_update(self, other):
        # type: (Iterable[Any]) -> _BaseSet
        
        intersect = self.intersection(other)
        self.remove(*intersect)
        for elem in set(other).difference(intersect):
            self.add(elem)
        return self
708774
def compare_ecp_pots(potential1, potential2, compare_meta=False, rel_tol=0.0):
    '''
     
    '''

    if potential1['angular_momentum'] != potential2['angular_momentum']:
        return False

    rexponents1 = potential1['r_exponents']
    rexponents2 = potential2['r_exponents']
    gexponents1 = potential1['gaussian_exponents']
    gexponents2 = potential2['gaussian_exponents']
    coefficients1 = potential1['coefficients']
    coefficients2 = potential2['coefficients']

    # integer comparison
    if rexponents1 != rexponents2:
        return False
    if not _compare_vector(gexponents1, gexponents2, rel_tol):
        return False
    if not _compare_matrix(coefficients1, coefficients2, rel_tol):
        return False
    if compare_meta:
        if potential1['ecp_type'] != potential2['ecp_type']:
            return False
        return True
    else:
        return True
867246
def get_hessian(self):
        """"""
        force_const = self.fields.get("Cartesian Force Constants")
        if force_const is None:
            return None
        N = len(self.molecule.numbers)
        result = np.zeros((3*N, 3*N), float)
        counter = 0
        for row in range(3*N):
            result[row, :row+1] = force_const[counter:counter+row+1]
            result[:row+1, row] = force_const[counter:counter+row+1]
            counter += row + 1
        return result
1269135
def anisotropy(self):
        
        square_diff_energy = 0
        weighted_energy = self.weighted_surface_energy
        area_frac_dict = self.area_fraction_dict
        miller_energy_dict = self.miller_energy_dict

        for hkl in miller_energy_dict.keys():
            square_diff_energy += (miller_energy_dict[hkl] - weighted_energy)\
                                  ** 2 * area_frac_dict[hkl]
        return np.sqrt(square_diff_energy) / weighted_energy
179950
def hessfunc(self, p):
        
        self._set_stochastics(p)
        for i in xrange(self.len):

            di = self.diff(i)
            self.hess[i, i] = self.diff(i, 2)

            if i < self.len - 1:

                for j in xrange(i + 1, self.len):
                    dij = self.diff2(i, j)

                    self.hess[i, j] = dij
                    self.hess[j, i] = dij

        return -1. * self.hess
1149702
def get_flux(self, energies):

        """"""

        results = [component.shape(energies) for component in self.components.values()]

        return numpy.sum(results, 0)