<beast version='2.0'
       namespace='beast.app.beauti:beast.core:beast.evolution.branchratemodel:beast.evolution.speciation:beast.evolution.tree.coalescent:beast.core.util:beast.evolution.nuc:beast.evolution.operators:beast.evolution.sitemodel:beast.evolution.substitutionmodel:beast.evolution.likelihood:beast.evolution:beast.math.distributions'>

       
       
       
    <mergewith point='substModelTemplates'>
    
        <!-- gamma site model -->
        <subtemplate id='Gamma Site Model' class='beast.evolution.sitemodel.SiteModel' mainid='SiteModel.s:$(n)'>
            <![CDATA[
            <plugin spec='SiteModel' id="SiteModel.s:$(n)" gammaCategoryCount='0'>
                <!--substModel will be automatically detected /-->
                <proportionInvariant spec='parameter.RealParameter' id='proportionInvariant.s:$(n)' value='0.0' lower='0' upper='1' estimate='false'/>
                <mutationRate        spec='parameter.RealParameter' id='mutationRate.s:$(n)' value='1.0'        estimate='false'/>
                <shape               spec='parameter.RealParameter' id='gammaShape.s:$(n)' value='1.0'         estimate='false'/>
            </plugin>

                <prior id='MutationRatePrior.s:$(n)' x='@mutationRate.s:$(n)'><distr spec="OneOnX"/></prior>
            <prior id='GammaShapePrior.s:$(n)' x='@gammaShape.s:$(n)'><distr spec="beast.math.distributions.Exponential" mean='1'/></prior>
            <prior id='PropInvariantPrior.s:$(n)' x='@proportionInvariant.s:$(n)'><distr spec="beast.math.distributions.Uniform" lower='0' upper='1'/></prior>

            <operator id='proportionInvariantScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@proportionInvariant.s:$(n)"/>
            <operator id='mutationRateScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@mutationRate.s:$(n)"/>
            <operator id='gammaShapeScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@gammaShape.s:$(n)"/>
            ]]>

                        <connect method="beast.app.beauti.SiteModelInputEditor.customConnector"/>

