Return an Atom whose coordinates are the center of the unit-cell.
161026
def center(visible_only = true)
      if atoms.empty?
        return Atom.new(0,0,0)
      else
        bounds = bounding_box(visible_only)
        x = (bounds[0].x + bounds[1].x)/2.0
        y = (bounds[0].y + bounds[1].y)/2.0
        z = (bounds[0].z + bounds[1].z)/2.0
        return Atom.new(x,y,z)
      end
    end
1361570
def center(self):
        

        if np.all(np.isfinite(self.xyz)):
            return np.mean(self.xyz, axis=0)
1168681
def centre(self):
        """"""
        return self.p2s(self.canvasx(self.width / 2.0)), self.p2s(self.canvasy(self.height / 2.0))
896299
def atoms(self):
        """"""
        return sorted(self._atoms.values(), key=lambda x: x.aid)
610011
def getCenter(self):
        
        return Location(self.x+(self.w/2), self.y+(self.h/2))
899164
def to_unit_cell(self, in_place=False):
        
        frac_coords = np.mod(self.frac_coords, 1)
        if in_place:
            self.frac_coords = frac_coords
        else:
            return PeriodicSite(self.species, frac_coords, self.lattice,
                                properties=self.properties)
34430
def unit_cell_to_lattice_array(cryst):
    """"""
    a_, b_, c_, alpha, beta, gamma = cryst
    # Convert angles from degrees to radians.
    r_alpha = np.deg2rad(alpha)
    r_beta = np.deg2rad(beta)
    r_gamma = np.deg2rad(gamma)
    # Calculate unit cell volume that is neccessary.
    volume = a_ * b_ * c_ * (
        1 - np.cos(r_alpha)**2 - np.cos(r_beta)**2 - np.cos(r_gamma)**2 + 2 *
        np.cos(r_alpha) * np.cos(r_beta) * np.cos(r_gamma))**0.5
    # Create the orthogonalisation Matrix (M^-1) - lattice matrix
    a_x = a_
    a_y = b_ * np.cos(r_gamma)
    a_z = c_ * np.cos(r_beta)
    b_x = 0
    b_y = b_ * np.sin(r_gamma)
    b_z = c_ * (
        np.cos(r_alpha) - np.cos(r_beta) * np.cos(r_gamma)) / np.sin(r_gamma)
    c_x = 0
    c_y = 0
    c_z = volume / (a_ * b_ * np.sin(r_gamma))
    lattice_array = np.array(
        [[a_x, a_y, a_z], [b_x, b_y, b_z], [c_x, c_y, c_z]])
    return lattice_array
449585
def centerLatLon(self):
        
        # GET CENTROID FROM GSSHA GRID
        gssha_grid = self.getGrid()

        min_x, max_x, min_y, max_y = gssha_grid.bounds()
        x_ext, y_ext = transform(gssha_grid.proj,
                                 Proj(init='epsg:4326'),
                                 [min_x, max_x, min_x, max_x],
                                 [min_y, max_y, max_y, min_y],
                                 )
        return np.mean(y_ext), np.mean(x_ext)
622276
def get_center(self):
        
        return Point((self.p1.x+self.p2.x)/2.0, (self.p1.y+self.p2.y)/2.0)
122089
def from_coordinates(cls, coordinates):
        """"""
        prim = cls()
        for coord in coordinates:
            pm = PseudoMonomer(ampal_parent=prim)
            pa = PseudoAtom(coord, ampal_parent=pm)
            pm.atoms = OrderedDict([('CA', pa)])
            prim.append(pm)
        prim.relabel_all()
        return prim
173419
private Point getCellPoint() {
        double x1 = (minX + cellI * deltaX) + (deltaX / 2d);
        double y1 = (minY + cellJ * deltaY) + (deltaY / 2d);
        cellI++;
        return GF.createPoint(new Coordinate(x1, y1));
    }
263592
def moments_central(self):
        

        ycentroid, xcentroid = self.cutout_centroid.value
        return _moments_central(self._filtered_data_zeroed,
                                center=(xcentroid, ycentroid), order=3)
1096018
def from_center(self, x=None, y=None, z=None, r=None,
                    theta=None, h=None, reference=None):
        
        coords_to_endpoint = None
        if all([isinstance(i, numbers.Number) for i in (x, y, z)]):
            coords_to_endpoint = self.from_cartesian(x, y, z)

        if all([isinstance(i, numbers.Number) for i in (r, theta, h)]):
            coords_to_endpoint = self.from_polar(r, theta, h)

        coords_to_reference = Vector(0, 0, 0)
        if reference:
            coords_to_reference = self.coordinates(reference)

        return coords_to_reference + coords_to_endpoint
503815
def unit_vector(self):
        """"""
        return Point2D( self.x / self.magnitude, self.y / self.magnitude )
352925
def from_ase_atoms(cls, atoms):
        
        return cls(atoms=atoms.get_chemical_symbols(), coords=atoms.positions)
2388
private int nAdjacentCentres(int i) {
        int n = 0;
        for (IAtom atom : tetrahedralElements[i].getLigands())
            if (tetrahedralElements[atomToIndex.get(atom)] != null) n++;
        return n;
    }
947799
def centered(coordinates):
    
    coordinates = N.array(coordinates)
    means = N.mean(coordinates,axis=0)
    return coordinates - means