예제 #1
0
def new_spin(name, base_ks, uploaded):
    """
    Return new spin
    """
    spin = Spin(name=name, baseks=base_ks, uploaded=uploaded)
    spin.save()
    return spin
예제 #2
0
파일: helper.py 프로젝트: shreyankg/Dorrie
def new_spin(name, base_ks):
    """
    Return new spin
    """
    spin = Spin(name=name, baseks=base_ks)
    spin.save()
    return spin
예제 #3
0
파일: helper.py 프로젝트: firesofmay/Dorrie
def new_spin(name, base_ks):
    """
    Return new spin
    """
    spin = Spin(name=name, baseks=base_ks)
    spin.save()
    return spin
예제 #4
0
from core import Contractor as ct
from core import MPO
from core import MPS
from models import Boson as Bs
from models import Spin as Sp

L = 10
D = 20
Jx = 1.
Jy = 1.
Jz = 1.
g = -1.05
h = 0.5
offset = 0
Nmax = 4
IsingModel = Sp.Ising(L, Jz, g, h, offset)
HeisenbergModel = Sp.Heisenberg(L, Jx, Jy, Jz, g, h, offset)
BoseHubbardModel = Bs.BoseHubbard(L,
                                  Nmax,
                                  t=1.,
                                  U=0.1,
                                  mu=1.,
                                  V=0.5,
                                  Vint=0.2,
                                  offset=0)

# Test of DMRG & fitApplyMPO & entanglement entropy & total spin projector
#H = IsingModel.hamil
H = HeisenbergModel.hamil
gs = MPS.MPS(L, D, 2)
# gs.setProductState(Sp.Up)
예제 #5
0
    def __init__(s, H_PARAMS):
        #======================================================================
        # Initiate the Hamiltonian features
        #======================================================================
        Hamiltonian.__init__(s)
        #======================================================================
        # Define the lattice
        # for key in lattice.keys: printa(key)
        #======================================================================
        from lattices import Chain
        lattice = Chain()
        keys = lattice.keys
        s.LATTICE_UNIT_CELL_SIZE = lattice.LATTICE_UNIT_CELL_SIZE
        #======================================================================
        # Define the model
        # for key in model.opts: printa(key)
        #======================================================================
        from models import Spin
        model = Spin(1)
        s.d = model.d
        s.model_operators = model.opts
        #======================================================================
        # Initiate the Hamiltonian features
        #======================================================================
        Hamiltonian.__init__(s, model, lattice, H_PARAMS)
        #======================================================================
        # Define the Hamiltonian and its operators
        #======================================================================
        g = H_PARAMS['g']
        # Spin-Spin
        s.make_two_sites_operators(keys['nearest_n'], 1,
                                   s.model_operators['Sx'],
                                   s.model_operators['Sx'])
        s.make_two_sites_operators(keys['nearest_n'], 1,
                                   s.model_operators['Sy'],
                                   s.model_operators['Sy'])
        s.make_two_sites_operators(keys['nearest_n'], 1,
                                   s.model_operators['Sz'],
                                   s.model_operators['Sz'])
        # Spin-squared
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sx'], s.model_operators['Sx']),
            dot(s.model_operators['Sx'], s.model_operators['Sx']))
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sy'], s.model_operators['Sy']),
            dot(s.model_operators['Sy'], s.model_operators['Sy']))
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sz'], s.model_operators['Sz']),
            dot(s.model_operators['Sz'], s.model_operators['Sz']))

        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sx'], s.model_operators['Sy']),
            dot(s.model_operators['Sx'], s.model_operators['Sy']))
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sy'], s.model_operators['Sx']),
            dot(s.model_operators['Sy'], s.model_operators['Sx']))

        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sx'], s.model_operators['Sz']),
            dot(s.model_operators['Sx'], s.model_operators['Sz']))
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sz'], s.model_operators['Sx']),
            dot(s.model_operators['Sz'], s.model_operators['Sx']))

        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sz'], s.model_operators['Sy']),
            dot(s.model_operators['Sz'], s.model_operators['Sy']))
        s.make_two_sites_operators(
            keys['nearest_n'], g,
            dot(s.model_operators['Sy'], s.model_operators['Sz']),
            dot(s.model_operators['Sy'], s.model_operators['Sz']))