def bond(s): if len(s) % 3 != 0: raise Exception("Not 3D spins" + str(len(s))) else: N = int(len(s) / 3) i_iplus1 = np.multiply(s, spinlib.cycle3D(s, N, 1)) bond = i_iplus1[:N] + i_iplus1[N:2 * N] + i_iplus1[2 * N:] return bond
def bondz2_mean(s): if len(s) % 3 != 0: raise Exception("Not 3D spins" + str(len(s))) else: N = int(len(s) / 3) i_iplus2 = np.multiply(s, spinlib.cycle3D(s, N, 2)) bond = i_iplus2[2 * N:] return np.mean(bond)
def bondx_var(s): if len(s) % 3 != 0: raise Exception("Not 3D spins" + str(len(s))) else: N = int(len(s) / 3) i_iplus1 = np.multiply(s, spinlib.cycle3D(s, N, 1)) bond = i_iplus1[:N] return np.var(bond)
def bond2_var(s): if len(s) % 3 != 0: raise Exception("Not 3D spins" + str(len(s))) else: N = int(len(s) / 3) i_iplus2 = np.multiply(s, spinlib.cycle3D(s, N, 2)) bond = i_iplus2[:N] + i_iplus2[N:2 * N] + i_iplus2[2 * N:] #bond = i_iplus2[2*N:] return np.var(bond)
def hamiltonian_sub(self, s, N_s=10, starting_at=0): """hamiltonian of a subsystem from starting_at up to starting_at + N_s-1 (lenght N_s) """ if N_s == self.N and starting_at == 0: return self.hamiltonian(s[:3 * self.N]) s1 = s.copy() N = self.N s1 = spinlib.cycle3D(s, N, -starting_at) s1[N_s:N].fill(0) s1[N + N_s:2 * N].fill(0) s1[2 * N + N_s:].fill(0) return self.hamiltonian(s1[:3 * self.N])