Dear Yulian,

I think you can solve this bug by removing the last line "  <EDGE type="0"><SOURCE vertex="1" offset="1"/><TARGET vertex="2" offset="1"/></EDGE>
" from the definition of the UNITCELL.

Step 1: Expose the bug.
You can write a short "mock" python script to generate a simulation input XML file. Here is the script (named get_config.py)
-------------------------------
import pyalps

p = {}
p['LATTICE'] = '2 band sublattice open chain lattice'
# p['LATTICE'] = '2 band open chain lattice'
p['LATTICE_LIBRARY'] = './lattices.xml'
p['L'] = 4
pyalps.writeInputFiles('superlatticechain', [p])
-------------------------------
where your own lattice library file is at './lattices.xml'. Then run the script and get the input xml file:
-------------------------------
~ alpspython ./get_config.py
~ ls
ALPS.xsl                       lattices.xml                   superlatticechain.task1.in.xml
get_config.py                  superlatticechain.in.xml
-------------------------------
Then use the command line tool 'printgraph' to print the GRAPH used by your simulation:
-------------------------------
~ printgraph superlatticechain.task1.in.xml
<GRAPH dimension="1" vertices="8" edges="10">
  <VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX>
  <VERTEX id="2" type="1"><COORDINATE>0</COORDINATE></VERTEX>
  <VERTEX id="3" type="0"><COORDINATE>1</COORDINATE></VERTEX>
  <VERTEX id="4" type="1"><COORDINATE>1</COORDINATE></VERTEX>
  <VERTEX id="5" type="0"><COORDINATE>2</COORDINATE></VERTEX>
  <VERTEX id="6" type="1"><COORDINATE>2</COORDINATE></VERTEX>
  <VERTEX id="7" type="0"><COORDINATE>3</COORDINATE></VERTEX>
  <VERTEX id="8" type="1"><COORDINATE>3</COORDINATE></VERTEX>
  <EDGE source="1" target="2" id="1" type="0" vector="0"/>
  <EDGE source="3" target="4" id="2" type="0" vector="0"/>
  <EDGE source="2" target="3" id="3" type="1" vector="1"/>
  <EDGE source="3" target="4" id="4" type="0" vector="0"/>
  <EDGE source="5" target="6" id="5" type="0" vector="0"/>
  <EDGE source="4" target="5" id="6" type="1" vector="1"/>
  <EDGE source="5" target="6" id="7" type="0" vector="0"/>
  <EDGE source="7" target="8" id="8" type="0" vector="0"/>
  <EDGE source="6" target="7" id="9" type="1" vector="1"/>
  <EDGE source="7" target="8" id="10" type="0" vector="0"/>
</GRAPH>
-------------------------------
You will see that some bonds are duplicated constructed (in bold).

Step 2: Fix the bug.
The removed line in your UNITCELL definition leads to this duplicated construction. Because this line creates a type 0 bond from the vertex 1 with offset 1 to the vertex 2 with offset 1. The two vertexes are shifted 1 unit cell. That means create a bond in the next unit cell of the LATTICE. This is the source of the redundancy. After fixing the bug, you can print the right result:
-------------------------------
<GRAPH dimension="1" vertices="8" edges="7">
  <VERTEX id="1" type="0"><COORDINATE>0</COORDINATE></VERTEX>
  <VERTEX id="2" type="1"><COORDINATE>0</COORDINATE></VERTEX>
  <VERTEX id="3" type="0"><COORDINATE>1</COORDINATE></VERTEX>
  <VERTEX id="4" type="1"><COORDINATE>1</COORDINATE></VERTEX>
  <VERTEX id="5" type="0"><COORDINATE>2</COORDINATE></VERTEX>
  <VERTEX id="6" type="1"><COORDINATE>2</COORDINATE></VERTEX>
  <VERTEX id="7" type="0"><COORDINATE>3</COORDINATE></VERTEX>
  <VERTEX id="8" type="1"><COORDINATE>3</COORDINATE></VERTEX>
  <EDGE source="1" target="2" id="1" type="0" vector="0"/>
  <EDGE source="2" target="3" id="2" type="1" vector="1"/>
  <EDGE source="3" target="4" id="3" type="0" vector="0"/>
  <EDGE source="4" target="5" id="4" type="1" vector="1"/>
  <EDGE source="5" target="6" id="5" type="0" vector="0"/>
  <EDGE source="6" target="7" id="6" type="1" vector="1"/>
  <EDGE source="7" target="8" id="7" type="0" vector="0"/>
</GRAPH>
-------------------------------

Best regards,
Rongyang Sun

 



From: Comp-phys-alps-users <comp-phys-alps-users-bounces@lists.phys.ethz.ch> on behalf of yulian chen <cyl119zj@gmail.com>
Sent: Wednesday, October 17, 2018 14:03
To: comp-phys-alps-users@lists.phys.ethz.ch
Subject: [ALPS-users] How to define the superlattice Bose-Hubbard model?
 
Hello everybody,

I was trying to run a simulation on the one-dimensional superlattice Bose-Hubbarad with alternating tunneling rates t1 and t2, which is the bosonic analogue of the Su-Schrieffer-Heeger(SSH) model. The lattice with one unit cell is made of A and B sites.
To this end, I have adaped the following unit-cell:
<UNITCELL name="sublattice1d" dimension="1">
  <VERTEX type="0"/>
  <VERTEX type="1"/>
  <EDGE type="0"><SOURCE vertex="1" offset="0"/><TARGET vertex="2" offset="0"/></EDGE>
  <EDGE type="1"><SOURCE vertex="2" offset="0"/><TARGET vertex="1" offset="1"/></EDGE>
  <EDGE type="0"><SOURCE vertex="1" offset="1"/><TARGET vertex="2" offset="1"/></EDGE>
</UNITCELL>

This enters into the lattice graph:
<LATTICEGRAPH name = "2 band sublattice open chain lattice">
  <FINITELATTICE>
    <LATTICE ref="chain lattice"/>
    <EXTENT dimension="1" size ="L"/>
    <BOUNDARY type="open"/>
  </FINITELATTICE>
  <UNITCELL ref="sublattice1d"/>
</LATTICEGRAPH>

And the Hamiltonian:
<HAMILTONIAN name="boson Hubbard">
  <PARAMETER name="mu" default="0"/>
  <PARAMETER name="hop" default="1"/>
  <PARAMETER name="hop'" default="1"/>
  <PARAMETER name="U" default="0"/>
  <BASIS ref="boson"/>
  <SITETERM site="i">
    <PARAMETER name="mu#" default="mu"/>
    <PARAMETER name="U#" default="U"/>
    -mu#*n(i)+U#*n(i)*(n(i)-1)/2
  </SITETERM>  
   <BONDTERM type="0" source="i" target="j">
     -hop*boson_hop(i,j)
   </BONDTERM>
   <BONDTERM type="1" source="i" target="j">
     -hop'*boson_hop(i,j)
   </BONDTERM>
</HAMILTONIAN>

However when I run a DMRG calculation.I still get the wrong results.I compare the ground state energy of it with which I calculated by matlab using ED method.All the parameters of the two calculation are the same.

I seem to misunderstand the implementation. So the question I want to ask is that are there any wrong in the definitions of my lattice or the model in XML.

Thank you for any kind of heplful remarks.

Yulian Chen