Menu

error in measuring MPO observables

Technical
liang
2015-04-09
2015-04-10
  • liang

    liang - 2015-04-09

    Dear all,
    I tested measuring MPO observables. I added related term in Ising model as suggested in the OSMPS_Manual, the error appears:

    Execute_MPSMain TMP/Ising_Staticsg_0.0Main.nml
    running with 0 1
    Cannot open file named TMP/Ising_Staticsg_0.0ObsMPO_1.dat

    Execute_MPSMain TMP/Ising_Staticsg_0.1Main.nml
    running with 0 1
    Cannot open file named TMP/Ising_Staticsg_0.1ObsMPO_1.dat


    Do I missed some term? or what's the problem? thanks.

    Best regards
    Jun-Jun


    In IsingStatics.py nothing is added but the following paragraph:
    DefectDensity=mps.MPO()
    DefectDensity.AddMPOTerm(Operators,'bond',['sz','sz'])
    myObservables.AddObservable(Operators,DefectDensity,'MPO','DefectDensity')


    souce file: 

    import MPSPyLib as mps
    import numpy as np
    import matplotlib.pyplot as plt

    PostProcess=False

    Operators=mps.BuildSpinOperators(0.5)
    Operators['sigmaz']=2*Operators['sz']
    Operators['sigmax']=(Operators['splus']+Operators['sminus'])

    H=mps.MPO()

    H.AddMPOTerm(Operators,'bond',['sigmaz','sigmaz'],hparam='J',weight=-1.0)
    H.AddMPOTerm(Operators,'site','sigmax',hparam='g',weight=-1.0)

    myObservables=mps.Observables()

    DefectDensity=mps.MPO()
    DefectDensity.AddMPOTerm(Operators,'bond',['sz','sz'])
    myObservables.AddObservable(Operators,DefectDensity,'MPO','DefectDensity')

    myConv=mps.MPSConvergenceParameters(max_bond_dimension=20,max_num_sweeps=6,local_tol=1E-14)

    J=1.0
    glist=np.linspace(0,2,21)
    parameters=[]
    L=30

    for g in glist:
    parameters.append({
    #Directories
    'job_ID' : 'Ising_Statics',
    'unique_ID' : 'g_'+str(g),
    'Write_Directory' : 'TMP/',
    'Output_Directory' : 'OUTPUTS/',
    #System size and Hamiltonian parameters
    'L' : L,
    'J' : J,
    'g' : g,
    #ObservablesConvergence parameters
    'verbose' : 1,
    'MPSObservables' : myObservables,
    'MPSConvergenceParameters' : myConv
    })

    MainFiles=mps.WriteFiles(parameters,Operators,H,PostProcess=PostProcess)

    if not PostProcess:
    mps.runMPS(MainFiles,RunDir='')

    if PostProcess:
    magnetizationlist=[]
    Outputs=mps.ReadStaticObservables(parameters)
    for Output in Outputs:
    print Output['converged']
    spincorrelation=Output['zz']
    magnetization=np.sqrt(spincorrelation[4][27])
    magnetizationlist.append(magnetization)
    plt.rc('text', usetex=True)
    plt.rc('font', family='serif')
    plt.scatter(glist,magnetizationlist)
    plt.xlabel(r"\textbf{transverse field coupling} " r"$g$",fontsize=16)
    plt.ylabel(r"\textbf{Magnetization}" r"$\sqrt{\langle\sigma^\mathbf{z}4\sigma^\mathbf{z}{27}\rangle}$",fontsize=16)
    plt.xlim((0,2))
    plt.ylim((0,1))
    plt.show()

     
  • Anonymous

    Anonymous - 2015-04-09

    Hi Jun-Jun,
    Adding CALL AppendBaseName(ObsName,extrastub) between lines 163 and 164 in PyInterface_all_include.f90 will fix the problem. Thank you.

     
  • Anonymous

    Anonymous - 2015-04-09

    Hi Jun-Jun,
    This is the followup of last reply. To be more specific,
    Add CALL AppendBaseName(ObsName,extrastub) between
    CALL AppendBaseName(ObsName,fileStub)
    and
    CALL AppendBaseName(ObsName,'ObsMPO_')
    in the last do loop in the SUBROUTINE ReadObservables_MATRIXLIST_TYPE in the file PyInterface_all_include.f90.
    Also add CALL AppendBaseName(ObsName,extrastub) to the same place in the SUBROUTINE DeallocateObservables_MATRIXLIST_TYPE in the same file. Thank you.

    Daniel and Wei

     
  • liang

    liang - 2015-04-10

    Dear Daniel and Wei,
    It works well, thank you.

    Best regards
    Jun-Jun

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.