示例#1
0
def startMCForOn(param):  # start MC for O(n) model
    # unzip all global parameters for every processing
    ID, T, bondList, LMatrix, pos, S, DList, h, nsweep, nthermal, ninterval, Lx, Ly, Lz, algorithm, On, GcOrb, orbGroupList, groupInSC, dipoleAlpha, spinFrame = param
    mcslave = mc.MC(ID,
                    LMatrix,
                    pos=pos,
                    S=S,
                    D=DList,
                    bondList=bondList,
                    T=T,
                    Lx=Lx,
                    Ly=Ly,
                    Lz=Lz,
                    ki_s=GcOrb[0][0],
                    ki_t=GcOrb[0][1],
                    ki_overLat=GcOrb[1],
                    orbGroupList=orbGroupList,
                    groupInSC=groupInSC,
                    h=h,
                    dipoleAlpha=dipoleAlpha,
                    On=On,
                    spinFrame=spinFrame)
    spin_i, spin_j, spin_ij, autoCorr, E, E2, U4 = mcslave.mainLoopViaCLib_On(
        nsweep=nsweep,
        nthermal=nthermal,
        ninterval=ninterval,
        algo=algorithm,
        On=On)
    #mData=abs(mData)/Lx/Ly/Lz
    #eData/=(Lx*Ly*Lz)
    return ID, T, h, spin_i, spin_j, spin_ij, autoCorr, E, E2, U4, mcslave.totOrbs
示例#2
0
def startMC(param): # start MC for Ising model
    # unzip all global parameters for every processing
    ID, T, bondList,LMatrix,pos,S,DList,nsweep,nthermal,Lx,Ly,Lz,algorithm=param
    mcslave=mc.MC(ID,LMatrix,pos=pos,S=S,D=DList,bondList=bondList,T=T,Lx=Lx,Ly=Ly,Lz=Lz)
    mData, eData=np.array(mcslave.mainLoopViaCLib(nsweep=nsweep,nthermal=nthermal,algo=algorithm))
    mData=abs(mData)/Lx/Ly/Lz
    eData/=(Lx*Ly*Lz)
    return ID, T, mData, eData
示例#3
0
def startMC(param): # start MC for Ising model
    # unzip all global parameters for every processing
    ID, T, bondList,LMatrix,pos,S,DList,h,nsweep,nthermal,ninterval,Lx,Ly,Lz,algorithm,GcOrb=param
    mcslave=mc.MC(ID,LMatrix,pos=pos,S=S,D=DList,bondList=bondList,T=T,Lx=Lx,Ly=Ly,Lz=Lz,ki_s=GcOrb[0][0],ki_t=GcOrb[0][1],ki_overLat=GcOrb[1],h=h)
    spin_i, spin_j, spin_ij, autoCorr, E, E2, U4=mcslave.mainLoopViaCLib(nsweep=nsweep,nthermal=nthermal,ninterval=ninterval,algo=algorithm)
    #mData=abs(mData)/Lx/Ly/Lz
    #eData/=(Lx*Ly*Lz)
    #print("<ij>=",np.mean(corr))
    return ID, T, h, spin_i, spin_j, spin_ij, autoCorr, E, E2, U4, mcslave.totOrbs
示例#4
0
import numpy as np
import Lattice as lat
import mcMain as mc
import matplotlib.pyplot as plt
## magnetic crystal part
LMatrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
# magnetic orbitals in fractional coordinates
pos = [[0, 0, 0]]
# couplings   #source #target #edge  #J(meV) negative for FM coupling
bond1 = lat.Bond(0, 0, np.array([1, 0, 0]), -1)
bond2 = lat.Bond(0, 0, np.array([0, 1, 0]), -1)
bondList = [bond1, bond2]

TList = np.linspace(2.2, 2.3, 10)
U4_list = []
for L in [16, 32]:
    U4_L = []
    for T in TList:
        mcslave = mc.MC(0, LMatrix, pos, bondList, T, L, L, 1)
        mData, eData = np.array(
            mcslave.mainLoopViaCLib(nsweep=40000, nthermal=20000,
                                    algo='Wolff'))
        U4_L.append(np.mean(mData * mData)**2 / np.mean(mData**4))
    U4_list.append(U4_L)

