/* This file defines the transition matrix for the F81 model
   The file should be used as follows:
   
   1) Read Data File and create datafilter filteredData
   2) #include this file (or use SelectTemplateModel(filteredData);)
   3) Define the tree
   4) Proceed with the likelihood function using 'vectorOfFrequencies' as the vector to pass to the constructor.
   
   This model has the following signature:
    #Short:F81#
   	#Desc:Felsenstein 81 (F81). Gamma variation optional.#
   	#Dimension:4#
    #DataType:nucleotide#
   	#FileName:F81.mdl#
   
   08/18/1999  by Sergei L. Kosakovsky Pond
*/

#include "modelParameters2.mdl";

if (modelType > 0)
{
	if (modelType == 1)
	{
		#include "defineGamma.mdl";
	}
	if (modelType == 2)
	{
		#include "defineHM.mdl";
	}
}

function PopulateModelMatrix (ModelMatrixName&, EFV)
{
	if (modelType == 0)
	{
		ModelMatrixName = {{*,t,t,t}{t,*,t,t}{t,t,*,t}{t,t,t,*}};
	}
	else
	{
		ModelMatrixName = {{*,t*c,t*c,t*c}{t*c,*,t*c,t*c}{t*c,t*c,*,t*c}{t*c,t*c,t*c,*}};
	}
	return 1;
}

F81 = 0;

HarvestFrequencies (vectorOfFrequencies, filteredData,1,1,0);

MULTIPLY_BY_FREQS = PopulateModelMatrix ("F81",vectorOfFrequencies);

Model F81model = (F81, vectorOfFrequencies, MULTIPLY_BY_FREQS);

FREQUENCY_SENSITIVE = 1;
