def __init__(self, lat): error_handling.lat(lat) self.lat = lat self.sites = self.lat.sites # used to check if sites changes self.coor_hop = np.array([], dtype=[('x', 'f8'), ('y', 'f8'), ('tag', 'S1')]) self.vec_hop = np.array([], dtype=[('dis', 'f8'), ('ang', 'f8') ]) # Hopping distances and angles self.dist_uni = np.array([], 'f8') # Different hopping distances self.store_hop = { } # Store the relevant hoppings (dynamic programming) self.hop = np.array([], dtype=[('n', 'u2'), ('i', 'u4'), ('j', 'u4'), ('ang', 'f8'), ('tag', 'S2'), ('t', 'c16') ]) # Hoppings to build-up the Hamiltonian self.onsite = np.array([], 'c16') # Onsite energies self.ham = sparse.csr_matrix( ([], ([], [])), shape=(self.lat.sites, self.lat.sites)) # Hamiltonian self.en = np.array([], 'c16') # Eigenenergies self.rn = np.array([], 'c16') # Right eigenvectors: H |rn> = en |rn> self.ln = np.array([], 'c16') # Left eigenvectors: <ln| H = en <ln| self.intensity = np.array([], 'f8') # Intensities (|rn|**2) self.pola = np.array([], 'f8') # sublattices polarisation (|rn^{(S)}|**2) self.petermann = np.array([], 'f8') # Inverse Participation Ratio self.nmax = 0 # number of different hoppings
def __iadd__(self, other): ''' Overloading operator +=. ''' error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) self.coor = np.concatenate([self.coor, other.coor]) self.sites += other.sites self.tags = np.unique([self.tags, other.tags]) return self
def __iadd__(self, other): """ Overloading operator +=. """ error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) self.coor = np.concatenate([self.coor, other.coor]) self.sites += other.sites self.tags = np.unique([self.tags, other.tags]) return self
def __add__(self, other): ''' Overloading operator +. ''' error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) coor = np.concatenate([self.coor, other.coor]) tags = np.concatenate([self.tags, other.tags]) lat = lattice(unit_cell=self.unit_cell, prim_vec=self.prim_vec) lat.add_sites(coor) lat.sites = self.sites + other.sites lat.tags = np.unique(tags) return lat
def __add__(self, other): """ Overloading operator +. """ error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) coor = np.concatenate([self.coor, other.coor]) tags = np.concatenate([self.tags, other.tags]) lat = lattice(unit_cell=self.unit_cell, prim_vec=self.prim_vec) lat.add_sites(coor) lat.sites = self.sites + other.sites lat.tags = np.unique(tags) return lat
def __isub__(self, other): ''' Overloading operator -=. .. note:: The tags are not considered in the lattice subtraction. ''' error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) ind_remove = [] boo = np.zeros(self.sites, bool) for i, c in enumerate(other.coor): boo += np.isclose(c['x'], self.coor['x']) & np.isclose(c['y'], self.coor['y']) self.coor = self.coor[np.logical_not(boo)] self.sites = sum(np.logical_not(boo)) return self
def __isub__(self, other): """ Overloading operator -=. .. note:: The tags are not considered in the lattice subtraction. """ error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) ind_remove = [] boo = np.zeros(self.sites, bool) for i, c in enumerate(other.coor): boo += np.isclose(c["x"], self.coor["x"]) & np.isclose(c["y"], self.coor["y"]) self.coor = self.coor[np.logical_not(boo)] self.sites = sum(np.logical_not(boo)) return self
def __init__(self, lat): error_handling.lat(lat) self.lat = lat self.sites = self.lat.sites # used to check if sites changes self.coor_hop = np.array([], dtype=[ ('x', 'f8'), ('y', 'f8'), ('tag', 'S1')]) self.vec_hop = np.array([], dtype=[('dis', 'f8'), ('ang', 'f8')]) # Hopping distances and angles self.dist_uni = np.array([], 'f8') # Different hopping distances self.store_hop = {} # Store the relevant hoppings (dynamic programming) self.hop = np.array([], dtype=[('n', 'u2'), ('i', 'u4'), ('j', 'u4'), ('ang', 'f8'), ('tag', 'S2'), ('t', 'c16')]) # Hoppings to build-up the Hamiltonian self.onsite = np.array([], 'c16') # Onsite energies self.ham = sparse.csr_matrix(([], ([], [])), shape=(self.lat.sites, self.lat.sites)) # Hamiltonian self.en = np.array([], 'c16') # Eigenenergies self.rn = np.array([], 'c16') # Right eigenvectors: H |rn> = en |rn> self.ln = np.array([], 'c16') # Left eigenvectors: <ln| H = en <ln| self.intensity = np.array([], 'f8') # Intensities (|rn|**2) self.pola = np.array([], 'f8') # sublattices polarisation (|rn^{(S)}|**2) self.petermann = np.array([], 'f8') # Inverse Participation Ratio self.nmax = 0 # number of different hoppings
def __sub__(self, other): ''' Overloading operator -. .. note:: The tags are not considered in the lattice subtraction. ''' error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) tags = np.unique([self.tags, other.tags]) boo = np.zeros(self.sites, bool) for i, c in enumerate(other.coor): boo += np.isclose(c['x'], self.coor['x']) & np.isclose(c['y'], self.coor['y']) coor = self.coor[np.logical_not(boo)] lat = lattice(unit_cell=self.unit_cell, prim_vec=self.prim_vec) lat.add_sites(coor) lat.sites = len(lat.coor) lat.tags = self.tags return lat
def __sub__(self, other): """ Overloading operator -. .. note:: The tags are not considered in the lattice subtraction. """ error_handling.lat(other) error_handling.empty_coor(self.coor) error_handling.empty_coor(other.coor) tags = np.unique([self.tags, other.tags]) boo = np.zeros(self.sites, bool) for i, c in enumerate(other.coor): boo += np.isclose(c["x"], self.coor["x"]) & np.isclose(c["y"], self.coor["y"]) coor = self.coor[np.logical_not(boo)] lat = lattice(unit_cell=self.unit_cell, prim_vec=self.prim_vec) lat.add_sites(coor) lat.sites = len(lat.coor) lat.tags = self.tags return lat
def __init__(self, lat): error_handling.lat(lat) self.lat = lat self.prop = np.array([], "c16")
def __init__(self, lat): error_handling.lat(lat) self.lat = lat self.prop = np.array([], 'c16')