コード例 #1
0
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
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
 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])