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!
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/
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/
Dear Miles,
The answer is the following:
The spinmc code takes your site and bond types and creates new bond types from them, which it then stores back into the bond_type. This is done in the file abstractspinsim.h. Just change that part in your application and you'll be fine.
The reason is the following: the bond type specifies the couplings Jij, and the site types the spin values Si and Sj on the two sites. Using spins normalized to one, the coupling on a bond is Jij*Si*Sj for the classical convention and slightly modified for the quantum convention. As you can see, this coupling value depends on both the bond type as well as the site types of the two sites. The code then creates a new bond type number to uniquely label each combination of these three.
Matthias
On 1 Jun 2009, at 23:45, Miles Stoudenmire wrote:
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/
-- -=Miles Stoudenmire=- miles@physics.ucsb.edu miles.stoudenmire@gmail.com http://www.crazytheory.com/
Thanks for the help! I just commented out that part of the code and it worked (my code ignores the quantum/classical convention stuff anyway). That was really puzzling me -
On Wed, Jun 3, 2009 at 10:42 AM, Matthias Troyer troyer@phys.ethz.ch wrote:
Dear Miles,
The answer is the following:
The spinmc code takes your site and bond types and creates new bond types from them, which it then stores back into the bond_type. This is done in the file abstractspinsim.h. Just change that part in your application and you'll be fine.
The reason is the following: the bond type specifies the couplings Jij, and the site types the spin values Si and Sj on the two sites. Using spins normalized to one, the coupling on a bond is Jij*Si*Sj for the classical convention and slightly modified for the quantum convention. As you can see, this coupling value depends on both the bond type as well as the site types of the two sites. The code then creates a new bond type number to uniquely label each combination of these three.
Matthias
On 1 Jun 2009, at 23:45, Miles Stoudenmire wrote:
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/
-- -=Miles Stoudenmire=- miles@physics.ucsb.edu miles.stoudenmire@gmail.com http://www.crazytheory.com/
We could add a new property map for the new bond type, but it would probably just be as confusing, unless we add this feature to the ALPS library and use it in all codes.
Matthias
On 3 Jun 2009, at 12:05, Miles Stoudenmire wrote:
Thanks for the help! I just commented out that part of the code and it worked (my code ignores the quantum/classical convention stuff anyway). That was really puzzling me -
On Wed, Jun 3, 2009 at 10:42 AM, Matthias Troyer troyer@phys.ethz.ch wrote:
Dear Miles,
The answer is the following:
The spinmc code takes your site and bond types and creates new bond types from them, which it then stores back into the bond_type. This is done in the file abstractspinsim.h. Just change that part in your application and you'll be fine.
The reason is the following: the bond type specifies the couplings Jij, and the site types the spin values Si and Sj on the two sites. Using spins normalized to one, the coupling on a bond is Jij*Si*Sj for the classical convention and slightly modified for the quantum convention. As you can see, this coupling value depends on both the bond type as well as the site types of the two sites. The code then creates a new bond type number to uniquely label each combination of these three.
Matthias
On 1 Jun 2009, at 23:45, Miles Stoudenmire wrote:
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/
-- -=Miles Stoudenmire=- miles@physics.ucsb.edu miles.stoudenmire@gmail.com http://www.crazytheory.com/
-- -=Miles Stoudenmire=- miles@physics.ucsb.edu miles.stoudenmire@gmail.com http://www.crazytheory.com/
comp-phys-alps-users@lists.phys.ethz.ch