<?xml version="1.0" standalone="yes"?>
<!-- Test calibration implementation: 5 taxa - prior on 2-taxon clade, exponential prior  -->
<beast>
  <taxa id="taxa">
    <taxon id="a"/>
    <taxon id="b"/>
    <taxon id="c"/>
    <taxon id="d"/>
    <taxon id="e"/>
  </taxa>

  <taxa id="cal">
    <taxon idref="a"/>
    <taxon idref="b"/>
  </taxa>
  
  <yuleModel id="yule" units="substitutions">
    <birthRate>
      <parameter id="yule.birthRate" value="2.0" lower="0.1" upper="10.0"/>
    </birthRate>
  </yuleModel>

  <treeModel id="tree">
    <newick>
      (((a:5,b:5):1,(c:5,d:5):1):1,e:7)
    </newick>
    <rootHeight>
      <parameter id="tree.rootHeight"/>
    </rootHeight>
    <nodeHeights rootNode="false" internalNodes="true">
      <parameter id="tree.internalNodeHeights"/>
    </nodeHeights>
    <nodeHeights rootNode="true" internalNodes="true">
      <parameter id="tree.allNodeHeights"/>
    </nodeHeights>
  </treeModel>
	
  <speciationLikelihood id="speciation">
    <model>
      <yuleModel idref="yule"/>
    </model>
    <speciesTree>
      <treeModel idref="tree"/>
    </speciesTree>
    <calibration>
      <point>
	<exponentialDistributionModel>
	  <mean>
	    2
	  </mean>
	</exponentialDistributionModel>
	<taxa idref="cal"/>
      </point>
    </calibration>
    </speciationLikelihood>

    <tmrcaStatistic id="tmrca(a)">
      <treeModel idref="tree"/>
      <mrca>
	<taxa idref="cal"/>
      </mrca>
    </tmrcaStatistic>

    <mcmc id="mcmc" chainLength="50000000" minOpsFullEvaluations="0" fullEvaluation="0" autoOptimize="true">
        <posterior>
	  <prior>
            <speciationLikelihood idref="speciation"/>
	  </prior>
        </posterior>
	
        <log id="screen" logEvery="100000">
            <column dp="4">
                <speciationLikelihood idref="speciation"/>
                <parameter idref="tree.rootHeight"/>
            </column>
        </log>

	<log id="log" logEvery="500" fileName="test_5t_2c_e2.log">
            <speciationLikelihood idref="speciation"/>
            <parameter idref="tree.rootHeight"/>
	    <statistic idref="tmrca(a)"/>
	    <parameter idref="yule.birthRate"/>
        </log>
	
        <logTree id="logTree" logEvery="100" nexusFormat="true" fileName="test_5t_2c_e2.trees">
            <treeModel idref="tree"/>
        </logTree>
	
        <operators>
            <subtreeSlide weight="1" gaussian="true" size="3">
                <treeModel idref="tree"/>
            </subtreeSlide>
	    <treeUniform weight="1" size="1">
                <treeModel idref="tree"/>
	    </treeUniform>
	    <!-- <scaleOperator scaleFactor="0.75" weight="1"> -->
	    <!--   <parameter idref="yule.birthRate"/> -->
	    <!-- </scaleOperator> -->
        </operators>
    </mcmc>

    <traceAnalysis fileName="test_5t_2c_e2.log" burnIn="1000">
        <expectation name="tmrca(a)" value="2"/>
    </traceAnalysis>
    
</beast>
