https://alps.comp-phys.org/mediawiki/api.php?action=feedcontributions&user=Zhenya&feedformat=atomALPS - User contributions [en]2021-09-29T01:05:37ZUser contributionsMediaWiki 1.27.7https://alps.comp-phys.org/mediawiki/index.php?title=Tutorials:MeasureHOWTO&diff=2790Tutorials:MeasureHOWTO2009-06-09T15:11:40Z<p>Zhenya: New page: == Defining your custom measurements == In case the default measurements performed by your favorite ALPS code do not suffice for your problem, you can define your custom measurements in ...</p>
<hr />
<div>== Defining your custom measurements ==<br />
<br />
In case the default measurements performed by your favorite ALPS code do not suffice for your problem, you can define your <br />
custom measurements in the parameter file. The general syntax is as follows:<br />
<br />
MEASURE_LOCAL[Name]=Op<br />
MEASURE_AVERAGE[Name]=Op<br />
Here "Name" is the name under which your measurements appear in the [[Tutorial:RunningSimulations | xml output]], and "Op" is <br />
the measurement operator, which must be defined in the [[Tutorials:ModelHOWTO | models.xml file]].<br />
MEASURE_AVERAGE measures the quantum mechanical and (for finite temperature simulations) thermodynamic expectation value<br />
of the operator Op. <br />
MEASURE_LOCAL measures the expectation values of the operator Op for each site of the lattice. The operator must be local, <br />
i.e., it can only have site terms.<br />
<br />
<br />
MEASURE_CORRELATIONS[Name]="Op1:Op2"<br />
MEASURE_CORRELATIONS[Name]=Op <br />
MEASURE_CORRELATIONS measures the correlations of the operators Op1 and Op2 for all inequivalent pairs of sites of the lattice. <br />
The second form above, MEASURE_CORRELATIONS[Name]=Op is equivalent to MEASURE_CORRELATIONS[Name]="Op:Op". <br />
At present, only two-site correlation functions can be computed. That is, both Op1 and Op2 must be site operators.<br />
<br />
<br />
MEASURE_STRUCTURE_FACTOR[Name]=Op<br />
This measures the structure factor for the operator Op using the momentum eigenstates for the simulation lattice. <br />
<br />
Notice that not all ALPS codes support all the above statements. Several codes have additional facilities for defining <br />
measurements. Consult the [[Tutorials:Overview | tutorial pages]] for your favorite code. <br />
<br />
<br />
== Further tricks and workarounds ==<br />
<br />
<br />
Measuring off-diagonal quantities in QMC codes is in general non-trivial and is hard to implement in a generic fashion. <br />
If your favorite QMC program refuses to perform your favorite measurement, you may need to modify the source code.<br />
<br />
In certain cases, however several tricks can be used. One useful trick is to enlarge the [[Tutorials:ModelHOWTO | site basis]] of your model.<br />
Consider the following example: Using the [[Tutorial:WormAlgorithm | worm code]] to simulate the Bose Hubbard model on an inhomogeneous lattice, <br />
measure the second moment of local density distribution &lt;n<sub>i</sub><sup>2</sup>&gt;. Since the worm code does not work in the site basis, it <br />
will not perform measurements for such an operator. One possible solution would be to patch the site basis "boson" which<br />
is used by the Bose Hubbard hamiltonian:<br />
<br />
<pre><br />
<SITEBASIS name="boson"><br />
<PARAMETER name="Nmax" default="infinity"/><br />
<QUANTUMNUMBER name="N" min="0" max="Nmax"/><br />
<OPERATOR name="bdag" matrixelement="sqrt(N+1)"><br />
<CHANGE quantumnumber="N" change="1"/><br />
</OPERATOR><br />
<OPERATOR name="b" matrixelement="sqrt(N)"><br />
<CHANGE quantumnumber="N" change="-1"/><br />
</OPERATOR><br />
<OPERATOR name="n" matrixelement="N"/><br />
<OPERATOR name="n2" matrixelement="N*N"/> <--! added --><br />
</SITEBASIS> <br />
</pre><br />
<br />
With this patch, one may define the corresponding measurements in a usual fashion, e.g.<br />
<br />
MEASURE_LOCAL[Local density squared]="n2"<br />
MEASURE_CORRELATIONS[Density squared, correlations]="n2:n2"</div>Zhenya