I tried to follow your instructions, but I am doing something wrong and cannot find out what it is. In order to test creating a graph with different coupling types, I created a file called 'my_lattices.xml' implementing a 9-site dimerized chain with the following contents:
<LATTICES>
<GRAPH name = "open chain dimerized lattice" dimension="1" vertices="9" edges="8">
<VERTEX id="1"/>
<VERTEX id="2"/>
<VERTEX id="3"/>
<VERTEX id="4"/>
<VERTEX id="5"/>
<VERTEX id="6"/>
<VERTEX id="7"/>
<VERTEX id="8"/>
<VERTEX id="9"/>
<EDGE source="1" target="2" id="1" type="0"/>
<EDGE source="2" target="3" id="2" type="1"/>
<EDGE source="3" target="4" id="3" type="0"/>
<EDGE source="4" target="5" id="4" type="1"/>
<EDGE source="5" target="6" id="5" type="0"/>
<EDGE source="6" target="7" id="6" type="1"/>
<EDGE source="7" target="8" id="7" type="0"/>
<EDGE source="8" target="9" id="8" type="1"/>
</GRAPH>
</LATTICES>
I then adapted a Python file from the tutorials in order to calculate the susceptibility of an antiferromagnetic Heisenberg model sitting on the sites of the dimerized lattice, using 'J0' and 'J1' to refer to the couplings associated with edge types 0 and 1, which I set equal to each other for testing:
import pyalps
import matplotlib.pyplot as plt
import pyalps.plot
#prepare the input parameters
#skip this part if you already ran the simulation from the command line
parms = []
for t in [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0]:
parms.append(
{
'LATTICE_LIBRARY': 'my_lattice.xml',
'LATTICE' : 'open chain dimerized lattice',
'T' : t,
'local_S' : 0.5,
'J0' : 1.0,
'J1' : 1.0,
'THERMALIZATION' : 10000,
'SWEEPS' : 500000,
'ALGORITHM' : 'loop',
'MODEL' : 'spin'
}
)
#write the input file and run the simulation
input_file = pyalps.writeInputFiles('parm2a',parms)
pyalps.runApplication('loop',input_file,Tmin=5)
#load the susceptibility and collect it as function of temperature T
data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm2a'),'Susceptibility')
susceptibility = pyalps.collectXY(data,x='T',y='Susceptibility')
#make plot
plt.figure()
plt.title("Antiferromagnetic Heisenberg chain")
pyalps.plot.plot(susceptibility)
plt.show()
When I run the code with alpspython, I get a segmentation fault, but if I use the standard lattice library and an 'open chain lattice' with 9 sites, everything works as it should.
Is there anything obviously silly in what I am doing?