plt.plot(TList, U4_list[0])
plt.plot(TList, U4_list[1])
plt.show()
示例#5
0
bond1 = lat.Bond(0, 0, np.array([1, 0, 0]), -1, -1, -1, 0, 0, 0, 0, 0, 0, True)
bond2 = lat.Bond(0, 0, np.array([0, 1, 0]), -1, -1, -1, 0, 0, 0, 0, 0, 0, True)

bondList = [bond1, bond2]

time0 = time.time()
mcslave = mc.MC(0,
                LMatrix,
                pos=pos,
                S=Spin,
                D=D,
                bondList=bondList,
                T=0.5,
                Lx=6,
                Ly=6,
                Lz=1,
                ki_s=0,
                ki_t=0,
                ki_overLat=[0, 0, 0],
                orbGroupList=[[0]],
                groupInSC=True,
                h=0.0,
                dipoleAlpha=0.0,
                On=3,
                spinFrame=0)
# Check MC part
#data=mcslave.mainLoopViaCLib_On(nsweep=80000,nthermal=40000,ninterval=20,algo='Wolff',On=2,flunc=0.0)
#data=mcslave.mainLoopViaCLib(nsweep=20000,nthermal=10000,ninterval=0,algo='Metropolis')
#print(data)
#mean=np.mean(abs(np.array(totSpin)))/mcslave.totOrbs
#print(np.mean(abs(np.array(corr)))-mean**2)
示例#6
0
# single ion anisotropy
D = np.array([[0.0, 0.0, 0.0]])
# couplings   #source #target #edge  #J(meV) negative for FM coupling
bond1 = lat.Bond(0, 0, np.array([1, 0, 0]), -1, -1, -1, True)
bond2 = lat.Bond(0, 0, np.array([0, 1, 0]), -1, -1, -1, True)

bondList = [bond1, bond2]

#time0=time.time()
mcslave = mc.MC(0,
                LMatrix,
                pos=pos,
                S=Spin,
                D=D,
                bondList=bondList,
                T=1,
                Lx=16,
                Ly=16,
                Lz=1,
                ki_s=0,
                ki_t=0,
                ki_overLat=[0, 0, 0],
                h=0.01)
data = mcslave.mainLoopViaCLib_On(nsweep=360000,
                                  nthermal=80000,
                                  ninterval=1,
                                  algo='Wolff',
                                  On=3,
                                  flunc=0.0,
                                  binGraph=False)
#data=mcslave.mainLoopViaCLib(nsweep=1,nthermal=1,ninterval=1,algo='Metroplis')
print(data)
示例#7
0
bond4 = lat.Bond(0, 0, np.array([1, 0, 0]), -7.4988, -7.5219, -7.5219, True)
bond5 = lat.Bond(0, 0, np.array([1, 1, 0]), -7.4988, -7.5219, -7.5219, True)
bond6 = lat.Bond(0, 0, np.array([0, 1, 0]), -7.4988, -7.5219, -7.5219, True)

bond7 = lat.Bond(1, 1, np.array([1, 0, 0]), -7.4988, -7.5219, -7.5219, True)
bond8 = lat.Bond(1, 1, np.array([1, 1, 0]), -7.4988, -7.5219, -7.5219, True)
bond9 = lat.Bond(1, 1, np.array([0, 1, 0]), -7.4988, -7.5219, -7.5219, True)

bondList = [bond1, bond2, bond3, bond4, bond5, bond6, bond7, bond8, bond9]

time0 = time.time()
mcslave = mc.MC(0,
                LMatrix,
                pos=pos,
                S=Spin,
                D=D,
                bondList=bondList,
                T=50,
                Lx=16,
                Ly=16,
                Lz=1)
mcslave.mainLoopViaCLib_On(nsweep=1, nthermal=1, algo='Wolff', On=3, flunc=0.0)
#mcslave.mainLoopViaCLib(nsweep=80000,nthermal=40000,algo='Wolff')
print('time elapsed: %.3f s' % (time.time() - time0))
'''
TList=np.linspace(45,55,10)
U4_list=[]
for L in [16,32]:
    U4_L=[]
    for T in TList:
        mcslave=mc.MC(0,LMatrix,pos=pos,S=Spin,D=D,bondList=bondList,T=T,Lx=L,Ly=L,Lz=1)
        mData, eData=np.array(mcslave.mainLoopViaCLib_On(nsweep=320000,nthermal=80000,algo='Wolff',On=3,flunc=0.0))