Thank you for the help - as far as the lattice_library file goes, what I wrote in the first email is the entire contents of that file. A more full piece of the code that attempts to determine the bond index is in the rewritten SpinSim method below that calculates the energy of my model. The bond types that it prints out while running are not reflecting what's in the lattice_library file.
template <> double SpinSim<ONMoment<6>, MIdMatrix<double,6> >::calculate_bond_energy(){
double en=0.0; typedef AbstractSpinSim< ONMoment<6> > parent; parent::bond_iterator bi; bi = (this->bonds()).first;
for (; bi!=(this->bonds()).second; ++bi) { // get bond type int edge_type = this->edge_type(*bi);
std::cout << "Bond of type " << edge_type;
en += bond_energy(spins_[this->source(*bi)],this->vertex_type(this->source(*bi)),spins_[this->target(*bi)],this->vertex_type(this->target(*bi)),this->o6couplings,edge_type);
}
return en; }
On Mon, Jun 1, 2009 at 10:36 PM, Matthias Troyer troyer@phys.ethz.ch wrote:
Can you send a full code, or at least which graph class unless it is the default one?
Matthias
On 1 Jun 2009, at 17:42, Miles Stoudenmire wrote:
Hi - I'm creating an application based on the ALPS classical Monte Carlo app that uses a custom lattice where a subset of the spins are to be designated as impurities.
Here's an example lattice I'm using (just a 4 site chain):
<LATTICES> <GRAPH name="test lattice" dimension="1" vertices="4" edges="4"> <VERTEX id="1" type="1"><COORDINATE>0</COORDINATE></VERTEX> <VERTEX id="2" type="0"><COORDINATE>1</COORDINATE></VERTEX> <VERTEX id="3" type="0"><COORDINATE>2</COORDINATE></VERTEX> <VERTEX id="4" type="0"><COORDINATE>2</COORDINATE></VERTEX> <EDGE source="1" target="2" id="1" type="0" vector="1"/> <EDGE source="2" target="3" id="2" type="0" vector="1"/> <EDGE source="3" target="4" id="3" type="0" vector="1"/> <EDGE source="4" target="1" id="4" type="0" vector="1"/> </GRAPH> </LATTICES>
Note how site 1 has type 1, which means it's to be treated as an impurity.
The problem I'm having is that when I'm looping over the bonds/edges using the following code, instead of detecting the bond type as 0 as written in the XML, it's detecting bond 1 as being of type 0, bonds 2 and 3 as being of type 1 and bond 4 as being of type 2. When I make all of the spins/vertices of type 0, however, all of the bonds come out as type 0. Here's the code (in a member function of the SpinSim object, which is a graph_helper object within spinsim.h):
parent::bond_iterator bi; bi = (this->bonds()).first; for (; bi!=(this->bonds()).second; ++bi) { // get bond type int edge_type = this->edge_type(*bi); std::cout << " Bond of type " << edge_type; }
How can I get ALPS to use the bond types that are written instead of making up its own? Thanks!
-- -=Miles Stoudenmire=- miles@physics.ucsb.edu miles.stoudenmire@gmail.com http://www.crazytheory.com/