<!-- when FixMeanMutationRatesOperator, the prior is uniform due to the operator -->
            <connect srcID='MutationRatePrior.s:$(n)'         targetID='prior' inputName='distribution' if='nooperator(FixMeanMutationRatesOperator) and inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>

            <connect srcID='proportionInvariant.s:$(n)'       targetID='state' inputName='stateNode' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'              targetID='state' inputName='stateNode' if='inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'                targetID='state' inputName='stateNode' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>


            <connect srcID='proportionInvariantScaler.s:$(n)' targetID='mcmc' inputName='operator' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'>Scales proportion of invariant sites parameter of partition $(n)</connect>
            <connect srcID='mutationRateScaler.s:$(n)'        targetID='mcmc' inputName='operator' if='nooperator(FixMeanMutationRatesOperator) and inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'>Scales mutation rate of partition s:$(n)</connect>
            <connect srcID='gammaShapeScaler.s:$(n)'          targetID='mcmc' inputName='operator' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'>Scales gamma shape parameter of partition s:$(n)</connect>

            <connect srcID='proportionInvariant.s:$(n)'       targetID='tracelog' inputName='log' if='inposterior(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'/>
            <connect srcID='mutationRate.s:$(n)'              targetID='tracelog' inputName='log' if='inlikelihood(mutationRate.s:$(n)) and mutationRate.s:$(n)/estimate=true'/>
            <connect srcID='gammaShape.s:$(n)'                targetID='tracelog' inputName='log' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'/>

            <connect srcID='GammaShapePrior.s:$(n)'           targetID='prior' inputName='distribution' if='inlikelihood(gammaShape.s:$(n)) and gammaShape.s:$(n)/estimate=true'>Prior on gamma shape for partition s:$(n)</connect>
            <connect srcID='PropInvariantPrior.s:$(n)'        targetID='prior' inputName='distribution' if='inlikelihood(proportionInvariant.s:$(n)) and proportionInvariant.s:$(n)/estimate=true'>Prior on proportion invariant for partition s:$(n)</connect>

        </subtemplate>

    

        <!-- substitution models -->
        <!-- JC69 substitution model -->
        <subtemplate id='JC69' class='beast.evolution.substitutionmodel.JukesCantor' mainid='JC69.s:$(n)'>
            <![CDATA[
        <plugin spec='JukesCantor' id='JC69.s:$(n)'/>
]]>
        </subtemplate>

        <!-- HKY substitution model -->
        <subtemplate id='HKY' class='beast.evolution.substitutionmodel.HKY' mainid='hky.s:$(n)'>
            <![CDATA[
        <plugin spec='HKY' id='hky.s:$(n)'>
            <parameter id="kappa.s:$(n)" name='kappa' value="2.0" lower="0.0" estimate='true'/>
            <frequencies id='estimatedFreqs.s:$(n)' spec='Frequencies'>
                <frequencies id='freqParameter.s:$(n)' spec='parameter.RealParameter' dimension='4' value='0.25' lower='0' upper='1'/>
            </frequencies>
        </plugin>

        <plugin id='KappaScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@kappa.s:$(n)"/>
        <plugin id='FrequenciesExchanger.s:$(n)' spec='DeltaExchangeOperator' delta="0.01" weight="0.1" parameter="@freqParameter.s:$(n)"/>

        <prior id='KappaPrior.s:$(n)' x='@kappa.s:$(n)'>
            <distr spec="LogNormalDistributionModel" meanInRealSpace='false'>
                <parameter name='M' value="1.0" estimate='false'/>
                <parameter name='S' value="1.25" estimate='false'/>
            </distr>
		</prior>
<!--
        <prior id='FrequenciesPrior.s:$(n)' x='@freqParameter.s:$(n)'><distr spec="beast.math.distributions.Uniform" lower='0' upper='1'/></prior>
-->

]]>

            <connect srcID='kappa.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(kappa.s:$(n)) and kappa.s:$(n)/estimate=true'/>
            <connect srcID='freqParameter.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>

            <connect srcID='KappaScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(kappa.s:$(n)) and kappa.s:$(n)/estimate=true'>Scale HKY transition-transversion
                parameter of partition s:$(n)
            </connect>
            <connect srcID='FrequenciesExchanger.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'>
                Exchange values of frequencies of partition s:$(n)
            </connect>

            <connect srcID='kappa.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(kappa.s:$(n)) and kappa.s:$(n)/estimate=true'/>
            <connect srcID='freqParameter.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>

            <connect srcID='KappaPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(kappa.s:$(n)) and kappa.s:$(n)/estimate=true'>HKY transition-transversion
                parameter of partition s:$(n)
            </connect>
            <!--
                        <connect srcID='FrequenciesPrior.s:$(n)'     targetID='prior' inputName='distribution' if='inposterior(hky.s:$(n)) and inposterior(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
            -->
        </subtemplate>


        <!-- TN93 substitution model -->
        <subtemplate id='TN93' class='beast.evolution.substitutionmodel.TN93' mainid='tn93.s:$(n)'>
            <![CDATA[
        <plugin spec='TN93' id='tn93.s:$(n)'>
            <parameter id="kappa1.s:$(n)" name='kappa1' value="2.0" lower="0.0" estimate='true'/>
            <parameter id="kappa2.s:$(n)" name='kappa2' value="2.0" lower="0.0" estimate='true'/>
            <frequencies id='estimatedFreqs.s:$(n)' spec='Frequencies'>
                <frequencies id='freqParameter.s:$(n)' spec='parameter.RealParameter' dimension='4' value='0.25' lower='0' upper='1'/>
            </frequencies>
        </plugin>

        <plugin id='kappa1Scaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@kappa1.s:$(n)"/>
        <plugin id='kappa2Scaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@kappa2.s:$(n)"/>
        <plugin id='FrequenciesExchanger.s:$(n)' spec='DeltaExchangeOperator' delta="0.01" weight="0.1" parameter="@freqParameter.s:$(n)"/>

        <prior id='kappa1Prior.s:$(n)' x='@kappa1.s:$(n)'>
            <distr spec="LogNormalDistributionModel" meanInRealSpace='false'>
                <parameter name='M' value="1.0" estimate='false'/>
                <parameter name='S' value="1.25" estimate='false'/>
            </distr>
	</prior>
        <prior id='kappa2Prior.s:$(n)' x='@kappa2.s:$(n)'>
            <distr spec="LogNormalDistributionModel" meanInRealSpace='false'>
                <parameter name='M' value="1.0" estimate='false'/>
                <parameter name='S' value="1.25" estimate='false'/>
            </distr>
	</prior>
<!--
        <prior id='FrequenciesPrior.s:$(n)' x='@freqParameter.s:$(n)'><distr spec="beast.math.distributions.Uniform" lower='0' upper='1'/></prior>
-->

]]>

            <connect srcID='kappa1.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(kappa1.s:$(n)) and kappa1.s:$(n)/estimate=true'/>
            <connect srcID='kappa2.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(kappa2.s:$(n)) and kappa2.s:$(n)/estimate=true'/>
            <connect srcID='freqParameter.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>

            <connect srcID='kappa1Scaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(kappa1.s:$(n)) and kappa1.s:$(n)/estimate=true'>Scale TN93 kappa1 (rateAG)
                parameter of partition s:$(n)
            </connect>
            <connect srcID='kappa2Scaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(kappa2.s:$(n)) and kappa2.s:$(n)/estimate=true'>Scale TN93 kappa2 (rateCT)
                parameter of partition s:$(n)
            </connect>
            <connect srcID='FrequenciesExchanger.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'>
                Exchange values of frequencies of partition s:$(n)
            </connect>

            <connect srcID='kappa1.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(kappa1.s:$(n)) and kappa1.s:$(n)/estimate=true'/>
            <connect srcID='kappa2.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(kappa2.s:$(n)) and kappa2.s:$(n)/estimate=true'/>
            <connect srcID='freqParameter.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(hky.$(n)) and inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>

            <connect srcID='kappa1Prior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(kappa1.s:$(n)) and kappa1.s:$(n)/estimate=true'>TN93 kappa1 (rateAG) parameter of
                partition s:$(n)
            </connect>
            <connect srcID='kappa2Prior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(kappa2.s:$(n)) and kappa2.s:$(n)/estimate=true'>TN93 kappa2 (rateCT) parameter of
                partition s:$(n)
            </connect>
            <!--
                        <connect srcID='FrequenciesPrior.s:$(n)'     targetID='prior' inputName='distribution' if='inposterior(hky.s:$(n)) and inposterior(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
            -->
        </subtemplate>


        <!-- GTR substitution model -->
        <subtemplate id='GTR' class='beast.evolution.substitutionmodel.GTR' mainid='gtr.s:$(n)'
                     suppressInputs='beast.evolution.substitutionmodel.GTR.eigenSystem'>
            <![CDATA[
        <plugin spec='GTR' id='gtr.s:$(n)'>
            <parameter id="rateAC.s:$(n)" name='rateAC' value="1.0" lower="0.0" estimate='true'/>
            <parameter id="rateAG.s:$(n)" name='rateAG' value="1.0" lower="0.0" estimate='true'/>
            <parameter id="rateAT.s:$(n)" name='rateAT' value="1.0" lower="0.0" estimate='true'/>
            <parameter id="rateCG.s:$(n)" name='rateCG' value="1.0" lower="0.0" estimate='true'/>
            <parameter id="rateCT.s:$(n)" name='rateCT' value="1.0" lower="0.0" estimate='false'/>
            <parameter id="rateGT.s:$(n)" name='rateGT' value="1.0" lower="0.0" estimate='true'/>
            <frequencies id='estimatedFreqs.s:$(n)' spec='Frequencies'>
                <frequencies id='freqParameter.s:$(n)' spec='parameter.RealParameter' dimension='4' value='0.25' lower='0' upper='1'/>
            </frequencies>
        </plugin>

        <operator id='RateACScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateAC.s:$(n)"/>
        <operator id='RateAGScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateAG.s:$(n)"/>
        <operator id='RateATScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateAT.s:$(n)"/>
        <operator id='RateCGScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateCG.s:$(n)"/>
        <operator id='RateCTScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateCT.s:$(n)"/>
        <operator id='RateGTScaler.s:$(n)' spec='ScaleOperator' scaleFactor="0.5" weight="0.1" parameter="@rateGT.s:$(n)"/>
        <operator id='FrequenciesExchanger.s:$(n)' spec='DeltaExchangeOperator' delta="0.01" weight="0.1" parameter="@freqParameter.s:$(n)"/>

        <prior id='RateACPrior.s:$(n)' x='@rateAC.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate='false'/><parameter name="beta" value='10.0' estimate='false'/></distr></prior>
        <prior id='RateAGPrior.s:$(n)' x='@rateAG.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate="false"/><parameter name="beta" value='20.0' estimate="false"/></distr></prior>
        <prior id='RateATPrior.s:$(n)' x='@rateAT.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate="false"/><parameter name="beta" value='10.0' estimate="false"/></distr></prior>
        <prior id='RateCGPrior.s:$(n)' x='@rateCG.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate="false"/><parameter name="beta" value='10.0' estimate="false"/></distr></prior>
        <prior id='RateCTPrior.s:$(n)' x='@rateCT.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate="false"/><parameter name="beta" value='20.0' estimate="false"/></distr></prior>
        <prior id='RateGTPrior.s:$(n)' x='@rateGT.s:$(n)'><distr spec="beast.math.distributions.Gamma"><parameter name="alpha" value='0.05' estimate="false"/><parameter name="beta" value='10.0' estimate="false"/></distr></prior>
]]>

            <connect srcID='freqParameter.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
            <connect srcID='rateAC.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateAC.s:$(n)) and rateAC.s:$(n)/estimate=true'/>
            <connect srcID='rateAG.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateAG.s:$(n)) and rateAG.s:$(n)/estimate=true'/>
            <connect srcID='rateAT.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateAT.s:$(n)) and rateAT.s:$(n)/estimate=true'/>
            <connect srcID='rateCG.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateCG.s:$(n)) and rateCG.s:$(n)/estimate=true'/>
            <connect srcID='rateCT.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateCT.s:$(n)) and rateCT.s:$(n)/estimate=true'/>
            <connect srcID='rateGT.s:$(n)' targetID='state' inputName='stateNode'
                     if='inlikelihood(rateGT.s:$(n)) and rateGT.s:$(n)/estimate=true'/>

            <connect srcID='FrequenciesExchanger.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'>Exchange values of
                frequencies of partition s:$(n)
            </connect>
            <connect srcID='RateACScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateAC.s:$(n)) and rateAC.s:$(n)/estimate=true'>Scale GTR A-C substitution
                parameter of partition s:$(n)
            </connect>
            <connect srcID='RateAGScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateAG.s:$(n)) and rateAG.s:$(n)/estimate=true'>Scale GTR A-G substitution
                parameter of partition s:$(n)
            </connect>
            <connect srcID='RateATScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateAT.s:$(n)) and rateAT.s:$(n)/estimate=true'>Scale GTR A-T substitution
                parameter of partition s:$(n)
            </connect>
            <connect srcID='RateCGScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateCG.s:$(n)) and rateCG.s:$(n)/estimate=true'>Scale GTR C-G substitution
                parameter of partition s:$(n)
            </connect>
            <connect srcID='RateCTScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateCT.s:$(n)) and rateCT.s:$(n)/estimate=true'>Scale GTR C-T substitution
                parameter of partition s:$(n)
            </connect>
            <connect srcID='RateGTScaler.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inlikelihood(rateGT.s:$(n)) and rateGT.s:$(n)/estimate=true'>Scale GTR G-T substitution
                parameter of partition s:$(n)
            </connect>

            <connect srcID='freqParameter.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
            <connect srcID='rateAC.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateAC.s:$(n)) and rateAC.s:$(n)/estimate=true'/>
            <connect srcID='rateAG.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateAG.s:$(n)) and rateAG.s:$(n)/estimate=true'/>
            <connect srcID='rateAT.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateAT.s:$(n)) and rateAT.s:$(n)/estimate=true'/>
            <connect srcID='rateCG.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateCG.s:$(n)) and rateCG.s:$(n)/estimate=true'/>
            <connect srcID='rateCT.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateCT.s:$(n)) and rateCT.s:$(n)/estimate=true'/>
            <connect srcID='rateGT.s:$(n)' targetID='tracelog' inputName='log'
                     if='inlikelihood(rateGT.s:$(n)) and rateGT.s:$(n)/estimate=true'/>

            <connect srcID='RateACPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateAC.s:$(n)) and rateAC.s:$(n)/estimate=true'>GTR A-C substitution parameter of
                partition s:$(n)
            </connect>
            <connect srcID='RateAGPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateAG.s:$(n)) and rateAG.s:$(n)/estimate=true'>GTR A-G substitution parameter of
                partition s:$(n)
            </connect>
            <connect srcID='RateATPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateAT.s:$(n)) and rateAT.s:$(n)/estimate=true'>GTR A-T substitution parameter of
                partition s:$(n)
            </connect>
            <connect srcID='RateCGPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateCG.s:$(n)) and rateCG.s:$(n)/estimate=true'>GTR C-G substitution parameter of
                partition s:$(n)
            </connect>
            <connect srcID='RateCTPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateCT.s:$(n)) and rateCT.s:$(n)/estimate=true'>GTR C-T substitution parameter of
                partition s:$(n)
            </connect>
            <connect srcID='RateGTPrior.s:$(n)' targetID='prior' inputName='distribution'
                     if='inlikelihood(rateGT.s:$(n)) and rateGT.s:$(n)/estimate=true'>GTR G-T substitution parameter of
                partition s:$(n)
            </connect>
        </subtemplate>


        <!-- empirical amino acid substitution models -->
        <subtemplate id='Blosum62' class='beast.evolution.substitutionmodel.Blosum62'
                     suppressInputs='beast.evolution.substitutionmodel.Blosum62.eigenSystem'
                     mainid='Blosum62.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='Blosum62' id='Blosum62.s:$(n)'/>]]></subtemplate>
        <subtemplate id='Dayhoff' class='beast.evolution.substitutionmodel.Dayhoff'
                     suppressInputs='beast.evolution.substitutionmodel.Dayhoff.eigenSystem'
                     mainid='Dayhoff.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='Dayhoff' id='Dayhoff.s:$(n)'/>]]></subtemplate>
        <subtemplate id='JTT' class='beast.evolution.substitutionmodel.JTT'
                     suppressInputs='beast.evolution.substitutionmodel.JTT.eigenSystem'
                     mainid='JTT.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='JTT' id='JTT.s:$(n)'/>]]></subtemplate>
        <subtemplate id='cpREV' class='beast.evolution.substitutionmodel.CPREV'
                     suppressInputs='beast.evolution.substitutionmodel.CPREV.eigenSystem'
                     mainid='CPREV.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='CPREV' id='CPREV.s:$(n)'/>]]></subtemplate>
        <subtemplate id='mtREV' class='beast.evolution.substitutionmodel.MTREV'
                     suppressInputs='beast.evolution.substitutionmodel.MTREV.eigenSystem'
                     mainid='MTREV.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='MTREV' id='MTREV.s:$(n)'/>]]></subtemplate>
        <subtemplate id='WAG' class='beast.evolution.substitutionmodel.WAG'
                     suppressInputs='beast.evolution.substitutionmodel.WAG.eigenSystem'
                     mainid='WAG.s:$(n)'><!--value spec='XML'-->
            <![CDATA[<plugin spec='WAG' id='WAG.s:$(n)'/>]]></subtemplate>

        <!-- binary model -->
        <subtemplate id='MutationDeathModel' class='beast.evolution.substitutionmodel.MutationDeathModel'
                     mainid='MutationDeathModel.s:$(n)'
                     suppressInputs="beast.evolution.substitutionmodel.MutationDeathModel.substmodel,beast.evolution.substitutionmodel.MutationDeathModel.frequencies">
            <![CDATA[
		<plugin id='MutationDeathModel.s:$(n)' spec='beast.evolution.substitutionmodel.MutationDeathModel'>
			<parameter name='deathprob' id='deathprob.s:$(n)' value='0.1' estimate='false'/>
			<frequencies id='freqs.s:$(n)' spec='Frequencies'>
				<frequencies spec='parameter.RealParameter' value='1 0'/>
			</frequencies>
		</plugin>
]]>
        </subtemplate>


        <!-- frequency models -->
        <subtemplate id='Estimated' class='beast.evolution.substitutionmodel.Frequencies'
                     mainid='estimatedFreqs.s:$(n)'>
            <![CDATA[
            <frequencies id='estimatedFreqs.s:$(n)' spec='Frequencies'>
                <frequencies id='freqParameter.s:$(n)' spec='parameter.RealParameter' dimension='4' value='0.25' lower='0' upper='1'/>
            </frequencies>

	        <plugin id='FrequenciesExchanger.s:$(n)' spec='DeltaExchangeOperator' delta="0.01" weight="0.1" parameter="@freqParameter.s:$(n)"/>
]]>
            <connect srcID='freqParameter.s:$(n)' targetID='state' inputName='stateNode'
                     if='inposterior(estimatedFreqs.s:$(n)) and inposterior(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
            <connect srcID='FrequenciesExchanger.s:$(n)' targetID='mcmc' inputName='operator'
                     if='inposterior(estimatedFreqs.s:$(n)) and inposterior(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'>
                Exchange values of frequencies of partition s:$(n)
            </connect>
            <connect srcID='freqParameter.s:$(n)' targetID='tracelog' inputName='log'
                     if='inposterior(estimatedFreqs.s:$(n)) and inposterior(freqParameter.s:$(n)) and freqParameter.s:$(n)/estimate=true'/>
        </subtemplate>

        <subtemplate id='Empirical' class='beast.evolution.substitutionmodel.Frequencies'
                     mainid='empiricalFreqs.s:$(n)'>
            <![CDATA[
            <frequencies id='empiricalFreqs.s:$(n)' spec='Frequencies' data='@$(n)' estimate='true'/>
]]>
        </subtemplate>

        <subtemplate id='AllEqual' class='beast.evolution.substitutionmodel.Frequencies' mainid='equalFreqs.s:$(n)'>
            <![CDATA[
            <frequencies id='equalFreqs.s:$(n)' spec='Frequencies' data='@$(n)' estimate='false'/>
]]>
        </subtemplate>
    </mergewith>
    
    
</beast>

