example_input.xsl

This explains how to create a series of input files from an experiment list.

Input Template

A frequent task in scientific computer simulation is to do many similar calculations, where one needs to vary only one or a few parameters. We refer to this method as the aggregate properties. The preferred way to solve this to us is using XML and XSLT templates.

inputtemplate.png

An example for such a parameter set may be

<?xml version="1.0" encoding="UTF-8" ?>
 <experiment>
   <set rgkmax="9" />
    <set rgkmax="10" />
    <set rgkmax="11" />
    <set rgkmax="12" />
 </experiment>

It is a convergence test for rgkmax.

The template is a input file where you want to replace the rgkmax attribute by the value of the set and create a separate file and working directory for each calculation. lets again use the aluminum example:

The template inptmpl.xsl creates a directory structure with the input files necessary to perform the calculations defined in the experiment sets.

The lines where the actual insertion of the rgkmax happens are:

<groundstate solver="Arpack" fromscratch="true" vkloff="0.5  0.5  0.5"   mixer="msec" ngridk="4  4  4">
  <xsl:attribute name="rgkmax"><xsl:value-of select="@rgkmax"/></xsl:attribute>
</groundstate>

The xsl:attribute is a XSL statement that will add the rgkmax attribute to its enclosing tag (groundstate).

This template is actually also able to replace many values in the input file and it will create a directory tree resembling the chosen parameters

Generate parameter sets

The simple format of the param sets file can be generated by hand or by some script. If you need a calculation for all permutation of a group of parameters, check Expand All Parameter Permutations.

Execute

The way to execute the calculations is different on every system. But, of course one can use a template to get from the experiment list to a script that will execute all the calculations.

set2shelcommand.xsl
set2shelcommand.xsl creates shelscript to execute all calculations in experiment setup
loadl.xsl
The template generates a loadleveler job script from the experiment list definition.

Collect data

XSL is also usefull in collecting the results:

collectdata.xsl

xsltproc  collectdata.xsl experiment.xml

yields:
<?xml version="1.0"?>
<result xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl">
  <set>
    <param rgkmax="9" path="./rgkmax_9/"/>
    <result status="finished" totalEnergy="-241.920242928" iterations="8"/>
  </set>
  <set>
    <param rgkmax="10" path="./rgkmax_10/"/>
    <result status="finished" totalEnergy="-241.920279514" iterations="8"/>
  </set>
  <set>
    <param rgkmax="11" path="./rgkmax_11/"/>
    <result status="finished" totalEnergy="-241.920309177" iterations="9"/>
  </set>
  <set>
    <param rgkmax="12" path="./rgkmax_12/"/>
    <result status="" totalEnergy="-25060.9664966" iterations="3"/>
  </set>
</result>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License